:root {
  --bg: #0d1424;
  --bg-soft: #1f2c25;
  --panel: rgba(8, 8, 8, 0.98);
  --panel-border: rgba(22, 199, 132, 0.2);
  --text: #f0f6ff;
  --muted: rgba(180, 200, 188, 0.7);
  --label: rgba(180, 200, 188, 0.6);
  --line: rgba(22, 199, 132, 0.1);
  --accent: #16c784;
  --green: #22c55e;
  --red: #ef4444;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
  --mono: ui-monospace, 'Courier New', monospace;
}

/* Manifest header: logo must not rely on Tailwind height utilities (often absent from built tailwind.css) */
#modeDashboard > header.sim-manifest-top {
  overflow: hidden;
  min-height: 5rem;
  max-height: 5rem;
  align-items: center;
}
#modeDashboard > header .sim-manifest-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  max-height: 3rem;
  line-height: 0;
  flex-shrink: 0;
}
#modeDashboard > header .sim-manifest-brand img {
  height: 40px;
  width: auto;
  max-width: min(200px, 46vw);
  max-height: 3rem;
  object-fit: contain;
  object-position: left center;
  display: block;
}

* {
  box-sizing: border-box;
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

body {
  margin: 0;
  color: var(--text);
  background: #0d1424;
}

body.night-mode {
  background: #0d1424;
}

/* =========================
   TICKER TAPE
========================= */

.ticker-tape {
  overflow: hidden;
  background: rgba(3, 6, 14, 0.95);
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
  white-space: nowrap;
}

.ticker-tape-track {
  display: inline-flex;
  gap: 48px;
  animation: ticker-scroll 45s linear infinite;
}

.ticker-item {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* =========================
   SITE NAV
========================= */

.site-mini-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(5, 10, 22, 0.95) 0%, rgba(3, 6, 14, 0.9) 100%);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.back-link {
  color: #9ec5ff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.back-link:hover {
  color: #d6e7ff;
}

.sim-dash-nav {
  flex-wrap: wrap;
}

.sim-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.15);
  color: #dbeafe;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
  font-family: inherit;
}

.sim-nav-btn:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(96, 165, 250, 0.75);
  color: #fff;
}

.sim-nav-btn--ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.sim-nav-btn--ghost:hover {
  color: var(--text);
  border-color: var(--panel-border);
}

.paper-hands-hud {
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  white-space: nowrap;
}

.squeeze-timer.squeeze-timer--inline {
  position: static;
  animation: none;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  margin: 0;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* Overtime power-up button — appears in the Squeeze HUD when the clock runs low
   and the player owns an Overtime. Spending one adds +15s. */
.squeeze-ot-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, #16c784, #0ea87a);
  color: #04121b;
  border: 1px solid #4ade9e;
  box-shadow: 0 0 14px rgba(22, 199, 132, 0.45);
  white-space: nowrap;
  animation: otPulse 1.3s ease-in-out infinite;
}
.squeeze-ot-btn:hover { filter: brightness(1.08); }
.squeeze-ot-btn:disabled { opacity: 0.55; cursor: default; animation: none; }
@keyframes otPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(56, 189, 248, 0.35); }
  50%      { box-shadow: 0 0 20px rgba(56, 189, 248, 0.7); }
}

/* Mulligan power-up button — undo your last trade (once per arcade run). */
.mulligan-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(167, 139, 250, 0.16);
  color: #ddd6fe;
  border: 1px solid rgba(167, 139, 250, 0.55);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.mulligan-btn:hover { background: rgba(167, 139, 250, 0.28); border-color: #a78bfa; }
.mulligan-btn:disabled { opacity: 0.55; cursor: default; }

.app-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  background: #0d1424;
  border-bottom: 1px solid var(--panel-border);
}

.app-header.sticky-hud {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Back · ● Live · JagSim title align in one row. */
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.hud-pnl-equity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.025);
  transition: border-color 0.3s ease, background 0.3s ease;
  min-width: 148px;
}

.hud-stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
}
.hud-stat-lbl {
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9px;
}
.hud-equity {
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: 0.01em;
}
.hud-pnl-val, .hud-cash-val {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}
.hud-stat-line--pnl.hud-pnl-up .hud-pnl-val { color: #86efac; }
.hud-stat-line--pnl.hud-pnl-down .hud-pnl-val { color: #fca5a5; }

.hud-mode-pill {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(22,199,132,0.35);
  background: rgba(22,199,132,0.1);
  color: #16c784;
  font-family: var(--mono);
  white-space: nowrap;
}

.exit-arena-btn--safe {
  border-color: rgba(148,163,184,0.35) !important;
  background: rgba(255,255,255,0.04) !important;
}
.new-run-btn--warn {
  border-color: rgba(245,158,11,0.55) !important;
  color: #fcd34d !important;
  background: rgba(245,158,11,0.12) !important;
}
.new-run-btn--warn:hover {
  background: rgba(245,158,11,0.22) !important;
}

.session-timer-pill {
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.hud-pnl-equity.hud-down {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

/* legacy — no longer pulse entire equity box red */
.hud-pnl-equity.hud-up {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.06);
}

.hud-pnl {
  font-size: 14px;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}
.hud-equity {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: #9eb4a4;
}

@keyframes hud-pulse-red {
  0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.15); }
  50% { box-shadow: 0 0 28px rgba(239, 68, 68, 0.25); }
}

.app-title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.app-tagline {
  margin: 2px 0 0;
  font-size: 9px;
  color: var(--label);
  font-weight: 500;
  line-height: 1.3;
  max-width: 320px;
}

.app-tagline em {
  color: var(--label);
  font-style: normal;
}

.positions-pill {
  padding: 4px 10px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--panel-border);
  font-size: 11px;
  color: var(--label);
  font-family: var(--mono);
}

