/*===================================*\
 * #CSS VARIABLES & THEMES
\*===================================*/

:root {
    /* Board Colors */
    --theme-light: #e0e0e0;
    --theme-dark: #6ea176;
    
    /* Layout */
    --board-scale: 80;
    
    /* Effects */
    --shadow-1: 0 2px 5px rgba(0, 0, 0, 0.15);
    --transition-1: 0.25s ease-in-out;
    
    /* Base Colors */
    --pure-white: #e0e0e0;
    --pure-black: #000000;
    
    /* Classification Colors */
    --color-classification-brilliant: var(--color-aqua-300);
    --color-classification-great: var(--color-slate-300);
    --color-classification-best: var(--color-green-300);
    --color-classification-excellent: var(--color-green-300);
    --color-classification-book: var(--color-skin-300);
    --color-classification-inaccuracy: var(--color-gold-200);
    --color-classification-mistake: var(--color-orange-200);
    --color-classification-miss: #ff7769;
    --color-classification-blunder: var(--color-red-300);
    --color-classification-forced: var(--color-green-300);
    
    /* Color Palette */
    --color-green-25: #f6ffe3;
    --color-green-50: #f3ffcf;
    --color-green-75: #ebffbd;
    --color-green-100: #d8fa9d;
    --color-green-200: #b2e068;
    --color-green-300: #81b64c;
    --color-green-400: #5d9948;
    --color-green-500: #45753c;
    --color-green-600: #305730;
    --color-green-700: #204227;
    --color-aqua-25: #eafffa;
    --color-aqua-50: #ddfff5;
    --color-aqua-75: #ccffec;
    --color-aqua-100: #adfbd8;
    --color-aqua-200: #62f6ca;
    --color-aqua-300: #26c2a3;
    --color-aqua-400: #109888;
    --color-aqua-500: #10777c;
    --color-aqua-600: #09505f;
    --color-aqua-700: #073745;
    --color-blue-25: #cef5ff;
    --color-blue-50: #b2f0ff;
    --color-blue-75: #83defc;
    --color-blue-100: #4dc3ea;
    --color-blue-200: #009fd9;
    --color-blue-300: #008cd1;
    --color-blue-400: #0069ab;
    --color-blue-500: #0b548c;
    --color-blue-600: #083a66;
    --color-blue-700: #072a4f;
    --color-slate-25: #faffff;
    --color-slate-50: #f2fcff;
    --color-slate-75: #e5f6ff;
    --color-slate-100: #d0e6fb;
    --color-slate-200: #aed0f0;
    --color-slate-300: #749bbf;
    --color-slate-400: #486688;
    --color-slate-500: #324660;
    --color-slate-600: #263242;
    --color-slate-700: #1e2533;
    --color-purple-25: #f6edff;
    --color-purple-50: #e8dbff;
    --color-purple-75: #d5c6ff;
    --color-purple-100: #c9acff;
    --color-purple-200: #9881f2;
    --color-purple-300: #7a66f4;
    --color-purple-400: #5e53d9;
    --color-purple-500: #303d8a;
    --color-purple-600: #212e5d;
    --color-purple-700: #152243;
    --color-fuchsia-25: #ffd4d4;
    --color-fuchsia-50: #ffb5b9;
    --color-fuchsia-75: #ff949d;
    --color-fuchsia-100: #ff788a;
    --color-fuchsia-200: #fa466a;
    --color-fuchsia-300: #ed2456;
    --color-fuchsia-400: #c4144f;
    --color-fuchsia-500: #940c45;
    --color-fuchsia-600: #610734;
    --color-fuchsia-700: #49052d;
    --color-vibrant-purple-100: #f464ff;
    --color-vibrant-purple-200: #c636ff;
    --color-vibrant-purple-300: #c200ff;
    --color-vibrant-purple-400: #9900cc;
    --color-vibrant-purple-500: #710099;
    --color-vibrant-purple-600: #4c0066;
    --color-vibrant-purple-700: #330044;
    --color-red-25: #ffe0ca;
    --color-red-50: #ffcbb2;
    --color-red-75: #ffb196;
    --color-red-100: #ff8a75;
    --color-red-200: #ff6352;
    --color-red-300: #fa412d;
    --color-red-400: #e02828;
    --color-red-500: #ad1f24;
    --color-red-600: #881822;
    --color-red-700: #631018;
    --color-orange-25: #fffbda;
    --color-orange-50: #fff3c2;
    --color-orange-75: #ffe5a8;
    --color-orange-100: #ffd591;
    --color-orange-200: #ffa459;
    --color-orange-300: #fa742c;
    --color-orange-400: #dc501d;
    --color-orange-500: #a93616;
    --color-orange-600: #7a1a0b;
    --color-orange-700: #610808;
    --color-gold-25: #ffffc7;
    --color-gold-50: #fff599;
    --color-gold-75: #fce26a;
    --color-gold-100: #fad541;
    --color-gold-200: #f7c631;
    --color-gold-300: #e3aa24;
    --color-gold-400: #cf8d1b;
    --color-gold-500: #b27314;
    --color-gold-600: #99580e;
    --color-gold-700: #7a4414;
    --color-brown-25: #fffef5;
    --color-brown-50: #fbf7ec;
    --color-brown-75: #fbf3d8;
    --color-brown-100: #fbebc1;
    --color-brown-200: #f9d983;
    --color-brown-300: #e2b664;
    --color-brown-400: #ca9350;
    --color-brown-500: #9d6c3e;
    --color-brown-600: #6a4632;
    --color-brown-700: #543426;
    --color-skin-25: #fffce8;
    --color-skin-50: #fff3d4;
    --color-skin-75: #fbe7c4;
    --color-skin-100: #fadaae;
    --color-skin-200: #e3c29c;
    --color-skin-300: #d5a47d;
    --color-skin-400: #8d694b;
    --color-skin-500: #6b4d3a;
    --color-skin-600: #543f34;
    --color-skin-700: #4a352e;
    --color-neutrals-white: #fff;
    --color-neutrals-black: #000;
    --color-gray-75: #f8f8f8;
    --color-gray-100: #f1f1f1;
    --color-gray-200: #e7e6e5;
    --color-gray-300: #dad8d6;
    --color-gray-400: #bebdb9;
    --color-gray-500: #8b8987;
    --color-gray-600: #666564;
    --color-gray-700: #4b4847;
    --color-gray-800: #312e2b;
    --color-gray-900: #262421;
    
    /* Classification Background Gradients */
    --theory-bg-start: rgba(213, 164, 125, 0.7);
    --theory-bg-end: rgba(107, 77, 58, 0.9);
    --brilliant-bg-start: rgba(38, 194, 163, 0.7);
    --brilliant-bg-end: rgba(16, 119, 124, 0.8);
    --great-bg-start: rgba(116, 155, 191, 0.6);
    --great-bg-end: rgba(72, 102, 136, 0.8);
    --excellent-bg-start: rgba(129, 182, 76, 0.7);
    --excellent-bg-end: rgba(69, 117, 60, 0.9);
    --forced-bg-start: rgba(129, 182, 76, 0.6);
    --forced-bg-end: rgba(48, 87, 48, 0.9);
    --good-bg-start: rgba(129, 182, 76, 0.6);
    --good-bg-end: rgba(48, 87, 48, 0.9);
    --inaccuracy-bg-start: rgba(247, 198, 49, 0.7);
    --inaccuracy-bg-end: rgba(227, 170, 36, 0.9);
    --mistake-bg-start: rgba(255, 164, 89, 0.6);
    --mistake-bg-end: rgba(250, 116, 44, 0.9);
    --blunder-bg-start: rgba(250, 65, 45, 0.7);
    --blunder-bg-end: rgba(173, 31, 36, 0.9);
    
    /* Social Media Colors */
    --youtube-red: #f77e7e;
    --discord-blue: #7891ff;
    
    /* Time Control Colors */
    --bullet-color: #dd9f4d;
    --blitz-color: #e2c72b;
    --rapid-color: #8ebe41;
    
    /* Result Colors */
    --win-green: #8ebe41;
    --loss-red: #cc5e43;
    --draw-gray: #818181;
    
    /* Evaluation Colors */
    --eval-bar-black: #070707;
    --eval-white-text: #070707;
    --eval-black-text: #ffffff;
    --engine-progress: #f0f0f0;
    
    /* Generic Grays */
    --gray-50: #f9f9f9;
    --gray-100: #f0f0f0;
    --gray-200: #e0e0e0;
    --gray-300: #d0d0d0;
    --gray-400: #bbb;
    --gray-500: #999;
    --gray-600: #777;
    --gray-700: #555;
    --gray-800: #333;
    --gray-900: #222;
    
    /* Hover Colors */
    --hover-light: rgba(255, 255, 255, 0.15);
    --hover-dark: rgba(0, 0, 0, 0.1);
    --hover-button: #454545;
    --hover-accent: #e8e8e8;
    
    /* Alpha Colors */
    --evaluation-pending-bg: rgba(0, 0, 0, 0.05);
    --section-border: rgba(255, 255, 255, 0.1);
    --transparent-bg: rgba(0, 0, 0, 0);
    --light-btn-shadow: rgba(240, 240, 240, 0.2);
    --light-btn-bg-alpha: rgba(240, 240, 240, 0.1);
    --light-btn-border-alpha: rgba(240, 240, 240, 0.5);
}

