/* ═══════════════════════════════════════════════════════════
   BLR64 Live Chess Broadcast — Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-surface2: #0f3460;
    --bg-hover: #1e2a4a;
    --accent: #e94560;
    --accent-hover: #d63050;
    --success: #4caf50;
    --warning: #ff9800;
    --text: #eeeeee;
    --text-muted: #999999;
    --text-dim: #666666;
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.3);
    --eval-white: #f0f0f0;
    --eval-black: #303030;
    --radius: 8px;
    --transition: 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    cursor: pointer;
}

.site-logo:hover {
    color: var(--accent);
}

.site-logo span {
    color: var(--text);
    font-weight: 400;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-links a {
    color: var(--text);
    font-size: 0.95rem;
    transition: color 0.2s;
}

.header-links a:hover {
    color: var(--accent);
    text-decoration: none;
}

.header-links .btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.header-links .btn-cta:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

/* ── Tab System ─────────────────────────────────────────── */
.tab-bar {
    display: flex;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 24px;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn i {
    margin-right: 6px;
}

.tab-panel {
    display: none;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

/* ── Category Filter Bar ────────────────────────────────── */
.category-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.category-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.category-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--text-dim);
}

.category-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.category-btn[data-category="finished"] {
    border-style: dashed;
}

.category-btn[data-category="finished"].active {
    background: #6b7280;
    border-color: #6b7280;
    border-style: solid;
    color: #fff;
}

/* ── Main Container ─────────────────────────────────────── */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.toolbar select {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 200px;
    cursor: pointer;
}

.toolbar select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
    color: #fff;
    transition: background var(--transition);
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-surface2); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-success { background: var(--success); }
.btn-danger { background: #c62828; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Player Search ─────────────────────────────────────── */
.player-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 260px;
}

.player-search-input {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 30px 8px 32px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 100%;
    transition: border-color var(--transition);
}

.player-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.player-search-input::placeholder {
    color: var(--text-dim);
}

.player-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-dim);
    font-size: 0.85rem;
    pointer-events: none;
}

.player-search-clear {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.player-search-clear:hover {
    color: var(--text);
}

/* Search result states */
.game-card.search-dimmed {
    opacity: 0.25;
    pointer-events: none;
}

.game-card.search-match {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--accent);
}

/* ── Status Bar ─────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-dot.live {
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.error {
    background: var(--accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Sound Toggle ──────────────────────────────────────── */
.sound-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    padding: 4px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: auto;
    transition: color var(--transition), border-color var(--transition);
}

.sound-toggle:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.sound-toggle.active {
    color: var(--warning);
    border-color: var(--warning);
}

/* ── Board Container ────────────────────────────────────── */
.board-area {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    margin-top: 12px;
}

.board-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 400px;
    overflow: hidden;
}

/* PGNV overrides for dark theme */
/* PGNV 1.6.x uses: .pgnvjs > .moves > <move> > <san> elements */
/* Current/highlighted move: <san class="yellow"> */
.board-container .pgnvjs,
.board-container .pgnv {
    background: transparent !important;
}

.board-container .moves {
    color: var(--text) !important;
    background: var(--bg-surface) !important;
}

/* Target both custom <move> elements and .move class (compatibility) */
.board-container .moves move,
.board-container .moves .move {
    color: var(--text) !important;
}

.board-container .moves move:hover,
.board-container .moves .move:hover {
    background: var(--bg-hover) !important;
}

/* Current move highlight — PGNV uses san.yellow for the active move */
.board-container .moves move san.yellow,
.board-container .moves .move.current {
    background: var(--bg-surface2) !important;
    color: var(--accent) !important;
    font-weight: bold;
    border-radius: 3px;
}

.board-container .buttons button {
    background: var(--bg-surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

.board-container .buttons button:hover {
    background: var(--bg-hover) !important;
}

/* ── Click-to-Move (Analysis Board) ────────────────────── */
#analysis-board {
    overflow-x: hidden;
}

#analysis-board .pgnvjs,
#analysis-board .pgnv {
    max-width: 100% !important;
}