.positions-pill strong {
  color: var(--accent);
  font-family: var(--mono);
}

.mode-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mode-hint {
  font-size: 9px;
  color: var(--muted);
  opacity: 0.9;
  max-width: 140px;
  text-align: center;
}

.header-center {
  flex: 1;
  max-width: 460px;
  margin: 0 14px;
  position: relative;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.account-pill {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  background: transparent;
  font-size: 12px;
  min-width: 100px;
  text-align: right;
  font-family: var(--mono);
  color: var(--label);
}

.account-pill strong {
  color: var(--text);
  font-family: var(--mono);
}

.symbol-input,
#symbolSearch {
  width: 100%;
  padding: 10px 14px;
  background: rgba(4, 10, 22, 0.92);
  color: var(--text);
  border: 1px solid rgba(82, 109, 154, 0.35);
  border-radius: 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#symbolSearch:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 24px rgba(34, 211, 238, 0.08);
}

.symbol-input:focus,
#symbolSearch:focus {
  border-color: rgba(96, 165, 250, 0.72);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.symbol-input::placeholder {
  color: #6f82a1;
}

.symbol-results,
#symbolResults {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(280px, calc(100vh - 108px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(8, 14, 28, 0.98);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  z-index: 20;
  box-shadow: var(--shadow);
}

.symbol-result {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
}

.symbol-result:hover {
  background: rgba(96, 165, 250, 0.16);
}

.sim-container {
  padding: 8px 10px 10px;
}

.sim-intro {
  max-width: 900px;
  margin: 0 0 18px;
  padding: 16px 20px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.75) 0%, rgba(8, 14, 28, 0.85) 100%);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #b8c5d8;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sim-intro strong {
  color: var(--text);
}

details.sim-intro-collapsible {
  max-width: 900px;
}

.sim-intro-summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-intro-summary::-webkit-details-marker {
  display: none;
}

.sim-intro-chevron {
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--muted);
  font-size: 12px;
}

details.sim-intro-collapsible[open] .sim-intro-chevron {
  transform: rotate(90deg);
}

.sim-intro-body {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.sim-intro-body p {
  margin: 0;
}

/* Run stats / feed / contracts above chart */
.sim-top-panels {
  margin-bottom: 16px;
}

.squeeze-timer {
  position: fixed;
  top: 120px;
  right: 24px;
  z-index: 50;
  padding: 12px 20px;
  background: rgba(239, 68, 68, 0.2);
  border: 2px solid rgba(239, 68, 68, 0.6);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  color: #fca5a5;
  animation: squeeze-pulse 1s ease-in-out infinite;
}

@keyframes squeeze-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 24px rgba(239, 68, 68, 0.5); }
}

/* =========================
   MODE DASHBOARD
========================= */

.mode-dashboard {
  padding: 32px 24px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.mode-dashboard-inner {
  width: 100%;
}

.mode-dashboard-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mode-dashboard-subtitle {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.mode-card {
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.95) 0%, rgba(8, 14, 28, 0.98) 100%);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  transition: all 0.25s ease;
  position: relative;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.mode-card--live:hover {
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.08);
}

.mode-card--soon {
  opacity: 0.85;
}

.mode-card--soon:hover {
  opacity: 1;
}

.mode-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.mode-badge--soon {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

.mode-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.mode-card p {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.mode-play-btn {
  margin-top: 4px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
}

.mode-play-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .mode-dashboard {
    padding: 24px 16px 36px;
  }

  .mode-dashboard-title {
    font-size: 24px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 200px;
  }
}

.sim-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.sim-layout.control-tower {
  grid-template-columns: 70% minmax(280px, 30%);
}

.action-sidebar.glass-cockpit {
  background: rgba(8, 14, 28, 0.75);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(82, 109, 154, 0.25);
}

.chart-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
}

.toolbar-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-right: 4px;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-hint {
  font-size: 10px;
  color: var(--muted);
}

.tool-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(7, 14, 30, 0.96);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s ease;
}

.tool-btn:hover {
  background: rgba(96, 165, 250, 0.16);
  color: #dbe9ff;
  border-color: rgba(96, 165, 250, 0.6);
}

.tool-btn.active {
  background: rgba(96, 165, 250, 0.2);
  color: #e9f2ff;
  border-color: rgba(96, 165, 250, 0.72);
}

.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chart-panel,
.panel {
  background: #0d1424;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: none;
}