/* Dark Theme Variables */
body.dark_theme {
    /* Background Colors */
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-accent: rgba(255, 255, 255, 0);
    
    --sidebar-base: #0d0d0d;
    --sidebar-inner-base: #121212;
    --turn-bg: #111111;
    --sidebar-inactive: #0f0f0f;
    --stats-label: #8a8a8a;
    --stats-divider: #2a2a2a;
    
    /* Text Colors */
    --text-primary: #fff;
    --text-secondary: #8a8a8a;
    --color-primary: hsl(0, 0%, 100%);
    --color-secondary: hsl(0, 0%, 62%);
    
    /* Button Colors */
    --light-btn: #5c5c5c;
    --light-btn-hover: #6b6b6b;
    --btn-secondary: #1a1a1a;
    --selected-blue: #f0f0f049;
    
    /* Scrollbar Colors */
    --scrollbar: #141414;
    --scroll-thumb: #2a2a2a;
    
    /* Accent Colors */
    --light-cyan: hsl(0, 0%, 95%);
    --lighter-cyan: hsl(0, 0%, 98%);
    --dark-cyan: hsl(0, 0%, 90%);
    
    /* Base Colors */
    --black: hsl(0, 0%, 0%);
    --white: hsl(0, 0%, 100%);
    --perm-white: white;
    
    /* Form Elements */
    --card-shadow: hsla(0, 0%, 0%, 0.4);
    --input-bg: #151515;
    
    /* Dark Theme Specific Colors */
    --dark-surface-1: #111111;
    --dark-surface-2: #1a1a1a;
    --dark-border: rgba(255, 255, 255, 0.06);
    --dark-border-hover: rgba(255, 255, 255, 0.18);
    --dark-text-muted: #6e6e6e;
    --dark-overlay: rgba(0, 0, 0, 0.85);
    --analysis-bg: rgba(255, 255, 255, 0.06);
    --analysis-progress-bg: #111111;
    --analysis-text: #ddd;
    --game-result-light-bg: #f0f0f0;
    --game-result-light-text: #333;
    --game-result-dark-bg: #333;
    --game-result-dark-text: #f0f0f0;
    --engine-white-bg: #e9e9e9;
    --engine-white-text: #333;
    --engine-black-bg: #1e1e1e;
    --engine-black-text: #fff;
    --move-pending-text: #888;
    --toggle-border: rgba(255, 255, 255, 0.08);
    --toggle-thumb: white;
    --nameplate-bg: #121212;

    /* Darker gray scale overrides for dark theme */
    --gray-50: #0a0a0a;
    --gray-100: #121212;
    --gray-200: #181818;
    --gray-300: #1f1f1f;
    --gray-400: #262626;
    --gray-500: #2e2e2e;
    --gray-600: #3a3a3a;
    --gray-700: #474747;
    --gray-800: #555555;
    --gray-900: #666666;
}

/*===================================*\
 * #RESET & BASE STYLES
\*===================================*/

/* CSS Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
}

/* Base HTML Elements */
html, body {
    margin: 0px;
    height: 100%;
    width: 100%;
    background-color: var(--bg-primary);
    padding: 0;
    box-sizing: border-box;
    font-family: "Roboto", sans-serif;
    font-optical-sizing: auto;
    scroll-behavior: smooth;


    opacity: 1;
    background-image:  linear-gradient(var(--bg-accent) 2px, transparent 2px), linear-gradient(to right, var(--bg-accent) 2px, var(--bg-primary) 2px);
    background-size: 50px 50px;
}

/* List Elements */
li { 
    list-style: none; 
}

/* Link Elements */
a { 
    text-decoration: none; 
}

/* Block Elements */
a,
img,
time,
span,
input,
label,
select,
button {
    display: block; 
}

/* Form Elements Reset */
input,
button,
select,
textarea {
    background: none;
    border: none;
    font: inherit;
}

/* Interactive Elements */
button,
select { 
    cursor: pointer; 
}



/*===================================*\
 * #HEADER & NAVIGATION
\*===================================*/

/* Main Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    padding-block: 12px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-1);
    z-index: 99999999;
}

.header .inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    max-width: calc(var(--board-scale) * 1vmin + 510px);
    margin: auto;
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo a {
    color: var(--color-primary);
    font-size: 22px;
}

.logo svg {
    color: var(--color-primary);
    width: 22px;
    height: 22px;
}

/* Navigation Styles */
.navbar { 
    all: unset; 
}

.navbar-list {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.navbar-list > li {
    margin: 0;
    padding: 0;
    overflow: visible;
}

.navbar-list > li svg {
    width: 22px;
    height: 22px;
}

.navbar-link {
    position: relative;
    width: max-content;
    margin-inline: auto;
    color: var(--color-primary);
    transform: translateY(0);
    font-size: unset;
    padding-inline: 5px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
}

.navbar-link::before {
    content: "";
    position: absolute;
    left: 0%;
    transform: translateY(150%);
    top: 20px;
    height: 2px;
    width: 0;
    background: var(--light-cyan);
    transition: var(--transition-1);
}

.navbar-link:is(:hover)::before { 
    width: 100%; 
}

/* Navigation Actions */
.navbar-actions select {
    color: var(--color-primary);
    width: 45px;
}

.navbar-actions option {
    background: var(--bg-primary);
    color: var(--color-primary);
}

/* Social Media Links */
.youtube {
    color: var(--youtube-red);
}

.discord {
    color: var(--discord-blue);
}

/* Icon-only navbar links (GitHub, YouTube, etc.) */
.navbar-link:has(svg:only-child)::before {
    display: none; /* Remove underline effect for icon-only links */
}

.navbar-link:has(svg:only-child):hover svg {
    color: var(--light-cyan);
    transition: var(--transition-1);
}

/* Mobile Navigation Toggle */
.nav-toggle-btn { 
    display: none; 
}



/*===================================*\
 * #MAIN LAYOUT & CHESS CONTAINER
\*===================================*/

/* Main Chess Container */
.chess-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    
    /* Prevent text selection */
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari, Chrome, Opera, Samsung */
    -khtml-user-select: none; /* Konqueror HTML */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Edge, IE */
    user-select: none; /* Modern browsers */
}

