@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-0: #0a0e17;
    --bg-1: #0f1320;
    --bg-2: #151926;
    --bg-3: #1c2030;
    --border: #1e2235;
    --border-2: #2a2e3e;
    --text-1: #d1d4dc;
    --text-2: #787b86;
    --text-3: #4a4e5a;
    --accent: #2962ff;
    --accent-h: #1e53e5;
    --bull: #26a69a;
    --bear: #ef5350;
}

html, body {
    height: 100%; width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-0); color: var(--text-1);
    overflow: hidden; user-select: none; -webkit-user-select: none;
}

.layout { display: flex; flex-direction: column; height: 100vh; width: 100vw; }

/* ====== TOP BAR ====== */
.top-bar {
    display: flex; align-items: center; height: 44px; min-height: 44px;
    background: var(--bg-1); border-bottom: 1px solid var(--border);
    padding: 0 12px; gap: 4px; flex-shrink: 0; z-index: 100;
}
.logo { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; color: var(--accent); letter-spacing: 2px; margin-right: 16px; white-space: nowrap; }
.sep { width: 1px; height: 22px; background: var(--border-2); margin: 0 8px; flex-shrink: 0; }

.btn-group { display: flex; gap: 2px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    background: transparent; border: 1px solid transparent; color: var(--text-2);
    font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500;
    padding: 5px 12px; border-radius: 4px; cursor: pointer; transition: all 0.12s; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--bg-3); color: var(--text-1); }
.btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-icon { width: 32px; height: 30px; padding: 0; }
.btn-icon svg { width: 16px; height: 16px; }

/* ====== LAYOUT PICKER ====== */
.layout-picker { display: flex; gap: 3px; align-items: center; }
.layout-btn {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 26px; background: transparent; border: 1px solid transparent;
    color: var(--text-3); border-radius: 4px; cursor: pointer; transition: all 0.12s;
}
.layout-btn:hover { background: var(--bg-3); color: var(--text-2); }
.layout-btn.active { background: var(--bg-3); color: var(--text-1); border-color: var(--border-2); }
.layout-btn svg { pointer-events: none; }

/* ====== CHART INFO ====== */
#chart-info {
    display: flex; align-items: center; gap: 10px; margin-left: 16px;
    font-family: 'JetBrains Mono', monospace; font-size: 12px; white-space: nowrap; overflow: hidden;
}
.header-symbol { font-weight: 700; color: var(--text-1); font-size: 14px; }
.header-tf { background: var(--bg-2); padding: 2px 8px; border-radius: 3px; color: var(--text-2); font-size: 10px; font-weight: 600; letter-spacing: 0.5px; }
.header-price { font-weight: 600; font-size: 14px; }
.header-price.bull { color: var(--bull); }  .header-price.bear { color: var(--bear); }
.header-change { font-size: 11px; font-weight: 500; }
.header-change.bull { color: var(--bull); }  .header-change.bear { color: var(--bear); }
.header-candles { color: var(--text-3); font-size: 10px; }

