/* =============================================================================
   PLAY.HTML — restyled to match the rest of the site (theme.css tokens).
   Every class/id below is read by script.js — only visual properties changed,
   nothing structural or classList-toggled was renamed.
   ============================================================================= */

:root {
    --p1-color: #ffffff; /* Default color for Player 1 */
    --p2-color: #000000; /* Default color for Player 2 */
}

body {
    margin: 0;
    padding: 0 0 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---- Top bar ---- */
#game-topbar {
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 72px;
    background: rgba(21, 15, 10, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 40px;
}
#game-topbar .brand { text-decoration: none; }
#game-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
#sound-toggle-button {
    background: none;
    border: 1px solid var(--line-soft);
    color: var(--ivory-dim);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
#sound-toggle-button:hover {
    border-color: var(--brass);
    color: var(--brass-bright);
    background: rgba(207, 157, 62, 0.08);
}
#game-topbar-status {
    font-size: 13px;
    color: var(--ivory-faint);
}
#game-topbar-status a { color: var(--brass-bright); font-weight: 600; }

/* ---- Page shell ---- */
.game-shell {
    width: 100%;
    max-width: 900px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.game-shell-head { text-align: center; margin-bottom: 22px; }
.game-shell-head h1 {
    font-size: 34px;
    margin: 10px 0 0;
}
.game-shell-head .eyebrow { justify-content: center; }

#game-info {
    margin-bottom: 24px;
    min-height: 25px;
    text-align: center;
}
#status-text {
    font-family: var(--font-eyebrow);
    letter-spacing: 0.06em;
    font-size: 15px;
    color: var(--brass-bright);
    margin: 0;
}

/* ---- Board + panels ---- */
#game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-bottom: 28px;
    width: 100%;
    flex-wrap: wrap;
}

.player-panel {
    width: 168px;
    text-align: center;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.player-panel h2 {
    margin: 0 0 10px;
    font-size: 17px;
    word-wrap: break-word;
    color: var(--ivory);
}
.player-panel p {
    margin: 6px 0;
    font-size: 13.5px;
    color: var(--ivory-dim);
}
.player-panel.active {
    border-color: rgba(207, 157, 62, 0.5);
    box-shadow: 0 0 0 1px rgba(207, 157, 62, 0.25), 0 0 24px -8px rgba(207, 157, 62, 0.5);
}

#board-container {
    width: 90vw;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lift);
    border: 1px solid var(--line-soft);
}
#game-board-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.spot {
    width: 26px;
    height: 26px;
    background-color: rgba(21, 15, 10, 0.35);
    border: 1px solid rgba(207, 157, 62, 0.35);
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    z-index: 5;
}
.spot.empty:hover {
    background-color: rgba(207, 157, 62, 0.25);
    border-color: var(--brass-bright);
}
.player1 { background-color: var(--p1-color); border: 1px solid rgba(0,0,0,0.4); box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.player2 { background-color: var(--p2-color); border: 1px solid rgba(0,0,0,0.4); box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.spot.selected {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 0 3px var(--brass-bright);
    z-index: 10;
}
.spot.in-mill {
    box-shadow: 0 0 16px 5px var(--brass-bright);
}
.spot.removable:hover {
    border: 3px solid var(--clay-bright);
    cursor: crosshair;
}

#game-over-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(21, 15, 10, 0.88);
    color: var(--ivory);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    z-index: 100;
}
#game-over-content { display: flex; flex-direction: column; align-items: center; gap: 20px; }
#game-over-message {
    font-family: var(--font-display);
    font-size: 1.5em;
    font-weight: 700;
}
#game-over-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.hidden { display: none !important; }

/* ---- Game Options dropdown menu ---- */
.game-options-wrap {
    position: relative;
    display: inline-flex;
}

.game-options-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lift);
    padding: 6px;
    z-index: 50;
}

.game-options-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--ivory);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}
.game-options-item:hover {
    background: rgba(207, 157, 62, 0.1);
}
.game-options-item .goi-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.game-options-item .goi-label {
    flex: 1;
}
.game-options-item .goi-state {
    font-size: 12px;
    color: var(--ivory-faint);
    font-weight: 600;
}
.game-options-item--danger {
    color: var(--clay-bright);
}
.game-options-item--danger:hover {
    background: rgba(193, 92, 55, 0.12);
}

/* ---- Buttons ---- */
.game-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---- History ---- */
#history-container {
    margin-top: 32px;
    width: 100%;
    max-width: 420px;
    max-height: 220px;
    overflow-y: auto;
}
#history-container h2 {
    font-size: 16px;
    margin: 0 0 12px;
}
#history-list { list-style-type: none; padding: 0; margin: 0; text-align: left; }
#history-list li {
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
    color: var(--ivory-dim);
}
#history-list li:last-child { border-bottom: none; }
#history-list li .date { font-size: 0.85em; color: var(--ivory-faint); float: right; }