.main-panel {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
}

/* Chess wrapper to contain move-info and chess-container */
.chess-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Chess Box Layout */
.chess-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: var(--sidebar-base);
    position: relative;
}

/* Chessboard */
#chessboard {
    width: calc(var(--board-scale) * 1vmin);
    height: calc(var(--board-scale) * 1vmin);
    max-width: calc(var(--board-scale) * 1vw);
    max-height: calc(var(--board-scale) * 1vh);
    background-color: var(--sidebar-base);
}

/* Player Nameplates */
.nameplate {
    height: 50px;
    background-color: var(--nameplate-bg);
    width: 100%;
    max-width: calc(calc(var(--board-scale) * 1vw) + 30px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nameplate.top { 
    border-radius: 10px 10px 0px 0px; 
}

.nameplate.bottom { 
    border-radius: 0px 0px 10px 10px; 
}

/* Flipped Board Styles */
.chess-container.flipped { 
    flex-direction: column-reverse; 
}

.chess-container.flipped .top { 
    border-radius: 0px 0px 10px 10px; 
}

.chess-container.flipped .bottom { 
    border-radius: 10px 10px 0px 0px; 
}

/* Player Profile Elements */
.profile-picture {
    width: 30px;
    height: 30px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 15px;
}

.name {
    color: var(--text-primary);
}

.rating {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

/* Clock Elements */
.clock {
    display: flex;
    align-items: center;
    padding-right: 15px;
    min-width: 60px;
    justify-content: center;
}

.clock-time {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--sidebar-inactive);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--dark-border);
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.clock-time.active {
    background-color: var(--sidebar-inactive);
    border-color: var(--color-primary);
}

.clock-time.low-time {
    color: #ff4444;
    background-color: rgba(255, 68, 68, 0.1);
    border-color: #ff4444;
}

.clock-time.low-time.active {
    background-color: #ff4444;
    color: white;
    border-color: #ff4444;
}



/*===================================*\
 * #SIDEBAR COMPONENTS
\*===================================*/

/* Main Sidebar */
.sidebar {
    background-color: var(--sidebar-base);
    height: calc(var(--board-scale) * 1vmin + 100px);
    max-height: calc(var(--board-scale) * 1vmin + 100px);
    width: 460px;
    border-radius: 10px;
    margin-left: 10px;
    margin-right: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Sidebar Header */
.sidebar-header {
    padding: 0;
    background-color: var(--sidebar-inactive);
    border-radius: 10px 10px 0 0;
    position: relative;
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
}

.header-top {
    background-color: var(--turn-bg);
    min-height: 50px;
    border-radius: 10px 10px 0px 0px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    padding-left: 20px;
    padding-right: 20px;
}

.header-top h2 {
    margin: 0px;
    padding: 5px;
    color: var(--text-primary);
    font-size: larger;
}

/* Sidebar Content Areas */
.top-content {
    padding: 15px;
    min-height: 40px;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    margin: 15px 15px 0 15px;
    box-shadow: var(--shadow-1);
}

.top-content.settings svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.bottom-content {
    padding: 15px;
    padding-top: 10px;
}

/* Tab System */
.tab-buttons {
    display: flex;
    width: 100%;
}

.tab-button {
    flex: 1;
    background-color: var(--sidebar-inactive);
    border: none;
    color: var(--dark-text-muted);
    padding: 15px 0;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 10px 10px 0px 0px;
}

.tab-button.white-text {
    color: var(--pure-white);
}

.tab-button.active {
    color: var(--text-primary);
    background-color: var(--sidebar-base);
}

.tab-button:focus {
    outline: none;
}

.tab-panel {
    display: none;
    height: 100%;
    overflow: hidden;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    max-height: 100%;
}

.tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
}

/* Board Style Selector */
.board-styles-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 10px;
}

.board-background {
    --color-light: #e0e0e0;
    --color-dark: #6ea176;
    width: 120px;
    height: 120px;
    background: repeating-conic-gradient(var(--color-light) 0 25%, var(--color-dark) 0 50%) 50% / 120px 120px;
    border-radius: 10px;
    box-shadow: var(--shadow-1);
}

.board-background.selected {
    box-shadow: 0 0 0 3px var(--light-btn-hover);
}

.board-background:hover {
    box-shadow: 0 0 0 3px var(--hover-accent);
}



/*===================================*\
 * #EVALUATION BAR
\*===================================*/

/* Main Evaluation Bar */
.eval-bar {
    width: 30px;
    height: calc(var(--board-scale) * 1vw);
    max-height: calc(var(--board-scale) * 1vh);
    background-color: var(--eval-bar-black);
    overflow: hidden;
    transform: rotate(180deg);
    position: relative;
}

.eval-bar.flipped {
    transform: rotate(0deg);
}

/* Evaluation Fill */
.eval-fill {
    width: 100%;
    height: 50%;
    transition: background-color 0.6s ease;
    background: var(--pure-white);
}

/* Evaluation Text */
.eval-text {
    position: absolute;
    font-weight: bold;
    font-size: 12px;
    padding: 4px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    z-index: 10;
}

.white-winning {
    top: 5px;
    transform: rotate(180deg);
    color: var(--eval-white-text);
}

.eval-bar.flipped .white-winning {
    top: 5px;
    rotate: 180deg;
}

.black-winning {
    bottom: 5px;
    transform: rotate(180deg);
    color: var(--eval-black-text);
}

.eval-bar.flipped .black-winning {
    bottom: 5px;
    rotate: 180deg;
}

/* Evaluation Progress Bar */
.evaluation-progress-container {
    width: 100%;
    height: 4px;
    background-color: var(--sidebar-base);
    margin: 0;
    padding: 0;
    overflow: visible;
    position: relative;
    z-index: 10;
}

.evaluation-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--engine-progress);
    transition: width 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    border-radius: 0 2px 2px 0;
}

.evaluation-progress-bar.visible {
    opacity: 1;
}



/*===================================*\
 * #MOVE TREE & NAVIGATION
\*===================================*/

/* Move Tree Container */
.moves-container {
    min-height: 250px;
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    font-family: "Roboto", sans-serif;
    line-height: 1.5;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scrollbar);
    margin: 15px;
    margin-bottom: 5px;
    box-shadow: var(--shadow-1);
}

.moves-container::-webkit-scrollbar {
    width: 8px;
}

.moves-container::-webkit-scrollbar-track {
    background: var(--scrollbar);
    border-radius: 4px;
}

.moves-container::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 4px;
    border: 2px solid var(--scrollbar);
}

