:root {
    --onyx: #161512;
    --carbon-black: #1e1d1a;
    --carbon-black-2: #262421;
    --iron-grey: #404444;
    --alabaster-grey: #dee3e6;
    --cool-steel: #8ca2ad;
    --cool-steel-2: #a1b3bc;
    --pale-slate: #b5c3ca;
    --malachite: #58e666;
    --strawberry-red: #e44545;
}

/* 1. BASE LAYOUT & BOARD */
body { 
    background-color: #161512; 
    color: #b5c3ca;
    display: flex; 
    flex-direction: column;
    align-items: stretch;
    padding-top: 0; 
    font-family: 'Aptos', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
}

#left-sidebar {
    width: 280px;
    height: 600px;
    margin-right: 35px;
    background: #262421;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#saved-lines-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.saved-line-item {
    padding: 8px;
    background: #262421;
    color: #b5c3ca;
    margin-bottom: 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.1s;
}

.saved-line-item:hover {
    background: #404444;
}

#my-board { 
    width: 100%;
    max-width: 600px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin-right: 35px;  
    margin-bottom: 30px; 
    flex-shrink: 1;
    container-type: inline-size;
    border-radius: 8px;
    overflow: hidden;
}

.blue-board cg-board {
    background-color: #dee3e6;
    background-image: conic-gradient(#8ca2ad 90deg, transparent 90deg 180deg, #8ca2ad 180deg 270deg, transparent 270deg);
    background-size: 25% 25%;
}

.board-wrapper {
    position: relative;
    width: max-content;
    display: inline-block;
    box-sizing: border-box;
}

.board-resizer {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 100;
    background: linear-gradient(-45deg, transparent 40%, rgba(0,0,0,0.5) 40%, rgba(0,0,0,0.5) 48%, transparent 48%, transparent 65%, rgba(0,0,0,0.5) 65%, rgba(0,0,0,0.5) 73%, transparent 73%);
    opacity: 0.8;
}
.board-resizer:hover {
    opacity: 1;
}

@keyframes flashGreen {
    0% { box-shadow: inset 0 0 0px 0px rgba(40, 167, 69, 0); }
    50% { box-shadow: inset 0 0 20px 8px rgba(40, 167, 69, 1); }
    100% { box-shadow: inset 0 0 0px 0px rgba(40, 167, 69, 0); }
}
@keyframes flashRed {
    0% { box-shadow: inset 0 0 0px 0px rgba(220, 53, 69, 0); }
    50% { box-shadow: inset 0 0 20px 8px rgba(220, 53, 69, 1); }
    100% { box-shadow: inset 0 0 0px 0px rgba(220, 53, 69, 0); }
}
.flash-green-active cg-board { animation: flashGreen 0.4s ease; }
.flash-red-active cg-board { animation: flashRed 0.4s ease; }

.player-info-container {
    font-size: 14px;
    font-weight: bold;
    color: #8ca2ad;
    padding: 8px 0;
    min-height: 20px;
    display: flex;
    align-items: center;
}

.player-white-text { color: #f0f0f0 !important; }
.player-black-text { color: #9e9e9e !important; }

.player-score { font-weight: bold; margin-right: 8px; }
.score-win { color: var(--malachite, #58e666) !important; }
.score-loss { color: var(--strawberry-red, #e44545) !important; }
.score-draw { color: var(--alabaster-grey, #dee3e6) !important; }

/* OUTSIDE COORDINATES */
.cg-wrap coords {
    position: absolute;
    display: flex;
    pointer-events: none;
    font-size: clamp(10px, 2.5cqw, 14px) !important;
    font-weight: bold;
    color: #8ca2ad !important;
    z-index: 10;
}
.cg-wrap coords coord { text-transform: lowercase; }

.cg-wrap coords.ranks {
    left: auto !important; 
    right: -25px !important; 
    top: 0;
    flex-direction: column-reverse; 
    width: 25px; 
    height: 100%;
}
.cg-wrap coords.ranks coord {
    flex: 1;
    display: flex;
    align-items: center !important; 
    justify-content: center !important; 
    padding: 0 !important; 
    transform: none !important;
}

.cg-wrap coords.files {
    bottom: -25px !important; 
    top: auto !important;
    left: 0;
    flex-direction: row;
    width: 100%;
    height: 25px; 
}
.cg-wrap coords.files coord {
    flex: 1;
    display: flex;
    align-items: center !important; 
    justify-content: center !important; 
    padding: 0 !important; 
}

/* PIECES & MOVE INDICATORS */
cg-board square.move-dest { background: radial-gradient(rgba(20, 85, 30, 0.5) 22%, #404444 0, rgba(0, 0, 0, 0) 24%); pointer-events: auto; }
cg-board square.oc.move-dest { background: radial-gradient(transparent 0%, transparent 78%, rgba(20, 85, 30, 0.5) 80%); }

.maestro piece.pawn.white { background-image: url('assets/wP.svg'); }
.maestro piece.knight.white { background-image: url('assets/wN.svg'); }
.maestro piece.bishop.white { background-image: url('assets/wB.svg'); }
.maestro piece.rook.white { background-image: url('assets/wR.svg'); }
.maestro piece.queen.white { background-image: url('assets/wQ.svg'); }
.maestro piece.king.white { background-image: url('assets/wK.svg'); }
.maestro piece.pawn.black { background-image: url('assets/bP.svg'); }
.maestro piece.knight.black { background-image: url('assets/bN.svg'); }
.maestro piece.bishop.black { background-image: url('assets/bB.svg'); }
.maestro piece.rook.black { background-image: url('assets/bR.svg'); }
.maestro piece.queen.black { background-image: url('assets/bQ.svg'); }
.maestro piece.king.black { background-image: url('assets/bK.svg'); }

/* 2. LICHESS SIDEBAR CLONE */
#sidebar {
    width: 350px;
    height: 600px;
    display: flex;
    flex-direction: column;
    background: #262421;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    overflow: hidden;
    flex-shrink: 0;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #404444; 
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #596367; 
}

#engine-name-label {
    font-family: inherit;
}

#engine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #262421;
    border-bottom: 1px solid #404444;
    font-size: 12px;
    color: #8ca2ad;
}
#engine-name { color: #8ca2ad; font-weight: bold; }
#engine-eval { font-weight: bold; color: #8ca2ad; font-size: 15px; }
#engine-ui { display: none; }

#lichess-moves {
    flex-grow: 1; 
    display: grid;
    grid-template-columns: 45px 1fr 1fr;
    align-content: start;
    overflow-y: auto;
    background: #262421;
}
.move-index { background: #1e1d1a; color: #8ca2ad; padding: 4px 8px; text-align: right; border-right: 1px solid #161512; user-select: none; font-size: 13px; }
.move-san { padding: 4px 10px; color: #b5c3ca; cursor: pointer; font-size: 14px; }
.move-san:hover { background: #1e1d1a; }
.move-san.active { background: #596367; color: #dee3e6; font-weight: bold; }
.san-token:hover { background: #404444 !important; }
.cm-item:hover { background: #404444; }
#db-context-menu {
    position: absolute;
    background: #262421;
    border: 1px solid #404444;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 3000;
    min-width: 150px;
    color: #dee3e6;
    font-size: 13px;
}
#db-context-menu li {
    padding: 8px 12px;
    cursor: pointer;
    color: #d54848;
}
#db-context-menu li:hover {
    background: #404444;
}

#explorer-box { height: 220px; background: #1e1d1a; display: flex; flex-direction: column; transition: height 0.2s; overflow: hidden; }
.explorer-header { background: #8ca2ad; color: #262421; padding: 6px 10px; font-size: 12px; font-weight: bold; display: flex; align-items: center; border-bottom: 1px solid #404444; }
.explorer-sub-header { background: #262421; color: #8ca2ad; font-size: 10px; padding: 4px 10px; display: flex; border-bottom: 1px solid #262421; }
.explorer-content { overflow-y: auto; }

.exp-row { display: flex; align-items: center; border-bottom: 1px solid #262421; font-size: 12px; padding: 4px 0; transition: background 0.1s; }
.exp-row:hover { background: #404444; }
.exp-move { width: 45px; padding-left: 10px; font-weight: bold; color: #dee3e6; }
.exp-games { width: 60px; color: #596367; text-align: right; padding-right: 8px; }
.exp-bars { flex-grow: 1; padding-right: 10px; display: flex; align-items: center; }

.bar-container { display: flex; width: 100%; height: 12px; border-radius: 2px; overflow: hidden; font-size: 9px; line-height: 12px; text-align: center; color: #dee3e6; }
.lichess-bar-white { background-color: var(--alabaster-grey, #dee3e6) !important; color: #161512; }
.lichess-bar-draw { background-color: var(--cool-steel, #8ca2ad) !important; }
.lichess-bar-black { background-color: var(--carbon-black-2, #262421) !important; color: var(--alabaster-grey, #dee3e6); }

.buttons { display: flex; background: #1e1d1a; padding: 8px; gap: 8px; }
.btn { flex: 1; padding: 6px; border: none; border-radius: 3px; font-size: 12px; font-weight: bold; cursor: pointer; color: white; }
#save-btn { background-color: #8ca2ad; }
#restart-btn { background-color: #404444; }

/* TOGGLE SWITCH */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.switch input:focus + .slider { outline: 2px solid #8ca2ad; outline-offset: 2px; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #404444; transition: .4s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: #8ca2ad; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #8ca2ad; }
input:checked + .slider:before { transform: translateX(14px); background-color: #161512; }

/* 3. RESPONSIVE BREAKPOINTS & MOBILE LAYOUT */
.mobile-tab-btn { display: none; }

#eval-bar-container {
    width: 16px;
    min-height: 0;
    height: auto;
    margin: 0;
    background: #1e1d1a;
    border: 1px solid #404444;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-direction: column-reverse;
    display: none;
    box-sizing: border-box;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .mobile-tab-btn { display: flex; }
    
    #workspace, #workspace-container {
        flex-direction: column !important;
        align-items: center !important;
        margin-top: 10px !important;
        padding: 0 10px !important;
        gap: 20px;
        display: flex !important;
    }
    
    /* Board scales to full width with fallback min-height */
    #ui-center-column, #ui-center {
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        order: 1;
    }
    .blue-board.maestro {
        width: 100% !important;
        height: auto !important;
        min-width: 300px !important;
        min-height: 300px !important;
        aspect-ratio: 1 / 1;
    }
    
    /* Eval bar constraints */
    #eval-bar-container {
        height: auto !important;
        min-height: 0;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    /* Hide desktop right sidebar completely on mobile */
    #sidebar {
        display: none !important;
    }
    
    /* Center bottom tabs & panels on mobile */
    #ui-bottom {
        order: 2;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* The left sidebar is now a tab panel on mobile, so let switchTab control its display, just fix its width */
    #left-sidebar, #trainer-sidebar, #ui-left {
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 400px !important;
        order: 3;
    }

    #ui-right-column, #ui-right {
        order: 4;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Touch targets minimum size */
    .btn, #nav-editor, #nav-trainer, #nav-database, #toggle-white, #toggle-black, .tab-btn, #flip-board-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #header {
        padding: 0 10px !important;
        flex-wrap: wrap;
        height: auto !important;
        min-height: 50px;
    }
    
    /* Increase move tree padding for fat thumbs */
    .san-token {
        padding: 8px 6px !important;
        display: inline-block;
        margin-bottom: 4px;
        line-height: 1.5;
    }
    
    /* Touch target for context menu */
    .cm-item {
        padding: 12px 16px !important;
        font-size: 16px !important;
    }

    /* --- TAB PANELS --- */
    .tab-pane { display: none !important; }
    .tab-pane.active { display: block !important; }
    #left-sidebar.tab-pane.active, #engine-panel-mobile.tab-pane.active, #database-panel-mobile.tab-pane.active { display: flex !important; }
    #menu-pane.tab-pane.active { display: flex !important; }

    #logo-text, #desktop-nav-links, #desktop-right-bar {
        display: none !important;
    }
}

/* 4. DESKTOP LAYOUT RESTORATION (min-width: 901px) */
@media (min-width: 901px) {
    /* 1. Main Flex-Row Container */
    #workspace-container, #workspace {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: flex-start !important;
        gap: 25px;
        width: 100%;
        max-width: 1300px;
        margin: 25px auto 0 auto !important;
        padding: 0 20px !important;
        box-sizing: border-box;
    }

    /* 2. Left UI Box (#ui-left): Repertoire Explorer & Training Dashboard */
    #ui-left {
        display: flex !important;
        flex-direction: column;
        width: 280px;
        flex-shrink: 0;
    }

    #left-sidebar, #trainer-sidebar {
        width: 280px;
        height: 600px;
        margin-right: 0 !important;
        background: #262421;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        overflow: hidden;
        flex-direction: column;
        flex-shrink: 0;
    }

    #left-sidebar {
        display: flex;
    }

    #trainer-sidebar {
        display: none;
    }

    /* 3. Center UI Box (#ui-center) & Restored Bottom UI Box (#ui-bottom) */
    #ui-center-column {
        display: flex !important;
        flex-direction: column;
        width: max-content;
        gap: 15px;
        flex-shrink: 1;
    }

    #ui-center {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start;
        gap: 0px;
        width: 100%;
        margin: 0 !important;
    }

    .blue-board.maestro, #my-board {
        width: 100%;
        max-width: 800px;
        height: auto;
        aspect-ratio: 1 / 1;
        min-width: 300px;
        min-height: 300px;
        margin: 0 !important;
        flex: 1;
        position: relative;
        border-radius: 8px;
        overflow: hidden;
    }

    #eval-bar-container {
        width: 16px;
        min-height: 0;
        height: auto;
        margin: 0;
        background: #1e1d1a;
        border: 1px solid #404444;
        border-radius: 4px;
        overflow: hidden;
        position: relative;
        flex-direction: column-reverse;
        display: none; /* Hidden by default in #ui-center */
        box-sizing: border-box;
        flex-shrink: 0;
    }

    /* Restored Bottom UI Box (#ui-bottom): Tabbed container holding Annotator & Tags */
    #ui-bottom {
        display: flex;
        flex-direction: column;
        width: 100%;
        background: #262421;
        border-radius: 8px;
        border: 1px solid #404444;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        overflow: hidden;
    }

    #ui-bottom #tabs-container {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        background: transparent;
    }

    #ui-bottom #bottom-tabs-bar {
        display: flex;
        border-bottom: 1px solid #404444;
        background: #1e1d1a;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    #ui-bottom .tab-pane {
        display: none !important;
    }

    #ui-bottom .tab-pane.active {
        display: block !important;
    }

    #annotator-panel {
        padding: 12px;
        box-sizing: border-box;
    }

    #annotation-editor {
        width: 100%;
        height: 180px;
        box-sizing: border-box;
        background: #1e1d1a;
        color: #dee3e6;
        border: 1px solid #404444;
        border-radius: 6px;
        padding: 10px;
        resize: none;
    }

    #tags-panel {
        padding: 12px 16px;
        box-sizing: border-box;
        height: 180px;
        overflow-y: auto;
        background: #262421;
    }

    /* 4. Right UI Box (#ui-right & Column) */
    #ui-right-column {
        display: flex !important;
        flex-direction: column;
        width: 350px;
        flex-shrink: 0;
    }

    #ui-right {
        display: flex !important;
        flex-direction: column;
        width: 350px;
        height: 600px;
        background: #262421;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        overflow: hidden;
        position: relative;
    }

    #sidebar {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
    }

    /* Engine Toggle Frame: attached to absolute top of Right UI Box */
    #engine-panel-mobile {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        flex-shrink: 0;
        margin: 0;
    }

    /* Move-list container in Right UI Box */
    #database-panel-mobile {
        display: flex !important;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
        overflow: hidden;
        background: #262421;
        margin: 0 !important;
    }

    #lichess-moves {
        flex-grow: 1;
        display: grid;
        grid-template-columns: 45px 1fr 1fr;
        align-content: start;
        overflow-y: auto;
        background: #262421;
        min-height: 0;
    }

    /* Master Database: at absolute bottom of Move-list, expands upwards */
    #explorer-box {
        display: flex !important;
        flex-shrink: 0;
        width: 100%;
        background: #1e1d1a;
        border-top: 1px solid #404444;
        transition: height 0.2s ease;
        overflow: hidden;
    }

    /* Menu Pane: shown in place of Master Database when Menu button clicked */
    #menu-pane {
        width: 100%;
        flex-shrink: 0;
        background: #1e1d1a;
        border-top: 1px solid #404444;
        border-radius: 0;
        box-sizing: border-box;
        overflow-y: auto;
    }

    /* Slim Menu Bar immediately below Right UI Box */
    #desktop-right-bar {
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
        padding: 4px 0;
        height: 24px;
    }
}

