:root {
  --bg: #06090f;
  --panel: rgba(11, 16, 26, 0.94);
  --panel-solid: #0b101a;
  --border: rgba(0, 245, 155, 0.24);
  --green: #00f59b;
  --red: #ff3366;
  --gold: #ffd166;
  --cyan: #22e5ff;
  --text: #eef6ff;
  --muted: #8496b5;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, canvas, [role="button"], .hud-bar, .tape-bar, .deck {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

#app {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hud-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(6, 9, 15, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(16, 24, 38, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-equity {
  border-color: rgba(0, 245, 155, 0.5);
  color: var(--green);
}

.pill-clock {
  border-color: rgba(255, 209, 102, 0.5);
  color: var(--gold);
}

.pill-clock.urgent {
  border-color: var(--red);
  color: var(--red);
}

.pill-streak {
  border-color: rgba(34, 229, 255, 0.45);
  color: var(--cyan);
}

.icon-btn {
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(16, 24, 38, 0.94);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn:hover { border-color: var(--green); color: var(--green); }

/* Live catalyst tape strip */
.tape-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(10, 15, 24, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 12px;
  flex-shrink: 0;
  min-height: 32px;
}

.tape-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tape-badge {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  flex-shrink: 0;
}

.tape-badge.bull { background: rgba(0, 245, 155, 0.18); color: var(--green); }
.tape-badge.bear { background: rgba(255, 51, 102, 0.22); color: var(--red); }
.tape-badge.vol { background: rgba(255, 209, 102, 0.2); color: var(--gold); }

.tape-msg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}

.ticker-price {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  color: var(--green);
}

.ticker-price.down { color: var(--red); }

/* Chart canvas fills middle */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

#chart {
  display: block;
  width: 100%;
  height: 100%;
}

/* Bottom trading deck */
.deck {
  position: relative;
  z-index: 9;
  padding: 9px 12px 10px;
  padding-right: 54px; /* leave room for platform feedback button in bottom-right */
  background: linear-gradient(180deg, rgba(10, 15, 24, 0.94), rgba(6, 9, 15, 0.99));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.deck-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.seg-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

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

.seg-btn {
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 27, 43, 0.92);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.seg-btn.active {
  border-color: var(--gold);
  background: rgba(255, 209, 102, 0.18);
  color: var(--gold);
}

.seg-btn.degen.active {
  border-color: var(--red);
  background: rgba(255, 51, 102, 0.22);
  color: #ff85a2;
}

.seg-btn:disabled { opacity: 0.42; cursor: not-allowed; }

/* Action buttons */
.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.action-row.single {
  grid-template-columns: minmax(0, 1fr);
}

.trade-btn {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, filter 0.12s ease;
}

.trade-btn:active { transform: scale(0.97); }
.trade-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-long {
  border: 1.5px solid #86ffd3;
  background: linear-gradient(135deg, #009c61, #00d986);
  color: #031910;
  box-shadow: 0 5px 20px rgba(0, 217, 134, 0.28);
}

.btn-short {
  border: 1.5px solid #ff9eb5;
  background: linear-gradient(135deg, #b8143e, #ef2b5b);
  color: #fff5f8;
  box-shadow: 0 5px 20px rgba(239, 43, 91, 0.3);
}

.btn-close {
  border: 1.5px solid #ffe599;
  background: linear-gradient(135deg, #c98a00, #f5b700);
  color: #161002;
  box-shadow: 0 5px 20px rgba(245, 183, 0, 0.3);
}

.btn-close.green {
  border-color: #86ffd3;
  background: linear-gradient(135deg, #009c61, #00e592);
  color: #031910;
}

.btn-close.red {
  border-color: #ff9eb5;
  background: linear-gradient(135deg, #b8143e, #ef2b5b);
  color: #fff5f8;
}

.pos-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

.pos-strip.hidden { display: none; }

.pos-pnl { font-size: 14px; font-weight: 900; }
.pos-pnl.pos { color: var(--green); }
.pos-pnl.neg { color: var(--red); }

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(5, 8, 14, 0.84);
  overflow-y: auto;
}

.overlay.hidden { display: none; }

.card {
  width: min(490px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.72);
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.title {
  margin: 0 0 6px;
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 900;
  color: var(--text);
}

.title span { color: var(--green); }

.sub {
  margin: 0 0 13px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.primary-btn {
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px solid #86ffd3;
  background: linear-gradient(135deg, #009c61, #00d986);
  color: #031910;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.disclaimer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

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

.result-cell {
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 10px;
}

.result-cell span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

.result-cell strong {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 16px;
}

.win { color: var(--green); }
.loss { color: var(--red); }

dialog {
  max-width: min(470px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  padding: 16px;
}

dialog::backdrop { background: rgba(4, 6, 12, 0.78); }

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dialog-head h2 { margin: 0; font-size: 18px; color: var(--green); }

.rules-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #dbe7fb;
}

.paused-badge {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 15, 0.76);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.paused-badge.hidden { display: none; }

@media (max-width: 520px) {
  .hud-bar { padding: 5px 7px; gap: 4px; }
  .hud-group { gap: 4px; flex-wrap: nowrap; }
  .pill { padding: 4px 6px; font-size: 10.5px; }
  .icon-btn { padding: 4px 7px; font-size: 10.5px; min-height: 30px; }
  .deck { padding: 7px 8px 8px; padding-right: 48px; gap: 6px; }
  .seg-btn { padding: 4px 7px; font-size: 11px; min-height: 32px; }
  .trade-btn { min-height: 44px; font-size: 14px; }
}