.move-tree {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.main-line {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.turn {
    display: flex;
    flex-wrap: nowrap;
    margin-bottom: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    background-color: var(--turn-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.turn:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

.variation {
    margin-left: 20px; /* Indentation for variations */
    margin-bottom: 10px;
    position: relative;
    border-left: 2px solid var(--scroll-thumb);
    padding-left: 10px;
}

.variations {
    margin-bottom: 10px;
}

/* New move-entry container to hold move number and move */
.move-entry {
    display: flex;
    align-items: center;
    margin: 0 4px;
    position: relative;
    min-width: 40%;
}

.move-container {
    display: flex;
    align-items: center;
    margin: 0 0 0 2px;
    position: relative;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
}

.move-number {
    margin-right: 4px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 22px;
    display: inline-block;
    text-align: right;
}

.move-icon {
    width: 18px;
    height: 18px;
    margin-right: 5px;
    margin-left: 1px;
    object-fit: contain;
    opacity: 0.9;
    border-radius: 50%;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.move-container:hover {
    background-color: var(--hover-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.move-container:active {
    transform: translateY(0);
    box-shadow: none;
}

.move {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 24px;
    position: relative;
}

.move:hover {
    background-color: transparent;
    transform: none;
    box-shadow: none;
}

.current-move {
    color: var(--perm-white) !important;
    font-weight: 600;
}

.current-container {
    background-color: var(--light-btn);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.current-container:hover {
    background-color: var(--light-btn-hover);
}

/* Make the icons in current move pop more */
.current-container .move-icon {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Add some highlighting for move quality - scoped to moves container only */
.moves-container .move[data-node-id*="brilliant"],
.moves-container .brilliant-move {
	color: var(--color-classification-brilliant);
}

.moves-container .move[data-node-id*="great"],
.moves-container .great-move {
    color: var(--color-classification-great);
}

.moves-container .move[data-node-id*="perfect"],
.moves-container .move[data-node-id*="excellent"],
.moves-container .perfect-move,
.moves-container .excellent-move {
    color: var(--pure-white);
}

.moves-container .move[data-node-id*="good"],
.moves-container .good-move,
.moves-container .forced-move {
    color: var(--pure-white);
}

.moves-container .move[data-node-id*="inaccuracy"],
.moves-container .inaccuracy-move {
    color: var(--color-classification-inaccuracy);
}

.moves-container .move[data-node-id*="mistake"],
.moves-container .mistake-move {
    color: var(--color-classification-mistake);
}

.moves-container .move[data-node-id*="blunder"],
.moves-container .move[data-node-id*="miss"],
.moves-container .blunder-move,
.moves-container .miss-move {
    color: var(--color-classification-blunder);
}

.moves-container .theory-move {
    color: var(--pure-white);
}

/* Move icon after text in moves-container only */
.moves-container .move-container {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.moves-container .move-icon {
    margin-right: 0;
    margin-left: 5px;
}

/* Hide move icons for specific classifications in moves-container only */
.moves-container .perfect-container .move-icon,
.moves-container .excellent-container .move-icon,
.moves-container .theory-container .move-icon,
.moves-container .forced-container .move-icon,
.moves-container .good-container .move-icon {
    display: none;
}

/* Move classification colors for everywhere else (outside moves container) */
.move[data-node-id*="brilliant"]:not(.moves-container .move),
.brilliant-move:not(.moves-container .brilliant-move) {
	color: var(--color-classification-brilliant);
}

.move[data-node-id*="great"]:not(.moves-container .move),
.great-move:not(.moves-container .great-move) {
    color: var(--color-classification-great);
}

.move[data-node-id*="perfect"]:not(.moves-container .move),
.move[data-node-id*="excellent"]:not(.moves-container .move),
.perfect-move:not(.moves-container .perfect-move),
.excellent-move:not(.moves-container .excellent-move) {
    color: var(--color-classification-excellent);
}

.move[data-node-id*="good"]:not(.moves-container .move),
.good-move:not(.moves-container .good-move),
.forced-move:not(.moves-container .forced-move) {
    color: var(--color-classification-forced);
}

.move[data-node-id*="inaccuracy"]:not(.moves-container .move),
.inaccuracy-move:not(.moves-container .inaccuracy-move) {
    color: var(--color-classification-inaccuracy);
}

.move[data-node-id*="mistake"]:not(.moves-container .move),
.mistake-move:not(.moves-container .mistake-move) {
    color: var(--color-classification-mistake);
}

.move[data-node-id*="blunder"]:not(.moves-container .move),
.move[data-node-id*="miss"]:not(.moves-container .move),
.blunder-move:not(.moves-container .blunder-move),
.miss-move:not(.moves-container .miss-move) {
    color: var(--color-classification-blunder);
}

.theory-move:not(.moves-container .theory-move) {
    color: var(--color-classification-book);
}



/*===================================*\
 * #UI CONTROLS & BUTTONS
\*===================================*/

/* Move Navigation Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.controls button {
    padding: 8px 16px;
    background-color: var(--btn-secondary);
    color: var(--pure-white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: "Roboto", sans-serif;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    width: 100%;
}

.controls button svg {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
    color: var(--pure-white);
}

.controls button:hover {
    background-color: var(--hover-button);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.controls button:hover img {
    filter: brightness(1.2);
}

.controls button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Make the quick menu button slightly wider */
.quick-menu-container button {
    min-width: 60px;
}



/*===================================*\
 * #MOVE CLASSIFICATIONS
\*===================================*/

/* Classification Icons */
.classification {
    position: absolute;
    width: 7vw;
    height: 7vw;
    max-width: 4.5vh;
    max-height: 4.5vh;
    transform: translate(min(8vw, 8vh), max(-1.8vw, -1.8vh));
    z-index: 11;
    pointer-events: none;
}

.classification.border {
    transform: translate(min(6vw, 6vh), max(-0.8vw, -0.8vh));
}

/* Board Classification Background Colors */
.board-classification.theory-move {
	background-image: linear-gradient(var(--theory-bg-start) 100%, var(--theory-bg-end) 50%);
}

.board-classification.brilliant-move {
	background-image: linear-gradient(var(--brilliant-bg-start) 100%, var(--brilliant-bg-end) 0%);
}

.board-classification.great-move {
	background-image: linear-gradient(var(--great-bg-start) 100%, var(--great-bg-end) 50%);
}

.board-classification.perfect-move,
.board-classification.excellent-move {
	background-image: linear-gradient(var(--excellent-bg-start) 100%, var(--excellent-bg-end) 0%);
}

.board-classification.forced-move {
	background-image: linear-gradient(var(--forced-bg-start) 100%, var(--forced-bg-end) 50%);
}

.board-classification.good-move {
	background-image: linear-gradient(var(--good-bg-start) 100%, var(--good-bg-end) 50%);
}

.board-classification.inaccuracy-move {
	background-image: linear-gradient(var(--inaccuracy-bg-start) 100%, var(--inaccuracy-bg-end) 50%);
}

.board-classification.mistake-move {
	background-image: linear-gradient(var(--mistake-bg-start) 100%, var(--mistake-bg-end) 50%);
}

.board-classification.miss-move,
.board-classification.blunder-move {
	background-image: linear-gradient(var(--blunder-bg-start) 100%, var(--blunder-bg-end) 50%);
}



/*===================================*\
 * #GAME INFORMATION DISPLAY
\*===================================*/

/* Game Info Section */
.game-info {
    color: var(--text-primary);
    text-align: center;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Game Result Display */
.game-result {
    padding: 10px 15px;
    background-color: var(--game-result-light-bg);
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    color: var(--game-result-light-text);
    text-align: center;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.game-result.black {
    background-color: var(--game-result-dark-bg);
    color: var(--game-result-dark-text);
}



/*===================================*\
 * #LOADING & ANIMATION STATES
\*===================================*/

/* Loading Icons and Animations */
.loading-icon {
    width: 18px;
    height: 18px;
    margin-right: 5px;
    animation: spin 1.5s linear infinite;
    display: inline-block;
    vertical-align: middle;
    color: var(--text-secondary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Evaluation Status Styles */
.evaluation-pending {
    opacity: 0.9;
    background-color: var(--evaluation-pending-bg);
}

.evaluation-pending .move {
    color: var(--move-pending-text);
}



/*===================================*\
 * #ENGINE ANALYSIS
\*===================================*/

/* Engine Lines Section */
.engine-lines-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    font-family: "Roboto", sans-serif;
    max-width: 100%;
}

.engine-line {
    display: flex;
    align-items: flex-start;
    border-radius: 5px;
    overflow: hidden;
    background-color: var(--sidebar-base);
    min-height: 28px;
    max-width: 100%;
}

.engine-score {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 8px 10px;
    min-width: 55px;
    border-radius: 3px;
    margin: 0px;
    text-align: center;
    font-size: 13px;
}

.white-score {
    background-color: var(--pure-white);
    color: var(--engine-white-text);
}

.black-score {
    background-color: var(--engine-black-bg);
    color: var(--engine-black-text);
}

.engine-moves {
    display: flex;
    flex: 1;
    padding: 6px 10px;
    color: var(--text-secondary);
    font-size: 13px;
    align-items: center;
    position: relative;
    justify-content: space-between;
}

.moves-content {
    flex: 1;
    overflow: hidden;
}

.visible-moves {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expand-button {
    cursor: pointer;
    padding: 2px 6px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    margin-left: 5px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    align-self: flex-start;
    height: 100%;
    padding-top: 4px;
}

.expand-button svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.expand-button:hover svg {
    opacity: 1;
    transform: scale(1.1);
}

.hidden-moves {
    display: none;
    padding: 6px 0 0 0;
    width: 100%;
    color: #aaa;
    font-size: 13px;
    line-height: 1.4;
}

.engine-lines {
    padding: 10px 12px;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    margin: 15px 15px 0 15px;
    box-shadow: var(--shadow-1);
    min-height: auto;
    padding-bottom: 10px;
}

.engine-lines:not(.collapsed) {
    min-height: 160px;
    padding-bottom: 10px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--section-border);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.section-title.clickable-title {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    padding: 6px 8px;
    margin: -6px -8px 10px -8px;
}

.section-title.clickable-title:hover {
    background-color: var(--hover-dark);
}

/* Engine lines title and waiting message */
.engine-lines-title::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.engine-lines-title.has-evaluation::before {
    background-color: #7bcc18;
}

.engine-lines-title.no-evaluation::before {
    background-color: #999;
}

.engine-lines-collapse-button {
    margin-left: auto;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.engine-lines-collapse-button:hover {
    background-color: var(--hover-dark);
}

.engine-lines-collapse-button svg {
    width: 12px;
    height: 12px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.engine-lines-collapse-button:hover svg {
    color: var(--text-primary);
}

.engine-depth {
    font-size: 14px;
    color: #999;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 10px;
}

.engine-lines-waiting {
    display: flex;
    align-items: center;
    padding: 10px;
    color: #aaa;
    justify-content: center;
    min-height: 30px;
    font-style: italic;
}

.engine-lines-waiting img {
    margin-right: 6px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.engine-lines-waiting .loading-icon {
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Clickable move styles */
.clickable-move {
    cursor: pointer;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s ease;
    margin: 0 1px;
}

.clickable-move:hover {
    background-color: var(--light-btn);
    color: var(--perm-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Move Information Display */
/* Bubble styling for the move-info positioned outside chess-container */
.move-info {
    background-color: var(--engine-white-bg);
    color: var(--engine-white-text);
    border-radius: 15px;
    box-shadow: var(--shadow-1);
    padding: 12px;
    margin: 0 0 8px 0;
    position: relative;
    min-width: 80%;
    min-height: 20px;
    text-align: left;
    font-weight: 500;
    align-self: center;
}

.move-info::after {
    content: "";
    position: absolute;
    top: -5px;
    left: 5%;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--engine-white-bg);
}

.classification-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.move-left-side {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
}

.perfect-move-alternative {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 14px;
}

.move-eval-score {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    padding: 4px 6px;
    /* min-width: 50px; */
    border-radius: 3px;
    text-align: center;
    font-size: x-small;
    flex-shrink: 0;
    margin-left: auto;
}




/*===================================*\
 * #MODAL & OVERLAY COMPONENTS
\*===================================*/

/* Game Analysis Overlay */
.analysis-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-overlay);
    z-index: 9999999999999;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

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

/* Lock scroll when overlay is active (applied via JS on mobile) */
body.lock-scroll {
    overflow: hidden;
    height: 100vh;
    touch-action: none;
}

.board-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 25;
    display: none;
    pointer-events: all;
}

.blur-content {
    filter: blur(4px);
    pointer-events: none;
    transition: filter 0.3s ease;
}

.analysis-content {
    text-align: center;
    color: var(--text-primary);
    width: 80%;
    max-width: 350px;
    z-index: 21;
}

.analysis-content #cancel-analysis {
    background-color: var(--btn-secondary);
}

.analysis-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 5px;
}

.analysis-content p {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    margin: 15px;
    margin-top: 0px;
}

.analysis-progress {
    width: 100%;
    height: 8px;
    background-color: var(--analysis-progress-bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.analysis-progress-bar {
    height: 100%;
    background-color: var(--engine-progress);
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-percentage {
    color: #bbb;
    font-size: 14px;
    margin-top: 5px;
}

.fun-fact {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--analysis-bg);
    border-radius: 8px;
    font-style: italic;
    color: var(--analysis-text);
    transition: opacity 0.3s ease;
    opacity: 1;
}

.game-graph {
    padding: 0px;
    background-color: #ffffff00;
    overflow: hidden;
    height: 100px;
}

#game-analysis-graph {
    width: 100%;
    height: 130px;
    color:#1f1f1f;
}


/*===================================*\
 * #MEDIA QUERIES
\*===================================*/

/* Mobile Navigation Styles */
@media (max-width: 992px) {
    .nav-toggle-btn {
        position: relative;
        transform: rotate(-55deg);
        z-index: 2;
        display: block;
    }

    .nav-toggle-btn { transform: rotate(-45deg); }

    .nav-toggle-btn span {
        width: 20px;
        height: 2px;
        background: var(--color-primary);
        margin: 5px;
        transition: var(--transition-1);
    }

    .nav-toggle-btn :is(.one, .three) { width: 10px; }

    .nav-toggle-btn .one {
        margin-left: auto;
        transform-origin: left;
    }

    .nav-toggle-btn .three { transform-origin: right; }
    .nav-toggle-btn.active .one { transform: rotate(90deg) translateX(-3px); }
    .nav-toggle-btn.active .three { transform: rotate(90deg) translateX(3px); }

    .header .inner {
        max-width: 80vw;
    }
    
    .navbar {
        position: fixed;
        background: var(--bg-secondary);
        left: -100%;
        top: 50px;
        width: 160px;
        height: 100%;
        display: flex;
        visibility: hidden;
        transition: 0.15s cubic-bezier(0.71, 0.01, 0.24, 0.99);
        z-index: 0;
        justify-content: center;
        align-items: flex-start;
    }

    .navbar.active {
        left: 0;
        visibility: visible;
        transition-delay: 0s;
    }

    .navbar-list {
        display: block;
    }

    .navbar-list > li {
        margin-block: 30px;
        padding-inline: 0px;
        overflow: hidden;
        text-align: left;
    }

    .navbar-link {
        position: relative;
        width: max-content;
        margin-inline: auto;
        color: var(--color-primary);
        font-size: 18px;
    }

    .navbar-link::before {
        height: 5px;
        top: 20px;
    }

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: transparent;
        pointer-events: none;
        opacity: 0;
        transition: var(--transition-1);
        z-index: 24;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    .overlay.active {
        pointer-events: all;
        opacity: 1;
        transition: var(--transition-1);
    }
}

/* Tablet Layout */
@media (max-width: 1280px) {
    .main-panel {
        flex-direction: column;
        padding-top: 10px;
    }

    .sidebar {
        width: calc(var(--board-scale) * 1vmin + 30px);
        max-width: calc(var(--board-scale) * 1vw + 30px);
        margin: 0 auto;
        height: auto;
        max-height: 92vh;
        flex-direction: column;
        padding-bottom: 80px; /* Add space for sticky nav */
    }

    .bottom-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--sidebar-base);
        padding: 10px 15px;
        z-index: 20;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }

    .bottom-content.blur-content {
        display: none;
    }

    .controls {
        margin: 0 auto;
        gap: 8px;
        max-width: calc(var(--board-scale) * 1vmin);
    }

    .controls button {
        padding: 12px 8px;
        touch-action: manipulation;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-text-size-adjust: none;
        -webkit-user-select: none;
        font-size: 1.6rem;
        border-radius: 8px;
    }

    .header .inner {
        max-width: calc(var(--board-scale) * 1vmin);
    }
    
    .moves-container {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100% - 120px);
    }
    
    .tab-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Portrait Layout */
@media (max-width: 768px) {
    .main-panel {
        flex-direction: column;
        padding-top: 10px;
    }

    .sidebar {
        width: calc(var(--board-scale) * 1vmin + 30px);
        max-width: calc(var(--board-scale) * 1vw + 30px);
        margin: 0 auto;
        height: auto;
        max-height: 92vh;
        flex-direction: column;
        padding-bottom: 80px;
    }

    .bottom-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--sidebar-base);
        padding: 10px 15px;
        z-index: 20;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }

    .bottom-content.blur-content {
        display: none;
    }

    .controls {
        margin: 0 auto;
        gap: 8px;
        max-width: calc(var(--board-scale) * 1vmin);
    }

    .controls button {
        padding: 12px 8px;
        touch-action: manipulation;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-text-size-adjust: none;
        -webkit-user-select: none;
        font-size: 1.6rem;
        border-radius: 8px;
    }

    .header .inner {
        max-width: calc(var(--board-scale) * 1vmin);
    }
    
    .moves-container {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100% - 120px);
    }

    /* Quick menu responsive adjustments */
    .quick-menu {
        min-width: 160px;
        bottom: calc(100% + 6px);
    }
    
    .quick-menu-item {
        padding: 10px 14px;
        font-size: 13px;
        gap: 12px;
    }
    
    .quick-menu-item svg {
        width: 16px;
        height: 16px;
    }
}

/* Small Mobile Layout */
@media (max-width: 655px) {
    .main-panel {
        flex-direction: column;
    }

    .header {
        margin-bottom: 10px;
    }

    .header .inner {
        max-width: 95vw;
    }

    .sidebar {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        height: unset;
        max-height: unset;
        flex-direction: column;
        border-radius: 0px;
    }

    .sidebar-header {
        border-radius: 0px;
    }

    .tab-button {
        border-radius: 0px;
    }

    .container {
        width: 100vw;
        padding-top: 0px;
        padding-bottom: 0px;
    }

    .nameplate {
        border-radius: 0px !important;
        max-width: unset;
    }

    .clock {
        padding-right: 10px;
        min-width: 50px;
    }

    .clock-time {
        font-size: 14px;
        padding: 3px 6px;
        letter-spacing: normal;
    }

    #chessboard {
        width: 100vw;
        height: 100vw;
        max-height: calc(100vw + 30px);
        max-width: 100vw;
        overflow: hidden;
    }

    .board-elements {
        position: absolute;
        width: 100vw;
        height: 100vw;
        max-height: calc(100vw + 30px);
        max-width: 100vw;
        transform: translateY(30px);
    }
    
    .bottom-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--sidebar-base);
        padding: 10px 15px;
        padding-bottom: 15px;
        z-index: 20;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
        touch-action: manipulation;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-text-size-adjust: none;
        -webkit-user-select: none;
    }

    .controls {
        margin: 0 auto;
        gap: 8px;
        padding-bottom: 10px;
        touch-action: manipulation;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-text-size-adjust: none;
        -webkit-user-select: none;
    }

    .controls button {
        padding: 16px 8px;
        font-size: 1.6rem;
        border-radius: 8px;
        touch-action: manipulation;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-text-size-adjust: none;
        -webkit-user-select: none;
    }

    .analysis-overlay {
        border-radius: 0px;
    }

    .classification {
        transform: translate(min(9.4vw, 9.4vh), max(-3.4vw, -3.4vh));
        z-index: 11;
    }

    .classification.border {
        transform: translate(min(6.4vw, 6.4vh), max(-1.8vw, -1.8vh));
    }

    /* Mobile Evaluation Bar Adjustments */
    .chess-box {
        flex-direction: column;
    }

    .eval-bar {
        height: 100vw;
        width: 30px;
        overflow: hidden;
        transform: rotate(-90deg);
    }

    .eval-text {
        transform: rotate(90deg);
    }

    .eval-bar-container {
        height: 30px;
        max-width: 100vw;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0px;
    }

    .eval-bar.flipped {
        transform: rotate(90deg);
    }

    /* Hide elements on small screens */
    .accuracy,
    .game-time {
        display: none;
    }

    /* Quick menu responsive adjustments for small screens */
    .quick-menu {
        min-width: 140px;
    }
    
    .quick-menu-item {
        padding: 8px 12px;
        gap: 10px;
        font-size: 12px;
    }
    
    .quick-menu-item svg {
        width: 14px;
        height: 14px;
    }

    /* Learning actions container mobile adjustments */
    .learning-actions {
        order: -1; /* Place at the top of sidebar on mobile */
        margin-top: 16px;
    }
    
    .learning-actions-counter {
        margin-top: 5px; /* Remove large top margin on mobile */
    }
}

/* Game Stats Styles */

.game-stats {
    background-color: #00000000;
    box-shadow: none;
    padding: 0px;
}

.stats-comparison {
    color: var(--color-primary);
    font-family: 'Roboto', sans-serif;
    background-size: cover;
    background-position: center;
    border-radius: 0;
}

.stats-players {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
}

.stats-player {
    flex: 1;
    text-align: center;
    font-weight: 700;
}

.stats-label {
    flex: 1;
    font-weight: 500;
    color: var(--stats-label);
    padding-left: 10px;
}

.no-padding {
    padding: 0px;
}

.stats-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    height: 28px;
}

.stats-moves, .stats-phases {
    margin-bottom: 10px;
}

.stats-count {
    flex: 1;
    text-align: center;
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-icon {
    width: 24px;
    height: 24px;
    margin: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-icon svg, .stats-icon img {
    width: 100%;
    height: 100%;
}

.stats-icon .move-icon {
    width: 24px;
    height: 24px;
}

.stats-box {
    flex: 1;
    text-align: center;
    font-family: 'Jost', sans-serif;
    color: #1a1a1a;
    background-color: #dddddd;
    border-radius: 4px;
    font-weight: 700;
    padding: 3px 0;
    font-size: larger;
}

.stats-box.black {
    background-color: #1a1a1a;
    color: #dddddd;
}

.stats-divider {
    border: 1px solid var(--stats-divider);
    margin: 16px 0px;
}

/* Stats Expand/Collapse Button */
.stats-expand-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 6px;
    background-color: var(--sidebar-inner-base);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.stats-expand-button:hover {
    background-color: var(--hover-dark);
}

.stats-expand-button .expand-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stats-expand-button:hover .expand-text {
    color: var(--text-primary);
}

.stats-expand-button .expand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.stats-expand-button .expand-icon svg {
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
}

.stats-expand-button:hover .expand-icon svg {
    color: var(--text-primary);
}

.stats-expandable-row {
    overflow: hidden;
}












.three-tag-layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 15px;
}

.tag {
    background-color: var(--sidebar-inner-base);
    color: var(--text-secondary);
    
    padding: 10px;
    width: calc(33% - 10px);
    border-radius: 10px;

    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 5px;

    font-weight: 500;
}

.tag .icon {
    color: var(--text-secondary);
    width: 10px;
}

.tag:hover {
    background-color: var(--selected-blue);
    cursor: pointer;
}

.tag.selected {
    background-color: var(--selected-blue);
    color: var(--text-primary);
}

.tag.selected .icon {
    color: var(--text-primary);
}

.game-search-box {
    padding: 15px;
    padding-top: 0px;
    padding-bottom: 0px;
    display: flex;
}

.search-bar {
    background-color: var(--sidebar-inner-base);
    padding: 10px;

    border-radius: 10px;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}

.button-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.search-field {
    width: 100%;
    color: var(--text-primary);
}

.search-bar input:focus{
    outline: none;
    border-bottom: 1px solid var(--text-secondary);
    margin-bottom: -1px;
}

.search-button {
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
}

.search-button:hover {
    color: var(--text-primary);
}

.selection-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

.recent-games {
    padding: 15px;
    margin: 15px;
    margin-bottom: 0px;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scrollbar);
    flex: 1;
    box-shadow: var(--shadow-1);
}

.recent-games::-webkit-scrollbar {
    width: 8px;
}

.recent-games::-webkit-scrollbar-track {
    background: var(--scrollbar);
    border-radius: 4px;
}

.recent-games::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 4px;
    border: 2px solid var(--scrollbar);
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-item {
    width: 100%;
    background-color: var(--dark-surface-1);
    color: var(--pure-white);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: var(--dark-surface-2);
}

.left-side {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.right-side {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.opponent {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    line-height: 20px;
}

.opponent .profile-picture {
    padding: 0px;
    border-radius: 3px;
}

.opponent .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
}


.accuracy {
    background-color: var(--turn-bg);
    border-radius: 5px;
    padding: 3px 8px 3px 8px;
    color: var(--text-secondary);
}

.game-time {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.game-time svg {
    width: 18px;
    height: 18px;   
}

.game-time .bullet { color: var(--bullet-color); }
.game-time .blitz { color: var(--blitz-color); }
.game-time .rapid { color: var(--rapid-color); }

.result {
    width: 24px;
    height: 26px;
}

.result.win { color: var(--win-green); }
.result.loss { color: var(--loss-red); }
.result.draw { color: var(--draw-gray); }


.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    left: -140px;
    min-width: 160px;

    display: none;
    position: absolute;
    background-color: var(--bg-secondary);
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 12;
    border-radius: 5px;
}

.dropdown.active .dropdown-content {display: block;}

/* Filter dropdown styles */
.dropdown-content .filter-section {
    padding: 10px 15px;
    border-bottom: 1px solid var(--turn-bg);
}

.dropdown-content .filter-section:last-of-type {
    border-bottom: none;
}

.dropdown-content .filter-section h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-content .filter-section label {
    display: block;
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-content .filter-section label:hover {
    color: var(--text-primary);
}

.dropdown-content .filter-section input[type="radio"] {
    margin: 0;
    accent-color: var(--light-btn);
}

.dropdown-content .filter-actions {
    padding: 10px 15px;
    display: flex;
    gap: 8px;
}

.dropdown-content .filter-actions button {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-content .apply-filters {
    background-color: var(--light-btn);
    color: var(--pure-white);
}

.dropdown-content .apply-filters:hover {
    background-color: var(--light-btn-hover);
}

.dropdown-content .reset-filters {
    background-color: var(--btn-secondary);
    color: var(--text-secondary);
}

.dropdown-content .reset-filters:hover {
    background-color: var(--turn-bg);
    color: var(--text-primary);
}




/* Game list loading and error states */
.loading-container, 
.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    text-align: center;
    gap: 10px;
}

.loading-text, 
.error-text {
    color: var(--text-secondary);
    font-style: italic;
}

.error-item,
.loading-item {
    background-color: var(--transparent-bg);
}

.error-item:hover,
.loading-item:hover {
    background-color: var(--transparent-bg);
    transform: translateY(0px);
    box-shadow: none;
}

/* Load more button styles */
.load-more-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.load-more-button {
    background-color: var(--light-btn);
    color: var(--pure-white);
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Roboto", sans-serif;
}

.load-more-button:hover {
    background-color: var(--light-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.load-more-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.all-loaded-message {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 10px;
    font-size: 13px;
}

/* PGN Input Styles */
.pgn-input-container {
    padding: 15px;
    margin: 15px;
    margin-top: 0px;
    margin-bottom: 0px;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pgn-input-section,
.pgn-upload-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pgn-input-section h3,
.pgn-upload-section h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.pgn-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid var(--turn-bg);
    border-radius: 6px;
    background-color: var(--dark-surface-1);
    color: var(--text-primary);
    font-size: 12px;
    resize: none;
    box-sizing: border-box;
}

.pgn-textarea::placeholder {
    color: var(--text-secondary);
}

.pgn-textarea:focus {
    outline: none;
    border-color: var(--light-btn);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.pgn-load-button,
.pgn-upload-button {
    background-color: var(--light-btn);
    color: var(--pure-white);
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Roboto", sans-serif;
    align-self: flex-start;
}

.pgn-load-button:hover,
.pgn-upload-button:hover {
    background-color: var(--light-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pgn-load-button:active,
.pgn-upload-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.pgn-file-name {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
    margin-left: 10px;
}

.pgn-game-item {
    cursor: pointer;
}

.pgn-game-item:hover {
    background-color: var(--dark-surface-2);
}












/* Opening Theory Styles */

.opening-theory-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    padding-top: 0px;
}

.opening-theory-content p {
    font-style: italic;
}

.opening-theory-content h1, 
.opening-theory-content h2, 
.opening-theory-content h3, 
.opening-theory-content h4, 
.opening-theory-content h5, 
.opening-theory-content h6 {
    color: var(--text-primary);
}

.opening-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.opening-description p {
    margin: 0 0 10px 0;
}

.opening-description p:last-child {
    margin-bottom: 0;
}

.opening-source {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--sidebar-inner-base);
}

.opening-source a {
    color: var(--light-btn);
    font-size: 12px;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.opening-source a:hover {
    color: var(--light-btn-hover);
    text-decoration: underline;
}

.opening-theory-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.opening-theory-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--sidebar-inner-base);
    border-top: 2px solid var(--light-btn);
    border-radius: 50%;
    animation: opening-spin 1s linear infinite;
    margin-bottom: 15px;
}

.opening-theory-loading p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.opening-theory-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.opening-theory-empty p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    font-style: italic;
}

@keyframes opening-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ==========================================
   SETTINGS MENU COMPONENT STYLES
   ========================================== */

/* Settings Groups */


.settings-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0 10px 0;
    border-bottom: 2px solid var(--stats-divider);
    margin-bottom: 15px;
}

.settings-group-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.5px;
}

.settings-group-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Individual Setting Items */
.setting-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background-color: var(--sidebar-inner-base);
    border-radius: 8px;
    box-shadow: var(--shadow-1);
    transition: box-shadow 0.2s ease;
    transform: translateZ(0);
}

.setting-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.setting-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.setting-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    opacity: 0.9;
}

.setting-input {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.setting-group-item {
    border: 1px solid var(--sidebar-inner-base);
    border-radius: 10px;
    padding: 18px;
    flex-direction: column;
    align-items: stretch;
}

.setting-group-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-group-label .setting-name {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.setting-group-label .setting-description {
    color: var(--text-secondary);
    font-size: 14px;
    opacity: 0.9;
}

.setting-group-content-inline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-sub-item {
    display: flex;
}

.setting-sub-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-sub-label {
    flex: 1;
    display: flex;
    align-items: center;
}

.setting-sub-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

/* Color Input Styles */
.color-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-preview-box {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid var(--dark-border);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateZ(0);
}

.color-preview-box:hover {
    box-shadow: 0 0 0 2px var(--light-btn);
}

.color-input {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    opacity: 0;
    position: absolute;
}



/* Slider Input Styles */
.slider-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 120px;
}

.slider-input {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--input-bg);
    outline: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    /* CSS variable for filled track - update via JavaScript */
    --slider-progress: 50%;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.slider-input::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        var(--light-btn) 0%,
        var(--light-btn) var(--slider-progress),
        var(--input-bg) var(--slider-progress),
        var(--input-bg) 100%
    );
    border: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--light-btn);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
    margin-top: -6px; /* Center the thumb */
}

.slider-input::-webkit-slider-thumb:hover {
    background: var(--light-btn-hover);
}

/* Firefox */
.slider-input::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--input-bg);
    border: none;
}

.slider-input::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--light-btn);
    border: none;
}

.slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--light-btn);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
    appearance: none;
    -moz-appearance: none;
}

.slider-input::-moz-range-thumb:hover {
    background: var(--light-btn-hover);
}

.slider-value {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    background: var(--input-bg);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Dropdown Input Styles */
.dropdown-input {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--dark-border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 120px;
}

.dropdown-input:focus {
    outline: none;
    border-color: var(--light-btn);
    box-shadow: 0 0 0 2px var(--light-btn-shadow);
}

.dropdown-input:hover {
    border-color: var(--dark-border-hover);
}

.dropdown-input option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}





/* Visual List Input Styles */
.visual-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    max-width: 280px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scrollbar);
    will-change: scroll-position;
    contain: layout style;
}

.visual-list-container::-webkit-scrollbar {
    width: 6px;
}

.visual-list-container::-webkit-scrollbar-track {
    background: var(--scrollbar);
    border-radius: 3px;
}

.visual-list-container::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 3px;
}

.visual-list-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background-color: var(--turn-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    text-align: center;
    transform: translateZ(0);
}

.visual-list-option:hover {
    border-color: var(--dark-border-hover);
    background-color: var(--hover-dark);
}

.visual-list-option.selected {
    border-color: var(--light-btn);
    background-color: rgba(46, 181, 214, 0.1);
    outline: 1px solid var(--light-btn);
    outline-offset: -1px;
    order: -1;
}