#analysis-board cg-board {
    cursor: pointer;
}

.blr-selected {
    background: rgba(20, 85, 30, 0.5);
}

.blr-move-hint::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32%;
    height: 32%;
    border-radius: 50%;
    background: rgba(20, 85, 30, 0.5);
}

/* ── Eval Bar (Vertical) ────────────────────────────────── */
.eval-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 50px;
}

.eval-bar {
    width: 30px;
    height: 360px;
    background: var(--eval-black);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

.eval-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: var(--eval-white);
    transition: height 0.5s ease;
}

.eval-score {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--text);
    text-align: center;
}

.eval-depth {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Engine Info Panel ──────────────────────────────────── */
.engine-info {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.engine-info .pv-line {
    color: var(--text-muted);
    margin-top: 4px;
    word-break: break-word;
}

/* ── ChessBase Container ────────────────────────────────── */
.chessbase-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 500px;
}

.chessbase-container iframe {
    width: 100%;
    border: none;
    border-radius: 4px;
}

/* ChessBase widget overrides */
.cblive-container {
    background: var(--bg-surface) !important;
}

/* ── Move Navigator (Game Analysis) ────────────────────── */
.analysis-nav {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 12px;
}

.analysis-nav-info {
    margin-bottom: 8px;
}

.analysis-game-title {
    font-weight: 600;
    font-size: 1rem;
}

.analysis-nav-controls {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.nav-btn {
    background: var(--bg-surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.move-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    flex: 1;
    max-height: 100px;
    overflow-y: auto;
    padding: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
}

.move-num {
    color: var(--text-dim);
    margin-left: 4px;
    user-select: none;
}

.move-san {
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
}

.move-san:hover {
    background: var(--bg-hover);
}

.move-san.active {
    background: var(--accent);
    color: #fff;
}

/* ── Play Move Bar ─────────────────────────────────────── */
.play-move-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ── Variation Line ────────────────────────────────────── */
.variation-line {
    padding: 6px 0 0;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--warning);
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* ── Clickable Best Move ───────────────────────────────── */
.bestmove-link {
    color: var(--success);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(76, 175, 80, 0.1);
}

.bestmove-link:hover {
    color: #66bb6a;
}

.engine-bestmove-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Analysis Tab ───────────────────────────────────────── */
.analysis-input {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.analysis-input textarea {
    flex: 1;
    min-width: 250px;
    min-height: 120px;
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
}

.analysis-input textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
    color: var(--text-dim);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
}

/* ── Loading Spinner ────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Notifications ──────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ── Multi-Board Grid ──────────────────────────────────────── */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 12px;
}

.game-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    overflow: hidden;
}

.game-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-weight: 600;
    padding: 4px 6px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.3;
    flex-wrap: wrap;
}

.game-card-names {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.game-card-result {
    display: inline-block;
    background: var(--bg-surface2);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Game Card Opening Name ─────────────────────────────── */
.game-card-opening {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: 2px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Game Card Sparkline ───────────────────────────────── */
.game-card-sparkline {
    display: flex;
    justify-content: center;
    padding: 2px 6px;
}

.eval-sparkline {
    display: block;
}

/* ── Game Card Status Line ────────────────────────────── */
.game-card-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 2px 6px;
}

.status-dot-mini {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

/* ── Game Card Actions ──────────────────────────────────── */
.game-card-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    padding: 2px 4px 4px;
    flex-wrap: wrap;
}

.game-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-surface2);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.game-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-dim);
}

.game-action-btn i {
    font-size: 0.7rem;
}

/* ── Focus Mode Bar ────────────────────────────────────── */
.focus-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.focus-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* PGNV overrides inside game cards */
.game-card .pgnvjs,
.game-card .pgnv {
    background: transparent !important;
}

.game-card .moves {
    color: var(--text) !important;
    background: var(--bg-surface) !important;
}

.game-card .moves move,
.game-card .moves .move {
    color: var(--text) !important;
}

.game-card .moves move:hover,
.game-card .moves .move:hover {
    background: var(--bg-hover) !important;
}

