:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #15191f;
  --panel-2: #1c222b;
  --line: #2b3440;
  --text: #eef3f8;
  --muted: #91a1b3;
  --buy: #1aa37a;
  --sell: #d55353;
  --warn: #d8a231;
  --bad: #ef6b6b;
  --focus: #4aa3ff;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-width: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202833;
  color: var(--text);
  cursor: pointer;
  min-height: 34px;
}

button:hover {
  border-color: var(--focus);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1318;
  color: var(--text);
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 0.8vw, 10px);
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: clamp(6px, 0.8vw, 10px);
  overflow: hidden;
}

.replay-nav {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 46px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10151c;
}

.replay-nav a,
.replay-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202833;
  color: var(--text);
  text-decoration: none;
}

.replay-nav div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.replay-nav > div:last-child {
  margin-left: auto;
}

.demo-limit-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #2f6f58;
  border-radius: 6px;
  background: #10231d;
  color: #d9fff1;
}

.demo-limit-timer[hidden] {
  display: none;
}

.demo-limit-timer span {
  color: #83e5be;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.demo-limit-timer strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.demo-limit-timer.warning {
  border-color: #d8a231;
  background: #2d2613;
}

.demo-limit-timer.warning span {
  color: #f2c766;
}

#saveReturnDashboard {
  border-color: #36765f;
  background: #17664f;
}

#helpToggle[aria-pressed="true"] {
  border-color: #4aa3ff;
  background: #183a5c;
}

.support-icon {
  border-color: #346653;
  background: #17372c;
  color: #83e5be;
}

.support-icon.support-unread {
  animation: support-reply-alert 2s steps(1, end) infinite;
  color: #fff;
}