.chart-panel {
  flex: 0 0 auto;
  height: calc(100vh - 250px);
  min-height: 360px;
  max-height: 680px;
  padding: 6px;
  overflow: hidden;
  position: relative;
  border-color: rgba(0, 210, 200, 0.25);
}

/* “Terminal” status strip above chart */
.sim-session-strip {
  /* Replaced by the compact ● Live pill in the header (frees a full row so the
     chart, run-stats and activity feed all move up). Kept in the DOM, hidden. */
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin-bottom: 2px;
  border-radius: 10px;
  background: rgba(4, 12, 24, 0.85);
  border: 1px solid rgba(34, 211, 238, 0.1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sim-session-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
  animation: sim-pulse 1.8s ease-in-out infinite;
}

@keyframes sim-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}

.sim-session-label {
  color: #86efac;
}

.sim-session-meta {
  color: #64748b;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Compact live-session pill in the header (replaces the full-width session strip). */
.hud-live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; flex-shrink: 0;
  background: rgba(4, 12, 24, 0.85); border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: #86efac; white-space: nowrap;
}
.hud-live-pill .hud-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
  animation: sim-pulse 1.8s ease-in-out infinite;
}
/* Arcade-only, matching the old strip (Invest Mode has its own header tagline). */
body.invest-mode .hud-live-pill { display: none; }

.trade-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 900;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s ease;
  text-shadow: 0 0 24px currentColor;
}

.trade-flash.win {
  color: #22c55e;
}

.trade-flash.loss {
  color: #ef4444;
}

.session-timer-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(7, 14, 28, 0.9);
  border: 1px solid rgba(34, 211, 238, 0.28);
  font-size: 12px;
  font-weight: 800;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.win-streak-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 14, 28, 0.9);
  border: 1px solid var(--panel-border);
  font-size: 12px;
  font-weight: 700;
}

.win-streak-pill.streak-active {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

/* Active XP-boost indicator (spin 2× next run, or shop XP booster runs left) */
.xp-boost-pill {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #16c784;
  background: rgba(22, 199, 132, 0.12);
  border: 1px solid rgba(22, 199, 132, 0.55);
  box-shadow: 0 0 14px rgba(22, 199, 132, 0.25);
  animation: xpBoostPulse 1.8s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes xpBoostPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(56, 189, 248, 0.2); }
  50%      { box-shadow: 0 0 20px rgba(56, 189, 248, 0.45); }
}

/* =========================
   STREAK HEAT MAP (Gambler's High)
========================= */

body.streak-heat-5 .tool-btn:not(:disabled),
body.streak-heat-5 .order-ticket button:not(:disabled) {
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
  border-color: rgba(251, 191, 36, 0.5);
}

body.streak-heat-5 .chart-panel {
  border-color: rgba(251, 191, 36, 0.25);
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.08);
}

body.streak-heat-10 .tool-btn:not(:disabled),
body.streak-heat-10 .order-ticket button:not(:disabled) {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.5);
  border-color: rgba(251, 191, 36, 0.7);
  animation: button-spark 0.8s ease-in-out infinite;
}

body.streak-heat-10 .chart-panel {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.15);
  animation: chart-spark 1.2s ease-in-out infinite;
}

@keyframes button-spark {
  0%, 100% { box-shadow: 0 0 16px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.7); }
}

@keyframes chart-spark {
  0%, 100% { box-shadow: 0 0 32px rgba(251, 191, 36, 0.15); }
  50% { box-shadow: 0 0 48px rgba(251, 191, 36, 0.25); }
}

canvas {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: block;
}

.right-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  padding: 12px;
  min-height: 110px;
}

.panel-title {
  margin: 0 0 8px 0;
  font-size: 9px;
  font-weight: 700;
  color: var(--label);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 1;
}

.panel-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 0;
}

