/* --- EXTRACTED FROM index.html --- */

:root {
    --board-height-offset: 160px;
    --board-width-offset: 560px;
    --play-board-size: min(calc(100vh - var(--board-height-offset)), calc(100vw - var(--board-width-offset)));
    --play-rail-size: var(--play-board-size);
    --analysis-board-size: calc(var(--play-board-size) * 0.98);
    --puzzle-board-size: calc(var(--play-board-size) * 0.98);

    /* Ideal Resolution Constraint */
    --max-site-width: 1920px;

    /* Theme-aware Text Colors */
    --color-on-surface: #1c1c15;
    --color-on-background: #1c1c15;
    --color-on-surface-variant: #424841;
}

html.dark {
    --color-on-surface: #ffffff;
    --color-on-background: #ffffff;
    --color-on-surface-variant: #e0e0e0;
}

@media (max-width: 1024px) {
    :root {
        --board-width-offset: 40px;
        --board-height-offset: 200px;
    }
}

#view-mount {
    width: 100%;
}

.library-shadow {
    box-shadow: 0 4px 24px -4px rgba(28, 28, 21, 0.06);
}

.ghost-border {
    border: 1px solid rgba(194, 200, 191, 0.15);
}

.wood-texture {
    background-color: #6c5338;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.05) 10px, rgba(0, 0, 0, 0.05) 20px);
}



.sq img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Chess Engine Required Styles */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.stagger-in>* {
    opacity: 1;
}

.sq-light {
    background-image: url('../images/sq_light.png');
    background-size: cover;
}

.sq-dark {
    background-image: url('../images/sq_dark.png');
    background-size: cover;
}

.chess-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    gap: 0;
    touch-action: none;
    /* Dynamic Texture System */
    background-image: var(--board-texture, url('../images/board_wood.png'));
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    box-sizing: border-box;
    image-rendering: -webkit-optimize-contrast;
    overflow: hidden;
}

.sq {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.1s;
    overflow: hidden;
    aspect-ratio: 1;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: background-color 0.15s ease, filter 0.15s ease;
}

.sq img {
    position: absolute;
    width: 82%;
    height: 82%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.4));
    z-index: 1;
    will-change: transform;
    /* Prepare GPU for movement/drag */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Silky move transitions */
}

.sq:hover {
    filter: brightness(1.05);
}

.sq.sq-selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid rgba(255, 215, 0, 0.8);
    background-color: rgba(255, 215, 0, 0.35);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    pointer-events: none;
    z-index: 0;
}

.sq.sq-last {
    background-color: rgba(255, 215, 0, 0.2) !important;
}

.sq.sq-last::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 215, 0, 0.4);
    pointer-events: none;
    z-index: 0;
}

.sq.sq-premove-from {
    background-color: rgba(160, 80, 220, 0.55) !important;
    box-shadow: inset 0 0 0 3px rgba(180, 100, 255, 0.9);
    animation: premovePulse 1.2s infinite alternate !important;
}

.sq.sq-premove-to {
    background-color: rgba(160, 80, 220, 0.28) !important;
    box-shadow: inset 0 0 0 2px rgba(180, 100, 255, 0.6);
}

@keyframes premovePulse {
    from {
        background-color: rgba(160, 80, 220, 0.45) !important;
    }

    to {
        background-color: rgba(160, 80, 220, 0.70) !important;
    }
}

.sq.sq-last {
    background-color: rgba(255, 215, 0, 0.2) !important;
    box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.4);
}

.sq.sq-check {
    background-color: rgba(220, 50, 50, 0.55) !important;
    animation: checkPulse 1s infinite alternate;
}

.hint-dot {
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    animation: hintScale 0.3s ease-out;
}

.hint-ring {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 2;
    animation: hintScale 0.3s ease-out;
}

/* ── Premove Square Highlight ── */
.sq.sq-premove-from {
    background-color: rgba(180, 100, 255, 0.3) !important;
    box-shadow: inset 0 0 0 3px rgba(180, 100, 255, 0.7);
    animation: premovePulse 1.2s infinite alternate !important;
}

.sq.sq-premove-to {
    background-color: rgba(180, 100, 255, 0.45) !important;
    box-shadow: inset 0 0 0 3px rgba(180, 100, 255, 0.9), 0 0 20px rgba(180, 100, 255, 0.4);
    animation: premovePulse 1.2s infinite alternate !important;
}

@keyframes premovePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}

@keyframes boardShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.board-shake {
    animation: boardShake 0.2s ease-in-out 2;
}

.premove-number {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: 900;
    color: white;
    background: rgba(180, 100, 255, 0.8);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.premove-badge {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    z-index: 10;
}

.premove-badge.show {
    display: block;
    animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* ── Board Arrow Overlay SVG ── */
#board-arrow-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: visible;
}

.board-arrow-container {
    position: absolute;
    inset: 3px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 19;
    overflow: hidden;
}

/* ── Online Presence Dot ── */
.presence-dot-online {
    background: #22c55e !important;
}

.presence-dot-offline {
    background: #6b7280 !important;
}

@keyframes hintScale {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkPulse {
    from {
        background-color: rgba(220, 50, 50, 0.4);
    }

    to {
        background-color: rgba(220, 50, 50, 0.7);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: inset 0 0 0 3px rgba(210, 210, 0, 0.85);
        background-color: rgba(246, 246, 105, 0.65);
    }

    50% {
        box-shadow: inset 0 0 0 6px rgba(210, 210, 0, 1);
        background-color: rgba(246, 246, 105, 0.85);
    }

    100% {
        box-shadow: inset 0 0 0 3px rgba(210, 210, 0, 0.85);
        background-color: rgba(246, 246, 105, 0.65);
    }
}

.dragging-piece {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    object-fit: contain;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.4));
    transition: none !important;
    transform: translate(-50%, -50%);
}

.sq-dragging img {
    opacity: 0 !important;
}

.sq-target-hover {
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.5) !important;
}

.game-status {
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Work Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.gs-yours {
    background: rgba(43, 71, 46, 0.1);
    border: 1px solid rgba(43, 71, 46, 0.2);
    color: #2b472e;
}

.gs-ai {
    background: rgba(83, 60, 35, 0.1);
    border: 1px solid rgba(83, 60, 35, 0.2);
    color: #533c23;
}

.gs-check {
    background: rgba(186, 26, 26, 0.1);
    border: 1px solid rgba(186, 26, 26, 0.35);
    color: #ba1a1a;
}

.gs-over {
    background: rgba(43, 71, 46, 0.15);
    border: 1px solid rgba(43, 71, 46, 0.4);
    color: #2b472e;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(43, 71, 46, 0.25);
    border-top-color: #2b472e;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.captured-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    line-height: 1;
}

.captured-item .cap-val {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.06);
    color: #2b472e;
    font-weight: 700;
    font-family: 'Work Sans', sans-serif;
}

.captured-total {
    font-size: 12px;
    color: rgba(26, 28, 28, 0.7);
    margin-left: 6px;
    font-family: 'Work Sans', sans-serif;
}