@keyframes support-reply-alert {
  0%, 49.999% { border-color: #42e09d; background: #13704d; box-shadow: 0 0 0 2px rgba(66,224,157,.18), 0 0 18px rgba(66,224,157,.48); }
  50%, 100% { border-color: #ff6b73; background: #a92f39; box-shadow: 0 0 0 2px rgba(255,107,115,.18), 0 0 18px rgba(255,107,115,.48); }
}

.support-panel {
  position: fixed;
  z-index: 180;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  height: 100dvh;
  padding: 18px;
  border-left: 1px solid #315244;
  background: #0e1714;
  box-shadow: -20px 0 60px rgba(0,0,0,.45);
  transform: translateX(0);
  transition: transform .25s ease;
}

.support-panel[aria-hidden="true"] { transform: translateX(105%); pointer-events: none; }
.support-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.support-panel-head button { width: 38px; height: 38px; border: 1px solid #365448; border-radius: 50%; background: #17241f; color: #fff; font-size: 23px; }
.support-eyebrow { color: #56d39f; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.support-intro, .support-empty { color: #8fa59b; }
.support-messages { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 160px; overflow: auto; padding: 14px 4px; }
.support-message { align-self: flex-start; max-width: 88%; padding: 10px 12px; border: 1px solid #30493f; border-radius: 12px 12px 12px 3px; background: #17231f; }
.support-message.user { align-self: flex-end; border-color: #2f6f58; border-radius: 12px 12px 3px 12px; background: #174534; }
.support-message p { margin: 4px 0; white-space: pre-wrap; }
.support-message small { color: #83968e; }
.support-form { display: grid; gap: 8px; }
.support-form textarea { min-height: 82px; padding: 10px; resize: vertical; }
.support-form button { border-color: #2f8f68; background: #17664f; }

@media (prefers-reduced-motion: reduce) {
  .support-icon.support-unread { animation: none; border-color: #ff6b73; background: #a92f39; }
}

#playPause.playback-ready {
  border-color: #2fbf83;
  background: #167250;
  color: #fff;
}

#playPause.playback-active {
  border-color: #ff6b73;
  background: #a82e38;
  color: #fff;
}

.topbar,
.chart-toolbar,
.panel-head,
.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  flex: 0 0 auto;
  min-height: auto;
  flex-wrap: wrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}

.topbar-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

h2 {
  font-size: 15px;
  font-weight: 650;
}

.topbar p,
.contract span,
.panel-head span,
label,
.metric-grid span,
.status-strip span {
  color: var(--muted);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  flex: 1 1 560px;
}

.status-strip div,
.panel-block,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-strip div {
  padding: 8px 10px;
}

.status-strip span,
.status-strip strong {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 24vw, 360px);
  gap: clamp(6px, 0.8vw, 10px);
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chart-toolbar {
  min-height: auto;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.toolbar-actions button {
  min-width: 58px;
  padding: 0 10px;
}

#reviewTradeOverlayToggle[aria-pressed="true"] {
  border-color: #2a8fff;
  background: #143c68;
  color: #d8ecff;
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid #253140;
  border-radius: 7px;
  background: #111720;
}

.time-nudge-buttons {
  gap: 4px;
}

.time-nudge-buttons button {
  min-width: 68px;
  min-height: 30px;
  padding: 0 8px;
  border-color: #39485a;
  background: #17202b;
}

.session-jump-buttons {
  gap: 4px;
}

.session-jump-buttons button {
  min-width: 76px;
  min-height: 30px;
  padding: 0 8px;
  border-color: #35506d;
  background: #142335;
}

.session-jump-buttons #jumpCmeOpen {
  border-color: #3d6c55;
  background: #173126;
}

.session-jump-buttons button.current-session {
  border-color: #ff747c;
  background: #a82e38;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), 0 0 12px rgba(255,77,95,.22);
}

.timeframe-buttons {
  gap: 4px;
}

.timeframe-buttons button {
  min-width: 46px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 13px;
}

.timeframe-buttons button.active {
  border-color: #36765f;
  background: #17664f;
  color: white;
}

.toolbar-actions label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.indicator-menu {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: #11161d;
}

.indicator-menu summary {
  width: max-content;
  min-width: 112px;
  margin: 5px 8px;
  padding: 7px 10px;
  border: 1px solid #314052;
  border-radius: 6px;
  background: #18212b;
  cursor: pointer;
  font-weight: 650;
}

.indicator-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 38px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: #11161d;
}

body.help-enabled [data-help] {
  position: relative;
}

body.help-enabled [data-help]:hover::after {
  content: attr(data-help);
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 8px;
  width: max-content;
  max-width: 280px;
  padding: 7px 9px;
  border: 1px solid #4a6d8f;
  border-radius: 6px;
  background: #102235;
  color: #eef7ff;
  box-shadow: 0 10px 28px rgb(0 0 0 / 45%);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

body.help-enabled .chart-wrap[data-help]:hover::after {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.indicator-bar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.indicator-bar input[type="number"] {
  width: 72px;
  min-height: 30px;
  padding: 0 8px;
}

.chart-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  background: #0a0d11;
}

#tvChart {
  width: 100%;
  height: 100%;
}

#tvChart table {
  letter-spacing: 0;
}

.chart-status {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 4;
  padding: 5px 8px;
  border: 1px solid rgb(43 52 64 / 70%);
  border-radius: 6px;
  background: rgb(10 13 17 / 72%);
  color: var(--muted);
  pointer-events: none;
}

body.review-mode .chart-status {
  border-color: #375d86;
  background: rgb(12 30 50 / 86%);
  color: #d8ecff;
}

body.practice-mode .chart-status {
  border-color: #4f6f3c;
  background: rgb(21 36 20 / 88%);
  color: #e6f6d8;
}

body.review-mode #saveReturnDashboard {
  border-color: #375d86;
  background: #143c68;
}

body.practice-mode #saveReturnDashboard {
  border-color: #4f7d35;
  background: #275d1f;
}

#chart {
  width: 100%;
  height: 100%;
}

.price-hint,
.position-pnl-badge,
.head2head-pnl-badge,
.order-line-badge,
.order-menu {
  position: absolute;
  z-index: 5;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
}

.price-hint {
  padding: 7px 10px;
  color: var(--text);
  pointer-events: none;
  font-weight: 650;
  white-space: nowrap;
}

.position-pnl-badge {
  left: 40px;
  display: inline-flex;
  align-items: stretch;
  min-height: 30px;
  padding: 0;
  border-color: #f5c84b;
  background: #17150b;
  color: #f5c84b;
  font-weight: 750;
  pointer-events: none;
  overflow: hidden;
}

.head2head-pnl-badge {
  right: 40px;
  display: inline-flex;
  align-items: stretch;
  min-height: 30px;
  padding: 0;
  border-color: #62d9ff;
  background: #09202b;
  color: #b7f1ff;
  font-weight: 800;
  pointer-events: none;
  overflow: hidden;
}