.ticket-symbol-row,
.order-actions-row,
.order-ticket-grid {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.order-actions-row--triple {
  flex-wrap: nowrap;
  gap: 6px;
}
.order-actions-row--triple > .buy,
.order-actions-row--triple > .sell,
.order-actions-row--triple > .btn-short--inline {
  flex: 1 1 0;
  min-width: 0;
  font-size: 11px;
  padding-left: 6px;
  padding-right: 6px;
}
.btn-short--inline {
  width: auto;
  min-height: 42px;
  line-height: 1.15;
  font-size: 11px;
  padding: 10px 6px;
  letter-spacing: 0.04em;
}

.ticket-symbol-row {
  justify-content: space-between;
}

.order-ticket-grid {
  flex-wrap: wrap;
}

.panel-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.panel-field input,
.panel-field select {
  background: rgba(6, 12, 24, 0.9);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 8px;
  min-width: 110px;
}

.order-ticket-modes {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

/* Long ↔ Short side-toggle. Sits between the Market/Limit/Stop tabs and the
   action row. Two big segmented buttons that swap the action row semantics. */
.ot-dir-toggle {
  display: grid;
  grid-template-columns: auto 1fr 1fr;   /* "Side" label + Buy + Sell selector */
  gap: 6px;
  align-items: center;
  margin: 6px 0 10px;
  padding: 4px 4px 4px 2px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
/* Small label so the toggle reads as a SIDE selector, not a second buy button. */
.ot-dir-label {
  padding-left: 6px; white-space: nowrap;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #5b6675;
}
/* Active side = a subtle tinted tab (clearly lighter than the solid CTA below, so
   "Buy" the selector never looks like "BUY 10" the execute button). */
.ot-dir-buy.active  { background: rgba(34,197,94,0.14);  border-color: rgba(34,197,94,0.45); color: #86efac; }
.ot-dir-sell.active { background: rgba(239,68,68,0.14);  border-color: rgba(239,68,68,0.45); color: #fca5a5; }

.ticket-msg {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.ticket-msg--error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  padding: 6px 8px;
}

.ticket-msg--ok {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
}

.order-ticket {
  position: relative;
}
.ot-cash-strip {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(8,14,26,0.98) 80%, rgba(8,14,26,0));
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.ot-insufficient-banner {
  display: none;
  margin: 6px 0 4px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #fecaca;
  background: rgba(239,68,68,0.14);
  border: 1px solid rgba(239,68,68,0.45);
}
.ot-insufficient-banner.visible { display: block; }
.ot-preview.ot-preview--warn {
  border-color: rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.08);
}
.ot-held-badge.ot-held-tap {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.ot-held-badge.ot-held-tap:hover { color: #16c784; }
.ot-secondary-wrap {
  margin-top: 6px;
}
.ot-secondary-wrap summary {
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  list-style: none;
  padding: 4px 0;
}
.ot-secondary-wrap summary::-webkit-details-marker { display: none; }
.ot-fill-toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 10050;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  color: #ecfdf5;
  background: rgba(22,199,132,0.95);
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
  transition: transform 0.28s ease;
  pointer-events: none;
}
.ot-fill-toast.visible { transform: translateX(-50%) translateY(0); }

.poshist-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1;
}
.poshist-tabs {
  display: flex;
  gap: 6px;
  padding: 0 2px 8px;
}
.poshist-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: #94a3b8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
.poshist-tab.active {
  color: #16c784;
  border-color: rgba(22,199,132,0.45);
  background: rgba(22,199,132,0.1);
}
.poshist-pane[hidden] { display: none !important; }
.poshist-pane { flex: 1; min-height: 0; overflow: auto; }

.pos-half-btn {
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(248,113,113,0.35);
  background: rgba(248,113,113,0.1);
  color: #fca5a5;
  cursor: pointer;
  font-family: inherit;
}
.pos-half-btn:hover { background: rgba(248,113,113,0.2); }

.chart-toolbar .tool-btn.active {
  background: rgba(34,211,238,0.18);
  border-color: rgba(34,211,238,0.55);
  color: #67e8f9;
  box-shadow: inset 0 0 0 1px rgba(34,211,238,0.25);
}
#chartTickerPrice .chart-tick-up { color: #16c784; }
#chartTickerPrice .chart-tick-down { color: #f87171; }

.positions-panel,
.orders-panel {
  overflow: hidden;
}

.order-ticket {
  overflow: visible;
}

.positions-panel {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
}

.orders-panel {
  min-height: 160px;
  max-height: 320px;
  overflow-y: auto;
}

/* =========================
   WHALE RADAR (Whale Watching)
========================= */

.whale-radar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(6, 12, 24, 0.9);
  cursor: default;
  transition: all 0.2s ease;
}

.whale-radar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.whale-radar-help {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.whale-radar--has-card {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.06);
  cursor: pointer;
}

.whale-radar--has-card:hover {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.whale-radar--active {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  animation: whale-radar-pulse 1.5s ease-in-out infinite;
}

@keyframes whale-radar-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.25); }
  50% { box-shadow: 0 0 28px rgba(56, 189, 248, 0.4); }
}

.whale-radar-icon {
  font-size: 18px;
}

.whale-radar-count {
  font-weight: 800;
  font-size: 14px;
  color: var(--accent);
}

.whale-radar-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.trade-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.order-main,
.order-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.order-cancel,
.order-ticket button {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(7, 14, 28, 0.95);
  color: var(--text);
  cursor: pointer;
}

.order-cancel {
  padding: 4px 8px;
  font-size: 10px;
}

.order-ticket button {
  flex: 1;
  padding: 12px 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.order-ticket button.buy {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #15803d;
  color: #04210f;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.order-ticket button.buy:hover {
  border-color: #16a34a;
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(34, 197, 94, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  color: #04210f;
}

.order-ticket button.sell {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #b91c1c;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.order-ticket button.sell:hover {
  border-color: #dc2626;
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fff;
}

.order-ticket button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.buy { color: #86efac; }
.sell { color: #fca5a5; }
.short-label { color: #c084fc; font-weight: 700; }
.cover-label { color: #fbbf24; font-weight: 700; }

/* ── Order Ticket v2 — Cash / Preview / Short ────────────────────── */
.ot-cash-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(0, 210, 200, 0.04);
}
.ot-cash-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--label);
}
.ot-cash-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 900;
  color: #f0f6ff;
}
.ot-field-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--label);
  display: block;
  margin-bottom: 2px;
}
.ot-symbol-text {
  font-size: 18px;
  letter-spacing: .04em;
  font-family: var(--mono);
}
.ot-price-text {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  color: #f8fafc;
}
.ot-held-badge {
  display: inline-block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--accent);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  padding: 1px 6px;
}
.ot-held-badge.ot-squeeze-start {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
  cursor: default;
}
.ot-mono { font-family: var(--mono); }
.ot-green { color: #4ade80; }
.ot-red   { color: #f87171; }

/* Qty row with quick buttons */
.ot-qty-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.ot-quick-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 1px;
}
.ot-quick {
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--mono);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .12s, color .12s;
  font-family: inherit;
}
.ot-quick:hover { border-color: var(--accent); color: var(--accent); }
.ot-quick--max {
  border-color: rgba(34,197,94,.4);
  color: #4ade80;
}
.ot-quick--max:hover { border-color: #22c55e; color: #86efac; }
.ot-quick--all {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.ot-quick--all:hover:not(:disabled) {
  border-color: #f87171;
  color: #fecaca;
}
.ot-quick--all:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Trade preview block */
.ot-preview {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(255,255,255,0.025);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ot-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ot-preview-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--label);
}
.ot-preview-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: #f0f6ff;
}
.ot-preview-val.ot-over { color: #f87171; }

/* Short section */
.ot-short-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,0.1);
}
.ot-short-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.ot-short-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 4px;
  background: rgba(99,102,241,0.04);
}
.ot-short-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ot-short-stat .ot-mono { font-size: 11px; font-weight: 700; }