.mhist {
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.mrow {
    display: grid;
    grid-template-columns: 28px 1fr 1fr;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-family: monospace;
}

.mrow.cur {
    background: rgba(43, 71, 46, 0.1);
    border: 1px solid rgba(43, 71, 46, 0.3);
}

.timer-active {
    animation: timerPulse 2s infinite ease-in-out;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    background: #fcf9ee;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px -8px rgba(28, 28, 21, 0.35);
    border: 1px solid rgba(43, 71, 46, 0.2);
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s ease forwards;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast.toast-success {
    border-left: 4px solid #2b472e;
}

.toast.toast-error {
    border-left: 4px solid #ba1a1a;
}

.toast.toast-info {
    border-left: 4px solid #533c23;
}

.toast.toast-warning {
    border-left: 4px solid #af2b3e;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-success .toast-icon {
    background: rgba(43, 71, 46, 0.1);
    color: #2b472e;
}

.toast-error .toast-icon {
    background: rgba(186, 26, 26, 0.1);
    color: #ba1a1a;
}

.toast-info .toast-icon {
    background: rgba(83, 60, 35, 0.1);
    color: #533c23;
}

.toast-warning .toast-icon {
    background: rgba(175, 43, 62, 0.1);
    color: #af2b3e;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    color: #1c1c15;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: #737971;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #737971;
    border-radius: 4px;
    transition: all 0.15s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1c1c15;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastFadeOut {
    0% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(50px);
    }
}

html.dark .toast {
    background: #2c2f25;
    border-color: rgba(174, 207, 173, 0.2);
}

html.dark .toast-title {
    color: #e5e2d2;
}

html.dark .toast-message {
    color: #c3c8b4;
}

html.dark .toast-close:hover {
    background: rgba(255, 255, 255, 0.05);
}

.diff-btn {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: transparent;
    color: #555;
    transition: 0.15s;
    font-family: 'Work Sans', sans-serif;
}

.diff-btn.active {
    background: #2b472e;
    color: #fff;
    border-color: #2b472e;
}

.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.result-overlay.show {
    display: flex;
    opacity: 1;
}

.result-card {
    background: #fcf9ee;
    border-radius: 32px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(43, 71, 46, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.3);
}

.result-overlay.show .result-card {
    transform: scale(1) translateY(0);
}

.analysis-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
    width: 20px;
    height: 20px;
}

.analysis-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1;
}

.hover-lift {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.hover-lift:hover {
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15) !important;
}

/* Hide logic for the navigation */
.nav-btn.active {
    color: #2b472e !important;
    background-color: rgba(43, 71, 46, 0.1);
}

.nav-btn.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.nav-btn-mobile.active {
    color: #2b472e !important;
    background-color: rgba(43, 71, 46, 0.1);
    border-radius: 0.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.nav-btn-mobile.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    z-index: 9999;
    /* Ensure it's on top of everything */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.auth-modal {
    background: #fcf9ee;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    border: 1px solid rgba(194, 200, 191, 0.3);
    box-shadow: 0 32px 80px -12px rgba(28, 28, 21, 0.35);
    animation: authSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes authSlideIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-tab-btn {
    flex: 1;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Work Sans', sans-serif;
    color: #737971;
    background: transparent;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.auth-tab-btn.active {
    color: #2b472e;
    border-bottom-color: #2b472e;
}

.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
}

/* ─── Side Nav: Fixed Overlay (does not push content) ─── */
#side-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

#side-nav.nav-slide-out {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Blindfold Mode */
.blindfold-mode .piece,
.blindfold-mode [class*="piece"],
.blindfold-mode img[src*="pieces"],
.blindfold-mode .cg-piece {
    opacity: 0 !important;
    transition: opacity 0.3s ease;
}

input:checked ~ #blindfold-dot,
input:checked ~ #heatmap-dot {
    transform: translateX(100%);
    background-color: #000;
}

input:checked ~ #blindfold-bg,
input:checked ~ #heatmap-bg {
    background-color: #f97316;
    border-color: #f97316;
}


/* Main content always full width — never shifts */
#main-content {
    width: 100%;
    transition: none;
}

#main-content.nav-collapsed {
    margin-left: 0 !important;
}

#nav-reveal-btn {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%) translateX(-80px);
    z-index: 45;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    pointer-events: none;
}

#nav-reveal-btn.visible {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Copy button feedback */
.copy-btn-success {
    color: #2b472e !important;
}

html.dark .copy-btn-success {
    color: #aecfad !important;
}

/* ─── Dark Mode ─── */
html.dark body {
    background-color: #1a1c17 !important;
    color: #e5e2d2 !important;
}

html.dark .bg-background,
html.dark .bg-surface-bright {
    background-color: #1a1c17 !important;
}

html.dark .bg-surface {
    background-color: #21241b !important;
}

html.dark .bg-surface-container-lowest {
    background-color: #1e2119 !important;
}

html.dark .bg-surface-container-low {
    background-color: #262920 !important;
}

html.dark .bg-surface-container {
    background-color: #2c2f25 !important;
}

html.dark .bg-surface-container-high {
    background-color: #31352a !important;
}

html.dark .bg-surface-container-highest {
    background-color: #3c4033 !important;
}

html.dark .bg-surface-variant {
    background-color: #3c4033 !important;
}

html.dark .text-on-surface,
html.dark .text-on-background {
    color: #e5e2d2 !important;
}

html.dark .text-on-surface-variant {
    color: #c3c8b4 !important;
}

html.dark .text-primary {
    color: #aecfad !important;
}

html.dark .text-tertiary {
    color: #e3c19f !important;
}

html.dark .text-on-primary {
    color: #ffffff !important;
}

html.dark .border-outline-variant/10,
html.dark .border-outline-variant/15 {
    border-color: rgba(80, 86, 68, 0.5) !important;
}

html.dark .border-outline-variant/20 {
    border-color: rgba(80, 86, 68, 0.6) !important;
}

html.dark .border-outline-variant/30 {
    border-color: rgba(80, 86, 68, 0.75) !important;
}

html.dark .border-outline-variant/40 {
    border-color: rgba(80, 86, 68, 0.9) !important;
}

html.dark nav.hidden.lg\\:flex,
html.dark nav#bottom-nav {
    background-color: #262920 !important;
    border-color: rgba(80, 86, 68, 0.4) !important;
}

html.dark .nav-btn {
    color: #c3c8b4 !important;
}

html.dark .nav-btn.active {
    color: #aecfad !important;
    background-color: rgba(174, 207, 173, 0.12) !important;
}

html.dark .nav-btn-mobile {
    color: #c3c8b4 !important;
}

html.dark .nav-btn-mobile.active {
    color: #aecfad !important;
    background-color: rgba(174, 207, 173, 0.12) !important;
}

html.dark .result-card {
    background: #21241b !important;
}

html.dark .auth-modal {
    background: #21241b !important;
}

html.dark #auth-trigger-btn {
    background-color: #262920 !important;
    color: #aecfad !important;
    border-color: rgba(80, 86, 68, 0.6) !important;
}

html.dark .auth-tab-btn {
    color: #c3c8b4 !important;
}

html.dark .auth-tab-btn.active {
    color: #aecfad !important;
    border-bottom-color: #aecfad !important;
}

html.dark .diff-btn {
    color: #c3c8b4 !important;
    border-color: rgba(174, 207, 173, 0.25) !important;
    background: transparent !important;
}

html.dark .diff-btn.active {
    background: #2b472e !important;
    color: #fff !important;
    border-color: #2b472e !important;
}

html.dark .gs-yours {
    background: rgba(174, 207, 173, 0.1) !important;
    border-color: rgba(174, 207, 173, 0.2) !important;
    color: #aecfad !important;
}

html.dark .gs-ai {
    background: rgba(227, 193, 159, 0.1) !important;
    border-color: rgba(227, 193, 159, 0.2) !important;
    color: #e3c19f !important;
}

html.dark .gs-check {
    background: rgba(186, 26, 26, 0.15) !important;
    color: #ff8a80 !important;
}

html.dark .mrow.cur {
    background: rgba(174, 207, 173, 0.1) !important;
    border-color: rgba(174, 207, 173, 0.3) !important;
}

html.dark .hover-lift:hover {
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4) !important;
}

html.dark .wood-texture {
    background-color: #3d2c18 !important;
}

html.dark .chess-square-light {
    background-color: #3c4033 !important;
}

html.dark .chess-square-dark {
    background-color: #1a1c17 !important;
}

html.dark .grid-paper {
    background-image: linear-gradient(to right, rgba(174, 207, 173, 0.07) 1px, transparent 1px), linear-gradient(to bottom, rgba(174, 207, 173, 0.07) 1px, transparent 1px) !important;
}

