* {
    box-sizing: border-box;
}

:root {
    --bg: radial-gradient(circle at 10% 20%, #0b1226, #050911 50%, #03060c 80%);
    --text: #e9ecf5;
    --muted: #8c92a6;
    --card: rgba(255, 255, 255, 0.04);
    --stroke: rgba(255, 255, 255, 0.08);
    --glow: 0 20px 80px rgba(0, 245, 255, 0.15);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    --accent: #7ef3c6;
    --accent-2: #5ad0ff;
    --danger: #ff8fa3;

    /* board theme defaults */
    --light-square: #f7f8fc;
    --dark-square: #cad1e5;
    --accent-strong: #5ad0ff;
    --accent-soft: rgba(90, 208, 255, 0.18);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    background-attachment: fixed;
    padding: 24px;
    overflow-x: hidden;
}

.hero-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    box-shadow: var(--glow), var(--shadow);
}

h1 {
    margin: 6px 0 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 32px;
    letter-spacing: -0.5px;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 11px;
    color: var(--muted);
}

.top-actions {
    display: flex;
    gap: 10px;
}

.top-actions button {
    min-width: 120px;
}

button {
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    border: none;
    border-radius: 12px;
    background: var(--card);
    padding: 10px 14px;
    cursor: pointer;
    border: 1px solid var(--stroke);
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.18);
}

button:active {
    transform: translateY(0);
}

button.primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #041018;
    box-shadow: 0 10px 30px rgba(90, 208, 255, 0.4);
    border-color: transparent;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.locked-control {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    display: grid;
    gap: 10px;
    z-index: 1200;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: rgba(12, 18, 32, 0.9);
    color: var(--text);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: toast-in 250ms ease, toast-out 250ms ease 3.75s forwards;
}

.review-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1300;
}

.review-modal.active {
    display: block;
}

.review-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 14, 0.72);
    backdrop-filter: blur(4px);
}