/* ============================================================
   ENGINE SETTINGS DROPDOWN
   ============================================================ */

/* Wrapper keeps the dropdown positioned relative to the gear */
.engine-settings-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Ensure the engine header row never clips the floating dropdown */
#engine-panel-mobile .explorer-header {
    overflow: visible !important;
}

/* Gear trigger button */
.engine-gear-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #596367;
    font-size: 19px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.engine-gear-btn:hover,
.engine-gear-btn.active {
    color: #dee3e6;
    background: #404444;
}

/* Dropdown panel */
.engine-settings-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    z-index: 1000;
    min-width: 230px;
    width: max-content;
    background: #1e1d1a;
    border: 1px solid #404444;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual setting row */
.engine-setting-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Label + current-value row */
.setting-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    color: #8ca2ad;
}
.setting-label-row span:last-child {
    color: #dee3e6;
    font-variant-numeric: tabular-nums;
    min-width: 18px;
    text-align: right;
}

/* Range sliders — themed to match the dark palette */
.engine-settings-dropdown input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #404444;
    outline: none;
    cursor: pointer;
}
.engine-settings-dropdown input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8ca2ad;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.engine-settings-dropdown input[type="range"]::-webkit-slider-thumb:hover {
    background: #dee3e6;
    transform: scale(1.15);
}
.engine-settings-dropdown input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: #8ca2ad;
    cursor: pointer;
}
.engine-settings-dropdown input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: #404444;
}

