/* Dice Market — shared styles.
   Layout: sticky status bar over a responsive grid of panels; phones stack to one column. */
:root {
  --bg: #edf1ef;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --line: #d6dedb;
  --line-strong: #b9c4c0;
  --text: #13201c;
  --muted: #56665f;
  --faint: #86948f;
  --accent: #0c6b57;
  --accent-ink: #ffffff;
  --accent-soft: #daeee8;
  --buy: #1b5cc2;
  --buy-soft: #e1ebfb;
  --sell: #c0352a;
  --sell-soft: #fbe4e1;
  --warn: #a86300;
  --warn-soft: #fff0d4;
  --ok: #26803a;
  --ok-soft: #e0f2e4;
  --grid: #e3e9e6;
  --shadow: 0 1px 2px rgba(19, 32, 28, .06), 0 6px 20px rgba(19, 32, 28, .07);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1412; --surface: #141d1a; --surface-2: #19241f; --line: #273530; --line-strong: #3a4b44;
    --text: #e3ebe8; --muted: #98aaa3; --faint: #6c7e77; --accent: #3dbd99; --accent-ink: #04211a;
    --accent-soft: #17382f; --buy: #5d9dff; --buy-soft: #172a46; --sell: #ff6d60; --sell-soft: #3f1f1b;
    --warn: #f0a63c; --warn-soft: #3b2b10; --ok: #5bc979; --ok-soft: #16321e; --grid: #1f2b27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1412; --surface: #141d1a; --surface-2: #19241f; --line: #273530; --line-strong: #3a4b44;
  --text: #e3ebe8; --muted: #98aaa3; --faint: #6c7e77; --accent: #3dbd99; --accent-ink: #04211a;
  --accent-soft: #17382f; --buy: #5d9dff; --buy-soft: #172a46; --sell: #ff6d60; --sell-soft: #3f1f1b;
  --warn: #f0a63c; --warn-soft: #3b2b10; --ok: #5bc979; --ok-soft: #16321e; --grid: #1f2b27;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font-ui);
}
h1, h2, h3 { margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.up { color: var(--ok); }
.down { color: var(--sell); }
.buy-text { color: var(--buy); }
.sell-text { color: var(--sell); }

/* ---------- status bar ---------- */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.bar .title { font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.bar .spacer { flex: 1; }
.clock { display: flex; align-items: baseline; gap: 8px; }
.clock .round { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.clock .timer { font: 700 20px/1 var(--font-num); font-variant-numeric: tabular-nums; }
.clock .timer.low { color: var(--sell); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill.open { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.halted { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.settled { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.bad { background: var(--sell-soft); color: var(--sell); border-color: transparent; }
.team-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--faint); }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.conn.live { background: var(--ok); }
.conn.down { background: var(--sell); }

/* ---------- layout ---------- */
.wrap { padding: 16px; max-width: 1480px; margin: 0 auto; }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .cols.three { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.25fr); } }
@media (min-width: 1280px) { .cols.three { grid-template-columns: minmax(320px, .95fr) minmax(0, 1.2fr) minmax(300px, .95fr); } }
.stack { display: grid; gap: 16px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0;
}
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.panel h3 { font-size: 15px; }
.panel.attention { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.empty { color: var(--faint); font-size: 14px; padding: 6px 0; }

/* ---------- forms ---------- */
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); min-width: 0;
}
textarea { resize: vertical; min-height: 72px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input.num { font-family: var(--font-num); }
.grid2 { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.buy { background: var(--buy); color: #fff; border-color: var(--buy); }
.btn.sell { background: var(--sell); color: #fff; border-color: var(--sell); }
.btn.danger { color: var(--sell); border-color: var(--sell); background: transparent; }
.btn.danger:hover { background: var(--sell-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 12px 14px; font-size: 16px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--line-strong); background: var(--surface); padding: 9px 8px; font-weight: 700; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"].buy { background: var(--buy); color: #fff; }
.seg button[aria-pressed="true"].sell { background: var(--sell); color: #fff; }
.seg button[aria-pressed="true"]:not(.buy):not(.sell) { background: var(--accent); color: var(--accent-ink); }

.chips { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.chip {
  display: grid; gap: 1px; text-align: left; padding: 7px 9px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); cursor: pointer; min-width: 0;
}
.chip b { font: 700 14px/1.2 var(--font-num); }
.chip span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.chip:disabled { opacity: .45; cursor: not-allowed; }

.form-error { color: var(--sell); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 7px 4px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .r { text-align: right; }
table.data td.num, table.data th.r { text-align: right; }
table.data tr.total td { font-weight: 700; border-top: 1px solid var(--line); }

.status { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.status.CONFIRMED { background: var(--ok-soft); color: var(--ok); }
.status.PENDING { background: var(--warn-soft); color: var(--warn); }
.status.DISPUTED { background: var(--sell-soft); color: var(--sell); }
.status.OPEN { background: var(--ok-soft); color: var(--ok); }
.status.DONE { background: var(--accent-soft); color: var(--accent); }
.status.QUEUED { background: var(--surface-2); color: var(--muted); }
.status.PUBLISHED { background: var(--accent-soft); color: var(--accent); }

/* ---------- inbox cards ---------- */
.ticket {
  display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--warn);
  border-radius: 6px; background: var(--surface-2);
}
.ticket .what { font-weight: 600; }
.ticket .what .side { font-weight: 800; }
.list { display: grid; gap: 8px; }

/* ---------- risk ---------- */
.risk-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fig .label { font-size: 12px; color: var(--muted); }
.fig .value { font: 700 24px/1.15 var(--font-num); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .3s; }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--sell); }
.preview { font-size: 14px; padding: 8px 10px; border-radius: 6px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.preview.bad { border-color: var(--sell); background: var(--sell-soft); }

.dice { display: inline-flex; gap: 4px; vertical-align: middle; flex-wrap: wrap; }
.dice svg { display: block; }
.die-body { fill: var(--surface); stroke: var(--line-strong); }
.die-pip { fill: var(--text); }
.die-unknown { fill: var(--faint); font: 700 11px var(--font-ui); }

/* ---------- news ---------- */
.news-item { padding: 8px 0; border-bottom: 1px solid var(--grid); display: grid; gap: 2px; }
.news-item:last-child { border-bottom: 0; }
.news-item .when { font-size: 12px; color: var(--faint); }
.news-item .headline { font-weight: 600; }
.news-item .fact { font: 12px var(--font-num); color: var(--accent); }
.scroll { max-height: 340px; overflow-y: auto; }

/* ---------- leaderboard ---------- */
.board { display: grid; gap: 4px; }
.board .line { display: grid; grid-template-columns: 26px 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 4px; border-radius: 6px; }
.board .line.me { background: var(--accent-soft); }
.board .rank { font: 700 13px var(--font-num); color: var(--faint); text-align: right; }
.board .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .pnl { font: 700 14px var(--font-num); font-variant-numeric: tabular-nums; }
.board .line.hidden .name { color: var(--faint); font-weight: 400; letter-spacing: .2em; }
.board .line.revealed { animation: reveal .6s ease-out; }
@keyframes reveal { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.awards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.award { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.award .t { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.award .w { font-weight: 700; font-size: 16px; }
.award .d { font-size: 13px; color: var(--muted); }

/* ---------- toasts (top right) ---------- */
.toasts {
  position: fixed; z-index: 60; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px;
  display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 2px;
  animation: toast-in .25s ease-out;
}
.toast.news { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--sell); }
.toast.ok { border-left-color: var(--ok); }
.toast .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.toast .h { font-weight: 700; }
.toast .b { font-size: 14px; color: var(--muted); }
.toast .x { justify-self: end; margin-top: -4px; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(16px); opacity: 0; } }

/* ---------- customer request popup ---------- */
.rfq {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 64px); width: min(460px, calc(100vw - 24px));
  background: var(--surface); border: 2px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow);
  padding: 14px 16px; display: grid; gap: 10px; animation: toast-in .25s ease-out;
}
.rfq .k { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.rfq .ask-line { font-size: 18px; font-weight: 700; }
.rfq .count { font: 800 28px/1 var(--font-num); font-variant-numeric: tabular-nums; }
.rfq .count.low { color: var(--sell); }
.rfq .timebar { height: 4px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.rfq .timebar i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.rfq .mine { font-size: 14px; padding: 6px 10px; border-radius: 6px; background: var(--accent-soft); }
.rfq.result { border-color: var(--line-strong); }
.rfq .min { justify-self: end; }
.rfq.collapsed { width: auto; padding: 8px 12px; grid-template-columns: auto auto; align-items: center; cursor: pointer; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 11px var(--font-num); }
.chart .marker { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 3; opacity: .8; }
.chart .marker-dot { fill: var(--warn); }
.chart .limit { stroke: var(--sell); stroke-width: 1.5; stroke-dasharray: 6 4; }
.chart .limit-label { fill: var(--sell); font: 600 11px var(--font-ui); }
.chart .round-band { fill: var(--surface-2); }
.chart .empty-label { fill: var(--faint); font: 13px var(--font-ui); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.legend span.off { opacity: .35; }

/* ---------- tabs (admin) ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.login .card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; letter-spacing: -.01em; }
.login .sub { color: var(--muted); font-size: 14px; }
.login .dice-row { display: flex; gap: 6px; }

/* ---------- credentials sheet ---------- */
.creds { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cred { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 12px; display: grid; gap: 4px; break-inside: avoid; }
.cred .n { font-weight: 700; font-size: 17px; }
.cred .p { font: 700 16px var(--font-num); }
@media print {
  .bar, .tabs, .no-print, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.panel > header select { width: auto; padding: 4px 8px; font-size: 13px; }

@media (max-width: 600px) {
  .rfq { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); max-height: 75vh; overflow-y: auto; }
  .toasts { width: calc(100vw - 24px); }
  .bar { gap: 8px; padding: 8px 12px; }
  .bar .title { font-size: 15px; }
  .clock .timer { font-size: 18px; }
}

/* ---------- team page: sticky top, summary strip, menu ---------- */
.top { position: sticky; top: 0; z-index: 20; }
.top .bar { position: static; }
.strip { display: none; }
.menu-btn svg { fill: currentColor; display: block; }
.menu {
  position: absolute; right: 12px; top: calc(100% - 2px); z-index: 30; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 6px; display: grid; animation: pop .15s ease-out;
}
.menu button { text-align: left; border: 0; background: none; padding: 11px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu .danger { color: var(--sell); }
.menu-who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabbar { display: none; }
.team-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.known { display: inline-flex; align-items: center; gap: 6px; }
.install {
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; font-size: 14px;
}

/* ---------- leaderboard movement and badges ---------- */
.move { margin-left: 6px; font: 700 11px var(--font-num); }
.move.up { color: var(--ok); }
.move.down { color: var(--sell); }
.board .line.moved.up { animation: rank-up 1.4s ease-out; }
.board .line.moved.down { animation: rank-down 1.4s ease-out; }
@keyframes rank-up { from { box-shadow: inset 0 0 0 2px var(--ok); transform: translateY(8px); } to { box-shadow: inset 0 0 0 2px transparent; transform: none; } }
@keyframes rank-down { from { box-shadow: inset 0 0 0 2px var(--sell); transform: translateY(-8px); } to { box-shadow: inset 0 0 0 2px transparent; transform: none; } }
.badge-icons { margin-left: 6px; font-size: 13px; letter-spacing: 1px; font-weight: 400; }
.badge-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--grid); }
.badge-row:last-child { border-bottom: 0; }
.badge-row.me { background: var(--accent-soft); border-radius: 6px; }
.badge-row .bi { font-size: 22px; text-align: center; }
.rival { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; }

/* ---------- modal and round recap card ---------- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(4, 10, 8, .5); display: grid; place-items: center; padding: 16px; }
.modal-card {
  width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface);
  border-radius: 14px; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); animation: pop .25s ease-out;
}
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.recap { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.recap-head { padding: 16px 18px; background: linear-gradient(135deg, #0c6b57, #08362c); color: #fff; display: grid; gap: 4px; }
.recap-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; font-weight: 700; }
.recap-team { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.recap-pnl { font: 800 46px/1.05 var(--font-num); font-variant-numeric: tabular-nums; }
.recap-pnl.up { color: #a8f0bd; }
.recap-pnl.down { color: #ffbdb5; }
.recap-sub { font-size: 12px; opacity: .85; }
.recap-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.recap-figs > div { background: var(--surface); padding: 10px 14px; display: grid; gap: 1px; }
.recap-figs span, .recap-best > span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.recap-figs b { font-size: 22px; }
.recap em { font-style: normal; font-size: 12px; color: var(--muted); }
.recap em.up { color: var(--ok); }
.recap em.down { color: var(--sell); }
.recap-best { padding: 10px 14px; display: grid; gap: 2px; border-top: 1px solid var(--line); }
.recap-badges { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); }
.recap-badges span { padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); font-size: 13px; font-weight: 600; }

/* ---------- dice landing when news reveals them ---------- */
.dice-reveal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(4, 10, 8, .55); animation: fade-in .2s ease-out; cursor: pointer; }
.dice-reveal.out { animation: fade-out .3s ease-in forwards; }
.dr-card { background: var(--surface); border: 2px solid var(--warn); border-radius: 16px; padding: 18px 22px; display: grid; gap: 12px; justify-items: center; box-shadow: var(--shadow); max-width: 100%; }
.dr-label { font-weight: 800; font-size: 20px; text-align: center; }
.dr-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dr-die { display: grid; justify-items: center; gap: 4px; }
.dr-die .die-body { fill: #fff; stroke: #13201c; stroke-width: 1; }
.dr-die .die-pip { fill: #13201c; }
.dr-die.rolling svg { animation: tumble .18s linear infinite; }
.dr-die.landed svg { animation: land .5s cubic-bezier(.2, 1.6, .4, 1); }
.dr-n { font-size: 12px; color: var(--muted); font-weight: 700; }
.dr-sub { font-size: 14px; color: var(--muted); text-align: center; max-width: 360px; }
@keyframes tumble { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(180deg) translateY(-8px); } 100% { transform: rotate(360deg) translateY(0); } }
@keyframes land { from { transform: scale(1.6) rotate(-25deg); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* ---------- the last ten seconds of a round ---------- */
.clock .timer { display: inline-block; }
.clock .timer.final { color: var(--sell); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
body.team-page.final10::after, body.screen.final10::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  box-shadow: inset 0 0 0 4px var(--sell); animation: edge 1s ease-in-out infinite;
}
@keyframes edge { 50% { box-shadow: inset 0 0 48px 8px var(--sell); } }

/* ---------- phones: four tabs and a summary strip ---------- */
@media (max-width: 899px) {
  .team-page .t-trade, .team-page .t-book, .team-page .t-news, .team-page .t-board { display: none; }
  .team-page[data-tab="trade"] .t-trade, .team-page[data-tab="book"] .t-book,
  .team-page[data-tab="news"] .t-news, .team-page[data-tab="board"] .t-board { display: block; }
  .team-page .cols.three > .stack { display: contents; }
  .team-page .wrap { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .team-page .tabbar {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .tabbar button {
    position: relative; border: 0; background: none; display: grid; justify-items: center; gap: 2px;
    padding: 8px 4px 9px; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer;
  }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button[aria-current="page"] { color: var(--accent); }
  .tb-badge {
    position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--sell); color: #fff; font: 700 11px/18px var(--font-ui); text-align: center;
  }
  .team-page .strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border-bottom: 1px solid var(--line); }
  .sfig { display: grid; justify-items: center; padding: 3px 6px 6px; min-width: 0; }
  .sfig + .sfig { border-left: 1px solid var(--line); }
  .sfig .l { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
  .sfig b { font-size: 17px; white-space: nowrap; }
  .desk-only { display: none !important; }
  .team-page .bar .title { display: none; }
  .team-page .rfq { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); max-height: calc(100vh - 190px); overflow-y: auto; }
  /* Notifications sit just under the header and strip, so the menu and timer stay visible. */
  .team-page .toasts { top: calc(env(safe-area-inset-top, 0px) + 104px); }
}
@media (max-width: 600px) { .hide-narrow { display: none; } }
@media (max-width: 420px) {
  .team-page .clock .round { display: none; }
  .team-chip .nm { max-width: 110px; }
}

/* ---------- admin: joining from phones ---------- */
.join-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.join-row img { width: 120px; height: 120px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.join-row b { font-size: 16px; word-break: break-all; }
.cred-qr { width: 72px; height: 72px; flex: none; }

/* ---------- game master's phone remote ---------- */
.remote-page .wrap { max-width: 560px; }
.btn.big { padding: 14px 16px; font-size: 17px; min-height: 52px; }
.remote-start { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: end; }
.remote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.remote-grid .wide { grid-column: 1 / -1; }
.remote-dice { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.remote-dice .btn { flex-direction: column; padding: 10px 4px; font-size: 13px; min-height: 76px; }
.remote-dice .btn.done { opacity: .55; }
.panel.alert { display: block; border-color: var(--sell); background: var(--sell-soft); color: var(--sell); font-weight: 700; text-decoration: none; }
.remote-links { padding: 4px 0 24px; }
