:root {
  --bg: #0b1017;
  --panel: #121a24;
  --panel-2: #172231;
  --line: #233042;
  --text: #e6edf5;
  --muted: #8b9bb0;
  --accent: #3b82f6;
  --long: #22c55e;
  --short: #ef4444;
  --info: #94a3b8;
  --sim: #f59e0b;
  --sim-bg: rgba(245, 158, 11, 0.08);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, select, input { font: inherit; color: inherit; }

.disclaimer {
  position: sticky; top: 0; z-index: 20;
  background: #3a2a06; color: #fde7b0; border-bottom: 1px solid #6b4e0e;
  padding: 8px 16px; font-size: 12.5px; line-height: 1.4;
}

.top { padding: 14px 16px 6px; }
.brand { font-size: 18px; font-weight: 650; letter-spacing: 0.2px; }
.brand span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; padding: 8px 16px 16px; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.workspace { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }

select, input[type="number"] {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-height: 32px;
}
input[type="number"] { width: 100%; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; padding: 6px 12px; cursor: pointer; min-height: 32px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }

button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; min-height: 32px; }
button:hover:not(:disabled) { border-color: #3a4b62; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.synthetic-settings { background: var(--sim-bg); border: 1px dashed var(--sim); border-radius: 8px; padding: 8px 12px; }
.synthetic-settings summary { cursor: pointer; color: var(--sim); font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; align-items: end; margin-top: 10px; }
.settings-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.settings-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 2px; line-height: 1.45; }

.chart-wrap { position: relative; height: min(62vh, 620px); min-height: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.chart { position: absolute; inset: 0; }
.chart-wrap.simulated { border: 2px solid var(--sim); }
.sim-watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: clamp(40px, 9vw, 110px); font-weight: 800; letter-spacing: 8px; color: rgba(245, 158, 11, 0.09);
  transform: rotate(-12deg); z-index: 3;
}
.sim-badge {
  position: absolute; top: 46px; /* below the chart toolbar, so it never covers its buttons */ right: 84px; z-index: 4; pointer-events: none;
  background: var(--sim); color: #1b1200; font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); z-index: 5; background: var(--panel); line-height: 1.6; }
.chart-empty code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.legend { position: absolute; left: 56px; bottom: 30px; z-index: 4; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.legend i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 5px; }

.playback, .livebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.playback input[type="range"] { flex: 1 1 200px; min-width: 120px; }
.pb-pos { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.livebar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--short); animation: pulse 1.2s infinite; }
.livebar.paused .dot { animation: none; background: var(--muted); }
@keyframes pulse { 50% { opacity: 0.3; } }

.sidebar { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.steps { padding-left: 18px; margin: 8px 0; line-height: 1.5; }
.steps li + li { margin-top: 6px; }

.stats.simulated { border: 2px solid var(--sim); background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 12px, #1a1a14 12px, #1a1a14 24px); }
.stats .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.stats .tag.sim { background: var(--sim); color: #1b1200; }
.stats .tag.hist { background: #1e3a5f; color: #cfe3ff; }
.stats .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.stats .num { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats .cap { font-size: 11px; color: var(--muted); }
.stats .note { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 6px 0 0; }
.stats .note strong { color: var(--text); }

.latest { border-left: 3px solid var(--accent); }
.latest.long { border-left-color: var(--long); }
.latest.short { border-left-color: var(--short); }
.latest .what { font-weight: 600; margin-bottom: 4px; }

.log { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; }
.log li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.4; }
.log li:first-child { border-top: 0; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin: 0 6px; background: #334155; }
.badge.long { background: #14532d; color: #bbf7d0; }
.badge.short { background: #7f1d1d; color: #fecaca; }
.badge.win { background: #14532d; color: #bbf7d0; }
.badge.loss { background: #7f1d1d; color: #fecaca; }
.log li.fresh { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(59, 130, 246, 0.25); } to { background: transparent; } }

.foot { color: var(--muted); font-size: 12px; padding: 4px 16px 20px; line-height: 1.5; }

/* ── Practice trading ─────────────────────────────────────────────── */
.zones { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.zone { position: absolute; }
.zone.tp { background: rgba(34, 197, 94, 0.18); border-top: 1px solid rgba(34, 197, 94, 0.5); border-bottom: 1px solid rgba(34, 197, 94, 0.5); }
.zone.sl { background: rgba(239, 68, 68, 0.18); border-top: 1px solid rgba(239, 68, 68, 0.5); border-bottom: 1px solid rgba(239, 68, 68, 0.5); }
.zone.done { opacity: 0.45; }

.ticket { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ticket h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; margin: 0; color: var(--muted); }
.ticket-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ticket-head .tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ticket-head .tag.sim { background: var(--sim); color: #1b1200; }
.ticket-head .tag.hist { background: #1e3a5f; color: #cfe3ff; }
.ticket-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.ticket-row label, .tk-price, .tk-rr { display: flex; flex-direction: column; gap: 4px; }
.ticket-row input { width: 120px; }
.tk-price strong, .tk-rr strong { font-size: 16px; font-variant-numeric: tabular-nums; min-height: 32px; display: flex; align-items: center; }
button.buy { background: #15803d; border-color: #15803d; color: #fff; min-width: 76px; font-weight: 600; }
button.sell { background: #b91c1c; border-color: #b91c1c; color: #fff; min-width: 76px; font-weight: 600; }
button.armed { outline: 2px solid var(--accent); outline-offset: 1px; }
.tk-msg { min-height: 18px; margin: 6px 0; font-size: 12.5px; color: var(--muted); }
.tk-msg.error { color: #fca5a5; }
.positions { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.positions th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.positions td { padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.positions td.actions { display: flex; gap: 6px; flex-wrap: wrap; white-space: normal; }
.positions td.actions button { min-height: 26px; padding: 2px 8px; font-size: 12px; }
.pos { color: #4ade80; }
.neg { color: #f87171; }
.table-scroll { overflow-x: auto; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.journal.simulated { border: 2px solid var(--sim); }
.journal .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; }
.journal .tag.sim { background: var(--sim); color: #1b1200; }
.journal .tag.hist { background: #1e3a5f; color: #cfe3ff; }
.journal .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.journal .num { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.journal .cap { font-size: 11px; color: var(--muted); }
.journal .note { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 6px 0 0; }
.chart-wrap.picking { cursor: crosshair; }