/* ── Degen Short button ───────────────────────────────────────────── */
.btn-short {
  width: 100%;
  padding: 11px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.6);
  background: transparent;
  color: #a5b4fc;
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  box-shadow: inset 0 0 14px rgba(99, 102, 241, 0.1), 0 0 10px rgba(99, 102, 241, 0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.btn-short:hover {
  border-color: #6366f1;
  box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.18), 0 0 22px rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
}
.btn-cover {
  width: 100%;
  padding: 11px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.6);
  background: transparent;
  color: #fbbf24;
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.btn-cover:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.4);
}
.positive { color: #4ade80; }
.negative { color: #f87171; }
.muted { color: var(--muted); }

/* ── Position rows ────────────────────────────────────────────────── */
.pos-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: rgba(8, 16, 32, 0.7);
  border: 1px solid rgba(82, 109, 154, 0.22);
}

.pos-symbol {
  font-size: 15px;
  font-weight: 900;
  color: #e2e8f0;
  letter-spacing: 0.02em;
  min-width: 48px;
}

.pos-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.pos-qty {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.pos-avg {
  font-size: 11px;
  color: var(--muted);
}

.pos-pnl {
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  min-width: 72px;
}

.pos-row:hover { border-color: rgba(59,130,246,0.35); background: rgba(59,130,246,0.06); }

/* One row = exit that line (distinct from order-ticket “Sell”) */
.pos-exit-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.pos-exit-btn:hover {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
}

/* Portfolio-level close — not the same as ticket “Sell” */
.pos-close-all-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.pos-close-all-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(251, 191, 36, 0.75);
}

.pos-cover-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(168,85,247,0.4);
  border-radius: 6px;
  background: rgba(168,85,247,0.1);
  color: #a855f7;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.pos-cover-btn:hover { background: rgba(168,85,247,0.25); }

/* ── Exit arena button ────────────────────────────────────────────── */
.exit-arena-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.8);
  color: #94a3b8;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.exit-arena-btn:hover {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.bottom-panels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

/* Compact strip under chart — scroll inside if needed */
.sim-bottom-panels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: none;
  overflow: visible;
  margin-top: 4px;
  gap: 8px;
}
.sim-bottom-panels:has(.night-risk-panel:not([hidden])) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sim-bottom-panels .bottom-panel {
  min-height: 64px;
}

.sim-bottom-panels .feed-panel {
  min-height: 72px;
}

.sim-bottom-panels .night-feed {
  min-height: 44px;
  max-height: 88px;
}

.bottom-panel {
  min-height: 80px;
}

