/* ── 1. CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  --bg-base:     #080808;
  --bg-surface:  #111111;
  --bg-elevated: #181818;
  --bg-border:        rgba(255,255,255,0.06);
  --bg-border-strong: rgba(255,255,255,0.10);
  --bear:   #f23645;
  --bull:   #00c896;
  --accent: #f5a623;
  --text-primary:   #f0f0f0;
  --text-secondary: #888888;
  --text-muted:     #444444;
  --bear-dim:    rgba(242,54,69,0.10);
  --bear-border: rgba(242,54,69,0.30);
  --bull-dim:    rgba(0,200,150,0.10);
  --bull-border: rgba(0,200,150,0.30);
  --accent-dim:    rgba(245,166,35,0.10);
  --accent-border: rgba(245,166,35,0.30);
  --bg:            var(--bg-base);
  --bg2:           var(--bg-surface);
  --bg3:           var(--bg-elevated);
  --bg4:           #222222;
  --border:        var(--bg-border);
  --border-mid:    var(--bg-border-strong);
  --border-strong: rgba(255,255,255,0.20);
  --text:          var(--text-primary);
  --text-mid:      var(--text-secondary);
  --text-dim:      var(--text-muted);
  --amber:         var(--accent);
  --amber-dim:     var(--accent-dim);
  --amber-border:  var(--accent-border);
  --amber-bright:  #ffb340;
  --cyan:          var(--bull);
  --cyan-dim:      var(--bull-dim);
  --cyan-border:   var(--bull-border);
  --cyan-bright:   #00e6ab;
  --green:         var(--bull);
  --red:           var(--bear);
  --blue:          #3b82f6;
  --purple:        #a78bfa;
  --font-sans: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;
  --radius-chip: 3px;
  --radius-data: 6px;
  --radius-card: 6px;
  --ease-out:   cubic-bezier(0.16,1,0.3,1);
  --transition: 150ms cubic-bezier(0.16,1,0.3,1);
}

/* ── 2. Reset + Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
::selection { background: rgba(245,166,35,0.28); color: var(--text-primary); }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border-strong); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

/* ── 3. Grain Overlay ─────────────────────────────────────────────────────── */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.032;
  background-size: 192px 192px;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ── 4. Login Screen ──────────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse 60% 45% at 50% 0%, rgba(245,166,35,0.06) 0%, transparent 70%);
}

.login-box {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-strong);
  border-radius: 8px;
  padding: 48px 40px 40px;
  width: 360px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.80), 0 0 0 1px rgba(255,255,255,0.03);
}

.login-logo { margin-bottom: 22px; }

.login-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent-border);
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 24px rgba(245,166,35,0.15);
}

.login-logo-fallback { font-size: 48px; color: var(--accent); display: block; }

.login-box h2 {
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 10px;
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.login-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-primary);
  padding: 13px 16px;
  border-radius: var(--radius-data);
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.login-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.10);
}

.login-box button {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 13px;
  border-radius: var(--radius-data);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
  transition: opacity var(--transition), transform var(--transition);
}
.login-box button:hover { opacity: 0.9; transform: scale(1.02); }
.login-box button:active { transform: scale(0.97); }

#login-error {
  color: var(--bear);
  margin-top: 12px;
  font-size: 12px;
  min-height: 16px;
  font-weight: 500;
}

/* ── 5. Toast ─────────────────────────────────────────────────────────────── */

/* ── 6. App Shell ─────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── 7. Header ────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--bg-border);
  height: 48px;
  flex-shrink: 0;
  gap: 16px;
  position: relative;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent-border); flex-shrink: 0; }
.header-title-group { display: flex; flex-direction: column; gap: 1px; }
.title { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-primary); line-height: 1.2; }
.title-sub { font-size: 8px; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.header-center { display: flex; align-items: baseline; gap: 10px; }
#current-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1;
}
#price-date { font-size: 10px; color: var(--text-muted); font-weight: 500; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.regime-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--bear-dim);
  color: var(--bear);
  border: 1px solid var(--bear-border);
  font-family: var(--font-sans);
}
.regime-badge.bull { background: var(--bull-dim); color: var(--bull); border-color: var(--bull-border); }
.setup-btn {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-data);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}
.setup-btn:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); transform: scale(1.02); }
.setup-btn:active { transform: scale(0.97); }
.zoom-controls { display: flex; gap: 2px; }
.zoom-btn {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-data);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}
.zoom-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--bg-border-strong); transform: scale(1.02); }
.zoom-btn:active { transform: scale(0.97); }
.zoom-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* ── 8. Setup Panel ───────────────────────────────────────────────────────── */
#setup-panel { background: var(--bg-surface); border-bottom: 1px solid var(--bg-border); flex-shrink: 0; position: relative; z-index: 90; }
.setup-panel-inner { display: flex; gap: 0; max-width: 100%; overflow-x: auto; }
.setup-group { flex: 1; padding: 14px 18px; border-right: 1px solid var(--bg-border); min-width: 260px; }
.setup-group:last-child { border-right: none; }
.setup-group-title { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.setup-group-subtitle { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-top: 12px; margin-bottom: 8px; opacity: 0.7; }
.setup-row { display: flex; gap: 6px; margin-bottom: 6px; }
.setup-row input[type="date"] {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-data);
  font-size: 12px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  outline: none;
  min-width: 0;
  transition: border-color var(--transition);
  color-scheme: dark;
}
.setup-row input[type="date"]:focus { border-color: var(--accent); }
.setup-row button {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-secondary);
  padding: 7px 12px;
  border-radius: var(--radius-data);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}