.head2head-pnl-badge[hidden] { display: none; }
.head2head-pnl-badge.positive { border-color: #62d9ff; background: #0d5267; color: #e9fbff; }
.head2head-pnl-badge.negative { border-color: #c792ff; background: #42245f; color: #fbf7ff; }
.head2head-pnl-badge strong,
.head2head-pnl-badge span {
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}
.head2head-pnl-badge span {
  min-width: 27px;
  justify-content: center;
  border-left: 1px solid rgb(255 255 255 / 18%);
  background: rgb(255 255 255 / 12%);
}

body[data-bracket-side="right"] .position-pnl-badge,
body[data-bracket-side="right"] .order-line-badge {
  right: 96px;
  left: auto;
}

.position-pnl-badge[hidden],
.order-line-badge[hidden] {
  display: none;
}

.position-pnl-badge.positive {
  border-color: #24d18b;
  background: #24d18b;
  color: #06150e;
}

.position-pnl-badge.negative {
  border-color: #ff4d5f;
  background: #ff4d5f;
  color: #fff;
}

.position-pnl-badge strong,
.order-line-badge strong {
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.line-badge-grip,
.line-badge-qty,
.order-line-badge button {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  padding: 0 6px;
  border: 0;
  border-left: 1px solid rgb(0 0 0 / 35%);
  border-radius: 0;
  background: rgb(255 255 255 / 14%);
  color: inherit;
  font: inherit;
}

.line-badge-grip {
  min-width: 22px;
  border-left: 0;
  border-right: 1px solid rgb(0 0 0 / 35%);
  font-size: 16px;
}

.order-line-badges {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.order-line-badge {
  position: absolute;
  left: 40px;
  display: inline-flex;
  align-items: stretch;
  min-height: 30px;
  overflow: hidden;
  border-color: #f5c84b;
  background: #17150b;
  color: #f5c84b;
  font-weight: 750;
  pointer-events: none;
}

.order-line-badge.positive {
  border-color: #24d18b;
  background: #24d18b;
  color: #06150e;
}

.order-line-badge.negative {
  border-color: #ff4d5f;
  background: #ff4d5f;
  color: #fff;
}

.order-line-badge button {
  min-width: 30px;
  pointer-events: auto;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.order-line-badge button:hover {
  background: rgb(255 255 255 / 28%);
}

.order-menu {
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 6px;
  padding: 8px;
}

.order-menu[hidden] {
  display: none;
}

.timeline-row {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

#timeline {
  width: 100%;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  max-height: none;
}

.panel-block {
  min-height: 0;
  padding: 10px;
}

.order-ticket {
  background: var(--panel-2);
}

.qty-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
  margin-top: 12px;
}

.qty-row label {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 8px;
}

.qty-row input {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
}

.trade-grid,
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.risk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.risk-row label {
  display: grid;
  gap: 5px;
}

.risk-row input {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
}

.bracket-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  min-height: 30px;
}

.bracket-settings {
  margin-top: 10px;
  border: 1px solid #334151;
  border-radius: 7px;
  background: #121922;
  overflow: hidden;
}

.bracket-settings.enabled {
  border-color: #358568;
}

.bracket-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  cursor: pointer;
  color: #cbd6e1;
  font-weight: 650;
  list-style: none;
}

.bracket-settings summary::-webkit-details-marker {
  display: none;
}

.bracket-settings summary::before {
  content: "›";
  color: var(--muted);
  font-size: 20px;
  transition: transform .2s ease;
}

.bracket-settings[open] summary::before {
  transform: rotate(90deg);
}

.bracket-settings summary strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.bracket-settings.enabled summary strong {
  color: #56d39f;
}

.bracket-settings-content {
  padding: 0 10px 10px;
  border-top: 1px solid #2c3744;
  animation: bracket-settings-in .2s ease;
}

.bracket-settings:not([open]) .bracket-settings-content {
  display: none;
}

@keyframes bracket-settings-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.bracket-side {
  display: grid;
  grid-template-columns: 1fr 92px;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.bracket-side select {
  min-height: 30px;
  padding: 0 7px;
}

.buy {
  background: color-mix(in srgb, var(--buy) 42%, #121820);
  border-color: color-mix(in srgb, var(--buy) 70%, var(--line));
}

.sell {
  background: color-mix(in srgb, var(--sell) 42%, #121820);
  border-color: color-mix(in srgb, var(--sell) 70%, var(--line));
}

.secondary {
  background: #202833;
}

.wide {
  width: 100%;
  margin-top: 8px;
}

#tvChart.line-hover,
#tvChart.line-hover * {
  cursor: grab !important;
}

#tvChart.dragging-line,
#tvChart.dragging-line * {
  cursor: grabbing !important;
}

.flatten {
  width: 100%;
  margin-top: 8px;
  background: #2d2630;
  border-color: #6c5268;
}

.metric-grid div {
  min-height: 56px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
}

.metric-grid span,
.metric-grid strong {
  display: block;
}

.metric-grid strong {
  margin-top: 4px;
  font-size: 16px;
}

.game-state {
  background: #111720;
}

#riskState.safe {
  color: #56d39f;
}

#riskState.caution {
  color: #ffd98d;
}

#riskState.danger,
#riskState.lockout {
  color: #ff8b8b;
}