html.dark .hover\\:bg-surface-variant:hover,
html.dark .hover\\:bg-surface-container-highest:hover {
    background-color: #3c4033 !important;
}

html.dark .hover\\:bg-surface-container:hover {
    background-color: #2c2f25 !important;
}

html.dark .hover\\:bg-surface-container-low:hover {
    background-color: #262920 !important;
}

html.dark .bg-secondary {
    background-color: #8b1a2a !important;
}

html.dark .hover\\:bg-secondary\\/80:hover {
    background-color: #7a1624 !important;
}

html.dark input,
html.dark textarea {
    background-color: #2c2f25 !important;
    color: #e5e2d2 !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #6b7060 !important;
}

html.dark .spinner {
    border-color: rgba(174, 207, 173, 0.25) !important;
    border-top-color: #aecfad !important;
}

#intro-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
    overflow: hidden;
    /* Prevent massive rays and pieces from leaking */
}

.view-section {
    width: 100%;
    overflow-x: hidden !important;
    /* Total guard against right-side bleed */
}

body {
    background-color: #000000 !important;
    color: #ffffff;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
}

#view-dashboard.active #intro-layer {
    opacity: 1;
    pointer-events: auto;
}

#hero-king {
    width: 92vh;
    /* Responsive height-based scaling */
    z-index: 10;
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    opacity: 0;
    transition: all 0.9s cubic-bezier(0.19, 1, 0.22, 1);
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.piece {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    opacity: 0;
    z-index: 1;
    transition: all 0.9s cubic-bezier(0.19, 1, 0.22, 1);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

.piece.active,
#hero-king.active {
    opacity: 1 !important;
    filter: none !important;
    animation: floating 8s infinite ease-in-out !important;
}

@keyframes floating {

    0%,
    100% {
        transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) translateY(0) rotate(0deg) scale(1);
    }

    33% {
        transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) translateY(-20px) rotate(1deg) scale(1.02);
    }

    66% {
        transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) translateY(10px) rotate(-1deg) scale(0.98);
    }
}


/* Ambient Cinematic Rays */
#ambient-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    background: conic-gradient(from 0deg at 50% 50%,
            transparent 0%,
            rgba(255, 145, 0, 0.08) 5%,
            transparent 10%,
            rgba(255, 145, 0, 0.05) 20%,
            transparent 30%,
            rgba(255, 145, 0, 0.08) 45%,
            transparent 50%);
    transform: translate(-50%, -50%);
    animation: rotate-rays 180s linear infinite;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 3s ease;
}

@keyframes rotate-rays {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Shadow beneath lifting pieces */
.piece:hover::after,
#hero-king:hover::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 10px;
    background: rgba(0, 0, 0, 0.4);
    filter: blur(8px);
    border-radius: 50%;
    z-index: -1;
}

/* Responsive Piece Scaling - Even More Massive */
#p-queen {
    width: 85vh;
}

#p-bishop-q,
#p-bishop-k {
    width: 78vh;
}

#p-knight-q,
#p-knight-k {
    width: 71vh;
}

#p-rook-q,
#p-rook-k {
    width: 64vh;
}

/* ── Modern Expandable Sidebar ── */
#side-nav {
    width: 80px;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1), background 400ms, border 400ms;
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.98) 0%, rgba(5, 5, 5, 0.98) 100%) !important;
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-right: 1px solid rgba(255, 145, 0, 0.15);
    /* Orange accent border */
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#side-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--md-sys-color-primary), transparent);
    opacity: 0.5;
}

#side-nav:hover {
    width: 320px;
}

/* Smooth main content transition */
#main-content {
    flex: 1;
    width: 100%;
    min-width: 0;
    transition: opacity 400ms;
    overflow-x: hidden !important;
    position: relative;
}

/* Sidebar Item Styling (Block Style) */
.nav-btn {
    position: relative;
    height: 60px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    color: #ffffff !important;
    background: transparent !important;
    transition: background 400ms, color 400ms;
    border-radius: 0 !important;
    width: 100%;
}

.nav-btn::before {
    position: absolute;
    left: -15px;
    top: 0;
    width: 15px;
    height: 100%;
    content: \"\";
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
    transition: background 400ms;
}

.nav-btn:hover {
    background-color: rgba(0, 163, 255, 0.08) !important;
    color: #00a3ff !important;
    backdrop-filter: blur(15px);
}

.nav-btn:hover::before {
    background-color: #1a1a1a;
}

.nav-btn .material-symbols-outlined {
    min-width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle neutral block */
    transition: background 400ms, color 400ms;
    z-index: 2;
}

.nav-btn:hover .material-symbols-outlined {
    background: rgba(0, 163, 255, 0.15);
    color: #00a3ff !important;
    transform: scale(1.1);
}

/* Label Sliding Effect */
.nav-btn span:not(.material-symbols-outlined) {
    position: relative;
    display: block;
    z-index: 0;
    text-indent: -20em;
    white-space: nowrap;
    transition: text-indent 400ms ease-in-out, opacity 400ms;
    opacity: 0;
    font-weight: 600;
}

#side-nav:hover .nav-btn span:not(.material-symbols-outlined) {
    text-indent: 0;
    opacity: 1;
}

/* Staggered Delay for Labels */
#side-nav:hover .nav-btn:nth-child(1) span {
    transition-delay: 100ms;
}

#side-nav:hover .nav-btn:nth-child(2) span {
    transition-delay: 150ms;
}

#side-nav:hover .nav-btn:nth-child(3) span {
    transition-delay: 200ms;
}

#side-nav:hover .nav-btn:nth-child(4) span {
    transition-delay: 250ms;
}

#side-nav:hover .nav-btn:nth-child(5) span {
    transition-delay: 300ms;
}

.sidebar-profile-link {
    padding: 24px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: padding 400ms, justify-content 400ms;
    width: 100%;
}

#side-nav:hover .sidebar-profile-link {
    padding: 24px 20px;
    justify-content: flex-start;
}

.profile-details {
    opacity: 0;
    display: none;
    margin-left: 12px;
    transition: opacity 400ms ease;
}

#side-nav:hover .profile-details {
    display: block;
    opacity: 1;
}

.friends-list-container {
    padding: 0;
    transition: padding 400ms;
}

#side-nav:hover .friends-list-container {
    padding: 0 20px;
}

/* ── Light Mode Sidebar Visibility (Forced on Home) ── */
html:not(.dark) #side-nav,
#side-nav.home-sidebar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(25px);
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .nav-btn,
#side-nav.home-sidebar .nav-btn {
    color: #1a1c17 !important;
}

html:not(.dark) .nav-btn::before,
#side-nav.home-sidebar .nav-btn::before {
    background: rgba(0, 0, 0, 0.08);
}

html:not(.dark) .nav-btn .material-symbols-outlined,
#side-nav.home-sidebar .nav-btn .material-symbols-outlined {
    color: #1a1c17 !important;
    background: rgba(0, 0, 0, 0.04);
}

html:not(.dark) .nav-btn:hover,
#side-nav.home-sidebar .nav-btn:hover {
    background-color: rgba(0, 163, 255, 0.08) !important;
    color: #00a3ff !important;
}

html:not(.dark) .nav-btn:hover .material-symbols-outlined,
#side-nav.home-sidebar .nav-btn:hover .material-symbols-outlined {
    background: rgba(0, 163, 255, 0.15);
    color: #00a3ff !important;
}

html:not(.dark) .nav-btn:hover::before,
#side-nav.home-sidebar .nav-btn:hover::before {
    background-color: #00a3ff;
}