.setup-row button:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); transform: scale(1.02); }
.setup-row button:active { transform: scale(0.97); }
#override-msg, #ycl-msg { font-size: 11px; color: var(--bull); min-height: 14px; margin-top: 4px; font-weight: 500; }
#wcl-projections { margin-top: 8px; display: flex; flex-direction: column; gap: 0; }
#manual-dcl-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.manual-dcl-row { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); font-variant-numeric: tabular-nums; padding: 3px 0; }
.dcl-delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; transition: color var(--transition); }
.dcl-delete-btn:hover { color: var(--bear); }

/* ── 9. Main Layout ───────────────────────────────────────────────────────── */
.main-layout { display: flex; flex: 1; overflow: hidden; }
.charts-column { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-width: 0; }

/* ── 10. Chart Toolbar ────────────────────────────────────────────────────── */
.chart-toolbar {
  display: flex;
  gap: 18px;
  padding: 6px 12px;
  background: transparent;
  border-bottom: 1px solid var(--bg-border);
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
}
.bar-mode-controls { display: flex; gap: 2px; margin-right: 6px; flex-shrink: 0; }
.bar-mode-btn {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border-strong);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: var(--radius-data);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.bar-mode-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.bar-mode-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.chart-toolbar label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; color: var(--text-muted); white-space: nowrap; font-weight: 500; transition: color var(--transition); user-select: none; }
.chart-toolbar label:hover { color: var(--text-secondary); }
.chart-toolbar input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; width: 12px; height: 12px; flex-shrink: 0; }
.chart-toolbar span { font-size: 11px; font-weight: 600; }

/* ── Key Level Buttons ────────────────────────────────────────────────────── */
.key-level-controls { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.key-level-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #000;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 150ms, transform 150ms;
  white-space: nowrap;
}
.key-level-btn:hover { opacity: 0.85; transform: scale(1.02); }
.key-level-btn:active { transform: scale(0.97); }
.key-level-btn.secondary { background: transparent; border-color: var(--bg-border-strong); color: var(--text-secondary); }
.key-level-btn.secondary:hover { border-color: var(--accent-border); color: var(--accent); }
.key-level-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Key Level Toggle Bar ─────────────────────────────────────────────────── */
.klvl-toggle-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 12px;
  background: transparent;
  border-top: 1px solid var(--bg-border);
  flex-shrink: 0;
  align-items: center;
}
.klvl-chip { display: flex; align-items: center; cursor: pointer; user-select: none; }
.klvl-chip input[type="checkbox"] { display: none; }
.klvl-chip span {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 10px;
  border: 1px solid var(--klvl-color, #666);
  color: #555;
  letter-spacing: 0.04em;
  transition: color 120ms, background 120ms, opacity 120ms;
  opacity: 0.45;
}
.klvl-chip.on span {
  color: var(--klvl-color, #aaa);
  background: color-mix(in srgb, var(--klvl-color, #aaa) 12%, transparent);
  opacity: 1;
}
.klvl-chip:hover span { opacity: 0.85; }

/* ── 11. Chart Containers ─────────────────────────────────────────────────── */
#main-chart { flex: 1; min-height: 0; position: relative; }
.pane-label { position: absolute; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.35); font-size: 9px; pointer-events: none; z-index: 10; letter-spacing: 0.1em; text-transform: uppercase; font-family: inherit; background: rgba(8,8,8,0.75); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }

/* ── 12. Marker Tooltip ───────────────────────────────────────────────────── */
#marker-tooltip {
  position: absolute;
  z-index: 20;
  background: rgba(17,17,17,0.97);
  border: 1px solid var(--bg-border-strong);
  border-radius: var(--radius-card);
  min-width: 236px;
  max-width: 280px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.80), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  pointer-events: all;
  animation: tooltipIn 150ms cubic-bezier(0.16,1,0.3,1);
}
@keyframes tooltipIn {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.mtip-header { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px 9px; border-bottom: 1px solid var(--bg-border); }
#mtip-title { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-primary); }
#mtip-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 0; line-height: 1; transition: color var(--transition); }
#mtip-close:hover { color: var(--text-primary); }
#mtip-body { padding: 11px 14px; display: flex; flex-direction: column; gap: 5px; }
.mtip-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.mtip-row .lbl { color: var(--text-muted); }
.mtip-row .val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); font-family: var(--font-mono); }
.mtip-row .val.win  { color: var(--bull); }
.mtip-row .val.loss { color: var(--bear); }
.mtip-rules { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; border-top: 1px solid var(--bg-border); padding-top: 9px; }
.mtip-rule { font-size: 10px; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.mtip-footer { padding: 9px 14px 12px; }
.mtip-detail-btn {
  width: 100%;
  padding: 7px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-data);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background var(--transition), transform var(--transition);
}
.mtip-detail-btn:hover { background: rgba(245,166,35,0.20); transform: scale(1.02); }
.mtip-detail-btn:active { transform: scale(0.97); }