.feed-panel {
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.feed-panel .panel-title {
  flex-shrink: 0;
}

.night-feed {
  flex: 1;
  min-height: 140px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sim-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-chip--total {
  grid-column: 1 / -1;
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.35);
}

.stat-chip--total strong {
  color: var(--accent);
}

.stat-chip--pnl-hero {
  grid-column: 1 / -1;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.25);
}
.stat-chip--pnl-hero span {
  font-size: 10px;
  color: #94a3b8;
}
.stat-chip--pnl-hero strong {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.stat-chip--pnl-hero strong.pnl-up { color: #4ade80; }
.stat-chip--pnl-hero strong.pnl-down { color: #f87171; }

.stat-chip {
  border: 1px solid var(--panel-border);
  background: transparent;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.stat-chip:hover {
  border-color: rgba(96, 165, 250, 0.25);
}

.stat-chip span {
  color: var(--label);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat-chip strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}


.feed-item {
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(6, 12, 24, 0.9);
  color: #d2ddf1;
  transition: border-color 0.15s ease;
}

.feed-item:hover {
  border-color: rgba(96, 165, 250, 0.2);
}

.risk-card {
  border: 1px solid var(--panel-border);
  background: rgba(6, 12, 24, 0.9);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}

.risk-card:hover {
  border-color: rgba(96, 165, 250, 0.2);
}

.risk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.risk-head .tool-btn {
  padding: 5px 10px;
}

.risk-card p {
  margin: 6px 0 0;
  font-size: 12px;
}

.contracts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}
.session-trades-hint {
  font-size: 11px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.45;
}
.session-trades-list {
  flex: 1;
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.session-trades-meta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}
.session-trades-empty {
  font-size: 12px;
  color: #64748b;
  padding: 16px 8px;
  text-align: center;
  line-height: 1.5;
}
.session-trade-row {
  display: grid;
  grid-template-columns: 72px 52px 1fr 40px 72px 64px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: #e2e8f0;
}
.session-trade-row .st-time { color: #64748b; font-size: 11px; }
.session-trade-row .st-sym { font-weight: 700; }
.session-trade-row .muted { color: #64748b; }
@media (max-width: 720px) {
  .session-trade-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
  }
  .session-trade-row .st-time { grid-column: 1 / -1; }
}

/* Session trade log (arcade bottom panel — replaces activity feed) */
.session-trades-panel {
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.contract-item {
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(6, 12, 24, 0.88);
  font-size: 12px;
  color: #d2ddf1;
  transition: all 0.15s ease;
}

.contract-item:hover {
  border-color: rgba(96, 165, 250, 0.2);
}

.contract-item.done {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

/* ── CLASSIC MODE: Control Room ─────────────────────────────────── */
/* Default black/white — panel borders stay dim white */
body:not(.night-mode):not(.squeeze-mode):not(.paperhands-mode):not(.duel-mode) {
  --panel-border: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.06);
  --accent: #ffffff;
}
body:not(.night-mode):not(.squeeze-mode):not(.paperhands-mode):not(.duel-mode) .app-title {
  color: #ffffff;
}
body:not(.night-mode):not(.squeeze-mode):not(.paperhands-mode):not(.duel-mode) .chart-panel {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── DEGEN MODES: Scanline / Overclock aesthetic ─────────────────── */
body.night-mode,
body.squeeze-mode,
body.paperhands-mode {
  --panel-border: rgba(22, 199, 132, 0.28);
  --line: rgba(22, 199, 132, 0.1);
  --accent: #16c784;
}

/* Scanline overlay on degen modes (not Paper Hands — the pulse was nauseating) */
body.night-mode::before,
body.squeeze-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

body.night-mode .panel,
body.night-mode .chart-panel {
  border-color: rgba(139, 92, 246, 0.35);
}
body.night-mode .app-header {
  border-color: rgba(139, 92, 246, 0.3);
}
body.night-mode .app-title { color: #c084fc; }

body.night-mode .tool-btn {
  border-color: rgba(167, 139, 250, 0.4);
  color: #d8b4fe;
}
body.night-mode .tool-btn.active {
  background: rgba(139, 92, 246, 0.18);
  color: #f3e8ff;
  border-color: rgba(167, 139, 250, 0.7);
}

/* Flash Crash — red arena accent (own identity; overrides night-mode purple).
   Rules come after .night-mode so they win at equal specificity. */
body.flashcrash-mode { --accent: #f6435a; --panel-border: rgba(239, 68, 68, 0.3); }
body.flashcrash-mode .panel,
body.flashcrash-mode .chart-panel { border-color: rgba(239, 68, 68, 0.4); }
body.flashcrash-mode .app-header { border-color: rgba(239, 68, 68, 0.32); }
body.flashcrash-mode .app-title { color: #f87171; }
body.flashcrash-mode .tool-btn { border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
body.flashcrash-mode .tool-btn.active {
  background: rgba(239, 68, 68, 0.18);
  color: #fee2e2;
  border-color: rgba(248, 113, 113, 0.7);
}

/* Squeeze — amber arena accent (matches its lobby card; keeps it distinct from
   Flash Crash's red). The 60s countdown still flips red/orange on its own. */
body.squeeze-mode .chart-panel,
body.squeeze-mode .panel {
  border-color: rgba(245, 158, 11, 0.35);
}
body.squeeze-mode .app-header { border-color: rgba(245, 158, 11, 0.3); }
body.squeeze-mode .app-title { color: #fbbf24; }

body.paperhands-mode .chart-panel,
body.paperhands-mode .panel {
  border-color: rgba(251, 191, 36, 0.35);
}
body.paperhands-mode .app-header { border-color: rgba(251, 191, 36, 0.3); }
body.paperhands-mode .app-title { color: #fbbf24; }

/* Duel — purple matchup arena (distinct from Classic white, Squeeze amber, Invest light). */
body.duel-mode {
  --accent: #0ea5e9;
  --panel-border: rgba(14, 165, 233, 0.38);
  --line: rgba(14, 165, 233, 0.14);
}
body.duel-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(14, 165, 233, 0.14), transparent 58%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(51, 65, 85, 0.1), transparent 50%);
}
body.duel-mode .chart-panel,
body.duel-mode .panel {
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 0 32px rgba(14, 165, 233, 0.06);
}
body.duel-mode .app-header { border-color: rgba(14, 165, 233, 0.35); }
body.duel-mode .app-title { color: #e2e8f0; text-shadow: 0 0 20px rgba(14, 165, 233, 0.25); }
body.duel-mode .tool-btn {
  border-color: rgba(192, 132, 252, 0.35);
  color: #cbd5e1;
}
body.duel-mode .tool-btn.active {
  background: rgba(14, 165, 233, 0.16);
  color: #f3e8ff;
  border-color: rgba(192, 132, 252, 0.65);
}
/* Duel HUD is the single source of P&L — hide the header hero + session strip
   during a live duel so P&L never shows in two places at once. */
body.duel-mode.duel-live #simSessionStrip,
body.duel-mode.duel-live #arcadePnlHero { display: none !important; }
body.duel-mode.duel-live .win-streak-pill { opacity: 0.45; pointer-events: none; }
body.duel-mode.duel-live #newRunBtn { display: none !important; }
body.duel-mode.duel-live .contracts-panel { display: none !important; }
body.duel-mode.duel-live .poshist-wrap { display: none !important; }
/* Hide the Market/Limit/Stop mode tabs in a live duel — but NOT the Buy/Sell
   direction toggle, which shares the .order-ticket-modes class. Hiding it too
   trapped the player long (only a Buy button, no way to close). */
body.duel-mode.duel-live .order-ticket .order-ticket-modes:not(.ot-dir-toggle) { display: none !important; }
body.duel-mode.duel-live .poshist-wrap { display: none !important; }
body.duel-mode.duel-live .chart-panel {
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 48px rgba(14, 165, 233, 0.12);
  min-height: clamp(280px, 42vh, 520px);
}
body.duel-mode.duel-live .chart-column { min-width: 0; }
body.duel-mode.duel-live #duelArenaDock { margin-bottom: 6px; }
body.duel-mode.duel-live .sim-session-strip { display: none !important; }
body.duel-mode.duel-live .bottom-panels,
body.duel-mode.duel-live .sim-bottom-panels { display: none !important; }
body.duel-mode.duel-live .chart-toolbar { display: none !important; }
body.duel-mode.duel-live .invest-watchlist-row { display: none !important; }
body.duel-mode.duel-live .right-stack {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: 1fr !important;
}
body.duel-mode.duel-live .duel-side-mount { flex: 1 1 auto; min-height: 200px; }
body.duel-mode.duel-live #duelTapePanel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
body.duel-mode.duel-live .duel-tape-split { flex: 1; min-height: 220px; }
body.duel-mode.duel-live .duel-tape-feed { max-height: none; flex: 1; }
body.duel-mode.duel-live .chart-panel {
  height: clamp(280px, 44vh, 520px) !important;
  max-height: none;
  min-height: 260px;
}
body.duel-mode.duel-live .duel-arena-mount { display: block !important; }
body.duel-mode.duel-live .duel-side-mount { display: block !important; }
body.duel-mode.duel-live .arena-mode-switch { display: none !important; }
body.duel-mode.duel-live #symbolSearch::placeholder { color: #cbd5e1; }
/* Duel arena — strip chart chrome that doesn’t apply to a 60s match */
body.duel-mode.duel-live .chart-toolbar .toolbar-label,
body.duel-mode.duel-live .chart-toolbar [data-timeframe],
body.duel-mode.duel-live #volToggleBtn,
body.duel-mode.duel-live #emaToggleBtn,
body.duel-mode.duel-live #vwapToggleBtn { display: none !important; }
body.duel-mode.duel-live .sim-session-meta { display: none !important; }
body.duel-mode.duel-live .session-trades-panel { display: none !important; }
body.duel-mode.duel-live .order-ticket {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 0 32px rgba(14, 165, 233, 0.08);
}
body.duel-mode.duel-live .order-ticket .buy {
  box-shadow: 0 0 24px rgba(22, 199, 132, 0.35);
}
body.duel-mode.duel-live .order-ticket .sell {
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.2);
}
body.duel-mode.duel-split .duel-arena-mount { margin-bottom: 4px; }
body.duel-mode.duel-split .duel-side-mount { display: none !important; }
body.duel-mode.duel-split.duel-live .chart-column { min-width: 0; flex: 1; }
body.duel-mode.duel-split #duelChartsSplit { margin-top: 0; }

/* ── Duel: honest opponent identity badge (BOT vs LIVE) in the live HUD ── */
.duel-hud-badge { font-size: 9px; font-weight: 900; letter-spacing: .08em; padding: 1px 6px; border-radius: 5px; vertical-align: middle; margin-left: 5px; white-space: nowrap; }
.duel-hud-badge:empty { display: none; }
.duel-hud-badge.is-bot { background: rgba(148,163,184,.18); color: #cbd5e1; border: 1px solid rgba(148,163,184,.42); }
.duel-hud-badge.is-live { background: rgba(34,211,238,.16); color: #67e8f9; border: 1px solid rgba(34,211,238,.45); }

/* ── Duel-only chrome: during a LIVE duel, silence everything that competes
   with the 60s match — the LIVE WINS ticker (other people's results) and the
   locked symbol search (a tease; the symbol is already in the duel HUD tag). ── */
body.duel-mode.duel-live #bw-ticker { display: none !important; }
body.duel-mode.duel-live #symbolSearch { display: none !important; }
/* Career header chrome — Shares held, win-streak (🔥), Trophies — is noise during
   a 60s duel. Gone. (The mode pill stays; New Run is already hidden above.) */
body.duel-mode.duel-live #headerPositions,
body.duel-mode.duel-live #winStreakPill,
body.duel-mode.duel-live #achievementsBtn { display: none !important; }

/* Short button pulses in volatile degen modes */
body.night-mode .btn-short,
body.squeeze-mode .btn-short {
  animation: short-pulse 2s ease-in-out infinite;
}

@keyframes short-pulse {
  0%, 100% { box-shadow: inset 0 0 14px rgba(99,102,241,0.1), 0 0 10px rgba(99,102,241,0.2); }
  50% { box-shadow: inset 0 0 20px rgba(99,102,241,0.2), 0 0 22px rgba(99,102,241,0.45); }
}

@media (max-width: 1180px) {
  .sim-layout,
  .sim-layout.control-tower {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .right-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-panels {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .ticker-tape {
    padding: 4px 0;
  }

  .ticker-item {
    font-size: 11px;
  }

  .hud-pnl-equity {
    padding: 4px 10px;
  }

  .hud-pnl, .hud-equity {
    font-size: 11px;
  }

  .app-header {
    flex-wrap: wrap;
    min-height: 96px;
  }

  .header-center {
    order: 3;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .mode-hint {
    display: none;
  }

  .positions-pill {
    order: -1;
  }

  .right-stack {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .bottom-panels {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    height: min(360px, calc(100vh - 280px));
    min-height: 240px;
    max-height: min(420px, calc(100vh - 240px));
  }

  .trade-row {
    grid-template-columns: 1fr 1fr 1fr;
    row-gap: 3px;
  }

  /* Symbol search: paper-trading-shell.css hides .pt-appbar-center at 900px,
     but game.html needs it visible so arcade users can search for a symbol.
     Keep it in the sticky header — fixed-position dropdown ensures it never
     overlaps the order ticket when the user has scrolled down. */
  #stickyHud .header-center {
    display: block !important;
    order: 3;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 4px 12px 8px;
    box-sizing: border-box;
    position: relative; /* anchor for the fixed-fallback below */
  }
  #stickyHud #symbolSearch {
    border-color: rgba(82, 109, 154, 0.6);
  }
  /* Results dropdown: fix to viewport so it appears directly under the
     search bar regardless of scroll position — no overlap on order ticket */
  #stickyHud #symbolResults {
    position: fixed !important;
    top: auto !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-height: 55vh !important;
    z-index: 600 !important;
  }

  /* Stack order ticket below chart on mobile in invest mode */
  body.invest-mode:not(.invest-portfolio-view) #simArena {
    grid-template-columns: 1fr !important;
    grid-template-areas: "chart" "bottom" "sidebar" !important;
  }

  /* Stack chart above order ticket in arcade mode on mobile */
  .sim-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .sim-layout .action-sidebar {
    width: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
  }
}

/* Session result modal (arcade modes) */
.session-result-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.session-result-modal[hidden] {
  display: none !important;
}

.session-result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.session-result-card {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  padding: 36px 32px 28px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.99), rgba(8, 12, 22, 1));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.session-result-title {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.session-result-sub {
  margin: 0 0 20px;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.55;
}

.session-result-pnl {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 20px;
}

.session-result-pnl.pos {
  color: var(--green);
}

.session-result-pnl.neg {
  color: var(--red);
}

.session-result-rewards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.session-result-reward-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.reward-label {
  color: var(--muted);
  font-weight: 600;
}

.reward-value {
  font-weight: 800;
  font-size: 1rem;
}

.reward-xp { color: #60a5fa; }
.reward-coins { color: #fbbf24; }

.session-result-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  background: linear-gradient(180deg, #16c784, #0e9268);
  color: #000;
}

.session-result-btn:hover {
  filter: brightness(1.08);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(116, 140, 177, 0.45);
  border-radius: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Paper Trading (invest mode) — kill dark bleed-through ── */
html:has(body.invest-mode),
body.invest-mode {
  background: #f4f6f8 !important;
}

body.invest-mode .sim-container,
body.invest-mode #simArena,
body.invest-mode .chart-arena,
body.invest-mode .chart-column,
body.invest-mode .bottom-panels,
body.invest-mode .sim-bottom-panels,
body.invest-mode .control-tower,
body.invest-mode .right-stack {
  background: #f4f6f8 !important;
}

body.invest-mode .panel,
body.invest-mode .chart-panel,
body.invest-mode .chart-arena-panel,
body.invest-mode .order-ticket,
body.invest-mode .positions-panel {
  background: #ffffff !important;
  border-color: #e3e8ee !important;
}

body.invest-mode .ot-cash-strip {
  background: #f7f9fb !important;
  border-color: #e3e8ee !important;
}

body.invest-mode .invest-disclaimer-strip {
  display: none !important;
}