.visual-list-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    word-break: break-word;
}

/* Board Preview Styles */
.board-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--dark-border);
    contain: layout style paint;
}

.board-preview-square {
    width: 100%;
    height: 100%;
}

/* Piece Preview Styles */
.piece-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
    width: 48px;
    height: 48px;
    background: repeating-conic-gradient(
        var(--theme-light) 0 25%, 
        var(--theme-dark) 0 50%
    ) 50% / 24px 24px;
    border-radius: 4px;
    border: 1px solid var(--dark-border);
    padding: 4px;
    contain: layout style paint;
}

.piece-preview-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
    display: block;
}

/* Toggle Input Styles */
.toggle-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--turn-bg);
    border-radius: 26px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border: 2px solid var(--toggle-border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    top: 2px;
    background-color: var(--toggle-thumb);
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    background-color: var(--light-btn);
    border-color: var(--light-btn);
}

.toggle-input:checked + .toggle-label .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label:hover .toggle-slider {
    border-color: rgba(46, 181, 214, 0.5);
}

/* Responsive Design for Settings */
@media (max-width: 655px) {
    .setting-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .setting-input {
        justify-content: center;
        width: 100%;
    }
    
    .visual-list-container {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        max-width: 100%;
    }
    
    .slider-input-container {
        min-width: 100%;
    }
    
    .color-input-container {
        justify-content: center;
    }
}

