* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    /* Project standard colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --accent-gold: #ffd700;
    --accent-purple: #a855f7;
    --accent-cyan: #00d4ff;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Go game specific colors */
    --board-color: #dcb35c;
    --board-dark: #c9a24d;
    --line-color: #2a2318;
    --accent: #e6a23c;
    --accent-glow: rgba(230, 162, 60, 0.4);
    --black-stone: #1a1a1a;
    --black-stone-highlight: #3a3a3a;
    --white-stone: #f5f5f0;
    --white-stone-shadow: #c0c0b8;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    overflow-x: hidden;
}

/* Background Effects */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.bg-orb:nth-child(1) {
    width: 300px;
    height: 300px;
    background: var(--accent-purple);
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.bg-orb:nth-child(2) {
    width: 250px;
    height: 250px;
    background: var(--accent);
    bottom: -50px;
    left: -50px;
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

/* Container */
.container {
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Header */
header {
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 8px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border-radius: 8px;
}

.back-btn:hover {
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.1);
}

.back-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Controls */
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* Board Size Selector */
.board-size-selector {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.size-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-secondary);
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.size-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.size-btn.active {
    color: var(--bg-primary);
    background: var(--accent);
    border-color: var(--accent);
}

/* Player Info */
.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-stone {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-stone.black {
    background: radial-gradient(ellipse at 30% 30%, var(--black-stone-highlight), var(--black-stone));
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.player-stone.white {
    background: radial-gradient(ellipse at 30% 30%, var(--white-stone), var(--white-stone-shadow));
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.player.active .player-stone {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-primary);
}

.player-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.player.active .player-status {
    color: var(--accent);
}

.player-captures {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.capture-count {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Black Han Sans', sans-serif;
    color: var(--text-primary);
}

.capture-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Board */
.board-wrapper {
    position: relative;
    padding: 12px;
    background: var(--board-color);
    border-radius: 8px;
    touch-action: none;
    box-shadow:
        0 0 0 4px var(--board-dark),
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.1);
}

.board-container {
    position: relative;
}

.board {
    display: grid;
    position: relative;
    background: var(--board-color);
}

.board-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.intersection {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.intersection::before {
    content: '';
    position: absolute;
    background: var(--line-color);
    width: 100%;
    height: 1px;
    top: 50%;
    transform: translateY(-50%);
}

.intersection::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--line-color);
}

/* Edge adjustments */
.intersection.top::after { top: 50%; height: 50%; }
.intersection.bottom::after { bottom: 50%; height: 50%; }
.intersection.left::before { left: 50%; width: 50%; }
.intersection.right::before { right: 50%; width: 50%; }

/* Star points */
.intersection.star-point::before {
    z-index: 0;
}

.star-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--line-color);
    border-radius: 50%;
    z-index: 1;
}

/* Stones */
.stone {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    transition: transform 0.1s ease;
}

.stone.black {
    background: radial-gradient(ellipse at 30% 30%, var(--black-stone-highlight), var(--black-stone));
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.stone.white {
    background: radial-gradient(ellipse at 30% 30%, var(--white-stone), var(--white-stone-shadow));
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stone.last-move::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: var(--accent);
}

/* Preview stone */
.intersection:hover .preview-stone {
    opacity: 0.5;
}

.preview-stone {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    position: absolute;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.15s ease;
}

.preview-stone.black {
    background: radial-gradient(ellipse at 30% 30%, var(--black-stone-highlight), var(--black-stone));
}

.preview-stone.white {
    background: radial-gradient(ellipse at 30% 30%, var(--white-stone), var(--white-stone-shadow));
}

/* Status Bar */
.status-bar {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-primary);
}

.pass-btn {
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.pass-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.scoring-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.scoring-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
}

/* Live Scoring Display */
.live-scoring-display {
    font-family: 'Jua', sans-serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 12px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.live-scoring-display.black-leading {
    color: #e2e8f0;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.live-scoring-display.white-leading {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

/* Action Buttons in Status Bar */
.action-buttons {
    display: flex;
    gap: 8px;
}

.place-btn {
    padding: 8px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: not-allowed;
    transition: all 0.2s ease;
    min-height: 44px;
}

.place-btn:disabled {
    opacity: 0.5;
}

.place-btn.active {
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
    border-color: var(--accent-gold);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    animation: place-btn-pulse 1s ease-in-out infinite;
}

.place-btn.active:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

@keyframes place-btn-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(255, 215, 0, 0.6); }
}

/* Move counter */
.move-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* Game Over Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #1a1a2e, #16162a);
    border-radius: 24px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 30px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    min-width: 280px;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Black Han Sans', sans-serif;
    color: var(--accent-gold);
    margin-bottom: 16px;
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.score-item {
    text-align: center;
}

.score-stone {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto 8px;
}

.score-stone.black {
    background: radial-gradient(ellipse at 30% 30%, var(--black-stone-highlight), var(--black-stone));
}

.score-stone.white {
    background: radial-gradient(ellipse at 30% 30%, var(--white-stone), var(--white-stone-shadow));
}

.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Black Han Sans', sans-serif;
    color: var(--text-primary);
}