html:not(.dark) #side-nav .profile-details h2,
#side-nav.home-sidebar .profile-details h2,
html:not(.dark) #side-nav .fellowship-title h3,
#side-nav.home-sidebar .fellowship-title h3,
html:not(.dark) #side-nav .material-symbols-outlined,
#side-nav.home-sidebar .material-symbols-outlined,
html:not(.dark) #side-nav #friends-list p,
#side-nav.home-sidebar #friends-list p {
    color: #1a1c17 !important;
}

html:not(.dark) #side-nav .profile-details p,
#side-nav.home-sidebar .profile-details p {
    color: rgba(26, 28, 23, 0.7) !important;
}

html:not(.dark) #side-nav .search-bar-input input,
#side-nav.home-sidebar .search-bar-input input {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1c17;
}

html:not(.dark) #side-nav .search-bar-input input::placeholder,
#side-nav.home-sidebar .search-bar-input input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

/* Darker borders for sections in light mode */
html:not(.dark) #side-nav div[class*=\"border-b\"],
#side-nav.home-sidebar div[class*=\"border-b\"] {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Hide profile/search details when collapsed */
#side-nav .profile-details,
#side-nav .search-bar-input,
#side-nav .fellowship-title,
#side-nav .friends-list-container {
    opacity: 0;
    transition: opacity 300ms;
    pointer-events: none;
}

#side-nav:hover .profile-details,
#side-nav:hover .search-bar-input,
#side-nav:hover .fellowship-title,
#side-nav:hover .friends-list-container {
    opacity: 1;
    pointer-events: auto;
}

/* Adjust views to have their own background so intro doesn't show through */
.view-section:not(#view-dashboard) {
    background:
        radial-gradient(circle at 12% 18%, rgba(249, 115, 22, 0.08), transparent 22%),
        radial-gradient(circle at 82% 16%, rgba(255, 214, 153, 0.05), transparent 18%),
        linear-gradient(180deg, #fcf9ee 0%, #f1eee3 100%);
    position: relative;
    isolation: isolate;
}

html.dark .view-section:not(#view-dashboard) {
    background:
        radial-gradient(circle at 12% 18%, rgba(249, 115, 22, 0.24), transparent 24%),
        radial-gradient(circle at 82% 16%, rgba(255, 214, 153, 0.12), transparent 20%),
        linear-gradient(180deg, #0e100d 0%, #030303 100%);
}

.view-section:not(#view-dashboard)::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 48%, transparent 52%),
        url('../images/bg.png') no-repeat center center / cover;
    opacity: 0.18;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 0;
}

html.dark .view-section:not(#view-dashboard)::before {
    opacity: 0.22;
}

.view-section:not(#view-dashboard)::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 62%),
        repeating-linear-gradient(180deg, transparent 0 72px, rgba(255, 255, 255, 0.035) 72px 74px, transparent 74px 152px);
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
}

.view-section:not(#view-dashboard)>* {
    position: relative;
    z-index: 1;
}

html.dark .view-section:not(#view-dashboard) .text-on-surface {
    color: rgba(248, 241, 228, 0.94) !important;
}

html.dark .view-section:not(#view-dashboard) .text-on-surface-variant {
    color: rgba(255, 245, 230, 0.58) !important;
}

.royal-shell {
    position: relative;
}

.royal-hero-panel {
    padding: clamp(1.5rem, 3vw, 2.75rem);
}

.royal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-label);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: rgba(43, 71, 46, 0.68);
    margin-bottom: 0.9rem;
}

html.dark .royal-kicker {
    color: rgba(255, 218, 179, 0.68);
}

.royal-kicker::before {
    content: '';
    width: 2.8rem;
    height: 1px;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0), rgba(249, 115, 22, 0.85));
}

.royal-title-display {
    font-family: var(--font-headline);
    font-size: clamp(2.6rem, 4vw, 4.8rem);
    line-height: 0.95;
    font-weight: 900;
    letter-spacing: -0.06em;
    color: #1c1c15;
}

html.dark .royal-title-display {
    color: #f7ead3;
    text-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
}

.royal-section-title {
    font-family: var(--font-headline);
    font-size: clamp(1.35rem, 1.2vw + 1rem, 2rem);
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #1c1c15;
}

html.dark .royal-section-title {
    color: #f7ead3;
}

.royal-copy {
    color: rgba(28, 28, 21, 0.75);
    font-family: var(--font-body);
    line-height: 1.7;
}

html.dark .royal-copy {
    color: rgba(255, 245, 230, 0.64);
}

.royal-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    justify-content: flex-end;
}

.royal-chip {
    min-width: 122px;
    padding: 0.85rem 1rem;
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(14px);
}

.royal-chip-label {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--font-label);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(43, 71, 46, 0.55);
}

html.dark .royal-chip-label {
    color: rgba(255, 225, 192, 0.45);
}

.royal-chip-value {
    color: #1c1c15;
    font-family: var(--font-headline);
    font-size: 1rem;
    font-weight: 800;
}

html.dark .royal-chip-value {
    color: #fff6e6;
}

.royal-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s ease, box-shadow 0.35s ease;
}

html.dark .royal-panel {
    background: linear-gradient(180deg, rgba(18, 20, 16, 0.9) 0%, rgba(8, 9, 7, 0.94) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.royal-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 232, 204, 0.45), transparent);
    opacity: 0.85;
}

.royal-panel:hover {
    transform: translateY(-3px);
    border-color: rgba(249, 115, 22, 0.26);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(249, 115, 22, 0.1);
}

.royal-panel-static:hover {
    transform: none;
}

.royal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
}

.royal-topbar-copy {
    max-width: 36rem;
}

.royal-eval-pill {
    min-width: 5.6rem;
    padding: 0.8rem 1.05rem;
    border-radius: 1.1rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1c1c15;
    font-family: var(--font-headline);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
}

html.dark .royal-eval-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: #fff1d9;
}

.royal-icon-btn {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #2b472e;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

html.dark .royal-icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff4df;
}

.royal-icon-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.35);
    background: rgba(255, 255, 255, 0.1);
}

.royal-icon-btn.primary {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.95), rgba(251, 191, 36, 0.8));
    border-color: transparent;
    color: white;
    box-shadow: 0 16px 30px rgba(249, 115, 22, 0.28);
}

.royal-action-btn,
.royal-action-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    border-radius: 999px;
    padding: 0.9rem 1.4rem;
    font-family: var(--font-label);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.royal-action-btn {
    background: linear-gradient(135deg, #f97316, #f59e0b);
    color: white;
    box-shadow: 0 18px 34px rgba(249, 115, 22, 0.28);
}

.royal-action-btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(28, 28, 21, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html.dark .royal-action-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 244, 225, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.royal-action-btn:hover,
.royal-action-btn-secondary:hover {
    transform: translateY(-2px);
}

.royal-board-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 2.2rem;
    padding: 0.75rem;
    background:
        linear-gradient(145deg, rgba(94, 63, 30, 0.85), rgba(31, 21, 14, 0.96)),
        radial-gradient(circle at top, rgba(255, 208, 132, 0.22), transparent 36%);
    box-shadow: 0 34px 80px rgba(0, 0, 0, 0.52);
}

.royal-board-frame::after {
    content: '';
    position: absolute;
    inset: -10%;
    background: radial-gradient(circle at center, rgba(249, 115, 22, 0.16), transparent 66%);
    pointer-events: none;
    z-index: 0;
}

.play-sized-board {
    aspect-ratio: 1 / 1;
    width: var(--play-board-size);
    height: var(--play-board-size);
    flex-shrink: 0;
}

.play-sized-rail {
    height: var(--play-rail-size);
    flex-shrink: 0;
}

.royal-board-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 1.35rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.9);
}

html.dark .royal-board-inner {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 8, 5, 0.88);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.royal-eval-rail {
    width: 18px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.05);
}

html.dark .royal-eval-rail {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.royal-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(28, 28, 21, 0.88);
    border-radius: 1.3rem;
    padding: 1rem 1.1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html.dark .royal-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 247, 235, 0.88);
}