/* ---- Setup modal ---- */
#setup-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px;
    box-sizing: border-box;
}
#setup-box {
    text-align: left;
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}
#setup-box h2 {
    font-size: 22px;
    margin: 8px 0 20px;
}
#setup-box h3 {
    font-size: 14px;
    margin: 0 0 12px;
    color: var(--ivory-dim);
    font-weight: 600;
}
#close-setup-button {
    position: absolute;
    top: 16px; right: 18px;
    font-size: 24px;
    font-weight: 400;
    color: var(--ivory-faint);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}
#close-setup-button:hover { color: var(--brass-bright); }

.setup-player-section { margin-bottom: 22px; }
.setup-player-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ivory-dim);
}
.setup-player-section input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--ivory);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    margin-bottom: 4px;
}
.setup-player-section input:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(207, 157, 62, 0.15);
}

.color-palette { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.color-swatch {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.15), inset 0 -2px 4px rgba(0,0,0,0.3);
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.selected { border-color: var(--brass-bright); }

#mode-selection { margin-bottom: 22px; }
.mode-button, #start-game-button:not(.btn) {
    display: block;
    width: 100%;
    padding: 13px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.15s ease;
}
.mode-button {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    color: var(--ivory);
}
.mode-button:hover {
    border-color: var(--brass);
    background: rgba(207, 157, 62, 0.08);
    color: var(--brass-bright);
}

.spot.penalty-removal {
    animation: pulse-red 1s ease-in-out 3;
    border: 3px solid #ff4444;
}

@keyframes pulse-red {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); background-color: #ff4444; }
}

/* Visual indicator for double mill */
.spot.double-mill {
    box-shadow: 0 0 20px 8px var(--brass-bright), 0 0 40px 12px rgba(207, 157, 62, 0.4);
    animation: glow-double 0.8s ease-in-out infinite alternate;
}

@keyframes glow-double {
    from { box-shadow: 0 0 20px 8px var(--brass-bright), 0 0 40px 12px rgba(207, 157, 62, 0.4); }
    to { box-shadow: 0 0 30px 15px var(--brass-bright), 0 0 60px 20px rgba(207, 157, 62, 0.6); }
}

.spot.missed-mill {
    box-shadow: 0 0 0 3px #ff4444, 0 0 14px 4px rgba(255, 68, 68, 0.5);
    animation: missed-mill-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes missed-mill-pulse {
    from { box-shadow: 0 0 0 3px #ff4444, 0 0 14px 4px rgba(255, 68, 68, 0.5); }
    to   { box-shadow: 0 0 0 5px #ff6a6a, 0 0 22px 8px rgba(255, 68, 68, 0.7); }
}

/* Status message for missed mill penalty */
.status-penalty {
    color: #ff4444;
    font-weight: bold;
    animation: flash-message 0.5s ease-in-out 3;
}

@keyframes flash-message {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Toast notifications (missed mill / double mill) ---- */
#toast-container {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: 100%;
    padding: 0 16px;
    box-sizing: border-box;
}

.toast {
    pointer-events: auto;
    max-width: 420px;
    width: max-content;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-lift);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid transparent;
}
.toast.toast--visible {
    opacity: 1;
    transform: translateY(0);
}
.toast.toast--leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.toast--penalty {
    background: rgba(193, 92, 55, 0.92);
    color: #fff6ec;
    border-color: rgba(255, 255, 255, 0.15);
}
.toast--double-mill {
    background: rgba(232, 189, 92, 0.95);
    color: #241a10;
    border-color: rgba(255, 255, 255, 0.25);
}
.toast--mill {
    background: rgba(21, 15, 10, 0.92);
    color: var(--brass-bright);
    border-color: rgba(207, 157, 62, 0.4);
}
.toast--info {
    background: rgba(21, 15, 10, 0.92);
    color: var(--ivory);
    border-color: var(--line-soft);
}

.toast .toast-icon { display: inline-flex; align-items: center; flex-shrink: 0; }
.toast .toast-icon svg { display: block; }

@media (max-width: 768px) {
    #toast-container { top: 70px; }
    .toast { font-size: 12.5px; padding: 10px 14px; }
}

/* ============================================================================= */
/* --- Mobile responsive --- */
/* ============================================================================= */
@media (max-width: 768px) {
    #game-area {
        flex-direction: column;
        gap: 20px;
    }
    .player-panel {
        width: 80%;
        max-width: 300px;
    }
    #player1-panel { order: -1; }
    #board-container { width: 100%; }
    #game-topbar { padding: 0 16px; }
}

/* ---- Per-player chess clock (tournament matches) ---- */
.clock-line { font-size: 15px; }
.clock-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ivory-dim);
    font-size: 1.15em;
}
.clock-line.active .clock-value { color: var(--brass-bright); }
.clock-value.low { color: var(--clay-bright); animation: clock-low-pulse 1s ease-in-out infinite; }
@keyframes clock-low-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }