/* Tally
   A chrome hand tally counter stuck to a whitewashed cinder-block wall, and beside it one hundred painted marks in
   groups of five, one per cent: green for the price of Yes, violet for No. The counter's wheels show the price of the
   side you look at, and a ring marks the mark where your position would be closed.
   The page takes its materials from that scene: whitewash for the ground, card white for every panel, graphite for
   every edge, chrome for collars and rules, and the counter's red plunger for every button you press (a rounded red
   cap in a chrome collar that goes down when you press it). The active tab is underlined with a painted stroke.
   Big figures in Funnel Display, everything you read in Funnel Sans; Oswald only on the counter's wheels. Loaded
   after /styles.css, which gives the layout; this file only gives the look. The token names below are also read by
   app.js for the charts, so they stay six-digit hex colours. */
:root {
  --ink-0: #ebeae4; --ink-1: #e2e1da; --ink-2: #d3d2ca; --ink-3: #a3a19a;
  --paper: #fbfbf8;
  --line: #1b1c1f; --line-soft: #dedcd5; --ink: #1b1c1f;
  --fg: #1b1c1f; --muted: #5c5b57; --dim: #8f8d87;
  --a: #1f7a46; --a-soft: rgba(31, 122, 70, .1);
  --b: #5b3ea8; --b-soft: rgba(91, 62, 168, .1);
  --lev: #1b1c1f; --lev-soft: rgba(27, 28, 31, .08);
  --up: #1f7a46; --down: #c3352b; --down-soft: rgba(195, 53, 43, .08);
  --red: #e0442a; --red-hi: #f0633f; --red-lo: #b8321c; --red-edge: #7d200f;
  --chrome: linear-gradient(180deg, #f6f7f9 0%, #c4c9cf 38%, #8d949c 52%, #dfe3e7 70%, #9aa1a9 100%);
  --display: "Funnel Display", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --sans: "Funnel Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "Funnel Sans", "Helvetica Neue", Arial, sans-serif; /* the base layout sets small labels in --mono; Tally uses its sans */
  --addr: "Oxygen Mono", ui-monospace, Menlo, monospace;
  --edge: 1.5px solid var(--line);
  --hair: 1px solid var(--line-soft);
  /* the painted stroke under the active tab: one tally mark laid on its side, tapered at both ends */
  --stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.2Q40 2.6 80 3.4T118 2.6Q119.5 4 117 5.4Q80 6.6 40 6.2T2 6.6Q.5 6 2 5.2Z' fill='%23e0442a'/%3E%3C/svg%3E");
  --shadow: 0 1px 0 rgba(27, 28, 31, .05), 0 18px 32px -24px rgba(40, 42, 48, .5);
  --r: 6px;
  color-scheme: light;
}
body { background: var(--ink-0); color: var(--fg); font: 450 15px/1.5 var(--sans); }
::selection { background: #f7c9bd; color: var(--fg); box-shadow: none; }

/* type: a wide, sturdy display face for the big figures, a plain sans for everything else, figures always lining and tabular */
h2, h3, .h { font: 700 13.5px/1.2 var(--sans); letter-spacing: 0; color: var(--fg); text-transform: none; }
h1 { font: 700 clamp(26px, 2.4vw, 36px)/1.12 var(--display); letter-spacing: -.015em; text-transform: none; font-variant-numeric: lining-nums; }
.num, .sum-stats dd, .pos-grid dd, .tbl td.r, .kv dd { font-family: var(--sans); font-weight: 700; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.005em; }
.hint, .empty, .stage-empty, .empty-state p { font-family: var(--sans); color: var(--muted); }

/* the split-flap tiles become plain figures that click into place when they change, like a counter wheel */
.flaps { gap: 0; }
.flaps > b { width: auto; height: auto; min-width: 0; background: none; border-radius: 0; color: inherit; font: 700 var(--ff, 22px)/1 var(--display); font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0; }
.flaps > b.sp { width: .28em; } .flaps > b.pt { width: auto; }
.flaps > b.flip { animation: roll .34s cubic-bezier(.25, .8, .25, 1); }
@keyframes roll { 0% { opacity: 0; transform: translateY(.32em); clip-path: inset(0 0 40% 0); } 60% { opacity: 1; } 100% { transform: none; clip-path: inset(0); } }
@media (prefers-reduced-motion: reduce) { .flaps > b.flip { animation: none; } }

/* top bar: card white over a graphite rule */
.top { background: var(--paper); border-bottom: 2px solid var(--line); }
.logo { gap: 9px; padding-right: 24px; font: 800 29px/1 var(--display); letter-spacing: -.02em; color: var(--fg); }
.logo .mark { width: 38px; height: 38px; }
.tabs { gap: 2px; }
.tabs a { border-radius: 0; padding: 0 14px; font: 650 14.5px var(--sans); color: var(--muted); }
.tabs a:hover { background: var(--ink-0); color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); background: var(--stroke) 50% calc(100% - 8px) / calc(100% - 20px) 7px no-repeat; }
.tabs b { font-family: var(--sans); font-weight: 800; color: var(--red-lo); }
.bal { border-left: var(--hair); }
.bal span { font: 600 12px var(--sans); color: var(--muted); }
.bal strong { font: 700 21px var(--display); font-variant-numeric: lining-nums tabular-nums; }
.net { color: var(--muted); }

/* controls: graphite edges; the buttons you press are the counter's red plunger in a chrome collar */
.btn { border: var(--edge); border-radius: var(--r); font: 650 14px var(--sans); background: var(--paper); color: var(--fg); box-shadow: inset 0 -2px 0 var(--ink-2); transition: transform .08s, box-shadow .08s, background-color .15s; }
.btn:hover:not(:disabled) { background: var(--ink-0); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--ink-2); }
.btn.primary { background: linear-gradient(180deg, var(--red-hi), var(--red) 55%, var(--red-lo)); color: #fff; border-color: var(--red-edge);
  box-shadow: inset 0 1px 0 rgba(255, 214, 200, .55), inset 0 -3px 0 rgba(90, 20, 6, .35), 0 0 0 2px #c9cdd2, 0 0 0 3px #6f757d; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #f5774f, #e7502f 55%, #c23820); }
.btn.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 214, 200, .35), inset 0 -1px 0 rgba(90, 20, 6, .35), 0 0 0 2px #c9cdd2, 0 0 0 3px #6f757d; }
.btn.cta { border: 1.5px solid var(--red-edge); border-radius: 12px; min-height: 60px; font: 800 23px/1 var(--display); letter-spacing: -.01em; color: #fff;
  background: linear-gradient(180deg, #f57a55 0%, var(--red) 48%, var(--red-lo) 100%);
  box-shadow: inset 0 2px 0 rgba(255, 222, 210, .6), inset 0 -5px 0 rgba(90, 20, 6, .32), 0 0 0 3px #cfd3d8, 0 0 0 4.5px #646a72, 0 6px 0 -1px #646a72; }
.btn.cta:hover:not(:disabled) { filter: none; background: linear-gradient(180deg, #f8875f 0%, #e7502f 48%, #c23820 100%); }
.btn.cta:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255, 222, 210, .4), inset 0 -2px 0 rgba(90, 20, 6, .32), 0 0 0 3px #cfd3d8, 0 0 0 4.5px #646a72, 0 2px 0 -1px #646a72; }
.btn.cta:disabled { background: var(--ink-2); color: var(--dim); border-color: var(--ink-3); box-shadow: 0 0 0 3px #e3e5e8, 0 0 0 4.5px var(--ink-3); }
.btn.ghost { background: var(--paper); box-shadow: none; border-color: var(--ink-3); }
.btn.ghost:active:not(:disabled) { transform: none; }
.btn.small { box-shadow: none; border-width: 1px; }
.seg { border: var(--edge); border-radius: var(--r); padding: 2px; background: var(--paper); }
.seg button { border-radius: 4px; font: 650 13px var(--sans); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--paper); box-shadow: none; }
input:not([type="range"]), select { background: var(--paper); border: 1px solid var(--ink-3); border-radius: var(--r); font-family: var(--sans); font-weight: 550; }
input:not([type="range"]):hover, select:hover { border-color: var(--fg); }
input:not([type="range"]):focus-visible, select:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--fg); box-shadow: none; }
:focus-visible { outline-color: var(--red); }
.chips button { font: 650 13px var(--sans); border-radius: var(--r); border: 1px solid var(--ink-3); background: var(--paper); }
.chips button[aria-pressed="true"] { background: var(--fg); border-color: var(--line); color: var(--paper); }

/* market list */
.mk { border-right: var(--edge); background: var(--paper); }
.mk-head { border-bottom: var(--hair); }
.mk-row { border-bottom: var(--hair); }
.mk-row:hover { background: #f4f3ef; }
.mk-row[aria-current="true"] { background: #efeee9; box-shadow: inset 4px 0 0 var(--red); }
.mk-q { font: 600 15px/1.3 var(--sans); letter-spacing: -.01em; }
.mk-meta { font: 550 12.5px var(--sans); color: var(--muted); }
.mk-px { font: 700 16px/1.15 var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.mk-px .pa { color: var(--a); } .mk-px .pb { color: var(--b); }
/* the split bar under each market: green paint for Yes, violet for No, a hairline of white where they meet */
.mk-split { height: 5px; border-radius: 3px; background: var(--b); } .mk-split i { background: var(--a); border-radius: 3px 0 0 3px; box-shadow: 1.5px 0 0 var(--paper); }
.thumb { border-radius: 5px; }
.thumb.tile { font-family: var(--display); font-weight: 800; border: var(--edge); }
.legal { color: var(--muted); font: 450 12.5px/1.55 var(--sans); }

/* the two sides: white cards; the one you picked takes its paint colour */
.duel { gap: 12px; border: 0; background: transparent; box-shadow: none; }
.duel-side { border: var(--edge); border-radius: var(--r); background: var(--paper); padding: 16px 20px 18px; box-shadow: inset 0 -3px 0 var(--ink-2); transition: background-color .18s, color .18s, transform .08s; }
.duel-side:hover { background: #ffffff; }
.duel-side:active { transform: translateY(1px); }
.duel-name { font: 750 15px var(--sans); }
.duel-side.a .duel-name { color: var(--a); } .duel-side.b .duel-name { color: var(--b); }
.duel-side.a[aria-pressed="true"] { background: var(--a); border-color: #0f4a29; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); }
.duel-side.b[aria-pressed="true"] { background: var(--b); border-color: #34226b; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2); }
.duel-side[aria-pressed="true"], .duel-side[aria-pressed="true"] .duel-name, .duel-side[aria-pressed="true"] .lev,
.duel-side[aria-pressed="true"] .duel-price.flaps > b { color: var(--paper); }
.duel-price.flaps { --ff: 46px; }
.duel-price.flaps > b { font-family: var(--display); font-weight: 800; letter-spacing: -.02em; }
.duel-side .lev { font: 600 12.5px var(--sans); color: var(--muted); }
#st-cat { font: 750 12.5px var(--sans); color: var(--muted); box-shadow: none; }

/* the wall with the counter and the tally under the two sides */
.tlz { margin-top: 14px; border-radius: var(--r); overflow: hidden; box-shadow: 0 0 0 1.5px var(--line), var(--shadow); background: var(--ink-0); }
.tlz svg { display: block; width: 100%; height: auto; }
.tlz.wait { width: min(460px, 86vw); margin: 0 0 22px; }

.chart-panel, .stage-row, .more { border-top: var(--hair); }
.panel { border-radius: var(--r); }
.room-num strong { font: 800 31px var(--display); font-variant-numeric: lining-nums tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--ink-2); } .meter i { background: var(--fg); border-radius: 3px; }

/* the ticket */
.ticket { background: var(--paper); border-left: var(--edge); }
.side-pick { gap: 8px; border: 0; }
.side-pick button { border: var(--edge); border-radius: var(--r); padding: 10px 12px; background: var(--paper); }
.side-pick button span { font: 750 14px var(--sans); }
.side-pick button small { font: 700 19px var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.side-pick .a[aria-pressed="true"] { background: var(--a); border-color: #0f4a29; color: var(--paper); }
.side-pick .b[aria-pressed="true"] { background: var(--b); border-color: #34226b; color: var(--paper); }
/* the ticket's board: card white with a graphite edge and a strip of brushed chrome along the top, like the counter's rim */
.tboard { gap: 10px; padding: 20px 18px 18px; border: var(--edge); border-radius: var(--r); background: var(--chrome) 0 0 / 100% 6px no-repeat, var(--paper); box-shadow: 0 6px 12px -10px rgba(40, 42, 48, .5); }
.tboard span { font: 600 13px var(--sans); color: var(--muted); }
.tboard .flaps { --ff: 26px; }
.tboard .flaps.am > b, .flaps.am > b { color: var(--fg); }
#tk-margin { font: 700 26px var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.quick { gap: 6px; border: 0; }
.quick button { border: 1px solid var(--ink-3); border-radius: var(--r); font: 700 15px var(--sans); font-variant-numeric: lining-nums tabular-nums; background: var(--paper); }
.quick button:hover { border-color: var(--fg); background: var(--ink-0); }
.lev-head output { font: 800 40px/1 var(--display); letter-spacing: -.02em; color: var(--fg); font-variant-numeric: lining-nums; }
/* the leverage slider: a graphite rule filled up to your leverage; the thumb is the red plunger seen from above in its collar */
#tk-lev::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; border: 1px solid var(--line); background: linear-gradient(var(--fg), var(--fg)) 0 0 / calc(var(--v) * 100%) 100% no-repeat, linear-gradient(var(--ink-3), var(--ink-3)) 0 0 / calc(var(--m) * 100%) 100% no-repeat, #efeee9; }
#tk-lev::-moz-range-track { height: 8px; border-radius: 4px; border: 1px solid var(--line); background: linear-gradient(var(--fg), var(--fg)) 0 0 / calc(var(--v) * 100%) 100% no-repeat, linear-gradient(var(--ink-3), var(--ink-3)) 0 0 / calc(var(--m) * 100%) 100% no-repeat, #efeee9; }
#tk-lev::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; border: 1px solid #4b5058; border-radius: 50%; background: radial-gradient(circle at 40% 36%, #ff9b7d 0, var(--red) 38%, #a82b14 64%, transparent 66%), radial-gradient(circle, #e8ebee 0 70%, #8d949c 100%); box-shadow: 0 2px 3px rgba(27, 28, 31, .4); }
#tk-lev::-moz-range-thumb { width: 24px; height: 24px; border: 1px solid #4b5058; border-radius: 50%; background: radial-gradient(circle at 40% 36%, #ff9b7d 0, var(--red) 38%, #a82b14 64%, transparent 66%), radial-gradient(circle, #e8ebee 0 70%, #8d949c 100%); box-shadow: 0 2px 3px rgba(27, 28, 31, .4); }
.lev-ticks { font: 700 13px var(--sans); font-variant-numeric: lining-nums; } .lev-ticks span.off { color: var(--ink-3); }
.rw-track { height: 6px; border-radius: 3px; } .rw-fill { background: var(--ink-3); } .rw-now { background: var(--fg); }
.kv { border-top: var(--hair); } .kv > div { border-bottom: var(--hair); }
.err { border-left: 3px solid var(--down); background: var(--down-soft); border-radius: 2px; }

/* account pages */
.summary { border-bottom: 2px solid var(--line); }
.sum-main span { font: 650 13px var(--sans); color: var(--muted); }
.sum-main strong { font: 800 clamp(48px, 7vw, 96px)/1 var(--display); letter-spacing: -.025em; font-variant-numeric: lining-nums tabular-nums; }
.pos { background: var(--paper); border: var(--edge); border-radius: var(--r); box-shadow: inset 0 -3px 0 var(--ink-2); }
.pos-out { font: 750 12.5px var(--sans); }
.empty-state { border: 1.5px dashed var(--ink-3); border-radius: var(--r); background: var(--paper); }
.empty-state .es-mark { width: 60px; height: 60px; margin-bottom: 6px; }
.empty-state b { font: 800 25px var(--display); }
.tbl th { border-bottom: var(--edge); font: 650 12.5px var(--sans); color: var(--fg); }
.tbl td { border-bottom: var(--hair); }
.mid-num { font: 800 46px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.big-num { font-family: var(--display); font-weight: 800; font-variant-numeric: lining-nums tabular-nums; }
.addr { border: 1px solid var(--ink-3); border-radius: var(--r); background: var(--paper); font-family: var(--addr); font-size: 13px; }
.pick { border: var(--edge); border-radius: 8px; box-shadow: 0 30px 60px -20px rgba(40, 42, 48, .55); background: var(--chrome) 0 0 / 100% 6px no-repeat, var(--paper); }
.pick::backdrop { background: rgba(27, 28, 31, .42); }
.pick-item { font: 650 18px/1.2 var(--sans); border-radius: var(--r); }
.pick-item:hover, .pick-item:focus-visible { background: var(--ink-0); color: var(--fg); }
.toast { background: var(--fg); color: var(--paper); border-left: 5px solid var(--red); border-radius: var(--r); font: 550 15px var(--sans); }

/* loading: the counter counts the books as they come in and grey marks are painted beside it */
.stage-empty .flaps { display: none; }
.stage-empty p:first-of-type { font: 800 24px var(--display); color: var(--fg); }
.stage-empty #load-count { font-family: var(--sans); font-weight: 700; font-variant-numeric: tabular-nums; }
.ld-track { display: none; }
.sk { background: linear-gradient(90deg, var(--ink-1), var(--ink-2), var(--ink-1)); background-size: 200% 100%; border-radius: 3px; }

/* the pointer */
.cur-dot { background: var(--fg); }
.cur-box { border: 1.5px solid var(--fg); border-radius: var(--r); }
#cur.go .cur-box { border-color: var(--red); }

/* the coin in the top bar */
.coin > * { border-left: var(--hair); padding: 0 12px; }
.coin-tk { font: 800 18px var(--display); color: var(--fg); box-shadow: none; }
.coin-ca { font: 400 13px var(--addr); color: var(--muted); }
.coin-ca:hover, .coin-pump:hover { background: var(--ink-0); color: var(--fg); }
.coin-pump { font: 650 13px var(--sans); color: var(--muted); }

@media (max-width: 760px) {
  .coin { border-top: var(--hair); }
  .logo { font-size: 24px; padding-right: 12px; } .logo .mark { width: 30px; height: 30px; }
  .duel-price.flaps { --ff: 28px; }
  .tabs a { padding: 12px 14px; }
  .bal strong { font-size: 17px; } .bal span { font-size: 10.5px; }
  .acct .btn, .seg button { padding-left: 10px; padding-right: 10px; }
  .duel-side { padding: 13px 14px; }
  .tlz { margin-top: 10px; }
  h1 { font-size: 23px; }
}

/* the base layout sets labels in spaced capitals; Tally writes them as words */
h2, h3, .h, .tabs a, .net, .bal span, .seg button, .field label, .chips button, .stage-empty, .stage-empty p, #st-cat, .duel-name,
.side-pick button span, .sum-main span, .pos-out, .tbl th, .eyebrow, .pick-go, h1, .btn, .mk-meta, .duel-side .lev,
.tboard span, .empty-state b, .coin-pump {
  text-transform: none; letter-spacing: 0; }
.net, .stage-empty { font-family: var(--sans); font-weight: 600; }
.field label, .eyebrow, .pick-go { font: 650 13px var(--sans); }

/* Live mode: before a wallet is connected the main button reads "Connect a wallet to trade". In the display face
   that line is wider than a phone, so the button may wrap and the bar never grows past the screen. The bar behind it
   is solid, so a message above the button never sits on the figures scrolling under it. */
.cta-bar { grid-template-columns: minmax(0, 1fr); background: var(--paper); box-shadow: 0 -1px 0 var(--line-soft); }
.cta-bar > * { min-width: 0; }
.btn.cta, .btn.cta:disabled { text-transform: none; letter-spacing: 0; white-space: normal; text-wrap: balance; line-height: 1.12; padding-top: 8px; padding-bottom: 14px; }
.btn.cta:disabled { color: var(--muted); }