.royal-input:focus {
    outline: none;
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.royal-input::placeholder {
    color: rgba(255, 245, 230, 0.35);
}

.royal-progress-track {
    width: 100%;
    height: 0.45rem;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.royal-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f97316, #facc15);
    box-shadow: 0 0 18px rgba(249, 115, 22, 0.35);
}

.royal-book-card {
    display: flex;
    overflow: hidden;
    border-radius: 1.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.royal-book-spine {
    width: 3rem;
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.95), rgba(194, 65, 12, 0.92));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    color: #fff5e7;
}

.royal-list-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.royal-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.royal-setting-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.royal-toggle {
    width: 3.7rem;
    height: 2rem;
    padding: 0.25rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
}

.royal-toggle.on {
    justify-content: flex-end;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.95), rgba(251, 191, 36, 0.8));
    box-shadow: 0 0 18px rgba(249, 115, 22, 0.3);
    border-color: rgba(251, 191, 36, 0.3);
}

.royal-toggle-knob {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: #fff8ef;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.royal-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
}

.royal-stat-card {
    padding: 1.4rem;
}

.royal-avatar-stage {
    position: relative;
    padding: 0.75rem;
    border-radius: 2rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.royal-avatar-stage::after {
    content: '';
    position: absolute;
    inset: auto 10% -18% 10%;
    height: 40%;
    background: radial-gradient(circle at center, rgba(249, 115, 22, 0.3), transparent 68%);
    pointer-events: none;
}

.royal-social-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 1.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.royal-social-card:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.24);
    background: rgba(255, 255, 255, 0.06);
}

.royal-avatar {
    width: 3rem;
    height: 3rem;
    padding: 0.15rem;
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.royal-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 0.85rem;
}

.royal-status-copy {
    font-family: var(--font-label);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 211, 169, 0.52);
}

.royal-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.78rem 1.15rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.98), rgba(194, 65, 12, 0.96));
    color: #fff7eb;
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    box-shadow: 0 14px 30px rgba(249, 115, 22, 0.24);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.royal-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(249, 115, 22, 0.34);
}

.royal-cta-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 247, 231, 0.82);
    box-shadow: none;
}

.royal-rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 1rem 1.1rem;
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.royal-rank-row:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(249, 115, 22, 0.18);
}

.royal-rank-row.is-leader {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.18), rgba(255, 255, 255, 0.04));
    border-color: rgba(249, 115, 22, 0.2);
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.08);
}

.royal-empty-state {
    padding: 2.5rem 1.5rem;
    border-radius: 1.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    text-align: center;
    color: rgba(255, 245, 230, 0.5);
    font-style: italic;
}

@media (max-width: 1024px) {
    .royal-topbar {
        flex-direction: column;
    }

    .royal-chip-row {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .royal-title-display {
        font-size: 2.3rem;
    }

    .royal-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* Premium Glass HUD Panels */
.hud-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.01);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

html.dark .hud-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-panel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(249, 115, 22, 0.3);
    transform: translateY(-2px);
}

html.dark .hud-panel:hover {
    background: rgba(255, 255, 255, 0.02);
}

.hud-title {
    font-family: var(--font-headline);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 900;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.4);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

html.dark .hud-title {
    color: rgba(255, 255, 255, 0.5);
}

.hud-title .material-symbols-outlined {
    font-size: 1.25rem;
    color: var(--md-sys-color-primary);
}

/* Premium Buttons in HUD */
.hud-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1c17;
    font-family: var(--font-label);
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1rem;
}

html.dark .hud-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.hud-btn:hover {
    background: var(--md-sys-color-primary);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.hud-btn.active {
    background: var(--md-sys-color-primary);
    border-color: transparent;
}

body {
    background: #000000 !important;
}

/* Piece Showcase - Premium Dark Modern Style */
.showcase-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #111111 0%, #000000 100%);
}

.piece-card {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    color: #ffffff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
    z-index: 1;
    will-change: opacity;
}

.piece-card.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* Container Strategy for Normalized Placement */
.piece-image-container {
    width: 65vw;
    height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 5;
    pointer-events: none;
}

/* Showcase Container - True Depth Background */
.showcase-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000000;
}

/* Animated Brand Atmosphere (Behind Content) */
.showcase-container::before {
    content: \"\";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right,
            rgba(249, 115, 22, 0.12) 0%,
            rgba(0, 0, 0, 0) 35%,
            rgba(43, 71, 46, 0.15) 50%,
            rgba(0, 0, 0, 0) 65%,
            rgba(249, 115, 22, 0.12) 100%);
    background-size: 200% 100%;
    z-index: 0;
    animation: atmospheric-drift 20s linear infinite;
}

@keyframes atmospheric-drift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.piece-image-container img {
    max-width: 115%;
    max-height: 115%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.95) translateX(40px);
    transition: all 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    /* Colored glow that feels like a reflection */
    filter:
        drop-shadow(-20px 0 60px rgba(249, 115, 22, 0.1)) drop-shadow(20px 0 60px rgba(43, 71, 46, 0.15));
}

.piece-card.active .piece-image-container img {
    opacity: 1;
    transform: scale(1.15) translateX(0);
    /* Scale up and slide into place */
}

/* Blueprint Side Panes - Modernized */
.piece-card .details-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5vw;
    /* Slightly more room */
    z-index: 10;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .piece-card .details-overlay {
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        padding: 10vh 5vw;
    }

    .blueprint-pane {
        width: 100% !important;
        max-width: 450px;
    }

    .piece-image-container {
        opacity: 0.15;
        /* Push image to background on mobile */
        width: 100vw;
    }
}

.blueprint-pane {
    width: clamp(280px, 20vw, 360px);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.framed-box {
    background: rgba(255, 255, 255, 0.01);
    /* Almost transparent */
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    padding: 2rem;
    border-radius: 2.5rem;
    position: relative;
    box-shadow:
        0 40px 100px rgba(0, 0, 0, 0.8),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    border: none;
    border-left: 1px solid rgba(249, 115, 22, 0.2);
    border-right: 1px solid rgba(43, 71, 46, 0.2);
}

.scroll-bar {
    background: rgba(255, 255, 255, 0.01);
    border-left: 2px solid rgba(249, 115, 22, 0.4);
    border-right: 2px solid rgba(43, 71, 46, 0.4);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    margin-top: 1.2rem;
    border-radius: 1rem;
    font-family: var(--font-headline);
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

.scroll-bar span.label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.15em;
}

.scroll-bar span.value {
    font-size: 1.1rem;
    color: #f97316;
    text-shadow: 0 0 15px rgba(249, 115, 22, 0.5);
}

/* Navigation at Bottom Center - Smaller Modern Style */
.slider-nav {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 4rem;
    pointer-events: none;
}

.nav-arrow {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(249, 115, 22, 0.3);
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(249, 115, 22, 0.1);
}

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

.nav-arrow .material-symbols-outlined {
    font-size: 28px;
}

/* Content Styling within Modern Frames */
.blueprint-pane h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 0.9;
    margin-bottom: 1rem;
    text-transform: uppercase;
    color: #ffffff;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #ffffff, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blueprint-pane .rank-badge {
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #f97316;
    margin-bottom: 0.6rem;
    display: block;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
}

.blueprint-pane .quote {
    font-size: 1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.blueprint-pane h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
}

.blueprint-pane p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

/* Cinematic Background & Index */
.piece-index {
    position: absolute;
    top: 6vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-headline);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.5em;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    z-index: 100;
}

.piece-index span.current {
    color: #f97316;
}

.bg-glow-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    filter: blur(80px);
    animation: orb-pulse 10s ease-in-out infinite alternate;
}

