/* =========================
   FONT IMPORT
========================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =========================
   THEME VARIABLES
========================= */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f8ff;
    --bg-panel: #ffffff;
    --text-primary: #0b1f4d;
    --text-secondary: #5a6a8a;
    --accent: #0b1f4d;
    --accent-gold: #d4af37;
    --accent-glow: #1a3a7c;
    --border: #e4eaf4;
    --shadow: 0 4px 24px rgba(11, 31, 77, 0.07);
    --glass-bg: #ffffff;
    --hover-bg: #eef3fb;
}

[data-theme="dark"] {
    --bg-primary: #0d1627;
    --bg-secondary: #111d35;
    --bg-panel: #111d35;
    --text-primary: #e8eeff;
    --text-secondary: #8fa0c8;
    --accent: #5b8aff;
    --accent-gold: #d4af37;
    --accent-glow: #7aa3ff;
    --border: #1e2d4a;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --glass-bg: #111d35;
    --hover-bg: #1a2d4a;
}

/* =========================
   RESET
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================
   BODY
========================= */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
}

/* =========================
   TOP NAVBAR (legacy, kept for compatibility)
========================= */
.top-navbar {
    width: 100%;
    height: 84px;
    background: #0b1f4d;
    box-shadow: 0 4px 20px rgba(11, 31, 77, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-inner {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 48px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.brand-name {
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 34px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

.nav-link:hover {
    color: #d4af37;
}

.nav-link.active {
    color: #ffffff;
}

.nav-link.active::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -14px;
    width: 56px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #d4af37, #f0cc65);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.55);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-login {
    min-height: 44px;
    padding: 0 22px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.nav-user-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* =========================
   THEME TOGGLE
========================= */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.theme-toggle {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: 40px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: center;
    box-shadow: 0 2px 10px rgba(11, 31, 77, 0.1);
}

.theme-toggle i {
    font-size: 1.1em;
    color: var(--text-primary);
    transition: all 0.3s;
}

.theme-toggle .fa-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-sun {
    display: inline-block;
    color: #d4af37;
}

/* =========================
   MAIN CONTAINER
========================= */
.container {
    max-width: 1400px;
    margin: 24px auto 0;
    padding: 0 20px 40px;
}

/* =========================
   GLASS PANEL (now white cards)
========================= */
.glass-panel {
    background: var(--bg-primary);
    backdrop-filter: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(11, 31, 77, 0.07);
    transition: box-shadow 0.25s ease;
}

[data-theme="dark"] .glass-panel {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* =========================
   MAIN GRID
========================= */
.main-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: start;
}

/* =========================
   BOARD PANEL
========================= */
.board-panel {
    padding: 24px;
    min-width: 400px;
}

.board-container {
    width: 100%;
    max-width: 700px;
    aspect-ratio: 1 / 1;
    background: var(--bg-primary);
    border-radius: 14px;
    overflow: hidden;
    margin: 0 auto 20px;
    box-shadow: 0 2px 14px rgba(11, 31, 77, 0.09);
    position: relative;
}

#chessboard {
    width: 100%;
    height: 100%;
}

/* =========================
   BOARD NAVIGATION
========================= */
.board-navigation {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.control-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
}

.control-btn:hover {
    background: var(--hover-bg);
    border-color: #0b1f4d;
    color: #0b1f4d;
}

.play-btn {
    background: #0b1f4d;
    color: white;
    border-color: #0b1f4d;
}

.play-btn:hover {
    background: #1a3a7c;
    border-color: #1a3a7c;
}

.control-secondary {
    display: flex;
    justify-content: center;
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-family: inherit;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.arrow-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 5px 0;
}

.nav-arrow {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(11, 31, 77, 0.06);
}

.nav-arrow:hover {
    transform: scale(1.08);
    border-color: #0b1f4d;
    color: #0b1f4d;
    background: var(--hover-bg);
}

.nav-arrow:active {
    transform: scale(0.95);
}

#playMoves,
#pauseMoves {
    background: #0b1f4d;
    color: white;
    border-color: #0b1f4d;
}

#playMoves:hover,
#pauseMoves:hover {
    background: #1a3a7c;
    color: white;
}

.nav-label {
    text-align: center;
    font-size: 0.85em;
    color: var(--text-secondary);
    background: var(--bg-panel);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

#moveIndicator {
    display: inline-block;
    padding: 5px 15px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid var(--border);
}

/* =========================
   FEN SECTION
========================= */
.fen-section {
    margin-bottom: 20px;
}

.fen-section label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.fen-section textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    height: 70px;
    resize: vertical;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.fen-section textarea:focus,
.user-level select:focus {
    outline: none;
    border-color: #0b1f4d;
    box-shadow: 0 0 0 3px rgba(11, 31, 77, 0.1);
}

/* =========================
   BUTTON GRID
========================= */
.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 13px 18px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.22s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', inherit;
    letter-spacing: 0.01em;
}