.score-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.winner-text {
    font-size: 1rem;
    font-family: 'Jua', sans-serif;
    color: var(--accent);
    margin-bottom: 24px;
}

.modal-btn {
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

/* Game Content */
.game-content {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
}

.game-content h2 {
    font-family: 'Jua', sans-serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 10px;
}

.game-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.tip-box {
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid var(--accent-gold);
    padding: 15px;
    border-radius: 0 10px 10px 0;
}

.tip-box p {
    margin-bottom: 8px;
}

.tip-box p:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    width: 100%;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 20px;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent-gold);
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .container {
        gap: 10px;
    }

    .board-wrapper {
        padding: 8px;
    }

    .player-info {
        padding: 10px 12px;
    }

    .controls {
        gap: 6px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

}

@media (max-width: 420px) {
    .header-top {
        flex-direction: column;
        gap: 8px;
    }

    .back-btn {
        position: static;
    }

    .board-size-selector {
        padding: 6px 10px;
    }

    .size-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
}

/* Start Overlay */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 26, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.start-overlay.active {
    opacity: 1;
    visibility: visible;
}

.start-content {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, var(--bg-secondary), #1a1a2e);
    border-radius: 24px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 60px rgba(0, 0, 0, 0.5);
    max-width: 340px;
    width: 90%;
}

.start-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.start-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

.start-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Jua', sans-serif;
}

.mode-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.mode-btn.selected {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--accent-gold);
}

.mode-icon {
    font-size: 1.5rem;
}

.mode-text {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.difficulty-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.difficulty-section.hidden {
    display: none;
}

.difficulty-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.difficulty-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-family: 'Jua', sans-serif;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.difficulty-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--accent-purple);
}

.difficulty-btn[data-difficulty="easy"]:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

.difficulty-btn[data-difficulty="normal"]:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--accent-gold);
}

.difficulty-btn[data-difficulty="hard"]:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Tap-Confirm Selected State */
.intersection.selected {
    z-index: 10;
}

.intersection.selected::before,
.intersection.selected::after {
    background: var(--accent-gold);
}

.intersection.selected .preview-stone {
    opacity: 0.8 !important;
    animation: pulse-confirm 0.8s ease-in-out infinite;
}

.tap-confirm-hint {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--accent-gold);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.intersection.selected .tap-confirm-hint {
    opacity: 1;
}

@keyframes pulse-confirm {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* AI thinking indicator */
.ai-thinking {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 30px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.ai-thinking.active {
    opacity: 1;
    visibility: visible;
}

.ai-thinking-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-thinking-text {
    color: var(--text-primary);
    font-family: 'Jua', sans-serif;
}

/* Continue Modal */
.continue-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.continue-modal.active {
    opacity: 1;
    visibility: visible;
}

.continue-modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 320px;
    width: 90%;
}

.continue-modal-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.continue-modal-score {
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 25px;
}

.continue-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.continue-btn {
    padding: 14px 30px;
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.continue-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px var(--accent-glow);
}

.newgame-btn {
    padding: 12px 25px;
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.newgame-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Fullscreen mode */
body.fullscreen-active .board-size-selector,
body.fullscreen-active .move-counter {
    display: none !important;
}

body.fullscreen-active .controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.fullscreen-active .container {
    padding-bottom: 70px !important;
}

/* =============================================
   Feature 1: Scoring Mode (계가)
   ============================================= */

/* Territory Markers */
.territory-marker {
    position: absolute;
    width: 40%;
    height: 40%;
    border-radius: 2px;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    animation: territory-fade-in 0.4s ease forwards;
}

.territory-marker.black-territory {
    background: var(--black-stone);
    opacity: 0.6;
}

.territory-marker.white-territory {
    background: var(--white-stone);
    opacity: 0.6;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

@keyframes territory-fade-in {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 0.6; transform: scale(1); }
}

/* Dead Stone Indicators */
.dead-stone-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    z-index: 4;
    pointer-events: none;
}

.dead-stone-mark::before,
.dead-stone-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #ef4444;
    border-radius: 2px;
}