@keyframes orb-pulse {
    from {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    to {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.8;
    }
}

@keyframes title-shimmer {
    0% {
        background-position: -200% center;
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        background-position: 200% center;
        opacity: 0.8;
    }
}

.animate-title-shimmer {
    background: linear-gradient(90deg, #ffffff 0%, #f97316 25%, #ffffff 50%, #f97316 75%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: title-shimmer 12s linear infinite;
}

/* Cinematic Board Glow */
#board-outer-wrap {
    position: relative;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#board-outer-wrap::after {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at center, rgba(249, 115, 22, 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* Modern Scrollbar for HUDs */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 145, 0, 0.4);
}

/* ── Premium Auth Card (Refined Glow) ── */
.auth-premium-card {
    --background: linear-gradient(135deg, #f7ba2b 0%, #ea5358 100%);
    width: 100%;
    max-width: 640px;
    /* Ultra-wide card */
    padding: 2px;
    border-radius: 3.5rem;
    background: var(--background);
    position: relative;
    z-index: 1;
    margin: auto;
    box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.7);
}

.auth-premium-card::after {
    position: absolute;
    content: \"\";
    inset: 0;
    z-index: -1;
    transform: scale(0.96) translateY(40px);
    filter: blur(60px);
    background: var(--background);
    transition: opacity 0.5s;
    opacity: 0.45;
}

.auth-card-info {
    background: #ffffff;
    color: #1a1c17;
    border-radius: 3.4rem;
    padding: 5rem;
    /* Massive internal breathing room */
    width: 100%;
    height: 100%;
}

html.dark .auth-card-info {
    background: #0d0e0b;
    color: white;
}

.auth-premium-card:hover::after {
    opacity: 0.7;
}

.auth-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.5rem;
    padding: 1.25rem 1.5rem 1.25rem 4rem;
    /* Increased padding */
    font-size: 1.1rem;
    /* Larger text */
    font-family: var(--font-body);
    transition: all 0.2s;
}

html.dark .auth-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.auth-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.15);
    background: transparent;
}

/* ── Chessophelic Spinning Logo ── */
#chessophelic-brand {
    position: absolute;
    top: -6rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 50;
}

.brand-text {
    font-family: var(--font-headline);
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.brand-text.mini {
    color: #1c1c15;
    text-shadow: none;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    margin-top: 5px;
}

html.dark .brand-text.mini {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Hero Ember Buttons (Re-styled from Red) */
.hero-red-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 1.1rem 3.4rem;
    border-radius: 1.4rem;
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    color: white;
    font-family: var(--font-label);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    box-shadow: 0 15px 45px rgba(249, 115, 22, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.3);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.hero-red-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.hero-red-btn:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 28px 60px rgba(249, 115, 22, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
}

.hero-red-btn:hover::after {
    opacity: 1;
}

.hero-red-btn:active {
    transform: translateY(-2px) scale(0.98);
}

.hero-red-btn .material-symbols-outlined {
    font-size: 1.6rem;
    font-variation-settings: 'FILL' 1, 'wght' 700;
}

/* Spinner & Utility */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════
   ANALYSIS SECTION — Premium Move Ledger
═══════════════════════════════════════════ */

/* Move row in the ledger */
#analysis-moves .analysis-move-row {
    display: grid;
    grid-template-columns: 44px 1fr 1fr;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

#analysis-moves .analysis-move-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

#analysis-moves .analysis-move-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Outfit', monospace;
    transition: color 0.15s;
}

#analysis-moves .analysis-move-cell:hover {
    color: #fff;
}

#analysis-moves .analysis-move-cell.active-move {
    color: #aecfad;
    background: rgba(174, 207, 173, 0.08);
    border-left: 2px solid #aecfad;
}

#analysis-moves .move-num-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    font-weight: 700;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* Move quality badge dots */
.move-quality-badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-brilliant {
    background: #22d3ee;
    box-shadow: 0 0 6px #22d3ee;
}

.badge-great {
    background: #6366f1;
    box-shadow: 0 0 6px #6366f1;
}

.badge-best {
    background: #10b981;
}

.badge-good {
    background: #84cc16;
}

.badge-inaccuracy {
    background: #f59e0b;
}

.badge-mistake {
    background: #f97316;
}

.badge-blunder {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

/* Analysis tab content panels */
#analysis-tab-panel-review,
#analysis-tab-panel-engine {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Custom scrollbar for the analysis ledger */
#analysis-moves::-webkit-scrollbar {
    width: 3px;
}

#analysis-moves::-webkit-scrollbar-track {
    background: transparent;
}

#analysis-moves::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

#analysis-moves::-webkit-scrollbar-thumb:hover {
    background: rgba(174, 207, 173, 0.3);
}

/* --- Opening Curriculum Styles --- */
.opening-curriculum-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(43, 71, 46, 0.05);
    border: 1px solid rgba(43, 71, 46, 0.1);
    border-radius: 16px;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.opening-curriculum-item:hover {
    background: rgba(43, 71, 46, 0.1);
    transform: translateY(-2px);
    border-color: rgba(43, 71, 46, 0.3);
}

.opening-curriculum-item .item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #2b472e;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    flex-shrink: 0;
}

.opening-curriculum-item .item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.opening-curriculum-item .item-title {
    font-family: 'Headline', sans-serif;
    font-weight: 600;
    color: #1c1c15;
    font-size: 15px;
}

.opening-curriculum-item .item-subtitle {
    font-family: 'Label', sans-serif;
    font-size: 11px;
    color: #424841;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.royal-explorer-row {
    border: 1px solid transparent;
}

.royal-explorer-row:hover {
    border-color: rgba(43, 71, 46, 0.2);
    background: rgba(43, 71, 46, 0.05);
}

html.dark .opening-curriculum-item {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .opening-curriculum-item .item-title {
    color: #ffffff;
}

html.dark .opening-curriculum-item .item-subtitle {
    color: #e0e0e0;
}

/* ─── Phase 1: Royal Ember Analysis UI ─── */

.analysis-sidebar {
    position: relative;
    left: -63px !important;
    top: -1px !important;
    width: 390px !important;
    height: 900px !important;
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--analysis-panel);
    border-radius: 32px;
    border: 1px solid var(--analysis-line);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    transform-origin: right;
}

.analysis-sidebar.collapsed {
    transform: translateX(calc(100% - 28px));
    opacity: 1;
}

.analysis-toggle-btn {
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
    width: 30px;
    height: 58px;
    border: 1px solid var(--analysis-line-strong);
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.96), rgba(194, 65, 12, 0.9));
    color: var(--analysis-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -6px 0 20px rgba(0, 0, 0, 0.28);
}

.accuracy-ring-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accuracy-ring-svg {
    transform: rotate(-90deg);
}

.accuracy-ring-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 4;
}

