:root {
    --bg: #302e2b;
    --panel: #262421;
    --panel-dark: #211f1c;
    --panel-light: #302e2b;
    --border: rgba(255, 255, 255, 0.08);
    --green: #81b64c;
    --green-hover: #96cb60;
    --green-shadow: #4e7828;
    --text: #ffffff;
    --text-dim: #b3b1ae;
    --yellow: #f7c631;
    --orange: #e58f2a;
    --red: #ca3431;
    --sq-light: #ebecd0;
    --sq-dark: #739552;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-left: 180px;
}

/* CHESS.COM-STYLE LEFT SIDEBAR (Desktop) */
nav {
    background: var(--panel-dark);
    border-right: 1px solid var(--border);
    padding: 16px 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 180px;
    z-index: 100;
    gap: 14px;
}

.nav-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand {
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
}

.brand span {
    color: var(--green);
}

.tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.tab-btn.active {
    background: var(--panel-light);
    color: var(--text);
    border-left: 3px solid var(--green);
}

.nav-bottom {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.icon-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.15s;
    position: relative;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
    transition: 0.15s;
    min-width: 0;
}
.user-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-pill:hover { background: #3c3a37; }

/* MOBILE BOTTOM NAV */
@media (max-width: 768px) {
    body { padding-left: 0; padding-bottom: 65px; }
    nav {
        position: sticky;
        width: 100%;
        height: auto;
        bottom: auto;
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .nav-top { flex-direction: row; align-items: center; }
    .nav-bottom { flex-direction: row; align-items: center; gap: 6px; }
    .sidebar-search-wrap { display: none; }
    .tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        background: var(--panel-dark);
        border-top: 1px solid var(--border);
        padding: 6px 4px;
        justify-content: space-around;
        z-index: 200;
    }
    .tab-btn {
        font-size: 0.64rem;
        padding: 6px 2px;
        flex: 1;
        flex-direction: column;
        gap: 3px;
        justify-content: center;
        align-items: center;
        text-align: center;
        border-left: none !important;
        min-width: 0;
    }
    .tab-btn.active { border-bottom: 3px solid var(--green); }
}

/* MAIN LAYOUT */
main {
    flex: 1;
    max-width: 1680px;
    width: 100%;
    margin: 14px auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 940px) {
    main {
        grid-template-columns: 1fr;
        justify-items: center;
        margin: 10px auto;
        padding: 0 12px;
        gap: 14px;
    }
}

/* BOARD SECTION */
.board-section {
    display: flex;
    gap: 10px;
    align-items: stretch;
    width: 100%;
    justify-content: center;
}

.eval-bar {
    width: 24px;
    background: #262421;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
    flex-shrink: 0;
}

.eval-black {
    background: #403d39;
    width: 100%;
    height: 50%;
    transition: height 0.35s ease;
}

.eval-white {
    background: #ffffff;
    width: 100%;
    flex: 1;
}

.eval-label {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 800;
    top: 4px;
    color: #fff;
    text-shadow: 0 1px 2px #000;
}

.board-container {
    position: relative;
    width: min(740px, calc(100vh - 150px), 88vw);
    height: min(740px, calc(100vh - 150px), 88vw);
}
.arrow-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 12;
}