.btn i {
    font-size: 0.95em;
}

.btn-primary {
    background: #0b1f4d;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(11, 31, 77, 0.18);
}

.btn-primary:hover {
    background: #1a3a7c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(11, 31, 77, 0.28);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.btn-premium {
    background: #d4af37;
    color: #0f2a66;
    font-weight: 700;
    grid-column: span 2;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.28);
}

.btn-premium:hover {
    background: #e0bb4d;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

.copy-btn:hover {
    transform: translateY(-2px);
}

/* =========================
   USER LEVEL
========================= */
.user-level {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.user-level label {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.user-level select {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s;
}

.user-level select:hover {
    border-color: #0b1f4d;
}

/* =========================
   ANALYSIS PANEL
========================= */
.analysis-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 700px;
    height: auto;
    max-height: none;
    overflow: visible;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.best-move-badge,
.eval-badge {
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.best-move-badge {
    background: #0b1f4d;
    color: white;
}

.eval-badge {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.eval-visual-section {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 8px;
}

.eval-bar-wrap {
    display: flex;
    align-items: center;
}

.eval-bar {
    width: 22px;
    height: 180px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(11, 31, 77, 0.07);
}

.eval-bar-black {
    background: #1a1a2e;
    height: 50%;
    transition: height 0.35s ease;
}

.eval-bar-white {
    background: #f0f4ff;
    height: 50%;
    transition: height 0.35s ease;
}

.eval-extra-info {
    flex: 1;
    display: flex;
    align-items: center;
}

.win-prob-box {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
}

.win-prob-title {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.win-prob-values {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

/* =========================
   TOP MOVES
========================= */
.top-moves-section h3 {
    color: var(--text-primary);
    margin-bottom: 14px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.move-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 0;
    max-height: 200px;
    overflow-y: auto;
}

.move-item {
    background: var(--bg-secondary);
    padding: 11px 16px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.move-item:hover {
    transform: translateX(4px);
    border-left-color: #d4af37;
    background: var(--hover-bg);
}

.move-item.best-move {
    border-left-color: #d4af37;
    background: rgba(212, 175, 55, 0.07);
}

.move-item.excellent { background: rgba(124, 58, 237, 0.06); }
.move-item.good      { background: rgba(34, 197, 94, 0.06); }
.move-item.ok        { background: rgba(59, 130, 246, 0.06); }
.move-item.weak      { background: rgba(245, 158, 11, 0.06); }
.move-item.mistake   { background: rgba(249, 115, 22, 0.06); }
.move-item.blunder   { background: rgba(239, 68, 68, 0.06); }

.move-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 10px 20px;
    font-style: italic;
    font-size: 0.9rem;
}

/* =========================
   GM ANALYSIS — CENTERPIECE
========================= */
.gm-analysis {
    background: var(--bg-primary);
    border-radius: 18px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(11, 31, 77, 0.09);
}

.gm-header {
    background: linear-gradient(135deg, #0b1f4d 0%, #1a3a7c 100%);
    color: #d4af37;
    padding: 14px 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 1.05em;
    flex-shrink: 0;
}

.gm-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.gm-header i {
    color: #d4af37;
}

.premium-tag {
    background: #d4af37;
    color: #0b1f4d;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.gm-analyze-btn {
    background: #f4c542;
    color: #0b1f5b;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gm-analyze-btn:hover {
    background: #ffd85c;
    transform: translateY(-1px);
}

.premium-lock-overlay {
    position: absolute;
    inset: 56px 0 0 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 0 0 16px 16px;
}

.premium-lock-overlay.hidden {
    display: none;
}

.premium-lock-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 22px 24px;
    width: 82%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(11, 31, 77, 0.12);
    border: 1px solid var(--border);
}

.premium-lock-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 16px;
    color: #0b1f4d;
}

.premium-lock-text {
    font-size: 13px;
    color: #5a6a8a;
    margin-bottom: 16px;
    line-height: 1.5;
}

.premium-action-btn {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-weight: 700;
    cursor: pointer;
    background: #0b1f4d;
    color: white;
    font-family: 'Inter', inherit;
    font-size: 14px;
    transition: background 0.2s;
}

.premium-action-btn:hover {
    background: #1a3a7c;
}

/* Grandmaster content scroll area */
#gmContent {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
    padding: 20px !important;
    background: var(--bg-primary);
}

#gmContent::-webkit-scrollbar {
    width: 6px !important;
    display: block !important;
}

#gmContent::-webkit-scrollbar-track {
    background: var(--bg-secondary) !important;
    border-radius: 6px !important;
}

#gmContent::-webkit-scrollbar-thumb {
    background: #d4af37 !important;
    border-radius: 6px !important;
}

#gmContent::-webkit-scrollbar-thumb:hover {
    background: #b8941f !important;
}

.analysis-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.analysis-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.section-content {
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 0.94em;
}

/* =========================
   SHARE SECTION
========================= */
.share-section {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.share-link {
    flex: 1;
    padding: 11px 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.88em;
}

.copy-btn {
    padding: 11px 20px;
    background: #0b1f4d;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.22s;
    font-family: 'Inter', inherit;
}

.copy-btn:hover {
    background: #1a3a7c;
    box-shadow: 0 5px 15px rgba(11, 31, 77, 0.22);
}

/* =========================
   LOADING OVERLAY
========================= */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 31, 77, 0.65);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    background: var(--bg-panel);
    padding: 32px 44px;
    border-radius: 20px;
    text-align: center;
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: 0 12px 48px rgba(11, 31, 77, 0.16);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: #0b1f4d;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 20px;
}

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