.accuracy-ring-circle-fill {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.rune-marker {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(0 0 4px currentColor);
    animation: runePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes runePop {
    from {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.ledger-row-glass {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 232, 204, 0.05);
    transition: background 0.2s ease;
}

.ledger-row-glass:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ledger-row-active {
    background: rgba(249, 115, 22, 0.12) !important;
    border-left: 3px solid #f97316;
}

/* Specific Rune Colors */
.rune-brilliant {
    color: #22d3ee;
}

.rune-great {
    color: #818cf8;
}

.rune-best {
    color: #aecfad;
}

.rune-good {
    color: #84cc16;
}

.rune-inaccuracy {
    color: #fbbf24;
}

.rune-mistake {
    color: #f97316;
}

.rune-blunder {
    color: #ef4444;
}

/* ─── Analysis / Review Layout ─── */
.analysis-wireframe {
    --analysis-ink: #f7ead3;
    --analysis-muted: rgba(255, 232, 204, 0.48);
    --analysis-paper: #0c0d0a;
    --analysis-panel: linear-gradient(145deg, rgba(26, 28, 20, 0.96), rgba(18, 20, 14, 0.98));
    --analysis-panel-soft: rgba(255, 232, 204, 0.045);
    --analysis-line: rgba(255, 232, 204, 0.11);
    --analysis-line-strong: rgba(255, 232, 204, 0.18);
    --analysis-accent: #f97316;
    --analysis-accent-soft: rgba(249, 115, 22, 0.14);
    --analysis-soft: rgba(0, 0, 0, 0.34);
    background: var(--analysis-paper) !important;
    color: var(--analysis-ink);
    font-family: 'Headline', 'Outfit', system-ui, sans-serif;
}

html:not(.dark) .analysis-wireframe {
    --analysis-ink: #1a1c14;
    --analysis-muted: #6b6f61;
    --analysis-paper: #f4f6f1;
    --analysis-panel: linear-gradient(145deg, #ffffff, #f9fbf4);
    --analysis-panel-soft: rgba(0, 0, 0, 0.045);
    --analysis-line: rgba(0, 0, 0, 0.11);
    --analysis-line-strong: rgba(0, 0, 0, 0.18);
    --analysis-accent: #f97316;
    --analysis-accent-soft: rgba(249, 115, 22, 0.14);
    --analysis-soft: rgba(255, 255, 255, 0.5);
}

.analysis-wireframe::before,
.analysis-wireframe::after {
    display: none;
}

.analysis-stage {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-columns: 44px 1fr 280px 400px;
    gap: 6px;
    padding: 28px 20px 22px 14px;
    background:
        radial-gradient(circle at 18% 12%, rgba(249, 115, 22, 0.07), transparent 34%),
        linear-gradient(180deg, #111209 0%, var(--analysis-paper) 100%);
    overflow: hidden;
}

html:not(.dark) .analysis-stage {
    background:
        radial-gradient(circle at 18% 12%, rgba(249, 115, 22, 0.04), transparent 34%),
        linear-gradient(180deg, #f4f6f1 0%, var(--analysis-paper) 100%);
}

.analysis-eval-rail {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    left: 60px !important;
    top: -27px !important;
}

.analysis-eval-track {
    width: 16px;
    height: calc(100vh - 68px);
    max-height: 840px;
    border: 1px solid var(--analysis-line-strong);
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.38);
}

html:not(.dark) .analysis-eval-track {
    background: rgba(0, 0, 0, 0.04);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.08);
}

.analysis-eval-fill {
    width: 100%;
    background: linear-gradient(to top, #fff9f0, #f7ead3);
    transition: height 700ms ease;
}

.analysis-eval-label {
    position: absolute;
    left: -20px;
    bottom: 18%;
    transform: rotate(-90deg);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
}

.analysis-board-panel {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.analysis-board-frame {
    width: 820px !important;
    height: 820px !important;
    aspect-ratio: 1 / 1 !important;
    transform: translate(-65px, 0px) !important;
    border: 1px solid var(--analysis-line);
    border-radius: 22px;
    padding: 12px;
    background: linear-gradient(145deg, #1a1c14, #212418);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(249, 115, 22, 0.05);
    overflow: hidden;
}

html:not(.dark) .analysis-board-frame {
    background: linear-gradient(145deg, #ffffff, #f4f6f1);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(249, 115, 22, 0.15);
}

.analysis-board-grid {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
}

.sq.l {
    background: rgba(240, 217, 181, 0.18);
}

.sq.d {
    background: rgba(120, 72, 35, 0.25);
}

.analysis-board-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    left: 585px !important;
    top: -230px !important;
    min-height: 42px;
    padding: 6px;
    border: 1px solid var(--analysis-line);
    border-radius: 16px;
    background: rgba(255, 232, 204, 0.035);
}

.analysis-board-controls button {
    width: 36px;
    height: 32px;
    border: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--analysis-muted);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.analysis-board-controls button:hover {
    background: var(--analysis-accent-soft);
    color: var(--analysis-ink);
}

.analysis-board-controls button:active {
    transform: scale(0.96);
}

.analysis-board-controls .material-symbols-outlined {
    font-size: 20px;
}

.analysis-control-column {
    position: relative;
    left: -135px !important;
    top: -52px !important;
    height: 758px !important;
    width: 290px !important;
    transform: translate(0px, 44px) !important;
    display: grid;
    grid-template-rows: 58px 58px 1fr 58px;
    align-items: center;
    gap: 18px;
}

.analysis-flip-button,
.analysis-player-strip,
.analysis-import-card,
.analysis-card-shell,
.analysis-premium-box,
.analysis-moves-card,
.analysis-review-bar,
.analysis-graph-card,
.analysis-count-card,
.analysis-metric-box,
.analysis-elo-box,
.analysis-best-move-card {
    border: 1px solid var(--analysis-line);
    background: var(--analysis-panel);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.analysis-flip-button {
    justify-self: center;
    width: 58px;
    height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    left: -4px !important;
    top: 153px !important;
    border: 0;
    color: var(--analysis-muted);
    line-height: 1.2;
}

.analysis-player-strip {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    position: relative;
    font-size: 12px;
    font-weight: 800;
}

html:not(.dark) .analysis-player-strip {
    background: rgba(255, 255, 255, 0.6);
}

.analysis-player-strip:nth-of-type(1) {
    left: 1px !important;
    top: -31px !important;
}

.analysis-player-strip:nth-of-type(2) {
    left: -1px !important;
    top: 25px !important;
}

.analysis-import-card {
    border-radius: 24px;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
}

.analysis-input-label {
    display: block;
    font-size: 10px;
    font-weight: 900;
    color: var(--analysis-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    position: relative;
    left: -3px !important;
    top: 5px !important;
    text-align: center;
}

.analysis-pgn-input {
    flex: 1;
    min-height: 120px;
    width: 100%;
    border: 1px solid var(--analysis-line);
    border-radius: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.38);
    color: var(--analysis-ink);
    font: 700 12px/1.45 'Outfit', monospace;
    resize: none;
    outline: none;
}

.analysis-depth-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
    font-weight: 900;
}

.analysis-depth-select {
    min-width: 96px;
    border: 1px solid var(--analysis-line);
    border-radius: 9px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.46);
    color: var(--analysis-ink);
    font-weight: 900;
}

.analysis-import-button,
.analysis-import-links button {
    border: 0;
    color: var(--analysis-ink);
    font-weight: 900;
    cursor: pointer;
}

.analysis-import-button {
    align-self: center;
    min-width: 150px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.94), rgba(194, 65, 12, 0.9));
    color: #fff;
    font-size: 13px;
    padding: 11px 16px;
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.22);
}

.analysis-import-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    font-size: 12px;
}

.analysis-card-shell {
    position: relative;
    height: 100%;
    border-radius: 26px;
    padding: 16px 14px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}

.analysis-card-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--analysis-line);
    padding-bottom: 10px;
}

.analysis-card-tab {
    border: 0;
    background: transparent;
    color: var(--analysis-muted);
    font-size: 11px;
    font-weight: 900;
    padding: 5px 4px;
    cursor: pointer;
    border-radius: 8px;
    transition: .15s;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.analysis-card-tab.active {
    color: #fff;
    background: rgba(249, 115, 22, 0.12);
    opacity: 1;
}

/* ── Progress Bar ── */
.analysis-progress {
    border: 1px solid var(--analysis-line);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.28);
}

.analysis-progress-copy {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 900;
    margin-bottom: 7px;
}

.analysis-live-badge {
    color: var(--analysis-accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .12em;
}

.analysis-progress-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.analysis-progress-fill {
    height: 100%;
    background: var(--analysis-accent);
    border-radius: inherit;
    transition: width .3s;
}

/* ── Move Ledger (Review Tab) ── */
.move-row {
    display: grid;
    grid-template-columns: 34px 1fr 1fr;
    border-bottom: 1px solid rgba(255, 232, 204, 0.04);
    transition: .15s;
}

.move-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.move-row.active {
    background: rgba(249, 115, 22, 0.1);
    border-radius: 8px;
}

.move-num {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.2);
    font-weight: 900;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.move-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.75);
    transition: .15s;
}