/* Settings Menu Container */
.tab-panel.active,
.settings-menu-container {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scrollbar);
    flex: 1;
    height: 100%;
    max-height: 100%;
    /* Performance optimizations */
    will-change: scroll-position;
    contain: layout style paint;
}

.settings-menu-container {
    padding: 0 15px 15px 15px;
}

.tab-panel.active::-webkit-scrollbar,
.settings-menu-container::-webkit-scrollbar {
    width: 8px;
}

.tab-panel.active::-webkit-scrollbar-track,
.settings-menu-container::-webkit-scrollbar-track {
    background: var(--scrollbar);
    border-radius: 4px;
}

.tab-panel.active::-webkit-scrollbar-thumb,
.settings-menu-container::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 4px;
    border: 2px solid var(--scrollbar);
}

/*===================================*\
 * #QUICK MENU STYLES
\*===================================*/

/* Quick Menu Container */
.quick-menu-container {
    position: relative;
    display: inline-block;
}

/* Quick Menu Popup */
.quick-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--sidebar-base);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 10px 0;
    display: none;
    z-index: 1000;
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.quick-menu.show {
    display: block;
    animation: quickMenuSlideIn 0.2s ease forwards;
}

@keyframes quickMenuSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Quick Menu Items */
.quick-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    user-select: none;
}