/* =========================
   SITE NAVBAR
========================= */
.site-navbar {
    width: 100%;
    min-height: 72px;
    background: #0b1f4d;
    border-bottom: none;
    box-shadow: 0 4px 24px rgba(11, 31, 77, 0.22);
    position: sticky;
    top: 0;
    z-index: 3000;
    margin: 0;
    padding: 0;
    display: block;
}

.site-navbar * {
    box-sizing: border-box;
}

.site-navbar-inner {
    width: min(98vw, 1600px);
    margin: 0 auto;
    padding: 0 20px;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo anchor inside dark navbar */
.site-navbar .logo,
a.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    overflow: visible;
    background: transparent;
    flex-shrink: 0;
}

/* ── CSS/HTML logo — no image file ──────────── */
.logo-html {
    gap: 10px;
    height: 44px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border: 2.5px solid #d4af37;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #d4af37;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
    line-height: 1;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.logo-name {
    font-size: 0.97rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.03em;
    line-height: 1.15;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.logo-sub {
    font-size: 0.5rem;
    font-weight: 600;
    color: #d4af37;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1.2;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.site-logo {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 800;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.site-nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.site-nav-links a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.site-nav-links a:hover,
.site-nav-links a.active {
    color: #d4af37;
}

.site-nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.site-btn {
    min-height: 40px;
    padding: 0 18px;
    border-radius: 11px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-family: 'Inter', inherit;
    cursor: pointer;
}

.site-btn-outline {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.22);
}

.site-btn-outline:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.38);
    color: #ffffff;
}

.site-btn-primary {
    background: #d4af37;
    color: #0b1f4d;
    border-color: #d4af37;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.28);
    font-weight: 700;
}

.site-btn-primary:hover {
    transform: translateY(-1px);
    background: #c9a432;
    box-shadow: 0 8px 22px rgba(212, 175, 55, 0.38);
}

/* Login status in dark navbar */
.login-status {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.86rem;
    font-weight: 500;
}

/* =========================
   GM ANALYSIS CONTENT BLOCKS
========================= */
.gm-content::-webkit-scrollbar {
    width: 6px;
}

.gm-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.gm-content::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 10px;
}

.gm-content::-webkit-scrollbar-thumb:hover {
    background: #b8941f;
}

.gm-structured-content {
    line-height: 1.7;
}

.gm-block {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.gm-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.gm-block-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: #0b1f4d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-theme="dark"] .gm-block-title {
    color: #7aa3ff;
}

.gm-block-body {
    font-size: 14.5px;
    color: var(--text-primary);
    line-height: 1.65;
}

.usage-info {
    margin: 10px 0;
    padding: 9px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* =========================
   PLACEHOLDER TEXT
========================= */
.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.92rem;
    text-align: center;
    padding: 30px 20px;
    opacity: 0.8;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 980px) {
    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .features-hero h1 {
        font-size: 34px;
    }
}

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

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

    .btn-premium {
        grid-column: span 1;
    }

    .analysis-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .share-section,
    .user-level {
        flex-direction: column;
        align-items: stretch;
    }

    .eval-visual-section {
        flex-direction: column;
    }

    .eval-bar-wrap {
        justify-content: center;
    }

    .eval-bar {
        width: 100%;
        max-width: 260px;
        height: 22px;
        flex-direction: row;
    }

    .eval-bar-black,
    .eval-bar-white {
        height: 100%;
    }

    .nav-inner {
        padding: 0 16px;
    }

    .nav-left {
        gap: 20px;
    }

    .nav-menu {
        gap: 16px;
        flex-wrap: wrap;
    }

    .brand-name {
        font-size: 18px;
    }

    .site-navbar-inner {
        padding: 14px 20px;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 12px;
    }

    .site-nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 14px;
    }

    .site-nav-actions {
        justify-content: flex-end;
    }
}

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

    .features-hero {
        padding: 28px;
    }

    .features-hero h1 {
        font-size: 28px;
    }

    .features-subtext {
        font-size: 16px;
    }
}