/* ── 13. Alert Card ───────────────────────────────────────────────────────── */
#alert-card {
  position: absolute;
  top: 48px;
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius-card);
  border: 1px solid var(--bg-border-strong);
  border-left-width: 3px;
  backdrop-filter: blur(16px);
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  pointer-events: all;
  background: rgba(17,17,17,0.94);
}
#alert-card.watch   { background: rgba(17,17,17,0.94); border-color: var(--bg-border-strong); border-left-color: var(--bg-border-strong); }
#alert-card.setup   { background: rgba(24,18,8,0.95); border-color: var(--accent-border); border-left-color: var(--accent); }
#alert-card.enter,
#alert-card.trade   { background: rgba(5,18,14,0.95); border-color: var(--bull-border); border-left-color: var(--bull); }
#alert-card.exit    { background: rgba(22,8,10,0.95); border-color: var(--bear-border); border-left-color: var(--bear); }
#alert-card.prepare { background: rgba(10,14,28,0.95); border-color: rgba(59,130,246,0.28); border-left-color: #3b82f6; }
.alert-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-content { flex: 1; min-width: 0; }
.alert-title { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px; color: var(--text-secondary); }
#alert-card.watch   .alert-title { color: var(--text-secondary); }
#alert-card.setup   .alert-title { color: var(--accent); }
#alert-card.enter   .alert-title,
#alert-card.trade   .alert-title { color: var(--bull); }
#alert-card.exit    .alert-title { color: var(--bear); }
#alert-card.prepare .alert-title { color: #3b82f6; }
.alert-body { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.alert-actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.alert-btn {
  padding: 5px 12px;
  border-radius: var(--radius-chip);
  border: 1px solid;
  background: transparent;
  font-size: 10px;
  font-family: var(--font-sans);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
  transition: background var(--transition), transform var(--transition);
}
.alert-btn:hover  { transform: scale(1.02); }
.alert-btn:active { transform: scale(0.97); }
.alert-btn.green { border-color: var(--bull-border); color: var(--bull); }
.alert-btn.green:hover { background: var(--bull-dim); }
.alert-btn.red { border-color: var(--bear-border); color: var(--bear); }
.alert-btn.red:hover { background: var(--bear-dim); }
.alert-btn.dim { border-color: var(--bg-border-strong); color: var(--text-muted); }
.alert-btn.dim:hover { background: rgba(255,255,255,0.04); }

/* ── 13b. YCL Banner ────────────────────────────────────────────────────── */
#ycl-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 10; padding: 14px 18px; min-width: 360px; max-width: 520px;
  background: rgba(239, 83, 80, 0.10); border: 1px solid rgba(239, 83, 80, 0.55);
  border-radius: 6px; backdrop-filter: blur(8px);
}
.ycl-banner__title { color: #ef5350; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ycl-banner__body  { color: var(--text-secondary, #aaa); font-size: 12px; line-height: 1.45; margin-bottom: 10px; }
.ycl-banner__row   { display: flex; gap: 8px; align-items: center; }
#ycl-date-input    {
  flex: 1; padding: 6px 8px; background: rgba(0,0,0,0.4); color: var(--text-primary, #ddd);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; font-family: var(--font-mono);
}
#ycl-seed-btn      {
  padding: 6px 14px; background: rgba(239, 83, 80, 0.25); color: #ef5350;
  border: 1px solid rgba(239, 83, 80, 0.55); border-radius: 4px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
#ycl-seed-btn:hover { background: rgba(239, 83, 80, 0.40); }
#ycl-seed-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ycl-banner__error { color: #ef5350; font-size: 11px; margin-top: 6px; min-height: 14px; }

#ycl-candidates-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 10; padding: 14px 18px; min-width: 380px; max-width: 560px;
  background: rgba(245, 166, 35, 0.10); border: 1px solid rgba(245, 166, 35, 0.55);
  border-radius: 6px; backdrop-filter: blur(8px);
}
.ycl-candidates__title { color: #f5a623; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ycl-candidates__body  { color: var(--text-secondary, #aaa); font-size: 12px; line-height: 1.45; margin-bottom: 10px; }
.ycl-cand {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(245, 166, 35, 0.25); border-radius: 4px;
  margin-bottom: 6px;
}
.ycl-cand__date  { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary, #ddd); }
.ycl-cand__price { font-family: var(--font-mono); color: var(--text-muted, #888); font-size: 11px; }
.ycl-cand__dots  { display: flex; gap: 4px; flex: 1; padding-left: 8px; }
.ycl-cand__dot   { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.ycl-cand__dot.on { background: #26a69a; box-shadow: 0 0 4px rgba(38,166,154,0.6); }
.ycl-cand__btn {
  padding: 4px 12px; background: rgba(245, 166, 35, 0.25); color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.55); border-radius: 4px; font-weight: 600;
  cursor: pointer; font-size: 11px; white-space: nowrap;
}
.ycl-cand__btn:hover    { background: rgba(245, 166, 35, 0.40); }
.ycl-cand__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 14. Cycle Bars ───────────────────────────────────────────────────────── */
.cycle-bar { display: flex; height: 56px; border-top: none; background: var(--bg-surface); flex-shrink: 0; align-items: center; }
.cycle-stat { flex: 1; padding: 0 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; justify-content: center; }
.cycle-stat .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cycle-stat .value { font-size: 14px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cross-date { font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; line-height: 1; }
.cycle-stat--day { background: rgba(245,166,35,0.04); }
.cycle-stat--day .label { color: rgba(245,166,35,0.55); }
.cycle-stat--day .value { font-size: 15px; font-weight: 700; color: var(--accent); }
.cycle-stat--dcl .value { color: var(--bull); font-weight: 700; }
.weekly-bar { background: #0d1010; border-top: 1px solid rgba(0,200,150,0.14) !important; }
.weekly-bar .label { color: rgba(0,200,150,0.40); }
.weekly-bar .value { color: rgba(0,200,150,0.85); }
.weekly-bar-label { flex: 0 0 auto; width: 32px; min-width: 32px; display: flex; align-items: center; justify-content: center; padding: 4px; border-right: 1px solid rgba(0,200,150,0.12); }
.weekly-tag { font-size: 7px; font-weight: 800; letter-spacing: 0.12em; color: rgba(0,200,150,0.40); text-transform: uppercase; writing-mode: vertical-lr; transform: rotate(180deg); }
.wcl-active   { color: var(--bull) !important; font-weight: 700; }
.wcl-inactive { color: var(--text-muted) !important; }

/* ── 15. Sidebar ──────────────────────────────────────────────────────────── */
.sidebar { width: 340px; background: var(--bg-surface); border-left: 1px solid var(--bg-border); display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
/* All direct sidebar children must not compress, sidebar itself scrolls */
.sidebar > * { flex-shrink: 0; }
/* Fade hint at bottom indicates more content below */
.sidebar::after {
  content: '';
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--bg-surface));
  pointer-events: none;
  flex-shrink: 0;
  display: block;
}
#signal-state-box { position: relative; padding: 24px 20px 20px; border-bottom: 1px solid var(--bg-border); text-align: center; overflow: hidden; background: var(--bg-surface); }
.state-glow-layer { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 500ms ease; }
#signal-state-box:has(.state-label.setup) .state-glow-layer {
  background: radial-gradient(ellipse 80% 50% at 50% -5%, rgba(245,166,35,0.18) 0%, transparent 65%);
  opacity: 1;
}
#signal-state-box:has(.state-label.entry) .state-glow-layer,
#signal-state-box:has(.state-label.trade) .state-glow-layer {
  background: radial-gradient(ellipse 80% 50% at 50% -5%, rgba(0,200,150,0.18) 0%, transparent 65%);
  opacity: 1;
}
#signal-state-box:has(.state-label.exit) .state-glow-layer {
  background: radial-gradient(ellipse 80% 50% at 50% -5%, rgba(242,54,69,0.16) 0%, transparent 65%);
  opacity: 1;
}
.state-pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); margin: 0 auto 16px; position: relative; z-index: 1; transition: background 300ms ease; }
#signal-state-box:has(.state-label.setup) .state-pulse-dot { background: var(--accent); animation: pulseAccent 2.2s ease-in-out infinite; }
#signal-state-box:has(.state-label.entry) .state-pulse-dot { background: var(--bull); animation: pulseBull 2s ease-in-out infinite; }
#signal-state-box:has(.state-label.trade) .state-pulse-dot { background: var(--bull); animation: pulseBull 2s ease-in-out infinite; }
#signal-state-box:has(.state-label.exit)  .state-pulse-dot { background: var(--bear); animation: pulseBear 1.4s ease-in-out infinite; }
@keyframes pulseAccent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,0.55); }
  60%       { box-shadow: 0 0 0 8px rgba(245,166,35,0); }
}
@keyframes pulseBull {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,200,150,0.55); }
  60%       { box-shadow: 0 0 0 8px rgba(0,200,150,0); }
}
@keyframes pulseBear {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242,54,69,0.60); }
  60%       { box-shadow: 0 0 0 8px rgba(242,54,69,0); }
}
.state-label-row { position: relative; z-index: 1; margin-bottom: 10px; }
.state-label {
  display: inline-block;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 12px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--bg-border-strong);
  background: var(--bg-elevated);
}
.state-label.setup { color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim); }
.state-label.entry { color: var(--bull); border-color: var(--bull-border); background: var(--bull-dim); }
.state-label.trade { color: var(--bull); border-color: var(--bull-border); background: var(--bull-dim); }
.state-label.exit  { color: var(--bear); border-color: var(--bear-border); background: var(--bear-dim); }
#state-score {
  position: relative;
  z-index: 1;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color 350ms ease;
}
#signal-state-box:has(.state-label.setup) #state-score { color: var(--accent); }
#signal-state-box:has(.state-label.entry) #state-score,
#signal-state-box:has(.state-label.trade) #state-score { color: var(--bull); }
#signal-state-box:has(.state-label.exit)  #state-score { color: var(--bear); }
.state-sublabel { position: relative; z-index: 1; font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin-top: 8px; }
.state-progress-track { position: relative; z-index: 1; width: 100%; height: 2px; background: var(--bg-elevated); border-radius: 1px; margin-top: 14px; overflow: hidden; }
#state-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 1px;
  background: var(--text-muted);
  transition: width 400ms cubic-bezier(0.16,1,0.3,1), background 350ms ease;
}
#signal-state-box:has(.state-label.setup) #state-progress-fill { background: var(--accent); }
#signal-state-box:has(.state-label.entry) #state-progress-fill,
#signal-state-box:has(.state-label.trade) #state-progress-fill { background: var(--bull); }
#signal-state-box:has(.state-label.exit)  #state-progress-fill { background: var(--bear); }