.quick-menu-item:hover {
    background-color: var(--hover-dark);
}

.quick-menu-item:active {
    background-color: var(--light-btn);
    color: white;
}

.quick-menu-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.quick-menu-item:hover svg {
    color: var(--text-primary);
}

.quick-menu-item span {
    white-space: nowrap;
}

/* Triangle arrow pointing down */
.quick-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--sidebar-base);
}

.quick-menu::before {
    content: '';
    position: absolute;
    top: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid var(--dark-border);
}

/* ==================== Learn from Mistakes Mode ==================== */

/* Learn from Mistakes Button */
.learn-button {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: none;
    color: var(--pure-white);
    border: 1px solid var(--color-vibrant-purple-500);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.learn-button:hover {
    background: var(--hover-dark);
    border-color: var(--light-btn);
}

.learn-button:active {
    background: var(--light-btn);
    color: white;
}

.learn-button svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Learning Feedback in Move Info Box */
.learning-feedback {
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

/* Ensure move-info is above confetti */
.move-info {
    position: relative;
    z-index: 1000;
}

/* Move move-info inside moves tab on PC only */
@media (min-width: 769px) {
    /* Hide the original move-info above chessboard on PC */
    .chess-wrapper > .move-info {
        display: none;
    }
    
    /* Show and style the move-info inside moves tab */
    .move-info-sidebar {
        display: block !important;
        position: relative;
        width: 80%;
        margin: 10px 0;
        min-width: auto;
    }
    
    .move-info-sidebar::after {
        display: none; /* Hide arrow */
    }
}

/* Hide sidebar move-info on mobile */
@media (max-width: 768px) {
    .move-info-sidebar {
        display: none !important;
    }
}

/* Hide move-info completely during learning mode */
.learning-mode ~ * .move-info,
body:has(.learning-mode) .move-info {
    display: none !important;
}

/* Leave button styling */
#leave-learning {
    background: #e02828 !important;
    color: white !important;
    order: -1; /* Move to leftmost position */
}

/* Ensure controls use flexbox in learning mode */
.controls.learning-mode {
    display: flex !important;
}

/* Learning Actions Container (in sidebar on desktop, under chessboard on mobile) */
.learning-actions {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    margin-top: 0;
    text-align: center;
    box-shadow: none;
    border: none;
    width: 100%;
}

.learning-actions-message {
    font-size: 16px;
    color: var(--text-primary);
    margin: 12px 0;
    text-align: center;
    line-height: 1.5;
    font-weight: 600;
}

.learning-actions-counter {
    font-size: 12px;
    color: var(--text-secondary);
    @media (min-width: 768px) {
        margin-top: 60%; /* Add spacing from top on PC */
    }
}

.learning-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.learning-action-btn {
    background: transparent;
    border: none;
    color: var(--analysis-text);
    padding: 5px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: "Roboto", sans-serif;
    text-align: center;
    font-weight: 400;
}

.learning-action-btn:hover {
    color: var(--text-secondary);
}



.learning-action-btn.primary:hover {
    color: var(--text-secondary);
}

@keyframes feedbackSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}