.shield-stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.shield-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.shield-track {
  height: 10px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #222a34;
}

.shield-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #1aa37a;
}

.shield-track span.caution {
  background: #d8a231;
}

.shield-track span.danger,
.shield-track span.lockout {
  background: #d55353;
}

.game-metrics {
  margin-top: 10px;
}

.rule-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rule-form label {
  display: grid;
  grid-template-columns: 1fr 110px;
  align-items: center;
  gap: 8px;
}

.rule-form input {
  min-height: 30px;
  padding: 0 8px;
  text-align: right;
}

.rule-form input:disabled {
  opacity: 0.72;
  color: var(--muted);
  cursor: not-allowed;
}

.rule-messages {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.rule-progress {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
}

.rule-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.rule-progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #222a34;
}

.rule-progress-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
}

.rule-progress-fill.positive {
  left: 50%;
  background: #1aa37a;
}

.rule-progress-fill.negative {
  right: 50%;
  background: #d55353;
}

.rule-progress-zero {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 1px;
  background: #91a1b3;
}

.rule-status {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
}

.rule-status::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d55353;
}

.rule-status.good::before,
.rule-status.pass::before {
  width: 12px;
  height: 7px;
  border: solid #56d39f;
  border-width: 0 0 3px 3px;
  border-radius: 0;
  background: transparent;
  transform: rotate(-45deg);
}

.rule-status strong {
  font-weight: 650;
}

.rule-status em {
  color: var(--muted);
  font-style: normal;
}

.rule-message {
  padding: 7px 8px;
  border-radius: 6px;
  background: #241f14;
  color: #ffd98d;
}

.rule-message.bad {
  background: #2b181a;
  color: #ffaaaa;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: clamp(6px, 0.8vw, 10px);
  flex: 0 0 clamp(120px, 18vh, 180px);
  min-height: 0;
  overflow: hidden;
}

.list-empty {
  padding: 16px 0 4px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 6px;
  max-height: 100%;
  overflow: auto;
  padding-top: 10px;
}

.row-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
}

.row-item small {
  color: var(--muted);
}

.trade-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trade-row {
  display: grid;
  grid-template-columns: 76px 80px minmax(90px, .8fr) minmax(150px, 1.5fr) minmax(120px, 1fr) 90px 80px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10151c;
}

.trade-row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.trade-row small {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.trade-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-row .trade-main {
  grid-column: 1 / -1;
}

.trade-close-detail {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 5px;
  padding: 6px 8px;
  border-left: 2px solid #526071;
  background: #151c24;
  font-size: 12px;
}

.trade-close-detail span {
  color: #c7d2df;
}

.trade-close-detail strong {
  white-space: nowrap;
}

.journal {
  display: flex;
  flex-direction: column;
}

.journal textarea {
  flex: 1;
  min-height: 0;
  margin-top: 10px;
  padding: 10px;
  resize: none;
}

.positive {
  color: #56d39f;
}

.negative {
  color: #ff8b8b;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 32vw);
  }

  .lower-grid {
    grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.1fr);
  }

  .lower-grid .journal {
    grid-column: 1 / -1;
  }
}