.move-cell:hover {
    color: #fff;
}

.move-cell.active-move {
    color: var(--analysis-accent);
}

.badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.b-brilliant {
    background: #22d3ee;
    box-shadow: 0 0 5px #22d3ee;
}

.b-great {
    background: #6366f1;
    box-shadow: 0 0 5px #6366f1;
}

.b-best {
    background: #10b981;
}

.b-good {
    background: #84cc16;
}

.b-inaccuracy {
    background: #fbbf24;
}

.b-mistake {
    background: #f97316;
}

.b-blunder {
    background: #ef4444;
    box-shadow: 0 0 5px #ef4444;
}

/* ── Settings Tab ── */
.engine-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.engine-box {
    border: 1px solid var(--analysis-line);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 232, 204, 0.03);
}

.engine-box span {
    font-size: 11px;
    font-weight: 900;
    color: var(--analysis-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.engine-box strong {
    font-size: 24px;
    font-weight: 900;
    color: #fff;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--analysis-line);
    font-size: 12px;
    font-weight: 900;
}

.setting-row:last-child {
    border-bottom: 0;
}

.toggle {
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--analysis-line-strong);
    display: flex;
    align-items: center;
    padding: 3px;
    cursor: pointer;
    transition: .3s;
}

.toggle.on {
    background: linear-gradient(90deg, rgba(249, 115, 22, .9), rgba(251, 191, 36, .8));
    justify-content: flex-end;
}

.toggle-knob {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff8ef;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.analysis-card-content {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-review-card,
.analysis-summary-card,
.tab-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-review-card.hidden,
.analysis-summary-card.hidden,
.tab-panel.hidden,
.analysis-progress.hidden {
    display: none !important;
}

.analysis-premium-box {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    color: var(--analysis-muted);
    font-size: 14px;
    font-weight: 900;
}

.analysis-moves-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 18px;
    border: 1px solid var(--analysis-line);
    padding: 12px 0;
}

.analysis-best-move-card {
    height: 72px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 16px;
    border-radius: 18px;
}

.analysis-premium-box,
.analysis-review-bar,
.analysis-graph-card {
    border-radius: 24px;
}

.analysis-premium-box {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--analysis-muted);
    font-size: 14px;
    font-weight: 900;
}

/* Consolidated above */

.analysis-ledger-view {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.analysis-ledger-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
    color: var(--analysis-muted);
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 6px;
}

.moves-list {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    font-family: 'Outfit', system-ui, sans-serif;
}

.analysis-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    opacity: 0.55;
}

/* Consolidated above */

.analysis-best-move-card strong {
    color: #fff;
    font-size: 18px;
}

.analysis-review-bar {
    padding: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    color: var(--analysis-muted);
    font-size: 15px;
    font-weight: 900;
}

.analysis-review-bar-track {
    width: 100%;
    flex: 1;
    border-radius: 18px;
    background: linear-gradient(90deg, #171812 0 50%, #f7ead3 50% 100%);
    border: 1px solid var(--analysis-line);
    overflow: hidden;
}

.analysis-review-bar-track div {
    width: 50%;
    height: 100%;
    background: rgba(249, 115, 22, 0.16);
}

.analysis-graph-card {
    padding: 16px 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.analysis-graph-card h3 {
    margin: 0;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
}

.analysis-chart-wrap {
    position: relative;
    min-height: 0;
    height: 180px;
}

#analysis-chart-canvas-container,
#analysis-chart-canvas {
    width: 100%;
    height: 100%;
}

#eval-text-sidebar {
    position: absolute;
    right: 8px;
    bottom: 6px;
    font-size: 12px;
    font-weight: 900;
}

.analysis-count-card {
    width: 64%;
    align-self: center;
    border-radius: 22px;
    padding: 30px 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 900;
}

.analysis-count-card .material-symbols-outlined {
    font-size: 16px;
    vertical-align: -2px;
}

.analysis-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 52px;
    align-items: start;
    padding: 0 32px;
}

.analysis-metric-pair {
    display: grid;
    gap: 12px;
}

.analysis-metric-box {
    height: 116px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--analysis-muted);
    font-size: 14px;
    font-weight: 900;
}

.analysis-elo-box {
    min-height: 62px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--analysis-muted);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.05;
}

.analysis-metric-box .accuracy-ring-container {
    width: 56px;
    height: 56px;
}

.analysis-metric-box .accuracy-ring-container span {
    color: #fff !important;
}

.analysis-accuracy-value {
    color: #fff;
    font-size: 13px;
    line-height: 1;
}

#analysis-moves .ledger-row-glass,
#analysis-moves .analysis-move-row {
    background: transparent;
    border: 0;
    display: grid;
    grid-template-columns: 34px 1fr 1fr;
}

#analysis-moves .ledger-row-active {
    border-left: 0;
    background: var(--analysis-accent-soft) !important;
    border-radius: 8px;
}

#analysis-moves .ledger-row-glass>div,
#analysis-moves .analysis-move-cell,
#analysis-moves .move-num-cell {
    color: var(--analysis-ink) !important;
    border: 0 !important;
    background: transparent !important;
    padding: 4px 6px;
    font-size: 13px;
    font-weight: 900;
}

#analysis-moves .analysis-icon {
    width: 18px;
    height: 18px;
}

.analysis-engine.accuracy-container {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.analysis-engine-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.analysis-engine-options>div {
    border: 1px solid var(--analysis-line);
    border-radius: 16px;
    padding: 18px;
    display: grid;
    gap: 8px;
    background: var(--analysis-panel-soft);
}

@media (max-width: 1280px) {
    .analysis-stage {
        grid-template-columns: 34px minmax(360px, 1fr) 240px 360px;
        gap: 16px;
        padding: 28px 18px 22px;
    }

    /* Consolidated flex layout */

    .analysis-count-card {
        width: 76%;
    }
}

@media (max-width: 980px) {
    .analysis-stage {
        grid-template-columns: 26px minmax(260px, 1fr);
        grid-template-rows: minmax(260px, 52vh) auto auto;
        overflow-y: auto;
    }

    .analysis-board-panel {
        grid-column: 2;
    }

    .analysis-control-column,
    .analysis-card-shell {
        grid-column: 1 / -1;
    }

    .analysis-control-column {
        grid-template-rows: auto auto minmax(280px, 420px) auto;
    }

    .analysis-card-shell {
        min-height: 760px;
    }
}

/* Move Classification Badges */
.badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.b-brilliant {
    background: #22d3ee;
    box-shadow: 0 0 10px #22d3ee;
}

.b-great {
    background: #6366f1;
}

.b-best {
    background: #10b981;
}

.b-good {
    background: #84cc16;
}

.b-inaccuracy {
    background: #fbbf24;
}

.b-mistake {
    background: #f97316;
}

.b-blunder {
    background: #ef4444;
}

.move-cell.active-move .badge {
    outline: 2px solid rgba(255, 255, 255, 0.4);
}

/* Opening Selection Gallery */
.opening-selection-card {
    background: rgba(255, 232, 204, 0.05);
    border: 1px solid rgba(255, 232, 204, 0.1);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.opening-selection-card:hover {
    transform: translateY(-12px) scale(1.02);
    background: rgba(255, 232, 204, 0.08);
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 20px rgba(249, 115, 22, 0.1);
}

.card-image-container {
    height: 240px;
    overflow: hidden;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.opening-selection-card:hover .card-img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(12, 13, 10, 0.8));
}

.card-content {
    padding: 24px;
    position: relative;
}

.card-title {
    font-family: "Headline", "Outfit", sans-serif;
    font-size: 24px;
    color: white;
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
    font-family: monospace;
}

.card-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}