.review-panel {
    position: relative;
    width: min(920px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    overflow: hidden;
    margin: 20px auto;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: linear-gradient(160deg, rgba(8, 14, 27, 0.97), rgba(9, 12, 20, 0.95));
    box-shadow: var(--shadow), var(--glow);
    padding: 16px;
    display: grid;
    gap: 10px;
}

.review-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.review-header h2 {
    margin: 3px 0 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 24px;
}

.review-summary {
    margin: 0;
    color: var(--text);
    font-weight: 700;
}

.review-progress {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.review-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
    overflow: auto;
    padding-right: 6px;
}

.review-item {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 6px;
}

.review-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.review-move {
    font-weight: 700;
}

.review-badge {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.review-badge.best { background: rgba(126, 243, 198, 0.18); border-color: rgba(126, 243, 198, 0.45); color: #c9ffe8; }
.review-badge.excellent { background: rgba(109, 220, 255, 0.18); border-color: rgba(109, 220, 255, 0.45); color: #cbf4ff; }
.review-badge.good { background: rgba(90, 208, 255, 0.16); border-color: rgba(90, 208, 255, 0.35); color: #d3eeff; }
.review-badge.inaccuracy { background: rgba(255, 193, 95, 0.16); border-color: rgba(255, 193, 95, 0.4); color: #ffe9b8; }
.review-badge.mistake { background: rgba(255, 153, 102, 0.16); border-color: rgba(255, 153, 102, 0.45); color: #ffd9c2; }
.review-badge.blunder { background: rgba(255, 103, 129, 0.17); border-color: rgba(255, 103, 129, 0.5); color: #ffd2dc; }

.review-detail,
.review-best-hint {
    margin: 0;
    font-size: 13px;
}

.review-best-hint {
    color: var(--accent);
}

/* Resign modal */
.resign-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1300;
    align-items: center;
    justify-content: center;
}

.resign-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 14, 0.72);
    backdrop-filter: blur(4px);
}

.resign-panel {
    position: relative;
    width: min(420px, calc(100vw - 48px));
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: linear-gradient(160deg, rgba(8, 14, 27, 0.97), rgba(9, 12, 20, 0.95));
    box-shadow: var(--shadow), var(--glow);
    padding: 24px;
    display: grid;
    gap: 16px;
}

.resign-panel h2 {
    margin: 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 22px;
}

.resign-message {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.resign-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toast.success { border-color: rgba(126, 243, 198, 0.6); }
.toast.info { border-color: rgba(90, 208, 255, 0.6); }
.toast.warn { border-color: rgba(255, 179, 71, 0.6); }
.toast.danger { border-color: rgba(255, 143, 163, 0.7); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-10px); }
}

button.ghost {
    background: transparent;
    border-color: var(--stroke);
}

button.secondary {
    background: rgba(255, 140, 163, 0.08);
    border-color: rgba(255, 140, 163, 0.25);
    color: #ffb3c6;
}

button.danger {
    background: linear-gradient(120deg, rgba(255, 140, 163, 0.9), rgba(255, 100, 140, 0.85));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(255, 140, 163, 0.35);
}

button.resign {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    font-weight: 600;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    gap: 18px;
}

.home-layout {
    grid-template-columns: minmax(280px, 760px);
    justify-content: center;
}

.home-layout .panel.controls {
    width: 100%;
}

.panel {
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: var(--card);
    padding: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.controls .control-block {
    margin-bottom: 16px;
}

.label {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pill {
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #041018;
    background: var(--accent);
    font-weight: 700;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.segmented.small {
    grid-template-columns: repeat(3, 1fr);
}

.seg {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.seg.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    padding: 8px 12px;
    border: 1px solid var(--stroke);
}

.chip.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.theme-card {
    width: 100%;
    padding: 10px;
    display: grid;
    gap: 6px;
    align-items: center;
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    background: rgba(255, 255, 255, 0.03);
}

.theme-card .swatch {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    grid-row: span 2;
}

.theme-card .title {
    font-weight: 700;
}

.theme-card .lock {
    color: var(--muted);
    font-size: 12px;
}

.theme-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.theme-card.active {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 30px rgba(90, 208, 255, 0.3);
}

.hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.board-wrapper {
    display: grid;
    gap: 12px;
}

.timers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.clock {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clock .tag {
    color: var(--muted);
    font-size: 13px;
}

.clock .time {
    font-weight: 700;
    font-size: 20px;
}

.board-shell {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

.board {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 1px;
    padding: 1px;
    background: rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease;
}

.board.flipped {
    transform: rotate(180deg);
}

.square {
    position: relative;
    display: grid;
    place-items: center;
    font-size: clamp(26px, 5vw, 36px);
    user-select: none;
    transition: background 0.2s ease, transform 0.1s ease;
    border-radius: 0;
}

.square.light {
    background: var(--light-square);
}

.square.dark {
    background: var(--dark-square);
}

.square .piece {
    width: 84%;
    height: 84%;
    display: block;
    pointer-events: auto;
    user-select: none;
    transition: transform 0.1s ease;
    cursor: grab;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.square .piece:active {
    cursor: grabbing;
}

/* White pieces */
.square .piece-w {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

/* Black pieces */
.square .piece-b {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.42));
}

.square.highlight-move::after {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 3px solid var(--accent-strong);
    position: absolute;
    box-shadow: 0 0 8px var(--accent-strong), inset 0 0 4px var(--accent-strong);
}

.square.capture::after {
    width: 70%;
    height: 70%;
    border-radius: 10px;
}

.square.selected {
    background: rgba(90, 208, 255, 0.34) !important;
    outline: 3px solid var(--accent-strong);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 3px rgba(90, 208, 255, 0.7), 0 0 12px rgba(90, 208, 255, 0.45);
}

.square.last-move {
    background: rgba(126, 243, 198, 0.34) !important;
    box-shadow: inset 0 0 0 3px rgba(126, 243, 198, 0.85), 0 0 12px rgba(126, 243, 198, 0.5);
}

.square.drag-over {
    background: rgba(90, 208, 255, 0.28) !important;
    outline: 3px dashed var(--accent-strong);
    outline-offset: -3px;
}

.square.in-check {
    box-shadow: inset 0 0 0 3px var(--danger);
}

.board-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 30% 20%, rgba(90, 208, 255, 0.07), transparent 35%),
                radial-gradient(circle at 70% 80%, rgba(126, 243, 198, 0.06), transparent 35%);
}

.info-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.captured-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.captured-side {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.captured-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 28px;
    font-size: 22px;
    line-height: 1;
}

.captured-piece {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.status {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.status .value {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 700;
}

.moves .move-list {
    margin: 12px 0 0;
    padding-left: 20px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    display: grid;
    gap: 8px;
}

.move-list li {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--stroke);
    list-style-position: inside;
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .timers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .info-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    body {
        padding: 14px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .info-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── Mobile-first refinements ── */
@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .top-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .top-actions button {
        flex: 1 1 48%;
    }

    .layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .home-layout {
        grid-template-columns: 1fr;
    }

    .board-wrapper {
        order: 1;
    }

    .panel.controls {
        order: 2;
    }

    .panel.moves {
        order: 3;
    }

    .board-shell {
        max-width: 640px;
        margin: 0 auto;
        width: 100%;
        height: auto;
    }

    .timers {
        grid-template-columns: 1fr;
    }

    .captured-bar {
        grid-template-columns: 1fr;
    }

    .info-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 26px;
    }

    .top-actions button {
        flex-basis: 100%;
    }

    .board-shell {
        width: calc(100vw - 20px);
        height: calc(100vw - 20px);
        max-width: 100%;
        max-height: 100vw;
        margin: 0 auto;
    }

    .moves .move-list {
        max-height: 240px;
    }
}

/* ── Board theme swatches ───────────────────────────────────────────────
   Each theme sets square colours, accent colours, and overrides
   piece fill / stroke so pieces are always readable on that palette.
──────────────────────────────────────────────────────────────────────── */

/* 0 · Tournament Green (classic green + gray) */
.theme-0 {
    --light-square: #d5d5d8; --dark-square: #6ea043;
    --accent-strong: #5ad0ff; --accent-soft: rgba(90,208,255,0.18);
    --pw-color: #ffffff; --pw-stroke: #111111;
    --pb-color: #111111; --pb-stroke: rgba(255,255,255,0.75);
}

/* 1 · Amberwood (warm honey-brown) */
.theme-1 {
    --light-square: #f8f0df; --dark-square: #d8b889;
    --accent-strong: #ffb347; --accent-soft: rgba(255,179,71,0.22);
    --pw-color: #fff8e7; --pw-stroke: #3d1c02;
    --pb-color: #2b0f00; --pb-stroke: rgba(255,230,180,0.65);
}

/* 2 · Mint Crest (fresh green) */
.theme-2 {
    --light-square: #e7fff3; --dark-square: #9de5c2;
    --accent-strong: #46d681; --accent-soft: rgba(70,214,129,0.18);
    --pw-color: #f4fff9; --pw-stroke: #0d2b1a;
    --pb-color: #0d2b1a; --pb-stroke: rgba(200,255,225,0.6);
}

/* 3 · Blush Silk (soft pink) */
.theme-3 {
    --light-square: #ffeef5; --dark-square: #f3a6cd;
    --accent-strong: #ff6fbd; --accent-soft: rgba(255,111,189,0.18);
    --pw-color: #fff0f7; --pw-stroke: #5a0030;
    --pb-color: #3b0020; --pb-stroke: rgba(255,210,235,0.65);
}

/* 4 · Polar Sky (periwinkle-blue) */
.theme-4 {
    --light-square: #f2f7ff; --dark-square: #9fbdfc;
    --accent-strong: #6f8bff; --accent-soft: rgba(111,139,255,0.2);
    --pw-color: #eef4ff; --pw-stroke: #18215c;
    --pb-color: #101840; --pb-stroke: rgba(210,225,255,0.6);
}

/* 5 · Violet Crown (lavender-purple) */
.theme-5 {
    --light-square: #f9f2ff; --dark-square: #c9a6f7;
    --accent-strong: #b073ff; --accent-soft: rgba(176,115,255,0.2);
    --pw-color: #fbf4ff; --pw-stroke: #2e0050;
    --pb-color: #220040; --pb-stroke: rgba(240,210,255,0.6);
}

/* 6 · Glacier Fade (teal-grey) */
.theme-6 {
    --light-square: #eef6f7; --dark-square: #89b6c4;
    --accent-strong: #49c1ff; --accent-soft: rgba(73,193,255,0.16);
    --pw-color: #f0fafc; --pw-stroke: #0d2d38;
    --pb-color: #062030; --pb-stroke: rgba(195,235,245,0.6);
}

/* 7 · Champagne (warm taupe) */
.theme-7 {
    --light-square: #f7f3ef; --dark-square: #c7b09d;
    --accent-strong: #e5c08c; --accent-soft: rgba(229,192,140,0.2);
    --pw-color: #fffbf5; --pw-stroke: #3a2510;
    --pb-color: #2a180a; --pb-stroke: rgba(255,240,210,0.6);
}

/* 8 · Garden Glass (bright sage) */
.theme-8 {
    --light-square: #f6fff7; --dark-square: #b5f0c2;
    --accent-strong: #7be495; --accent-soft: rgba(123,228,149,0.2);
    --pw-color: #f4fff6; --pw-stroke: #103020;
    --pb-color: #0c2518; --pb-stroke: rgba(210,255,220,0.6);
}

/* 9 · Frosted Slate (muted silver) */
.theme-9 {
    --light-square: #f6f7fb; --dark-square: #bfc2d7;
    --accent-strong: #9aa4ff; --accent-soft: rgba(154,164,255,0.2);
    --pw-color: #f8f9ff; --pw-stroke: #20223a;
    --pb-color: #181a30; --pb-stroke: rgba(220,225,255,0.6);
}

/* ═══════════════════════════════════════════
   FOCUS MODE LAYOUT
   ═══════════════════════════════════════════ */

.focus-layout {
    display: none;
}

.focus-layout.active {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: var(--bg);
    background-attachment: fixed;
    overflow: hidden;
}

body.focus-active > .focus-layout.active {
    position: fixed;
}

/* Left — board fills entire area as a square */
.focus-board-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    min-width: 0;
}

.focus-board-area .board-shell {
    width: calc(100vh - 24px);
    max-width: 100%;
    height: calc(100vh - 24px);
    max-height: 100%;
}

.focus-board-area .board {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
}

/* Center — clocks + captured */
.focus-center {
    width: 200px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 12px;
    justify-content: center;
    border-left: 1px solid var(--stroke);
    border-right: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.02);
}

.focus-clock {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.focus-clock .tag {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.focus-clock .time {
    font-weight: 700;
    font-size: 28px;
}

.focus-captured {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.focus-captured .captured-row {
    min-height: 32px;
    font-size: 24px;
}

.focus-captured .captured-piece {
    width: 26px;
    height: 26px;
}

.focus-vs {
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 4px;
}

/* Right — info + moves + exit */
.focus-right {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.focus-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.focus-right .move-list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

.focus-post-actions {
    display: none;
    gap: 10px;
    margin-top: auto;
}

.focus-post-actions.visible {
    display: grid;
}

.post-match-action {
    width: 100%;
}

.exit-focus-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--danger);
    border-color: rgba(255,143,163,0.25);
}

/* Dedicated Review Page */
.review-page-body {
    margin: 0;
    height: 100vh;
    padding: 12px;
    overflow: hidden;
}

.review-layout {
    max-width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr minmax(280px, 320px);
    gap: 12px;
    height: 100%;
}

.review-board-area {
    display: grid;
    gap: 8px;
    height: 100%;
    overflow: hidden;
    grid-template-rows: auto 1fr auto auto;
    min-width: 0;
}

.review-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.review-head h1 {
    margin: 0;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 22px;
}

.review-head .eyebrow {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.review-controls {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

#reviewBoardShell {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

#reviewBoard {
    width: 90%;
    height: 90%;
}

.review-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}

.review-result {
    margin: 0;
    font-weight: 700;
    font-size: 12px;
}

.review-side {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8px;
    height: 100%;
    overflow: hidden;
}

.review-meta {
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    display: grid;
    gap: 4px;
}

.review-meta p {
    margin: 0;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
}

.review-meta span {
    color: var(--muted);
    font-size: 12px;
}

.review-meta strong {
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.review-move-list {
    margin: 0;
    padding: 6px 4px;
    list-style: none;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 4px;
    align-content: start;
    height: 100%;
}

.review-nav-move {
    border: 1px solid var(--stroke);
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    font-size: 12px;
}

.review-nav-move:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.18);
}

.review-nav-move.active {
    border-color: var(--accent-2);
    background: rgba(90, 208, 255, 0.14);
}

.review-empty {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1100px) {
    .review-layout {
        grid-template-columns: 1fr;
    }

    .review-side {
        max-height: 260px;
    }
}

@media (max-width: 720px) {
    .review-page-body {
        padding: 10px;
    }

    .review-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .review-head h1 {
        font-size: 18px;
    }

    .review-controls {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
    }
}

.exit-focus-btn:hover {
    background: rgba(255,143,163,0.08);
}

/* Hide normal layout when focus is active */
body.focus-active .hero-grid > header,
body.focus-active #normalLayout {
    display: none !important;
}

body.focus-active {
    padding: 0;
    overflow: hidden;
}

body.focus-active .hero-grid {
    max-width: 100%;
    gap: 0;
    height: 100vh;
}

/* Focus mode mobile overrides (after base styles for priority) */
@media (max-width: 900px) {
    .focus-layout.active {
        flex-direction: column;
        height: 100vh;
        overflow-y: auto;
    }

    .focus-board-area {
        height: 56vh;
        padding: 8px;
    }

    .focus-board-area .board-shell {
        width: calc(100vw - 20px);
        height: calc(100vw - 20px);
        max-width: 100%;
        max-height: calc(100vw - 20px);
    }

    .focus-center {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--stroke);
        border-bottom: 1px solid var(--stroke);
    }

    .focus-center .focus-clock,
    .focus-center .focus-captured {
        flex: 1 1 45%;
    }

    .focus-right {
        width: 100%;
        min-width: 0;
        padding: 12px;
    }

    .focus-clock .time {
        font-size: 22px;
    }

    .focus-captured .captured-row {
        font-size: 20px;
    }

    .focus-right .move-list {
        max-height: 260px;
    }
}