.dead-stone-mark::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.dead-stone-mark::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Clickable dead stone toggle */
.intersection.scoring-phase .stone {
    cursor: pointer;
}

.intersection.scoring-phase .stone.dead {
    opacity: 0.4;
    filter: grayscale(0.5);
}

/* Scoring Status Banner */
.scoring-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Jua', sans-serif;
    font-size: 0.85rem;
    color: var(--accent-gold);
    animation: shimmer 2s ease-in-out infinite;
}

.scoring-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Scoring Action Buttons */
.scoring-actions {
    display: flex;
    gap: 8px;
}

.scoring-confirm-btn {
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--bg-primary);
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.scoring-confirm-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.scoring-cancel-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.scoring-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Score Breakdown in Game Over Modal */
.score-breakdown {
    width: 100%;
    margin: 16px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.score-row:last-child {
    border-bottom: none;
}

.score-row-label {
    color: var(--text-muted);
    font-family: 'Noto Sans KR', sans-serif;
    flex: 1;
    text-align: left;
}

.score-row-value {
    font-family: 'Jua', sans-serif;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
}

.score-row.total {
    border-top: 2px solid rgba(255, 215, 0, 0.3);
    padding-top: 10px;
    margin-top: 4px;
}

.score-row.total .score-row-value {
    color: var(--accent-gold);
    font-size: 1rem;
}

/* =============================================
   Feature 2: Territory Check / 2G (집 확인)
   ============================================= */

/* Gold-cost button */
.gold-cost-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.gold-cost-btn:hover:not(:disabled) {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--accent-gold);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.gold-cost-btn:disabled {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.4;
}

.gold-cost-btn .gold-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.gold-cost-btn .gold-amount {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Insufficient gold tooltip */
.gold-cost-btn.insufficient::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: #ff8c00;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.gold-cost-btn.insufficient:hover::after {
    opacity: 1;
}

/* Territory Preview Markers (temporary) */
.territory-preview-marker {
    position: absolute;
    width: 40%;
    height: 40%;
    border-radius: 2px;
    z-index: 3;
    pointer-events: none;
    animation: territory-preview 3.5s ease forwards;
}

.territory-preview-marker.black-territory {
    background: var(--black-stone);
}

.territory-preview-marker.white-territory {
    background: var(--white-stone);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

@keyframes territory-preview {
    0%   { opacity: 0; transform: scale(0.5); }
    10%  { opacity: 0.6; transform: scale(1); }
    75%  { opacity: 0.6; }
    100% { opacity: 0; }
}

/* Score Preview Banner */
.score-preview-banner {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    padding: 8px 16px;
    background: rgba(10, 10, 26, 0.9);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    font-family: 'Jua', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 5;
    animation: banner-preview 3.5s ease forwards;
    backdrop-filter: blur(5px);
}

.score-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.score-preview-stone {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.score-preview-stone.black {
    background: radial-gradient(ellipse at 30% 30%, #3a3a3a, #1a1a1a);
}

.score-preview-stone.white {
    background: radial-gradient(ellipse at 30% 30%, #f5f5f0, #c0c0b8);
}

.score-preview-value {
    font-weight: 700;
    color: var(--accent-gold);
}

@keyframes banner-preview {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    75%  { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
}

/* Gold Deduction Float Animation */
.gold-spent-float {
    position: absolute;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    color: #ff8c00;
    pointer-events: none;
    animation: gold-float-up 1s ease forwards;
    z-index: 20;
}

@keyframes gold-float-up {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-40px); }
}

/* Scoring mode body class: disable normal board interactions */
body.scoring-active .preview-stone {
    display: none !important;
}

body.scoring-active .intersection {
    cursor: default;
}

/* During territory check preview, disable board interaction */
body.territory-checking .intersection {
    pointer-events: none;
}

body.territory-checking .controls button {
    pointer-events: none;
    opacity: 0.5;
}

/* =============================================
   Feature 3: Save Kifu (기보 저장 - 10G)
   ============================================= */

/* Save Record Button in Game Over Modal */
.save-record-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    margin-bottom: 12px;
    width: 100%;
}

.save-record-btn:hover:not(:disabled) {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--accent-gold);
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.25);
}

.save-record-btn:disabled {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.4;
}

.save-record-btn .btn-gold-icon {
    width: 18px;
    height: 18px;
}

.save-record-btn .btn-cost-label {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 4px;
}

/* Saved state */
.save-record-btn.saved {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    cursor: default;
}

.save-record-btn.saved:hover {
    transform: none;
    box-shadow: none;
}

/* Controls area save button - saved state override */
.gold-cost-btn.saved {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    cursor: default;
}

.gold-cost-btn.saved:hover {
    transform: none;
    box-shadow: none;
}

/* Toast Notification */
.kifu-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: rgba(34, 197, 94, 0.9);
    color: #fff;
    font-family: 'Jua', sans-serif;
    font-size: 0.85rem;
    border-radius: 20px;
    z-index: 200;
    animation: toast-appear 2.5s ease forwards;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

@keyframes toast-appear {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* =============================================
   Feature 4: Load Kifu (기보 불러오기)
   ============================================= */

/* Load Record Button */
.load-record-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.load-record-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-cyan);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.load-record-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Records Modal */
.records-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.records-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.records-modal-content {
    text-align: center;
    padding: 30px 24px;
    background: linear-gradient(135deg, #1a1a2e, #16162a);
    border-radius: 24px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 30px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-width: 380px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.records-modal-overlay.active .records-modal-content {
    transform: scale(1);
}

.records-modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    font-family: 'Black Han Sans', sans-serif;
    color: var(--accent-gold);
    margin-bottom: 16px;
}

.records-list {
    flex: 1;
    overflow-y: auto;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

/* Custom scrollbar for records list */
.records-list::-webkit-scrollbar {
    width: 4px;
}

.records-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.records-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.records-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 30px 0;
    font-family: 'Noto Sans KR', sans-serif;
}

/* Record Card */
.record-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.record-card:hover {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.2);
    transform: translateY(-1px);
}

.record-card-board-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--board-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Jua', sans-serif;
    color: var(--line-color);
    flex-shrink: 0;
    border: 2px solid var(--board-dark);
}