/* ── 16. Rules Mode Header ────────────────────────────────────────────────── */
#rules-mode-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; border-bottom: 1px solid var(--bg-border); }
.rules-mode-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); transition: background var(--transition); }
.rules-mode-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); transition: color var(--transition); }
#rules-mode-header[data-mode="bear"] .rules-mode-dot  { background: var(--bear); }
#rules-mode-header[data-mode="bear"] .rules-mode-label { color: var(--bear); }
#rules-mode-header[data-mode="bull"] .rules-mode-dot  { background: var(--bull); }
#rules-mode-header[data-mode="bull"] .rules-mode-label { color: var(--bull); }

/* ── 16b. Bull Preconditions Header ──────────────────────────────────────── */
.preconditions-header { border-bottom: 1px solid var(--bg-border); }
.preconditions-header .rules-mode-dot  { background: var(--bull) !important; }
.preconditions-header .rules-mode-label { color: var(--bull) !important; opacity: 0.6; }
#bull-preconditions { border-bottom: 1px solid var(--bg-border); }
#bull-preconditions .rule-item:has(.rule-text.passed) .rule-icon { background: var(--bull); box-shadow: none; }

/* ── 17. Rules Checklist ──────────────────────────────────────────────────── */
.rules-checklist { display: flex; flex-direction: column; background: var(--bg-surface); padding: 2px 0 12px; position: relative; }
.rule-item { display: flex; align-items: flex-start; gap: 9px; padding: 6px 12px; border-radius: var(--radius-chip); transition: background var(--transition); margin: 0 6px; }
.rule-item:hover { background: var(--bg-elevated); }
.rule-item:has(.rule-text.passed) { background: rgba(255,255,255,0.025); }
.rule-icon { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.08); flex-shrink: 0; margin-top: 4px; transition: background var(--transition), box-shadow var(--transition); }
.rule-item:has(.rule-text.passed) .rule-icon { background: var(--bull); }
.rule-text { color: var(--text-secondary); flex: 1; font-size: 11px; font-weight: 400; line-height: 1.45; transition: color var(--transition); }
.rule-text.passed { color: var(--text-primary); font-weight: 600; }
.rule-item:has(.rule-text.passed) .rule-icon { background: var(--bull); box-shadow: 0 0 6px rgba(0,200,150,0.50); }
.rule-item.non-scoring { opacity: 0.55; }
.rule-extra { font-size: 10px; color: var(--text-muted); margin-left: 6px; }