@media (max-height: 860px) and (min-width: 1081px) {
  body {
    font-size: 13px;
  }

  button {
    min-height: 30px;
  }

  .app-shell {
    gap: 6px;
    padding: 6px;
  }

  .replay-nav {
    min-height: 36px;
    padding: 4px 8px;
  }

  .replay-nav a,
  .replay-nav button {
    min-height: 28px;
  }

  .topbar p {
    display: none;
  }

  h1 {
    font-size: 20px;
  }

  .topbar-mark {
    width: 34px;
    height: 34px;
  }

  .status-strip div {
    padding: 6px 8px;
  }

  .chart-toolbar {
    padding: 4px 6px;
  }

  .indicator-bar {
    min-height: 32px;
    padding: 4px 8px;
  }

  .timeframe-buttons button,
  .time-nudge-buttons button,
  .session-jump-buttons button {
    min-height: 28px;
  }

  .panel-block {
    padding: 8px;
  }

  .lower-grid {
    flex-basis: clamp(96px, 16vh, 140px);
  }
}

@media (max-width: 1080px) {
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace,
  .lower-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .chart-wrap {
    height: min(62dvh, 560px);
    min-height: 360px;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    max-height: none;
  }

  .lower-grid {
    flex: 0 0 auto;
  }

  .list {
    max-height: clamp(120px, 22vh, 220px);
  }

  .journal textarea {
    min-height: 130px;
  }

  .side-panel .rules {
    grid-column: 1 / -1;
  }

}