.captured-row {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--green);
}
.captured-row img {
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.chessboard {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    user-select: none;
}

.square {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.square.light { background-color: var(--sq-light); }
.square.dark { background-color: var(--sq-dark); }
.square.selected { background-color: rgba(255, 255, 51, 0.5) !important; }
.square.last-move { background-color: rgba(247, 236, 91, 0.45) !important; }
.square.best-from { box-shadow: inset 0 0 0 4px #52b0df; }
.square.best-to { box-shadow: inset 0 0 0 4px var(--green); }
.square.in-check { background: radial-gradient(circle, #ff2e2e 0%, transparent 80%) !important; }

.square img.piece-img {
    width: 86%;
    height: 86%;
    pointer-events: none;
    user-select: none;
}

.square.hint::after {
    content: '';
    width: 28%;
    height: 28%;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    position: absolute;
}

.square.hint-capture::after {
    content: '';
    width: 84%;
    height: 84%;
    border: 4px solid rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    position: absolute;
}

.coord {
    position: absolute;
    font-size: 0.65rem;
    font-weight: 700;
    pointer-events: none;
}
.coord-rank { top: 2px; left: 3px; }
.coord-file { bottom: 2px; right: 3px; }
.square.light .coord { color: var(--sq-dark); }
.square.dark .coord { color: var(--sq-light); }

/* RIGHT PANEL */
.side-panel {
    width: 100%;
    background: var(--panel);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tab-content { display: none; flex-direction: column; gap: 14px; }
.tab-content.active { display: flex; }

.card {
    background: var(--panel-dark);
    border-radius: 8px;
    padding: 14px;
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 0.98rem;
    margin-bottom: 10px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* CHESS.COM 3D BUTTONS */
.btn {
    background: var(--green);
    color: #fff;
    border: none;
    border-bottom: 3px solid var(--green-shadow);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.92rem;
    transition: 0.1s;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.btn:hover { background: var(--green-hover); }
.btn:active { transform: translateY(2px); border-bottom-width: 1px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: #3c3a37;
    color: var(--text);
    border-bottom: 3px solid #262421;
}
.btn-secondary:hover { background: #4b4844; }

input, select, textarea {
    background: #1a1917;
    color: var(--text);
    border: 1px solid #3c3a37;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.92rem;
    width: 100%;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }

.row { display: flex; gap: 8px; align-items: center; }

/* BADGES & MOVES */
.move-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 170px;
    overflow-y: auto;
    padding: 8px;
    background: #1a1917;
    border-radius: 6px;
}

.move-chip {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.84rem;
    cursor: pointer;
    background: #2b2926;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.move-chip:hover { background: #3c3a37; }
.move-chip.current { background: rgba(129, 182, 76, 0.3); border: 1px solid var(--green); }

.badge-best { color: #81b64c; }
.badge-good { color: #b3b1ae; }
.badge-inacc { color: var(--yellow); }
.badge-mistake { color: var(--orange); }
.badge-blunder { color: var(--red); font-weight: 800; }

/* SCANNER & PLAN */
.phase-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}
.phase-box {
    background: #1a1917;
    padding: 10px 6px;
    border-radius: 6px;
    text-align: center;
}
.phase-score { font-size: 1.3rem; font-weight: 800; margin: 4px 0; }

.game-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #1a1917;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid transparent;
}
.game-row:hover { border-color: var(--green); background: #262421; }

.plan-step {
    background: rgba(129, 182, 76, 0.1);
    border-left: 4px solid var(--green);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.88rem;
}

/* CHAT */
.chat-box {
    height: 110px;
    overflow-y: auto;
    background: #1a1917;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(129, 182, 76, 0.2);
    color: var(--green);
}

.lesson-item {
    padding: 12px;
    border-radius: 6px;
    background: #1a1917;
    cursor: pointer;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
}
.lesson-item:hover, .lesson-item.active {
    border-color: var(--green);
    background: #2b2926;
}

/* SETTINGS SWITCH & THEMES */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.theme-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #1a1917;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
}
.theme-swatch.active { border-color: var(--green); }
.swatch-colors {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}
.swatch-colors div { flex: 1; height: 100%; }

/* TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #4b4844;
    transition: .2s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--green); }
input:checked + .slider:before { transform: translateX(20px); }

/* COACH BUBBLE (Chess.com style) */
.coach-card {
    background: var(--panel-dark);
    border: 1px solid rgba(129, 182, 76, 0.35);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.coach-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2b2926, #3c3a37);
    border: 2px solid var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.coach-bubble {
    background: #ffffff;
    color: #262421;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.38;
    position: relative;
    flex: 1;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}
.coach-bubble.bad { border-left: 4px solid var(--red); }
.coach-bubble.warn { border-left: 4px solid var(--orange); }
.coach-bubble.good { border-left: 4px solid var(--green); }

/* LESSON CATEGORIES & PROGRESS */
.cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.cat-pill {
    background: #1a1917;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}
.cat-pill.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.progress-track {
    width: 100%;
    height: 8px;
    background: #1a1917;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-fill {
    height: 100%;
    background: var(--green);
    width: 0%;
    transition: width 0.3s ease;
}

/* LICHESS-STYLE MODULES & STAGE STEPPER */
.module-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #1a1917;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: 0.15s;
}
.module-item:hover {
    border-color: var(--green);
    background: #2b2926;
}
.module-item.completed {
    border-color: rgba(129, 182, 76, 0.45);
}
.module-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.module-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #2b2926;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.module-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
}
.module-sub {
    font-size: 0.74rem;
    color: var(--text-dim);
    margin-top: 2px;
}
.mini-pips {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 4px;
}
.mini-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3c3a37;
}
.mini-pip.done {
    background: var(--green);
}

.stage-stepper {
    display: flex;
    gap: 6px;
    margin: 10px 0 4px;
    flex-wrap: wrap;
}
.stage-pip {
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    background: #1a1917;
    border: 2px solid #3c3a37;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.12s;
}
.stage-pip.done {
    background: rgba(129, 182, 76, 0.22);
    border-color: var(--green);
    color: var(--green);
}
.stage-pip.current {
    border-color: var(--yellow);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--yellow);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    padding: 15px;
}
.modal-overlay.open { display: flex; }
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}
.module-grid .module-item {
    margin-bottom: 0;
}

.modal {
    background: var(--panel);
    border: 1px solid #3c3a37;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}
.modal.modal-wide {
    max-width: 620px;
}

/* CHESS.COM MOVE CLASSIFICATION BADGES (BOARD + ANALYSIS) */
.board-move-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}
.board-move-badge .move-badge-inline {
    margin-left: 0;
    display: block;
}
.move-badge-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 3px;
}
.move-chip.badge-book {
    border-color: rgba(168, 136, 101, 0.55);
    color: #e6cbb0;
}
.move-chip.badge-brilliant {
    border-color: rgba(27, 172, 166, 0.65);
    color: #5ce1db;
}
.ui-svg {
    width: 15px;
    height: 15px;
    vertical-align: -2px;
    flex-shrink: 0;
}
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px #1a1917 inset !important;
    -webkit-text-fill-color: var(--text) !important;
}

/* SMOOTH ANIMATIONS */
.piece-img.piece-animating {
    transition: transform 0.17s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    z-index: 6;
}
.square {
    transition: background-color 0.12s ease;
}
.btn {
    transition: transform 0.08s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.btn:active {
    transform: scale(0.96);
}
@keyframes badgePop {
    0% { transform: scale(0.35); opacity: 0; }
    70% { transform: scale(1.14); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.board-move-badge {
    animation: badgePop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalPop {
    0% { transform: scale(0.92) translateY(8px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-overlay.open .modal {
    animation: modalPop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes coachFadeIn {
    0% { opacity: 0.45; transform: translateY(3px); }
    100% { opacity: 1; transform: translateY(0); }
}
.coach-bubble {
    animation: coachFadeIn 0.2s ease-out;
}
@keyframes clockPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(255, 107, 107, 0); }
}
.clock-urgent {
    animation: clockPulse 1s infinite;
}
.square.premove {
    background-color: rgba(235, 97, 80, 0.55) !important;
}

/* --- BOARD COORDINATES --- */
.coord-rank, .coord-file {
    position: absolute;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    opacity: 0.78;
    z-index: 3;
}
.coord-rank {
    top: 3px;
    left: 4px;
}
.coord-file {
    bottom: 2px;
    right: 4px;
}
.sq.light .coord-rank, .sq.light .coord-file {
    color: var(--sq-dark);
}
.sq.dark .coord-rank, .sq.dark .coord-file {
    color: var(--sq-light);
}

/* --- ANALYSIS EVAL GRAPH & SUMMARY --- */
.analysis-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}
.summary-pill {
    background: #1a1917;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 4px;
    text-align: center;
    font-size: 0.72rem;
}
.summary-pill strong {
    display: block;
    font-size: 0.88rem;
}
.eval-graph-wrap {
    width: 100%;
    height: 76px;
    background: #1a1917;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    cursor: pointer;
}
.eval-graph-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- OPENINGS TRAINER --- */
.opening-card {
    background: #1a1917;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.15s, transform 0.15s;
}
.opening-card:hover {
    border-color: #c084fc;
    transform: translateY(-1px);
}
.opening-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(192, 132, 252, 0.16);
    color: #d8b4fe;
}

/* --- ACHIEVEMENTS & RECENT GAMES --- */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 8px;
}
.ach-card {
    background: #1a1917;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    opacity: 0.45;
    display: flex;
    gap: 8px;
    align-items: center;
}
.ach-card.unlocked {
    opacity: 1;
    border-color: rgba(240, 193, 92, 0.55);
    background: linear-gradient(135deg, rgba(240, 193, 92, 0.08), #1a1917);
}
.ach-icon {
    font-size: 1.45rem;
    flex-shrink: 0;
}
.recent-game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    background: #1a1917;
    border: 1px solid var(--border);
    border-radius: 6px;
}
@media (max-width: 600px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .board-container {
        width: min(740px, calc(100vh - 210px), calc(100vw - 58px));
        height: min(740px, calc(100vh - 210px), calc(100vw - 58px));
    }
    .analysis-summary-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
    }
    .summary-pill {
        font-size: 0.65rem;
        padding: 4px 2px;
    }
    .coord-rank, .coord-file {
        font-size: 8px;
    }
}

/* --- FOG OF WAR --- */
.square.fogged {
    position: relative;
}
.square.fogged::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(15, 14, 12, 0.84);
    backdrop-filter: blur(1px);
    pointer-events: none;
    z-index: 4;
}