/* ── 18. Modal ────────────────────────────────────────────────────────────── */
#signal-modal { position: fixed; inset: 0; z-index: 500; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.80); display: flex; align-items: center; justify-content: center; z-index: 500; backdrop-filter: blur(4px); }
.modal-box { background: var(--bg-elevated); border: 1px solid var(--bg-border-strong); border-radius: var(--radius-card); width: 480px; max-width: 95vw; max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,0.70); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--bg-border); }
.modal-header span, #modal-title { font-size: 13px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.02em; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0; line-height: 1; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }
#modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 9px; }
.modal-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; gap: 10px; }
.modal-row .label { color: var(--text-muted); flex-shrink: 0; }
.modal-row .value { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; font-family: var(--font-mono); }
.modal-row .value.win  { color: var(--bull); }
.modal-row .value.loss { color: var(--bear); }
.modal-rules { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
#modal-actions { padding: 12px 20px; border-top: 1px solid var(--bg-border); display: flex; gap: 7px; flex-wrap: wrap; }
#modal-ai { padding: 12px 20px; border-top: 1px solid var(--bg-border); font-size: 11px; color: var(--text-secondary); line-height: 1.65; }
.ai-label { font-weight: 700; color: var(--accent); margin-bottom: 5px; display: block; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
.modal-btn { padding: 8px 14px; border-radius: var(--radius-data); border: 1px solid var(--bg-border-strong); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; font-size: 11px; font-family: var(--font-sans); font-weight: 600; transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition); }
.modal-btn:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); transform: scale(1.02); }
.modal-btn:active { transform: scale(0.97); }
.modal-btn.confirm { background: var(--bull-dim); border-color: var(--bull-border); color: var(--bull); }
.modal-btn.confirm:hover { background: rgba(0,200,150,0.18); }
.modal-btn.danger { background: var(--bear-dim); border-color: var(--bear-border); color: var(--bear); }
.modal-btn.danger:hover { background: rgba(242,54,69,0.18); }
.modal-btn.loading { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── 19. Signal Rows ──────────────────────────────────────────────────────── */
.sidebar-section { padding: 14px; border-bottom: 1px solid var(--bg-border); }
.section-title { font-size: 9px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.signal-row { padding: 9px 10px; border-radius: var(--radius-data); background: var(--bg-elevated); margin-bottom: 5px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border: 1px solid var(--bg-border); transition: border-color var(--transition), background var(--transition), transform var(--transition); }
.signal-row:hover { border-color: var(--bg-border-strong); background: #1e1e1e; transform: translateX(1px); }
.signal-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.signal-state-chip { font-weight: 700; color: var(--accent); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: var(--radius-chip); background: var(--accent-dim); border: 1px solid var(--accent-border); }
.signal-date { color: var(--text-muted); font-size: 10px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.signal-detail { font-size: 10px; color: var(--text-secondary); line-height: 1.4; }
.signal-outcome { font-weight: 700; font-size: 10px; }
.signal-outcome.win  { color: var(--bull); }
.signal-outcome.loss { color: var(--bear); }
.signal-outcome.open { color: var(--accent); }
.outcome-badge { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 6px; border-radius: var(--radius-chip); }
.outcome-badge.win  { background: var(--bull-dim); color: var(--bull); border: 1px solid var(--bull-border); }
.outcome-badge.loss { background: var(--bear-dim); color: var(--bear); border: 1px solid var(--bear-border); }
.outcome-badge.open { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.signal-delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; opacity: 0; transition: opacity var(--transition), color var(--transition); flex-shrink: 0; }
.signal-row:hover .signal-delete-btn { opacity: 1; }
.signal-delete-btn:hover { color: var(--bear); }
#active-signal-info { font-size: 11px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.65; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.signal-action-row { display: flex; gap: 5px; flex-wrap: wrap; }
.signal-action-btn { padding: 6px 11px; border-radius: var(--radius-data); border: 1px solid var(--bg-border-strong); background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer; font-size: 11px; font-family: var(--font-sans); font-weight: 600; transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition); }
.signal-action-btn:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); transform: scale(1.02); }
.signal-action-btn:active { transform: scale(0.97); }
.signal-action-btn.green { border-color: var(--bull-border); color: var(--bull); }
.signal-action-btn.green:hover { background: var(--bull-dim); }
.signal-action-btn.red { border-color: var(--bear-border); color: var(--bear); }
.signal-action-btn.red:hover { background: var(--bear-dim); }
.wcl-proj-row { padding: 7px 0; border-bottom: 1px solid var(--bg-border); display: flex; flex-direction: column; gap: 3px; }
.wcl-proj-row:last-child { border-bottom: none; }
.wcl-proj-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.wcl-proj-num { color: var(--accent); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.wcl-proj-status { font-size: 9px; padding: 2px 7px; border-radius: var(--radius-chip); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.wcl-proj-status.projected   { background: rgba(59,130,246,0.10); color: #3b82f6; }
.wcl-proj-status.approaching { background: var(--accent-dim); color: var(--accent); }
.wcl-proj-status.active      { background: var(--bull-dim); color: var(--bull); }
.wcl-proj-status.past        { background: rgba(68,68,68,0.10); color: var(--text-muted); }
.wcl-proj-dates { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.override-row, .bull-ycl-row { display: flex; gap: 6px; margin-bottom: 6px; }
.override-row input, .bull-ycl-row input { flex: 1; background: var(--bg-elevated); border: 1px solid var(--bg-border-strong); color: var(--text-primary); padding: 7px 10px; border-radius: var(--radius-data); font-size: 12px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; outline: none; min-width: 0; transition: border-color var(--transition); color-scheme: dark; }
.override-row input:focus, .bull-ycl-row input:focus { border-color: var(--accent); }
.override-row button, .bull-ycl-row button { background: var(--bg-elevated); border: 1px solid var(--bg-border-strong); color: var(--text-secondary); padding: 7px 11px; border-radius: var(--radius-data); cursor: pointer; font-size: 11px; font-family: var(--font-sans); font-weight: 600; white-space: nowrap; transition: color var(--transition), border-color var(--transition), background var(--transition); }
.override-row button:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); }
.bull-ycl-row button:hover { border-color: var(--bull-border); color: var(--bull); background: var(--bull-dim); }

/* ── 20. Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .sidebar { width: 320px; }
  #current-price { font-size: 24px; }
  #state-score { font-size: 28px; }
}
@media (max-width: 1100px) {
  .sidebar { width: 300px; }
  #current-price { font-size: 22px; }
  #state-score { font-size: 26px; }
  .zoom-btn { padding: 3px 8px; font-size: 10px; }
}
@media (max-width: 900px) {
  .sidebar { width: 280px; }
  .title-sub { display: none; }
  header { padding: 0 12px; gap: 10px; height: 44px; }
  #current-price { font-size: 20px; }
  #state-score { font-size: 24px; }
  .cycle-stat { padding: 0 7px; }
  .cycle-stat .value { font-size: 10px; }
  .cycle-stat .label { font-size: 8px; }
  .setup-panel-inner { flex-direction: column; }
  .setup-group { min-width: unset; border-right: none; border-bottom: 1px solid var(--bg-border); }
  .setup-group:last-child { border-bottom: none; }
}
@media (max-width: 700px) {
  .header-center { display: none; }
  .sidebar { display: none; }
}

/* ── 21. Micro-interactions ───────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[id$="-val"], [id$="-score"], [id$="-price"], [id$="-day"], [id$="-week"],
[id$="-window"], [id$="-from"], #translation, #weekly-trans, #wcl-in-window { font-variant-numeric: tabular-nums; }

/* ── Animations ──────────────────────────────────────────────────────────── */

/* 1. Progress bar */
#state-progress-fill {
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Rule item entrance */
@keyframes ruleSlideIn {
  from { transform: translateX(-4px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.rule-item { animation: ruleSlideIn 150ms ease-out both; }
.rule-item:nth-child(1)  { animation-delay:   0ms; }
.rule-item:nth-child(2)  { animation-delay:  10ms; }
.rule-item:nth-child(3)  { animation-delay:  20ms; }
.rule-item:nth-child(4)  { animation-delay:  30ms; }
.rule-item:nth-child(5)  { animation-delay:  40ms; }
.rule-item:nth-child(6)  { animation-delay:  50ms; }
.rule-item:nth-child(7)  { animation-delay:  60ms; }
.rule-item:nth-child(8)  { animation-delay:  70ms; }
.rule-item:nth-child(9)  { animation-delay:  80ms; }
.rule-item:nth-child(10) { animation-delay:  90ms; }
.rule-item:nth-child(11) { animation-delay: 100ms; }
.rule-item:nth-child(12) { animation-delay: 110ms; }
.rule-item:nth-child(13) { animation-delay: 120ms; }
.rule-item:nth-child(14) { animation-delay: 130ms; }
.rule-item:nth-child(15) { animation-delay: 140ms; }
.rule-item:nth-child(16) { animation-delay: 150ms; }
.rule-item:nth-child(17) { animation-delay: 160ms; }
.rule-item:nth-child(18) { animation-delay: 170ms; }
.rule-item:nth-child(19) { animation-delay: 180ms; }

/* 3. Regime badge pulse */
@keyframes bearPulse {
  0%   { box-shadow: 0 0 0 0 rgba(242, 54, 69, 0); }
  40%  { box-shadow: 0 0 8px 2px rgba(242, 54, 69, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(242, 54, 69, 0); }
}
@keyframes bullPulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  40%  { box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.regime-badge:not(.bull) { animation: bearPulse 600ms ease-out 1; }
.regime-badge.bull       { animation: bullPulse 600ms ease-out 1; }

/* 4. Alert card entrance */
@keyframes alertSlideIn {
  from { transform: translateY(-6px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#alert-card { animation: alertSlideIn 200ms cubic-bezier(0.16, 1, 0.3, 1); }

/* 5. Signal state box glow layer */
.state-glow-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: transparent;
  transition: background 300ms ease;
}
#signal-state-box:has(.state-label.setup) .state-glow-layer {
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(245, 166, 35, 0.06), transparent);
}
#signal-state-box:has(.state-label.entry) .state-glow-layer,
#signal-state-box:has(.state-label.trade) .state-glow-layer {
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0, 200, 150, 0.08), transparent);
}
#signal-state-box:has(.state-label.exit) .state-glow-layer {
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(242, 54, 69, 0.08), transparent);
}

/* 6. Button micro-interactions */
button {
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 200ms ease,
              box-shadow 200ms ease,
              color 200ms ease;
}
button:hover  { transform: scale(1.02); }
button:active { transform: scale(0.97); }

/* 7. Zoom button active state */
.zoom-btn {
  transition: all 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.zoom-btn.active {
  border-bottom: 2px solid var(--accent);
  filter: brightness(1.25);
}

/* 8. Checkbox MA toggle indicator */
input[type="checkbox"]:not(:checked) + span { opacity: 0.35; }
input[type="checkbox"]:checked + span       { opacity: 1; }
input[type="checkbox"] + span { transition: opacity 150ms ease; }

/* 9. Marker tooltip entrance */
#marker-tooltip { animation: alertSlideIn 150ms ease-out; }

/* 10. Modal entrance */
@keyframes fadeIn  {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-overlay { animation: fadeIn  150ms ease; }
.modal-box     { animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1); }

/* 11. Progress fill color per regime */
body[data-regime="bull"] #state-progress-fill { background: var(--green); }
body[data-regime="bear"] #state-progress-fill { background: var(--red); }

/* 12. Pulse dot ring animation */
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0px currentColor; opacity: 0.8; }
  70%  { box-shadow: 0 0 0 6px currentColor; opacity: 0; }
  100% { box-shadow: 0 0 0 0px currentColor; opacity: 0; }
}
.state-pulse-dot {
  animation: pulseRing 2s ease-out infinite;
}
#signal-state-box:has(.state-label.setup) .state-pulse-dot {
  color: rgba(245, 166, 35, 0.6);
}
#signal-state-box:has(.state-label.entry) .state-pulse-dot,
#signal-state-box:has(.state-label.trade) .state-pulse-dot {
  color: rgba(0, 200, 150, 0.6);
}
#signal-state-box:has(.state-label.exit) .state-pulse-dot {
  color: rgba(242, 54, 69, 0.6);
}