/* ============================================================
   ENGINE PV (VARIATION LINES) LAYOUT
   ============================================================ */

#engine-pv {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Each variation line row — clickable to execute the engine's suggested move */
.pv-line-row {
    display: flex;
    align-items: baseline;
    width: 100%;
    border-bottom: 1px solid #2d2c29;
    padding: 3px 0;
    min-height: 20px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.1s ease;
}
.pv-line-row:hover {
    background-color: #2a2926;
}
.pv-line-last {
    border-bottom: none;
}

/* Score column — fixed width with a subtle right divider */
.pv-score-col {
    flex: 0 0 54px;
    min-width: 54px;
    font-family: 'Aptos', 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: #dee3e6;
    border-right: 1px solid #404444;
    padding-right: 6px;
    text-align: right;
    align-self: center;
}

/* Moves column — takes remaining width, truncates with ellipsis */
.pv-moves-col {
    flex: 1 1 0;
    font-family: monospace;
    font-size: 11px;
    color: #a1b3bc;
    padding-left: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

/* ============================================================
   FIDE PLAYER AUTOCOMPLETE & HISTORICAL ELO
   ============================================================ */

.fide-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.fide-player-input {
    padding-right: 28px !important;
}

.fide-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--cool-steel, #8ca2ad);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s, background-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fide-search-btn:hover {
    color: var(--alabaster-grey, #dee3e6);
    background-color: var(--iron-grey, #404444);
}

.fide-auto-btn {
    background-color: var(--iron-grey, #404444);
    color: var(--alabaster-grey, #dee3e6);
    border: 1px solid var(--iron-grey, #404444);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.fide-auto-btn:hover {
    background-color: var(--cool-steel, #8ca2ad);
    color: var(--onyx, #161512);
    border-color: var(--cool-steel, #8ca2ad);
}

.fide-auto-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fide-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 150px;
    overflow-y: auto;
    background: var(--carbon-black, #1e1d1a);
    border: 1px solid var(--iron-grey, #404444);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.fide-dropdown-item {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--alabaster-grey, #dee3e6);
    cursor: pointer;
    border-bottom: 1px solid var(--carbon-black-2, #262421);
    transition: background-color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fide-dropdown-item:last-child {
    border-bottom: none;
}

.fide-dropdown-item:hover,
.fide-dropdown-item.active {
    background-color: var(--iron-grey, #404444);
    color: var(--alabaster-grey, #dee3e6);
}

.fide-dropdown-loading,
.fide-dropdown-empty {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--cool-steel, #8ca2ad);
    text-align: center;
}