.record-card-info {
    flex: 1;
    min-width: 0;
}

.record-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'Noto Sans KR', sans-serif;
    margin-bottom: 2px;
}

.record-card-result {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-card-result .winner-mark {
    color: var(--accent-gold);
}

.record-card-meta {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 2px;
}

.record-card-moves {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Noto Sans KR', sans-serif;
}

.record-card-delete {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.record-card-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.record-card-delete svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.records-modal-close-btn {
    padding: 12px 30px;
    font-size: 0.9rem;
    font-family: 'Jua', sans-serif;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.records-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Confirm Dialog */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.confirm-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: linear-gradient(135deg, #1a1a2e, #16162a);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 300px;
    width: 85%;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.confirm-dialog-overlay.active .confirm-dialog {
    transform: scale(1);
}

.confirm-dialog-title {
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-dialog-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    font-family: 'Noto Sans KR', sans-serif;
}

.confirm-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-dialog-btn {
    padding: 10px 24px;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    min-width: 100px;
}

.confirm-dialog-btn.primary {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.confirm-dialog-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.confirm-dialog-btn.secondary {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.confirm-dialog-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Mobile adjustments for records modal */
@media (max-width: 600px) {
    .records-modal-content {
        max-width: 95%;
        padding: 20px 16px;
        max-height: 85vh;
    }

    .records-list {
        max-height: 55vh;
    }

    .record-card {
        padding: 10px 12px;
    }

    .record-card-board-icon {
        width: 32px;
        height: 32px;
        font-size: 0.6rem;
    }
}

/* =============================================
   Feature 5: Review Mode (복기 모드)
   ============================================= */

/* Mode badge */
.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Jua', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
}

.mode-badge.review-mode {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--accent-purple);
}

.mode-badge.trial-mode {
    background: rgba(255, 107, 157, 0.15);
    border: 1px solid rgba(255, 107, 157, 0.3);
    color: #ff6b9d;
}

.mode-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse-dot 1.2s ease-in-out infinite;
}

.mode-badge.review-mode .mode-badge-dot {
    background: var(--accent-purple);
}

.mode-badge.trial-mode .mode-badge-dot {
    background: #ff6b9d;
}

/* Review controls bar */
.review-controls {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 12px;
    transition: all 0.3s ease;
}

/* Navigation buttons */
.review-nav-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    padding: 0;
}

.review-nav-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.review-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.review-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.review-nav-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Move slider */
.review-slider-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.review-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.review-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
    transition: transform 0.1s;
}

.review-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.review-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

/* Move counter in slider area */
.review-move-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Noto Sans KR', sans-serif;
    white-space: nowrap;
}