.game-card .moves move san.yellow,
.game-card .moves .move.current {
    background: var(--bg-surface2) !important;
    color: var(--accent) !important;
}

.game-card .buttons button {
    background: var(--bg-surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

.game-card .buttons button:hover {
    background: var(--bg-hover) !important;
}

/* ── Game Counter ──────────────────────────────────────── */
.game-counter {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 4px 0;
}

/* ── Pagination Bar ───────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pagination-bar .page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.pagination-bar .page-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--text-dim);
}

.pagination-bar .page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-bar .page-info {
    font-weight: 600;
    color: var(--text);
    user-select: none;
}

/* ── Share Dropdown ────────────────────────────────────── */
.share-dropdown {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 0;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: shareDropIn 0.15s ease-out;
}

@keyframes shareDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.share-option:hover {
    background: var(--bg-hover);
    text-decoration: none;
    color: var(--text);
}

.share-option i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

.share-whatsapp i { color: #25D366; }
.share-twitter i  { color: #eeeeee; }
.share-facebook i { color: #1877F2; }
.share-copy i     { color: var(--text-muted); }

/* Share button green tint on hover */
.game-share-btn:hover {
    border-color: #25D366 !important;
    color: #25D366 !important;
}

/* Focus bar actions layout */
.focus-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.focus-share-btn {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
}

.focus-share-btn:hover {
    border-color: #25D366;
    color: #25D366;
}

/* ── Poll Countdown & Refresh ─────────────────────────── */
.poll-countdown {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    user-select: none;
    margin-left: auto;
}

.refresh-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    padding: 3px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}

.refresh-btn:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.refresh-btn:active i {
    animation: spin 0.5s linear;
}

/* ── Board Flip ───────────────────────────────────────── */
/* cg-board has no inline transform — CSS transform works */
.game-card.flipped cg-board {
    transform: rotate(180deg);
}

/* Pieces have inline transform:translate() for positioning.
   Using the separate CSS 'rotate' property so it stacks with
   the inline transform instead of overriding it. */
.game-card.flipped cg-board piece {
    rotate: 180deg;
}

/* Coords: counter-rotate individual labels so text is readable */
.game-card.flipped coords coord {
    transform: rotate(180deg);
}

.game-card.flipped .game-flip-btn {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* ── Featured Games Filter Bar ─────────────────────────── */
.featured-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.featured-filter-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.featured-filter-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--text-dim);
}

.featured-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Featured Games Grid ──────────────────────────────── */
.featured-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.featured-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.featured-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(233, 69, 96, 0.15);
    transform: translateY(-2px);
}

/* ── Featured Card Badge (Category) ───────────────────── */
.featured-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.featured-card-badge i {
    font-size: 0.7rem;
}

/* Category badge colors */
.badge-game_of_week {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.badge-game_of_month {
    background: rgba(33, 150, 243, 0.15);
    color: #42a5f5;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.badge-best_of_tournament {
    background: rgba(76, 175, 80, 0.15);
    color: #66bb6a;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge-brilliancy {
    background: rgba(233, 30, 99, 0.15);
    color: #ec407a;
    border: 1px solid rgba(233, 30, 99, 0.3);
}

.badge-instructive {
    background: rgba(0, 188, 212, 0.15);
    color: #26c6da;
    border: 1px solid rgba(0, 188, 212, 0.3);
}

/* ── Featured Card Content ────────────────────────────── */
.featured-card-players {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
}

.featured-card-result {
    display: inline-block;
    background: var(--bg-surface2);
    color: var(--accent);
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}

.featured-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.featured-card-event {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.featured-card-event i {
    margin-right: 4px;
    font-size: 0.75rem;
}

.featured-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 6px;
}

.featured-card-date {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 8px;
}

.featured-card-date i {
    margin-right: 4px;
    font-size: 0.72rem;
}

/* ── Featured Viewer ──────────────────────────────────── */
.featured-viewer-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.featured-viewer-header h3 {
    flex: 1;
    font-size: 1.1rem;
    color: var(--text);
}

.featured-viewer-board {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 400px;
    max-width: 900px;
}

/* PGNV dark theme overrides for featured viewer */
.featured-viewer-board .pgnvjs,
.featured-viewer-board .pgnv {
    background: transparent !important;
}

.featured-viewer-board .moves {
    color: var(--text) !important;
    background: var(--bg-surface) !important;
}

.featured-viewer-board .moves move,
.featured-viewer-board .moves .move {
    color: var(--text) !important;
}

.featured-viewer-board .moves move:hover,
.featured-viewer-board .moves .move:hover {
    background: var(--bg-hover) !important;
}

.featured-viewer-board .moves move san.yellow,
.featured-viewer-board .moves .move.current {
    background: var(--bg-surface2) !important;
    color: var(--accent) !important;
    font-weight: bold;
    border-radius: 3px;
}

.featured-viewer-board .buttons button {
    background: var(--bg-surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

.featured-viewer-board .buttons button:hover {
    background: var(--bg-hover) !important;
}

/* Annotation comments in PGNV */
.featured-viewer-board .comment {
    color: var(--text-muted) !important;
    font-style: italic;
}

.featured-viewer-board .variation {
    color: var(--text-dim) !important;
}

.featured-viewer-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 900px;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ── Hamburger Menu ────────────────────────────────────── */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 110;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 102;
}

.nav-overlay.open { display: block; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .board-area {
        grid-template-columns: 1fr;
    }

    .eval-panel {
        flex-direction: row;
        justify-content: center;
    }

    .eval-bar {
        width: 100%;
        height: 24px;
    }

    .eval-bar-fill {
        bottom: 0;
        left: 0;
        top: 0;
        right: auto;
        width: 50%;
        height: 100%;
        transition: width 0.5s ease;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .category-bar {
        gap: 6px;
        padding: 10px 0 4px;
    }

    .category-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .featured-filter-bar {
        gap: 6px;
        padding: 10px 0 4px;
    }

    .featured-filter-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .featured-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .featured-viewer-board {
        padding: 8px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar select {
        min-width: auto;
    }

    .player-search-wrap {
        max-width: 100%;
    }

    .hamburger { display: block; }

    .site-header {
        flex-wrap: nowrap;
    }

    .header-links {
        position: fixed;
        top: 0; right: -100%;
        width: 260px; height: 100vh;
        flex-direction: column;
        background: var(--bg-surface);
        border-left: 1px solid var(--border);
        padding: 72px 24px 24px;
        gap: 20px;
        z-index: 105;
        transition: right 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .header-links.open { right: 0; }

    .header-links a {
        font-size: 1.05rem;
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    .header-links .btn-cta {
        padding: 10px 18px;
        font-size: 0.95rem;
        justify-content: center;
    }

    .status-bar {
        gap: 8px;
        flex-wrap: wrap;
    }

    .game-action-btn {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .game-action-btn i {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .tab-btn i {
        display: none;
    }

    .board-container {
        padding: 6px;
    }

    .boards-grid {
        grid-template-columns: 1fr;
    }

    .featured-games-grid {
        grid-template-columns: 1fr;
    }

    .featured-card {
        padding: 12px;
    }

    .featured-viewer-board {
        padding: 6px;
        min-height: 300px;
    }

    .featured-viewer-header {
        gap: 10px;
    }

    .featured-viewer-header h3 {
        font-size: 0.95rem;
    }

    .pagination-bar {
        gap: 8px;
        font-size: 0.82rem;
    }

    .pagination-bar .page-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .game-card-header {
        font-size: 0.8rem;
    }

    .game-card-status {
        font-size: 0.68rem;
    }

    .game-action-btn {
        padding: 3px 6px;
        font-size: 0.68rem;
        gap: 3px;
    }

    .game-card-actions {
        gap: 4px;
    }

    .poll-countdown {
        font-size: 0.75rem;
    }

    .focus-bar {
        flex-direction: column;
        text-align: center;
    }

    .focus-title {
        order: -1;
        width: 100%;
    }

    .analysis-nav-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .move-strip {
        max-height: 80px;
        font-size: 0.8rem;
    }
}