@media (max-width: 560px) {
    .site-nav-actions {
        width: 100%;
    }

    .site-btn {
        min-height: 38px;
        padding: 0 14px;
    }
}

@media (max-width: 480px) {
    .nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.1em;
    }

    .arrow-row {
        gap: 14px;
    }

    .nav-right {
        gap: 8px;
    }

    .nav-login {
        padding: 0 14px;
    }
}

@media (min-width: 2000px) {
    .container {
        max-width: 1800px;
    }

    .board-container {
        max-width: 800px;
    }
}

/* ════════════════════════════════════════════════
   PGN Replay Component (P28) — shared across pages
   ════════════════════════════════════════════════ */

.pgn-replay-wrap {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 16px;
    align-items: start;
}

.pgn-replay-board {
    width: 420px;
    flex-shrink: 0;
}

.pgn-replay-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.pgn-replay-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pgn-replay-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 10px;
    transition: background 0.15s;
    line-height: 1;
}

.pgn-replay-btn:hover {
    background: var(--hover-bg);
}

.pgn-replay-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
    white-space: nowrap;
}

.pgn-replay-movelist {
    max-height: 340px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.85rem;
    line-height: 1.8;
}

.pgn-move-num {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-right: 3px;
    margin-left: 6px;
    user-select: none;
}

.pgn-move-num:first-child {
    margin-left: 0;
}

.pgn-move-san {
    cursor: pointer;
    padding: 1px 5px;
    border-radius: 4px;
    transition: background 0.1s;
    margin-right: 2px;
    color: var(--text-primary);
}

.pgn-move-san:hover {
    background: var(--hover-bg);
}

.pgn-move-active {
    background: var(--accent) !important;
    color: #fff !important;
    border-radius: 4px;
}

.pgn-replay-empty,
.pgn-replay-error {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 4px 0;
}

/* Replay section header line */
.pgn-replay-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pgn-replay-section-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.pgn-replay-dl-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 5px 10px;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.pgn-replay-dl-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Jump-to-move button on critical position cards */
.ga-jump-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 3px 9px;
    transition: border-color 0.15s, color 0.15s;
}

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

/* ── Analysis badges on move list (P28.5) ──── */
.pgn-badge {
    font-size: 0.62rem;
    font-weight: 800;
    margin-left: 1px;
    vertical-align: super;
    line-height: 1;
}

.pgn-badge-excellent  { color: #3b82f6; }
.pgn-badge-good       { color: #22c55e; }
.pgn-badge-inaccuracy { color: #f59e0b; }
.pgn-badge-mistake    { color: #f97316; }
.pgn-badge-blunder    { color: #ef4444; }
.pgn-badge-crit       { color: #9333ea; }

.pgn-move-critical {
    background: rgba(147, 51, 234, 0.08) !important;
    border-radius: 3px;
}

/* Quality pill badge in insight panel */
.pgn-quality-pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.01em;
}
.pgn-quality-pill.pgn-badge-excellent  { background: #3b82f6; }
.pgn-quality-pill.pgn-badge-good       { background: #22c55e; }
.pgn-quality-pill.pgn-badge-inaccuracy { background: #f59e0b; }
.pgn-quality-pill.pgn-badge-mistake    { background: #f97316; }
.pgn-quality-pill.pgn-badge-blunder    { background: #ef4444; }

/* Jump to Critical button */
.pgn-jump-crit-btn {
    background: rgba(147, 51, 234, 0.1);
    border-color: #9333ea;
    color: #9333ea;
    font-size: 0.78rem;
    white-space: nowrap;
}
.pgn-jump-crit-btn:hover:not(:disabled) {
    background: rgba(147, 51, 234, 0.22);
}
.pgn-jump-crit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

/* ── Move Insight panel (P28.5) ─────────────── */
.pgn-insight-panel {
    font-size: 0.82rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    line-height: 1.4;
}

.pgn-insight-header {
    font-size: 0.83rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.pgn-insight-reason {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.79rem;
    line-height: 1.45;
}

[data-theme="dark"] .pgn-replay-movelist {
    background: var(--hover-bg);
}

@media (max-width: 700px) {
    .pgn-replay-wrap {
        grid-template-columns: 1fr;
    }
    .pgn-replay-board {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
}