.top-bar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ====== STATUS ====== */
#status { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.ok { background: var(--bull); box-shadow: 0 0 8px rgba(38,166,154,0.6); animation: pulse 2s ease infinite; }
.status-dot.loading { background: #ffa726; animation: pulse 0.6s ease infinite; }
.status-dot.error { background: var(--bear); box-shadow: 0 0 8px rgba(239,83,80,0.6); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ====== MAIN AREA ====== */
.main-area { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ====== TOOLBAR ====== */
.toolbar {
    width: 50px; min-width: 50px; background: var(--bg-1); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px;
    flex-shrink: 0; z-index: 50; overflow: visible;
}
.tool-btn {
    width: 38px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; color: var(--text-2);
    border-radius: 6px; cursor: pointer; transition: all 0.15s; position: relative; flex-shrink: 0;
}
.tool-btn:hover { background: rgba(41,98,255,0.1); color: var(--text-1); border-color: var(--border-2); }
.tool-btn.active { background: rgba(41,98,255,0.15); color: var(--accent); border-color: rgba(41,98,255,0.3); }
.tool-btn svg { width: 18px; height: 18px; pointer-events: none; }
.tool-sep { width: 26px; height: 1px; background: var(--border); margin: 4px 0; flex-shrink: 0; }
.tool-btn .tooltip {
    display: none; position: fixed;
    background: #1c2030; border: 1px solid #2a2e3e; color: #d1d4dc;
    padding: 6px 12px; border-radius: 6px; font-size: 12px; font-family: 'Inter', sans-serif;
    white-space: nowrap; z-index: 9999; pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6); font-weight: 500;
}
.tool-btn:hover .tooltip { display: block; }

/* ====== CHART GRID ====== */
.chart-grid {
    flex: 1; display: grid; gap: 2px; min-width: 0; min-height: 0;
    grid-template-columns: 1fr; grid-template-rows: 1fr;
}
.chart-grid.layout-1   { grid-template-columns: 1fr;     grid-template-rows: 1fr; }
.chart-grid.layout-2h  { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.chart-grid.layout-2v  { grid-template-columns: 1fr;     grid-template-rows: 1fr 1fr; }
.chart-grid.layout-3   { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.chart-grid.layout-4   { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* ====== CHART PANEL ====== */
.chart-panel {
    display: flex; flex-direction: column; background: var(--bg-0);
    border: 1px solid var(--border); border-radius: 2px;
    overflow: hidden; min-width: 0; min-height: 0; position: relative;
}
.chart-panel.active-panel { border-color: var(--accent); }

.chart-grid.layout-3 .chart-panel:first-child {
    grid-row: 1 / 3;
}

.panel-header {
    display: flex; align-items: center; height: 30px; min-height: 30px;
    background: var(--bg-1); border-bottom: 1px solid var(--border);
    padding: 0 8px; gap: 4px; flex-shrink: 0;
}

.panel-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none; color: var(--text-2);
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
    padding: 2px 8px; border-radius: 3px; cursor: pointer; transition: all 0.1s;
    white-space: nowrap; line-height: 1;
}
.panel-btn:hover { background: var(--bg-3); color: var(--text-1); }
.panel-btn.active { background: var(--accent); color: #fff; }

.panel-sep { width: 1px; height: 14px; background: var(--border); margin: 0 2px; }

/* ====== SYMBOL PICKER ====== */
.sym-btn {
    font-weight: 700; min-width: 55px; gap: 4px; padding: 2px 6px 2px 10px;
}
.sym-btn .sym-arrow {
    opacity: 0.5; transition: transform 0.2s, opacity 0.2s; flex-shrink: 0;
}
.sym-btn:hover .sym-arrow { opacity: 1; }

.sym-picker {
    position: absolute; top: 30px; left: 0; z-index: 200;
    background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 10px;
    width: 340px; max-height: 480px; display: none; flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    overflow: hidden;
}
.sym-picker.open { display: flex; }

.sym-search-wrap {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}
.sym-search-icon { color: var(--text-3); flex-shrink: 0; display: flex; }
.sym-search-input {
    flex: 1; background: transparent; border: none; color: var(--text-1);
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    outline: none; min-width: 0;
}
.sym-search-input::placeholder { color: var(--text-3); }
.sym-search-count {
    font-family: 'JetBrains Mono', monospace; font-size: 10px;
    color: var(--text-3); flex-shrink: 0;
}

.sym-tabs {
    display: flex; gap: 2px; padding: 6px 10px;
    border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.sym-tab {
    background: transparent; border: none; color: var(--text-3);
    font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
    padding: 4px 10px; border-radius: 4px; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.3px; transition: all 0.12s;
}
.sym-tab:hover { color: var(--text-2); background: var(--bg-3); }
.sym-tab.active { color: var(--accent); background: rgba(41,98,255,0.1); }

.sym-list {
    overflow-y: auto; flex: 1; max-height: 380px; padding: 4px 6px;
}

.sym-loading {
    padding: 30px; text-align: center; color: var(--text-3); font-size: 12px;
}

.sym-row {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 8px; border-radius: 6px; cursor: pointer;
    transition: background 0.1s; font-family: 'JetBrains Mono', monospace; font-size: 12px;
}
.sym-row:hover { background: var(--bg-3); }
.sym-row.active { background: rgba(41,98,255,0.1); border-left: 2px solid var(--accent); }
.sym-row.hidden { display: none; }
.sym-row.no-data { opacity: 0.35; }
.sym-row.no-data:hover { opacity: 0.55; }

.sym-row-rank {
    font-size: 9px; color: var(--text-3); min-width: 20px; text-align: right;
}
.sym-row-star { color: #ffa726; font-size: 11px; margin-right: -2px; }
.sym-row-name { font-weight: 700; color: var(--text-1); min-width: 55px; font-size: 13px; }
.sym-row-pair { color: var(--text-3); font-size: 10px; }

.sym-row-right {
    margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.sym-row-price { color: var(--text-2); font-size: 11px; font-weight: 500; }
.sym-row-vol { color: var(--text-3); font-size: 9px; }

/* ====== SYMBOL SEARCH MODAL ====== */
.btn-search {
    color: var(--text-1) !important; font-weight: 600 !important;
    border: 1px solid var(--border-2) !important; background: var(--bg-2) !important;
    padding: 5px 14px !important;
}
.btn-search:hover { background: var(--bg-3) !important; border-color: var(--accent) !important; }
.btn-search svg { opacity: 0.6; }

#sym-search-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10000;
    display: flex; align-items: flex-start; justify-content: center; padding-top: 60px;
    backdrop-filter: blur(2px);
}

.sym-modal {
    background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 12px;
    width: 560px; max-height: 75vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    animation: modalIn 0.15s ease;
    overflow: hidden;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sym-modal-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}
.sym-modal-icon { color: var(--text-3); display: flex; flex-shrink: 0; }
.sym-modal-input {
    flex: 1; background: transparent; border: none; color: var(--text-1);
    font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 500;
    outline: none; min-width: 0;
}
.sym-modal-input::placeholder { color: var(--text-3); font-weight: 400; }
.sym-modal-count {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: var(--text-3); flex-shrink: 0; margin-right: 4px;
}
.sym-modal-close {
    background: none; border: none; color: var(--text-3); cursor: pointer;
    padding: 4px; border-radius: 4px; display: flex; transition: all 0.12s;
}
.sym-modal-close:hover { color: var(--text-1); background: var(--bg-3); }

.sym-modal-tabs {
    display: flex; gap: 2px; padding: 8px 14px;
    border-bottom: 1px solid var(--border); background: var(--bg-1);
}
.sym-modal-tab {
    background: transparent; border: none; color: var(--text-3);
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
    padding: 5px 12px; border-radius: 5px; cursor: pointer; transition: all 0.12s;
}
.sym-modal-tab:hover { color: var(--text-2); background: var(--bg-3); }
.sym-modal-tab.active { color: var(--accent); background: rgba(41,98,255,0.12); }

.sym-modal-colheader {
    display: grid; grid-template-columns: 36px 1fr 100px 100px;
    padding: 6px 18px; border-bottom: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 600;
    color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px;
}
.col-rank { text-align: right; padding-right: 8px; }
.col-price { text-align: right; }
.col-vol { text-align: right; }

.sym-modal-list {
    overflow-y: auto; flex: 1; padding: 4px 8px;
}

.sym-modal-loading {
    padding: 40px; text-align: center; color: var(--text-3); font-size: 13px;
}

.sym-modal-row {
    display: grid; grid-template-columns: 36px 1fr 100px 100px;
    align-items: center; padding: 8px 10px; border-radius: 6px;
    cursor: pointer; transition: background 0.1s;
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
}
.sym-modal-row:hover { background: var(--bg-3); }
.sym-modal-row.current { background: rgba(41,98,255,0.08); border-left: 3px solid var(--accent); }
.sym-modal-row.hidden { display: none; }
.sym-modal-row.no-data { opacity: 0.3; }
.sym-modal-row.no-data:hover { opacity: 0.5; }

.sym-modal-row .col-rank { color: var(--text-3); font-size: 10px; text-align: right; padding-right: 8px; }
.sym-modal-row .col-name { display: flex; align-items: center; gap: 4px; }
.sym-modal-row .col-name strong { color: var(--text-1); font-size: 13px; }
.sym-modal-row .col-name .pair-label { color: var(--text-3); font-size: 10px; }
.sym-modal-row .col-name .prio-star { color: #ffa726; font-size: 12px; }
.sym-modal-row .col-price { color: var(--text-2); text-align: right; font-size: 11px; }
.sym-modal-row .col-vol { color: var(--text-3); text-align: right; font-size: 10px; }

.panel-price {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600;
}
.panel-price.bull { color: var(--bull); }
.panel-price.bear { color: var(--bear); }

.panel-change {
    font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 500;
    margin-left: 6px;
}
.panel-change.bull { color: var(--bull); }
.panel-change.bear { color: var(--bear); }

.chart-wrap {
    flex: 1; position: relative; overflow: hidden; min-height: 0;
}

/* ====== CUSTOM TF POPOVER ====== */
.tf-popover {
    position: absolute; top: 30px; left: 0; z-index: 150;
    background: var(--bg-1); border: 1px solid var(--border-2);
    border-radius: 6px; padding: 8px; display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5); min-width: 160px;
}
.tf-popover.open { display: block; }

.tf-popover-label {
    font-size: 10px; color: var(--text-3); font-weight: 600;
    letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px;
}

.tf-input-row {
    display: flex; gap: 4px; margin-bottom: 6px;
}

.tf-input {
    width: 50px; background: var(--bg-0); border: 1px solid var(--border-2);
    border-radius: 4px; color: var(--text-1); font-family: 'JetBrains Mono', monospace;
    font-size: 12px; padding: 4px 6px; text-align: center; outline: none;
}
.tf-input:focus { border-color: var(--accent); }

.tf-unit-btns { display: flex; gap: 2px; }
.tf-unit-btn {
    background: var(--bg-3); border: 1px solid transparent; color: var(--text-2);
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
    padding: 3px 8px; border-radius: 3px; cursor: pointer; transition: all 0.1s;
}
.tf-unit-btn:hover { color: var(--text-1); }
.tf-unit-btn.active { background: var(--accent); color: #fff; }

.tf-apply {
    width: 100%; background: var(--accent); border: none; color: #fff;
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
    padding: 5px; border-radius: 4px; cursor: pointer; transition: background 0.1s;
}
.tf-apply:hover { background: var(--accent-h); }

.tf-presets {
    display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px;
    padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.tf-preset {
    background: var(--bg-3); border: none; color: var(--text-2);
    font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 500;
    padding: 3px 7px; border-radius: 3px; cursor: pointer; transition: all 0.1s;
}
.tf-preset:hover { color: var(--text-1); background: var(--bg-2); }
.tf-preset.active { background: var(--accent); color: #fff; }

/* ====== INDICATOR PANEL ====== */
.indicator-panel {
    position: absolute; top: 0; right: 0; width: 300px; height: 100%;
    background: var(--bg-1); border-left: 1px solid var(--border); z-index: 80;
    display: flex; flex-direction: column;
    transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.indicator-panel.open { transform: translateX(0); }
.ind-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.ind-panel-header .close-btn {
    background: none; border: none; color: var(--text-2); cursor: pointer;
    font-size: 22px; line-height: 1; padding: 0 4px; border-radius: 4px; transition: all 0.12s;
}
.ind-panel-header .close-btn:hover { color: var(--text-1); background: var(--bg-3); }
.indicator-list { padding: 8px; overflow-y: auto; flex: 1; }
.ind-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: 8px; cursor: pointer; transition: all 0.12s; font-size: 13px; border: 1px solid transparent;
}
.ind-item:hover { background: var(--bg-3); }
.ind-item.active { background: rgba(41,98,255,0.08); border-color: rgba(41,98,255,0.2); }
.ind-item.active .ind-name { color: var(--accent); }
.ind-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ind-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ind-name { font-weight: 600; font-size: 13px; }
.ind-desc { font-size: 11px; color: var(--text-3); }

/* ====== DEBUG ====== */
#debug-overlay {
    position: fixed; bottom: 8px; left: 58px;
    background: rgba(15,19,32,0.95); border: 1px solid var(--bear); border-radius: 8px;
    padding: 12px 16px; font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: var(--bear); z-index: 1000; max-width: 500px; display: none; line-height: 1.6; white-space: pre-wrap;
}
#debug-overlay.visible { display: block; }

.watermark {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    font-family: 'JetBrains Mono', monospace; font-size: 40px; font-weight: 700;
    color: rgba(255,255,255,0.02); pointer-events: none; letter-spacing: 4px; z-index: 0;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ====== ALERT TOAST ====== */
.alert-toast {
    position: fixed; top: 60px; right: -400px; z-index: 10000;
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-1); border: 1px solid #ff9800; border-radius: 8px;
    padding: 14px 18px; min-width: 280px; max-width: 420px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 20px rgba(255,152,0,0.15);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'JetBrains Mono', monospace;
}
.alert-toast.show { right: 20px; }
.alert-toast-icon { flex-shrink: 0; }
.alert-toast-msg { font-size: 13px; color: var(--text-1); font-weight: 500; }

/* ====== ALERT FLASH ====== */
.alert-flash {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(255, 152, 0, 0); pointer-events: none;
    transition: background 0.15s ease;
}
.alert-flash.active {
    background: rgba(255, 152, 0, 0.08);
    animation: alertFlash 0.6s ease;
}
@keyframes alertFlash {
    0% { background: rgba(255, 152, 0, 0.12); }
    100% { background: rgba(255, 152, 0, 0); }
}

/* ====== REPLAY BAR ====== */
.replay-bar {
    position: fixed; bottom: 0; left: 50px; right: 0; height: 46px;
    background: #0f1320; border-top: 1px solid #1e2235;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; z-index: 500;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.replay-left, .replay-center, .replay-right {
    display: flex; align-items: center; gap: 8px;
}

.replay-label {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
    color: #2196f3; letter-spacing: 1px; background: rgba(33,150,243,0.1);
    padding: 3px 8px; border-radius: 4px;
}

.replay-status {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #787b86;
}

.replay-btn {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 30px; background: #151926; border: 1px solid #2a2e3e;
    color: #d1d4dc; border-radius: 5px; cursor: pointer;
    font-size: 14px; transition: all 0.12s;
    font-family: 'JetBrains Mono', monospace;
}
.replay-btn:hover { background: #1c2030; border-color: #2962ff; color: #fff; }

.replay-play { width: 42px; background: #2962ff; border-color: #2962ff; color: #fff; font-size: 16px; }
.replay-play:hover { background: #1e53e5; }

.replay-speed {
    width: auto; padding: 0 10px; font-size: 12px; font-weight: 600;
    color: #2196f3; background: rgba(33,150,243,0.1); border-color: rgba(33,150,243,0.3);
}
.replay-speed:hover { background: rgba(33,150,243,0.2); }

.replay-exit { color: #ef5350; border-color: rgba(239,83,80,0.3); background: rgba(239,83,80,0.08); font-size: 12px; }
.replay-exit:hover { background: rgba(239,83,80,0.15); border-color: #ef5350; }

.replay-reselect { font-size: 16px; color: #ff9800; }

.replay-counter {
    font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #787b86;
    background: #151926; padding: 4px 10px; border-radius: 4px; border: 1px solid #1e2235;
}

/* ====== USER AREA ====== */
#user-area { display: flex; align-items: center; margin-right: 8px; }

.user-logged { display: flex; align-items: center; gap: 6px; }
.user-name {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600;
    color: var(--text-1); background: rgba(41,98,255,0.1); padding: 3px 10px;
    border-radius: 4px; border: 1px solid rgba(41,98,255,0.2);
}
.user-login-btn {
    color: var(--accent) !important; border: 1px solid rgba(41,98,255,0.3) !important;
    background: rgba(41,98,255,0.08) !important; font-weight: 600 !important;
}
.user-login-btn:hover { background: rgba(41,98,255,0.15) !important; }
.user-logout-btn {
    font-size: 10px !important; color: var(--text-3) !important; padding: 3px 8px !important;
}
.user-logout-btn:hover { color: #ef5350 !important; }
.user-settings-btn { padding: 4px !important; }
.user-settings-btn:hover { color: var(--accent) !important; }

/* ====== AUTH MODAL ====== */
.auth-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}
.auth-modal {
    background: #0f1320; border: 1px solid #2a2e3e; border-radius: 12px;
    width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    overflow: hidden; animation: modalIn 0.15s ease;
}
.auth-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #1e2235; background: #151926;
}
.auth-tabs { display: flex; gap: 4px; }
.auth-tab {
    background: transparent; border: none; color: #787b86; cursor: pointer;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
    padding: 6px 16px; border-radius: 6px; transition: all 0.12s;
}
.auth-tab:hover { color: #d1d4dc; }
.auth-tab.active { color: #2962ff; background: rgba(41,98,255,0.12); }
.auth-close {
    background: none; border: none; color: #787b86; font-size: 22px;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.auth-close:hover { color: #d1d4dc; }
.auth-body { padding: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
    background: #151926; border: 1px solid #2a2e3e; border-radius: 6px;
    color: #d1d4dc; font-family: 'JetBrains Mono', monospace; font-size: 13px;
    padding: 10px 14px; outline: none; transition: border-color 0.12s;
}
.auth-input:focus { border-color: #2962ff; }
.auth-input::placeholder { color: #4a4e5a; }
.auth-submit {
    background: #2962ff; border: none; color: #fff; border-radius: 6px;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600;
    padding: 10px; cursor: pointer; transition: background 0.12s;
}
.auth-submit:hover { background: #1e53e5; }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-error {
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    color: #ef5350; min-height: 16px; text-align: center;
}

/* ====== SETTINGS MODAL ====== */
.settings-modal {
    background: #0f1320; border: 1px solid #2a2e3e; border-radius: 12px;
    width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    overflow: hidden; animation: modalIn 0.15s ease;
}
.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #1e2235; background: #151926;
}
.settings-title {
    font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700;
    color: #d1d4dc;
}
.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.settings-section {
    font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
    color: #4a4e5a; text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 4px;
}
.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0;
}
.settings-label {
    font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #787b86;
}
.settings-color {
    width: 36px; height: 28px; border: 1px solid #2a2e3e; border-radius: 4px;
    background: transparent; cursor: pointer; padding: 0;
}
.settings-color::-webkit-color-swatch-wrapper { padding: 2px; }
.settings-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.settings-select {
    background: #151926; border: 1px solid #2a2e3e; border-radius: 4px;
    color: #d1d4dc; font-family: 'JetBrains Mono', monospace; font-size: 11px;
    padding: 5px 10px; outline: none;
}
.settings-actions {
    display: flex; gap: 8px; margin-top: 12px;
}
.settings-actions .auth-submit { flex: 1; }
.settings-reset {
    background: transparent; border: 1px solid #2a2e3e; border-radius: 6px;
    color: #787b86; font-family: 'JetBrains Mono', monospace; font-size: 11px;
    padding: 8px 12px; cursor: pointer; transition: all 0.12s;
}
.settings-reset:hover { color: #ef5350; border-color: #ef5350; }
