body.play {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
.play .topbar { height: 40px; flex: none; }
.play .wordmark { font-size: 15px; }
#game { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#game[hidden] { display: none; }

.hud {
  display: flex;
  flex-wrap: wrap;
  flex: none;
  gap: 4px 20px;
  align-items: center;
  padding: 4px 12px;
  background: var(--navy-panel);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.hud-item.up strong, .hud-item.up .f-arrow { color: var(--green); }
.hud-item.down strong, .hud-item.down .f-arrow { color: var(--red); }
.f-arrow { display: inline-block; width: 1em; margin-left: 4px; font-size: 11px; }
.hud-buttons { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.hud-buttons button { padding: 3px 12px; }
.hud-buttons button:disabled { opacity: 0.4; cursor: default; filter: none; }
.hud-status { min-width: 64px; font: 700 12px var(--sans); color: var(--muted); }
.hud-status.finished { color: var(--offer); }

.seed-error { max-width: 560px; margin: 48px auto; }
.seed-error p { margin-bottom: 12px; }

.load-error {
  margin: 12px 24px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(224, 102, 102, 0.15);
  color: var(--red);
}

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 8px;
}
.layout-col { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.tile {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.tile.dragging { opacity: 0.45; }
.tile-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 8px;
  background: var(--navy-raised);
  border-bottom: 1px solid var(--line);
  font: 700 11px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.tile-grip { color: var(--steel); font-size: 12px; letter-spacing: 0; }
.tile > .tile-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: none;
  padding: 5px 8px;
}

.splitter { flex: none; touch-action: none; }
.splitter-v { width: 8px; cursor: col-resize; }
.splitter-h { height: 8px; cursor: row-resize; }
.splitter:hover, .layout-resizing-x .splitter-v:active, .layout-resizing-y .splitter-h:active { background: rgba(69, 99, 242, 0.35); border-radius: 4px; }
body.layout-dragging, body.layout-dragging * { cursor: grabbing !important; user-select: none; }
body.layout-resizing-x, body.layout-resizing-x * { cursor: col-resize !important; user-select: none; }
body.layout-resizing-y, body.layout-resizing-y * { cursor: row-resize !important; user-select: none; }
.drop-indicator { position: fixed; z-index: 60; background: var(--gold); border-radius: 2px; pointer-events: none; }
.drag-ghost {
  position: fixed;
  z-index: 61;
  padding: 2px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--navy-raised);
  font: 700 11px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.click-sizes { display: inline-flex; gap: 10px; align-items: center; margin-right: 6px; }
.click-size { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font: 12px var(--sans); }
.hud input.click-size-input {
  width: 52px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--navy);
  color: var(--text);
  font: 12px var(--mono);
}

.panel {
  background: var(--navy-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.panel h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.panel h2 + h2, .panel * + h2 { margin-top: 8px; }

.tile > .smile-panel { display: flex; flex-direction: column; overflow: hidden; }

.risk-list {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr;
  gap: 0 10px;
  margin: 0;
  font-size: 13px;
}
.risk-list dt { color: var(--muted); cursor: help; }
.risk-list dd { margin: 0; text-align: right; }
.risk-list dd.neg { color: var(--red); }

.vol-tick { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 11px; white-space: nowrap; }
.smile-wrap { position: relative; flex: 1 1 0; min-height: 90px; }
.vol-shift { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
.shift-btn {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--navy-raised);
  font: 700 22px/1 var(--sans);
}
.shift-btn:hover { filter: brightness(1.4); }
.shift-up { color: var(--green); }
.shift-down { color: var(--red); }
.vol-nodes { flex: none; margin: 2px 12px 0 40px; }
.node-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.node-btn { padding: 1px 0; font: 700 13px/1.4 var(--sans); }
.node-btn:hover { filter: brightness(1.3); }
.node-row:first-child .node-btn { color: var(--green); }
.node-row:nth-child(3) .node-btn { color: var(--red); }
.node-values { text-align: center; font-size: 13px; line-height: 18px; }
.node-value { cursor: help; }
.node-labels { text-align: center; font-size: 11px; line-height: 14px; margin-top: 1px; }
.node-tick-label { display: flex; align-items: center; gap: 4px; }
.panel .vol-tick input.node-tick, .panel .vol-skew input.node-tick { width: 56px; padding: 1px 4px; font-size: 12px; }
.vol-skew { flex: none; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 12px 0 40px; font-size: 11px; white-space: nowrap; }
.skew-name { font: 700 12px var(--sans); color: var(--muted); cursor: help; }
.skew-btn { padding: 1px 14px; font: 700 13px/1.4 var(--sans); }
.skew-btn:hover { filter: brightness(1.3); }
.skew-up { color: var(--green); }
.skew-down { color: var(--red); }

.panel input[type="number"] {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--navy);
  color: var(--text);
  font: 13px var(--mono);
}

.quote-inputs { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.quote-inputs label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.panel .quote-inputs input[type="number"] { padding: 3px 6px; }
.controls-panel button { padding: 4px 12px; }

.button-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
button.danger { background: #8a2b2b; }
.quote-status { font-size: 12px; font-weight: 700; color: var(--bid); }
.quote-status.pulled { color: var(--red); }
.queued-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--royal);
  font-size: 11px;
  font-weight: 700;
}

.tile > .board-panel { --board-row-h: 18px; display: flex; flex-direction: column; overflow: hidden; padding: 4px; }
.board-scroll { flex: 1 1 0; min-height: 0; overflow: auto; }

.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
}

.board th, .board td {
  height: var(--board-row-h);
  padding: 0 4px;
  line-height: 16px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
.board thead tr:nth-child(2) th { top: var(--board-row-h); }

.board thead th {
  position: sticky;
  top: 0;
  background: var(--navy-raised);
  color: var(--muted);
  font: 600 11px var(--sans);
  cursor: default;
}
.board thead th[title] { cursor: help; }
.board .group-row th { text-align: center; letter-spacing: 0.1em; }
.board .group.calls { color: var(--bid); }
.board .group.puts { color: var(--offer); }

.board td.col-greek { color: var(--steel); }
.board td.col-bid { color: var(--bid); }
.board td.col-ask { color: var(--offer); }
.board td.col-theo { color: var(--text); font-weight: 600; }

.board td.on {
  background: #ffffff;
  color: var(--navy);
}
.board td.col-bid.on, .board td.col-ask.on { font-weight: 700; }

.board td.comp {
  color: #f3d36b;
  font-style: italic;
  opacity: 0.85;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(243, 211, 107, 0.45);
}
.board td.comp:hover { opacity: 1; background: rgba(243, 211, 107, 0.15); }

@keyframes fill-flash-buy { from { background: var(--bid); color: var(--navy); } }
@keyframes fill-flash-sell { from { background: var(--offer); color: var(--navy); } }
.board td.flash-buy { animation: fill-flash-buy 0.9s ease-out; }
.board td.flash-sell { animation: fill-flash-sell 0.9s ease-out; }

.board td.col-strike, .board th.col-strike {
  text-align: center;
  font-weight: 700;
  background: var(--navy-raised);
  border-left: 2px solid var(--line);
  cursor: context-menu;
}
.board td.col-tpos, .board th.col-tpos {
  text-align: center;
  background: var(--navy-raised);
  border-right: 2px solid var(--line);
}
.board td.col-strike.overridden { box-shadow: inset 3px 0 0 var(--offer); }

.board tr.atm td { border-top: 1px solid var(--muted); border-bottom: 1px solid var(--muted); }
.board tr.atm td:not(.on) { background-color: rgba(69, 99, 242, 0.22); }
.board tr.atm td.col-strike { background: var(--royal); color: var(--text); }

.smile { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tile > .history-panel { display: flex; flex-direction: column; overflow: hidden; }
.history { display: block; width: 100%; flex: 1 1 0; min-height: 60px; }
.tile > .list-panel { display: flex; flex-direction: column; overflow: hidden; }
.list-panel table { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.list-panel thead { flex: none; }

.list-empty { font-size: 12px; }
.ticker, .trades { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.ticker th, .trades th { color: var(--muted); font: 600 11px var(--sans); text-align: right; padding: 2px 2px; overflow: hidden; }
.ticker td, .trades td { text-align: right; padding: 1px 2px; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.ticker th:nth-child(2), .ticker td.label, .trades th:nth-child(2), .trades td.label { text-align: left; }
.ticker tbody, .trades tbody { display: block; flex: 1 1 0; min-height: 0; overflow-y: auto; }
.ticker thead, .trades thead, .ticker tbody tr, .trades tbody tr { display: table; width: 100%; table-layout: fixed; }
.ticker th:nth-child(1), .ticker td:nth-child(1) { width: 12%; }
.ticker th:nth-child(2), .ticker td:nth-child(2) { width: 30%; }
.ticker th:nth-child(3), .ticker td:nth-child(3) { width: 12%; }
.ticker th:nth-child(4), .ticker td:nth-child(4) { width: 9%; }
.ticker th:nth-child(5), .ticker td:nth-child(5) { width: 16%; }
.ticker th:nth-child(6), .ticker td:nth-child(6) { width: 21%; }
.trades th:nth-child(1), .trades td:nth-child(1) { width: 12%; }
.trades th:nth-child(2), .trades td:nth-child(2) { width: 17%; }
.trades th:nth-child(3), .trades td:nth-child(3) { width: 12%; }
.trades th:nth-child(4), .trades td:nth-child(4) { width: 9%; }
.trades th:nth-child(5), .trades td:nth-child(5) { width: 16%; }
.trades th:nth-child(6), .trades td:nth-child(6) { width: 16%; }
.trades th:nth-child(7), .trades td:nth-child(7) { width: 18%; }
.ticker tr.buy td.side, .trades tr.buy td.side { color: var(--offer); }
.ticker tr.sell td.side, .trades tr.sell td.side { color: var(--bid); }
.ticker tr.mine td { background: rgba(255, 255, 255, 0.08); font-weight: 700; }
.ticker tr.none td { color: var(--steel); opacity: 0.6; }
.trades td.edge { color: var(--green); }
.trades td.edge.neg { color: var(--red); }
.trades-summary { font-size: 11px; margin-bottom: 4px; }
.trades-notice { font-size: 11px; margin-bottom: 4px; color: var(--offer); }

.futures-line { font-size: 11px; line-height: 15px; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.futures-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0; }
.futures-row button { padding: 1px 7px; font-size: 12px; }
.futures-row button.buy { color: var(--offer); }
.futures-row button.sell { color: var(--bid); }
.futures-position { color: var(--muted); }

.popover {
  position: fixed;
  z-index: 10;
  width: 220px;
  padding: 12px;
  background: var(--navy-raised);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.popover h3 { font-size: 14px; margin-bottom: 8px; }
.popover label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.popover input {
  width: 100px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--navy);
  color: var(--text);
  font: 13px var(--mono);
}
.popover p { font-size: 11px; margin-bottom: 8px; }
.popover-error { color: var(--red); }
.popover .button-row { margin: 0; }
.popover button { padding: 6px 10px; }

.combo-head { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 4px; }
.combo-toggle { font-size: 11px; color: var(--muted); cursor: pointer; }

.combos { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.combos th { color: var(--muted); font: 600 11px var(--sans); text-align: right; padding: 2px 4px; cursor: help; }
.combos td { text-align: right; padding: 2px 4px; border-bottom: 1px solid var(--line); }
.combos th:first-child, .combos td.c-label { text-align: left; }
.combos td.c-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.combos tbody tr:hover td { background: rgba(255, 255, 255, 0.06); }
.combos td.tradable { cursor: pointer; }
.combos tbody tr td.tradable:hover { box-shadow: inset 0 0 0 1px currentColor; }
.combos td.c-theo { color: var(--text); font-weight: 600; }
.combos td.c-bid { color: var(--bid); }
.combos td.c-ask { color: var(--offer); }
.combos td.c-delta, .combos td.c-vega, .combos td.c-skew { color: var(--steel); }
.combos td.c-ttl { color: var(--muted); }
.combos tbody tr td.alert-red { background: #c0392b; color: #ffffff; font-weight: 700; }
.combos tbody tr td.alert-blue { background: #2f6fe0; color: #ffffff; font-weight: 700; }
@keyframes combo-flash { from { background: rgba(255, 255, 255, 0.45); } }
.combos tr.alert-flash td { animation: combo-flash 0.8s ease-out; }


.ticker tr.spread td.label { font-style: italic; }

.limits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.limit-head { display: flex; justify-content: space-between; font-size: 12px; line-height: 16px; color: var(--muted); margin-bottom: 2px; }
.limit-track { height: 8px; border-radius: 4px; background: var(--navy-raised); overflow: hidden; }
.limit-fill { height: 100%; width: 0; background: var(--bid); transition: width 0.2s; }
.limit.warn .limit-fill { background: var(--amber); }
.limit.breached .limit-fill { background: var(--red); }
.limit.breached .limit-head span:last-child { color: var(--red); }
.limit-note { font-size: 11px; line-height: 14px; color: var(--steel); margin-top: 2px; }
.limit.breached .limit-note { color: var(--red); }

.hud-buttons button[hidden] { display: none; }

.gameover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  background: rgba(0, 5, 30, 0.72);
}
.gameover[hidden] { display: none; }
.gameover-card {
  position: relative;
  width: min(1100px, 100%);
  background: var(--navy-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.gameover-card h2 { font-size: 22px; margin-bottom: 4px; }
.gameover-card h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.gameover-close { position: absolute; top: 12px; right: 12px; padding: 2px 10px; font-size: 20px; line-height: 1.2; }
.gameover-scenario { color: var(--muted); margin-bottom: 16px; }
.gameover-scenario strong { color: var(--offer); }
.gameover-summary { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.gameover-section { background: var(--navy-raised); border-radius: var(--radius); padding: 12px; }
.gameover-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 13px; }
.gameover-list dt { color: var(--muted); }
.gameover-list dd { margin: 0; text-align: right; }
.gameover-list .neg { color: var(--red); }
.gameover-list .final { font-size: 18px; font-weight: 700; color: var(--text); padding-top: 6px; border-top: 1px solid var(--line); }
.gameover-list dd.final.neg { color: var(--red); }
.gameover-vol { width: 100%; border-collapse: collapse; font-size: 13px; }
.gameover-vol th, .gameover-vol td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.gameover-vol th { color: var(--muted); font: 600 12px var(--sans); }
.gameover-vol tr > th:first-child { text-align: left; }
.gameover-vol td:last-child { color: var(--offer); }
.gameover-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.gameover-chart canvas { display: block; width: 100%; height: 200px; }
.gameover-post { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.gameover-post input { width: 200px; }
.gameover-post :disabled { opacity: 0.5; cursor: default; filter: none; }
.post-status { font-size: 13px; color: var(--muted); }
.post-status.ok { color: var(--bid); }
.post-status.warn { color: var(--amber); }
.post-status.error { color: var(--red); }
.gameover-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gameover-actions button:disabled { opacity: 0.5; cursor: default; filter: none; }

@media (max-width: 900px) {
  .gameover-summary, .gameover-charts { grid-template-columns: 1fr; }
}

.debug-overlay {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.debug-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.debug-table th, .debug-table td { padding: 2px 6px; text-align: right; }
.debug-table th { color: var(--muted); font: 600 11px var(--sans); }
.debug-chart { display: block; width: 100%; height: 140px; }

.small-screen { display: none; }
@media (max-width: 1279px) {
  body:not(.small-screen-ok) .small-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--navy);
  }
}
.small-screen-card { max-width: 420px; text-align: center; }
.small-screen-card p { margin-bottom: 14px; }
.gameover-manual { margin: 8px 0 4px; font-size: 13px; }