@media (max-width: 760px) {
  body {
    font-size: 13px;
  }

  .app-shell {
    padding: 6px;
  }

  .topbar,
  .chart-toolbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar > *,
  .chart-toolbar > *,
  .toolbar-actions,
  .time-nudge-buttons,
  .session-jump-buttons,
  .timeframe-buttons {
    width: 100%;
  }

  .toolbar-actions {
    display: flex;
  }

  .toolbar-group,
  .time-nudge-buttons,
  .session-jump-buttons,
  .timeframe-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar-actions button,
  .time-nudge-buttons button,
  .session-jump-buttons button,
  .timeframe-buttons button {
    width: 100%;
    min-width: 0;
    padding: 0 6px;
  }

  .indicator-bar {
    gap: 6px;
  }

  .trade-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .indicator-bar input[type="number"] {
    width: 58px;
  }

  .chart-wrap {
    height: min(58dvh, 460px);
    min-height: 320px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .side-panel .rules {
    grid-column: auto;
  }

  .trade-grid,
  .metric-grid,
  .risk-row {
    grid-template-columns: 1fr;
  }

  .rule-form label {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .replay-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .replay-nav div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .replay-nav > div:last-child {
    margin-left: 0;
  }

  .replay-nav .demo-limit-timer {
    display: flex;
    justify-content: space-between;
  }

  .replay-nav .demo-limit-timer[hidden] {
    display: none;
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions,
  .time-nudge-buttons,
  .session-jump-buttons,
  .timeframe-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-wrap {
    height: 420px;
    min-height: 320px;
  }

  .row-item {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}
/* Strategy drill briefing, result and live objective */
.drill-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(2, 7, 12, .88); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(5px); }
.drill-overlay[hidden], .drill-hud[hidden] { display: none; }
.drill-dialog { width: min(600px, 100%); border: 1px solid #263849; border-radius: 16px; background: #101821; padding: 28px; box-shadow: 0 28px 80px rgba(0,0,0,.55); }
.drill-dialog h2 { font-size: 1.7rem; margin: 4px 0 10px; }
.drill-dialog ol { color: #d6e0e9; line-height: 1.55; padding-left: 22px; }
.drill-dialog li + li { margin-top: 8px; }
.drill-objective { color: #79dfba; font-weight: 700; }
.drill-note { color: #8496a8; font-size: .82rem; }
.drill-tags { display: flex; gap: 8px; }
.drill-tags span { border: 1px solid #31485d; border-radius: 999px; padding: 4px 9px; color: #a8bed0; font-size: .75rem; text-transform: capitalize; }
.drill-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.drill-actions a { text-decoration: none; display: inline-flex; align-items: center; padding: 8px 13px; border-radius: 6px; }
.drill-actions a.button { background: #187a60; color: #f4fffb; border: 1px solid #239d7d; }
.drill-actions a.secondary { background: #202833; color: #eef3f8; border: 1px solid #2b3440; }
.demo-limit-overlay { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; padding: 20px; background: rgba(2, 7, 12, .9); backdrop-filter: blur(5px); }
.demo-limit-overlay[hidden] { display: none; }
.demo-limit-dialog { width: min(520px, 100%); padding: 28px; border: 1px solid #315244; border-radius: 12px; background: #0f1916; box-shadow: 0 28px 80px rgba(0,0,0,.6); }
.demo-limit-dialog h2 { margin: 4px 0 10px; font-size: 1.55rem; }
.demo-limit-dialog p:not(.eyebrow) { color: #d6e0e9; line-height: 1.5; }
.demo-limit-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.demo-limit-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: 8px; text-decoration: none; }
.demo-limit-actions a.button { border: 1px solid #239d7d; background: #187a60; color: #f4fffb; }
.demo-limit-actions a.secondary { border: 1px solid #2b3440; background: #202833; color: #eef3f8; }
.demo-limit-expired .app-shell { filter: saturate(.65); }
.drill-grade { width: 86px; height: 86px; display: grid; place-items: center; border-radius: 50%; background: #183c31; color: #69e4b5; font-size: 2.5rem; font-weight: 900; float: right; }
.drill-breakdown { display: grid; gap: 8px; clear: both; padding-top: 14px; }
.drill-breakdown div { display: flex; justify-content: space-between; border-bottom: 1px solid #24313c; padding: 8px 0; }
.head2head-result-dialog { width: min(440px, 100%); display: grid; justify-items: center; gap: 12px; border-color: #2e6b83; text-align: center; }
.head2head-result-dialog h2 { margin: 0; }
.head2head-result-dialog p:not(.eyebrow) { margin: 0; color: #d6e0e9; font-size: 1rem; line-height: 1.45; }
.head2head-result-dialog button { margin-top: 4px; min-width: 190px; border-color: #2e6b83; background: #10445c; }
.head2head-result-mark { display: grid; place-items: center; width: 74px; height: 74px; border: 1px solid rgba(98, 217, 255, .45); border-radius: 50%; background: rgba(13, 82, 103, .72); color: #e9fbff; font-size: .95rem; font-weight: 900; letter-spacing: .08em; box-shadow: 0 0 0 8px rgba(98, 217, 255, .07); }
.head2head-result-overlay.success .head2head-result-dialog { border-color: rgba(86, 211, 159, .58); }
.head2head-result-overlay.success .head2head-result-mark { border-color: rgba(86, 211, 159, .55); background: rgba(24, 91, 68, .82); color: #eafff5; box-shadow: 0 0 0 8px rgba(86, 211, 159, .08); }
.head2head-result-overlay.success .head2head-result-dialog button { border-color: #2e6f56; background: #185b44; }
.head2head-result-overlay.loss .head2head-result-dialog { border-color: rgba(213, 83, 83, .64); }
.head2head-result-overlay.loss .head2head-result-mark { border-color: rgba(255, 139, 139, .58); background: rgba(94, 32, 36, .82); color: #fff1f1; box-shadow: 0 0 0 8px rgba(255, 139, 139, .08); }
.head2head-result-overlay.loss .head2head-result-dialog button { border-color: #7b3636; background: #5e2024; }
.drill-hud { position: fixed; z-index: 100; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 24px; background: rgba(12, 24, 33, .96); border: 1px solid #2e5549; border-radius: 10px; padding: 7px 10px 7px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.drill-hud div { display: grid; }
.drill-hud span { color: #8496a8; font-size: .65rem; text-transform: uppercase; }
.drill-hud strong { font-size: .82rem; white-space: nowrap; }
.head2head-hud { position: fixed; z-index: 100; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 20px; background: rgba(8, 19, 28, .96); border: 1px solid #2e6b83; border-radius: 10px; padding: 7px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.head2head-hud[hidden] { display: none; }
.head2head-hud div { display: grid; }
.head2head-hud span { color: #8da8b5; font-size: .65rem; text-transform: uppercase; }
.head2head-hud strong { font-size: .82rem; white-space: nowrap; }
.head2head-hud .positive { color: #62d9ff; }
.head2head-hud .negative { color: #c792ff; }
.drill-mode .game-state, .drill-mode .rules { opacity: .45; pointer-events: none; }
.head2head-mode #saveReturnDashboard { border-color: #2e6b83; background: #10445c; }
.head2head-mode .session-jump-buttons { display: none; }
.head2head-mode .consecutive-loss-rule { display: none; }
@media (max-width: 900px) { .drill-hud, .head2head-hud { top: auto; bottom: 8px; width: calc(100% - 16px); justify-content: space-between; } }