.review-move-label .current-move {
    color: var(--accent-purple);
    font-weight: 700;
    font-family: 'Jua', sans-serif;
}

/* Move numbers on stones */
.stone .move-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.55em;
    font-weight: 700;
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1;
    z-index: 3;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Black stones get white text, white stones get black text */
.stone.black .move-number {
    color: #ffffff;
}

.stone.white .move-number {
    color: #1a1a1a;
}

/* Hide last-move indicator in review mode since we show numbers */
body.review-active .stone.last-move::after {
    display: none;
}

/* Current move in review gets a highlight ring */
.stone.review-current {
    box-shadow: 0 0 0 3px var(--accent-purple), 0 0 12px rgba(168, 85, 247, 0.5);
}

/* Hide game controls during review */
body.review-active #undoBtn,
body.review-active #passBtn,
body.review-active .place-btn,
body.review-active #territoryCheckBtn,
body.review-active #controlsSaveKifuBtn {
    display: none !important;
}

/* Disable board interaction in review mode (no preview stones) */
body.review-active .intersection {
    cursor: default;
}

body.review-active .preview-stone {
    display: none !important;
}

/* Re-enable board interaction in trial mode */
body.trial-active .intersection {
    cursor: pointer;
}

body.trial-active .preview-stone {
    display: block !important;
}

/* Mobile layout for review controls */
@media (max-width: 600px) {
    .review-controls {
        padding: 8px 10px;
        gap: 6px;
    }

    .review-nav-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .review-nav-btn svg {
        width: 16px;
        height: 16px;
    }

    .review-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .review-move-label {
        font-size: 0.6rem;
    }
}

/* Fullscreen mode: review controls fixed at bottom */
body.fullscreen-active .review-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
}

/* =============================================
   Feature 6: Trial Play (놓아보기)
   ============================================= */

/* Trial active review controls */
.review-controls.trial-active {
    background: rgba(255, 107, 157, 0.08);
    border-color: rgba(255, 107, 157, 0.15);
}

/* Trial stone visual treatment */
.stone.trial-stone {
    opacity: 0.85;
}

.stone.trial-stone::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px dashed rgba(255, 107, 157, 0.6);
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
}

/* Trial stone move numbers in pink */
.stone.trial-stone .move-number {
    color: #ff6b9d !important;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Current trial stone highlight */
body.trial-active .stone.review-current {
    box-shadow: 0 0 0 3px #ff6b9d, 0 0 12px rgba(255, 107, 157, 0.5);
}

/* Trial toast notification */
.trial-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(255, 107, 157, 0.9);
    color: #fff;
    font-family: 'Jua', sans-serif;
    font-size: 0.85rem;
    border-radius: 20px;
    z-index: 200;
    animation: toast-appear 2.5s ease forwards;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

/* =============================================
   Feature 7: Restore (복원하기)
   ============================================= */

/* Restore button */
.restore-btn {
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Jua', sans-serif;
    color: #ff6b9d;
    background: rgba(255, 107, 157, 0.1);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    min-width: 40px;
    display: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    animation: restore-appear 0.3s ease;
    margin-left: auto;
}

.restore-btn:hover {
    background: rgba(255, 107, 157, 0.2);
    border-color: #ff6b9d;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(255, 107, 157, 0.2);
}

.restore-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

@keyframes restore-appear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Show restore button only in trial mode */
body.trial-active .restore-btn {
    display: flex;
}

/* Review game button in modal */
.review-game-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    min-height: 44px;
    transition: all 0.2s ease;
}

.review-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3) !important;
}