/* ── Intro video overlay ───────────────────────────────────────────────────── */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#intro-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#intro-skip {
  position: absolute;
  bottom: 32px;
  right: 32px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.70);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#intro-skip:hover {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */
#loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #080808;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.loader-core {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid transparent;
}

.loader-ring-outer {
  width: 140px;
  height: 140px;
  border-top-color: rgba(245,166,35,0.9);
  border-right-color: rgba(245,166,35,0.2);
  animation: spin 2.4s linear infinite;
}

.loader-ring-mid {
  width: 112px;
  height: 112px;
  border-bottom-color: rgba(245,166,35,0.6);
  border-left-color: rgba(245,166,35,0.15);
  animation: spin 1.6s linear infinite reverse;
}

.loader-ring-inner {
  width: 84px;
  height: 84px;
  border-top-color: rgba(245,166,35,0.35);
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-left-color: rgba(245,166,35,0.35);
  animation: spin 3.2s linear infinite;
}

.loader-btc {
  font-size: 40px;
  color: #f5a623;
  line-height: 1;
  animation: btc-pulse 2.4s ease-in-out infinite;
  user-select: none;
}

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

@keyframes btc-pulse {
  0%, 100% {
    text-shadow: 0 0 12px rgba(245,166,35,0.5), 0 0 28px rgba(245,166,35,0.2);
    opacity: 1;
  }
  50% {
    text-shadow: 0 0 20px rgba(245,166,35,0.9), 0 0 48px rgba(245,166,35,0.4), 0 0 80px rgba(245,166,35,0.15);
    opacity: 0.88;
  }
}

.loader-brand {
  font-family: 'Satoshi', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}

.loader-status {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(245,166,35,0.55);
  text-transform: uppercase;
}

.loader-dots span {
  animation: dot-blink 1.4s ease-in-out infinite;
  opacity: 0;
}
.loader-dots span:nth-child(2) { animation-delay: 0.22s; }
.loader-dots span:nth-child(3) { animation-delay: 0.44s; }

@keyframes dot-blink {
  0%, 100% { opacity: 0; }
  50%       { opacity: 1; }
}

/* Login button loading state */
#login-btn.loading {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}
