body {
    margin: 0;
    padding: 10px;
    background-color: rgb(204, 204, 158);
    font-family: Arial, sans-serif;
    min-height: 100vh;
    box-sizing: border-box;
    width: 100%;
    overflow-x: auto;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: rgb(204, 204, 158);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-height: calc(100vh - 20px);
    box-sizing: border-box;
    width: 100%;
}

.problem-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #8b4513;
}

.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

.board-section {
    position: relative;
    flex-shrink: 0;
}

.board-container {
    position: relative;
    width: 450px;
    height: 450px;
    background-image: url('../images/board.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    cursor: pointer;
}

.board-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 450px;
    height: 450px;
    pointer-events: none;
}

.board-lines svg {
    width: 100%;
    height: 100%;
}

.board-grid {
    position: absolute;
    top: 0px;
    left: 0;
    width: 450px;
    height: 450px;
    display: grid;
    grid-template-columns: repeat(9, 50px);
    grid-template-rows: repeat(9, 50px);
    gap: 0;
    grid-column-start: 1;
    grid-row-start: 1;
    padding-left: 0px;
    padding-top: 0px;
}

.intersection {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.intersection:hover::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.stone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: absolute;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

.black-stone {
    background: radial-gradient(circle at 30% 30%, #333, #000);
}

.white-stone {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
}

.triangle-mark {
    position: absolute;
    font-size: 24px;
    color: #ff0000;
    font-weight: bold;
    pointer-events: none;
    z-index: 15;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.side-panel {
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    background-color: rgb(204, 204, 158);
    padding: 20px;
    border-radius: 15px;
    transform: translate(-30px, 60px);
    flex-shrink: 0;
    min-width: 220px;
}

.retry-section {
    text-align: center;
}

.retry-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background-color 0.2s;
}

.retry-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.retry-button img {
    width: 192px;
    height: auto;
    transform: scale(1.2);
}

.cats-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.cat {
    width: 144px;
    height: auto;
    transform: scale(1.2);
}

.comment-section {
    position: absolute;
    bottom: -120px;
    left: -50px;
    right: 50px;
}

.comment-bubble {
    position: relative;
    background-color: #fff;
    border: 3px solid #8b4513;
    border-radius: 30px;
    padding: 20px 25px;
    margin: 0 20px;
    text-align: left;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.comment-bubble:hover {
    background-color: #fafafa;
}

/* 茶色の矢印（三角形） */
.comment-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 0;
    height: 0;
    border-left: 12px solid #8b4513;
    border-top: 12px solid transparent;
    transform: rotate(45deg);
}

/* 白い抜き用の矢印 */
.comment-bubble::before {
    content: '';
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 0;
    height: 0;
    border-left: 10px solid #fff;
    border-top: 10px solid transparent;
    transform: rotate(45deg);
}


.board-coordinates {
    position: absolute;
    width: 100%;
    height: 100%;
}

.coord-horizontal {
    position: absolute;
    top: 5px;
    left: 25px;
    width: 400px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.coord-vertical {
    position: absolute;
    left: 5px;
    top: 25px;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.error-display {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 10px;
    margin-top: 10px;
    display: none;
}

.sgf-footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    border-top: 1px solid rgba(139, 69, 19, 0.3);
}

.sgf-footer span {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

/* Daily page specific styles */
.random-button {
    text-align: center;
    margin-top: 160px;
    margin-bottom: 30px;
    clear: both;
    position: relative;
    z-index: 100;
}

.random-button a {
    display: inline-block;
    padding: 15px 30px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.random-button a:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* iframe用の調整 */
.iframe-optimized {
    padding: 10px;
    min-height: auto;
}

.iframe-optimized .container {
    min-height: auto;
    padding: 15px;
}

/* スマートフォン用レスポンシブデザイン */
@media screen and (max-width: 768px) {
    body {
        padding: 2px;
        overflow: hidden;
        min-height: auto;
    }
    
    .container {
        transform: scale(0.55);
        transform-origin: top center;
        margin: 0 auto;
        border-radius: 15px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        min-height: auto;
        width: 182%;
        margin-left: -41%;
        padding: 10px;
        margin-top: -15px;
    }
    
    .board-section {
        margin-left: 0;
    }
    
    .main-content {
        gap: 10px;
        align-items: flex-start;
        justify-content: center;
        flex-wrap: nowrap;
        padding: 0 10px;
    }
    
    .side-panel {
        transform: translate(-20px, 40px);
        width: 160px;
        padding: 12px;
        gap: 15px;
        position: relative;
        flex-shrink: 0;
        min-width: 160px;
    }
    
    .comment-section {
        position: absolute;
        bottom: -80px;
        left: -30px;
        right: 30px;
        margin-top: 0;
    }
    
    .problem-title {
        font-size: 18px;
        margin-bottom: 15px;
        padding: 8px;
    }
    
    .random-button {
        margin-top: 100px;
        margin-bottom: 20px;
    }
    
    .random-button a {
        padding: 12px 25px;
        font-size: 16px;
    }
}

/* タブレット用調整 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        transform: scale(0.8);
        transform-origin: top center;
        margin: 0 auto;
        min-height: auto;
    }
}

/* デスクトップ用調整 */
@media screen and (min-width: 1025px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 30px;
    }
    
    .main-content {
        justify-content: center;
        align-items: center;
        gap: 50px;
        flex-wrap: nowrap;
    }
    
    .board-section {
        flex-shrink: 0;
    }
    
    .side-panel {
        flex-shrink: 0;
        min-width: 220px;
    }
}