:root {
  --ink: #000;
  --panel: #0e0e0d;
  --line: #2a2926;
  --bone: #f4f1e8;
  --dim: #99958a;
  --green: #19ff6a;
  --red: #ff2a45;
  --yellow: #ffe500;
  --head: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--ink); color: var(--bone); }
body {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100dvh; overflow: hidden;
  font: 500 14px/1.35 var(--mono);
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* header */
.top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); }
.horn { width: 40px; height: 40px; flex: none; }
.top h1 { margin: 0; font: 400 26px/1 var(--head); letter-spacing: .01em; }
.nums { display: flex; gap: 14px; margin: 0 0 0 auto; }
.nums div { text-align: right; }
.nums dt { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.nums dd { margin: 0; font: 400 19px/1.1 var(--head); }
.sound { min-height: 44px; padding: 0 10px; background: none; border: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.sound[aria-pressed="true"] { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }

/* mood meter: the caller gets angrier as the coin climbs */
.mood { display: flex; align-items: center; gap: 10px; padding: 4px 10px 6px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.mood-label b { font: 400 16px/1 var(--head); color: var(--yellow); letter-spacing: .03em; }
.mood-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; flex: 1; height: 10px; }
.mood-bar i { background: var(--line); }
.mood-bar i.on { background: var(--yellow); }
.mood-bar i.on:nth-child(4) { background: #ff8a00; }
.mood-bar i.on:nth-child(5) { background: var(--red); }

/* layout */
.show { display: grid; grid-template-rows: minmax(0, 1fr) 33%; min-height: 0; }

/* the stage */
#stage { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 4px; padding: 10px 12px 12px; min-height: 0; overflow: hidden; background: var(--ink); color: var(--bone); }
#stage.buy { color: var(--green); }
#stage.sell { color: var(--red); }
#stage.card { color: var(--yellow); }
#stage.flood { color: var(--ink); }
#stage.flood.buy { background: var(--green); }
#stage.flood.sell { background: var(--red); }
#stage.flood.card { background: var(--yellow); }
#stage.shake { animation: shake .34s linear 2; }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-7px, 3px) rotate(-.5deg); }
  40% { transform: translate(6px, -4px) rotate(.5deg); }
  60% { transform: translate(-5px, -2px); }
  80% { transform: translate(5px, 3px); }
}
.who { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-height: 26px; }
#who-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 24px/1.1 var(--mono); }
.note { min-height: 18px; font: 800 13px/1.3 var(--mono); text-transform: uppercase; color: var(--yellow); }
#stage.flood .note { color: inherit; }
#sound-gate { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); min-height: 48px; padding: 0 22px; background: var(--yellow); color: var(--ink); border: 0; font: 400 22px/1 var(--head); letter-spacing: .03em; text-transform: uppercase; }
#sound-gate[hidden] { display: none; }
#who-did { font: 800 13px/1.1 var(--mono); text-transform: uppercase; white-space: nowrap; }
.words { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 0; overflow: hidden; text-align: center; }
.line { display: block; font-family: var(--head); line-height: 1.04; white-space: nowrap; }
.w { display: inline-block; visibility: hidden; }
.w.in { visibility: visible; animation: slam .15s cubic-bezier(.2, 1.7, .4, 1) both; }
@keyframes slam { from { transform: scale(1.7); opacity: 0; } to { transform: none; opacity: 1; } }
.say { min-height: 24px; font: 400 20px/1.15 var(--head); letter-spacing: .02em; text-align: center; }
#stage img.idle { max-height: 100%; max-width: 70%; margin: auto; }

/* rail */
.rail { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: var(--panel); border-top: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs button { min-height: 44px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); font: 400 16px/1 var(--head); letter-spacing: .03em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--bone); border-bottom-color: var(--yellow); }
.list { margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.list[hidden], .me[hidden] { display: none; }
.row { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; padding: 6px 10px; border-bottom: 1px solid #1b1a18; font-size: 12px; }
.row .a { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--head); font-size: 15px; letter-spacing: .02em; }
.row .s { color: var(--dim); }
.row.buy .a, .row.buy .t { color: var(--green); }
.row.sell .a, .row.sell .t { color: var(--red); }
.row.sys .t, .row.sys .a { color: var(--yellow); }
.board .row { grid-template-columns: 26px minmax(0, 1fr) auto; }
.board .row .t { font: 800 13px/1.3 var(--mono); color: var(--bone); }
.board .row .a { color: var(--dim); }
#tab-shame .row .s { color: var(--red); }
#tab-fame .row .s { color: var(--green); }
.empty { padding: 16px 12px; color: var(--dim); }

/* my name */
.me { padding: 10px; overflow-y: auto; min-height: 0; }
.me form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.me label { grid-column: 1 / -1; font: 400 17px/1.2 var(--head); letter-spacing: .02em; text-transform: uppercase; }
.me input { min-height: 44px; min-width: 0; padding: 0 10px; background: var(--ink); border: 1px solid var(--line); font-size: 16px; }
.me form button { min-height: 44px; padding: 0 12px; background: var(--yellow); color: var(--ink); border: 0; font-weight: 800; }
#me-out { margin-top: 10px; }
#me-out .called { font: 400 22px/1.1 var(--head); }
#me-out .called.buy { color: var(--green); }
#me-out .called.sell { color: var(--red); }
#me-out p { margin: 6px 0 0; color: var(--dim); }

/* CA bar */
.ca { display: flex; align-items: center; gap: 6px; padding: 6px 10px; padding-bottom: max(6px, env(safe-area-inset-bottom)); background: var(--ink); border-top: 1px solid var(--line); }
.ca code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font: 500 12px/1 var(--mono); }
.ca button, .ca a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 0; font: 400 17px/1 var(--head); letter-spacing: .03em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.ca button { background: var(--bone); color: var(--ink); }
.ca a { background: var(--green); color: var(--ink); }
.ca [hidden] { display: none; }

/* desktop */
@media (min-width: 900px) {
  .top { padding: 10px 18px; gap: 12px; }
  .horn { width: 52px; height: 52px; }
  .top h1 { font-size: 38px; }
  .nums { gap: 26px; }
  .nums dd { font-size: 28px; }
  .nums dt { font-size: 11px; }
  .mood { padding: 4px 18px 10px; font-size: 14px; }
  .mood-label b { font-size: 24px; }
  .mood-bar { height: 14px; }
  .show { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) 400px; }
  .rail { border-top: 0; border-left: 1px solid var(--line); }
  #stage { padding: 18px 26px 22px; }
  #who-name { font-size: 40px; }
  #who-did { font-size: 22px; }
  .note { font-size: 22px; min-height: 30px; }
  .say { font-size: 40px; min-height: 46px; }
  .row { font-size: 13px; padding: 7px 12px; }
  .ca { padding: 8px 18px; }
  .ca code { font-size: 15px; }
}

/* the livestream view: the show and the tape, nothing to tap */
body.stream .sound:not([aria-pressed="false"]), body.stream .tabs, body.stream #ca-copy, body.stream #ca-buy { display: none; }
body.stream .rail { grid-template-rows: minmax(0, 1fr); }
body.stream .ca code { color: var(--bone); text-align: center; font-size: 18px; }
@media (min-width: 900px) { body.stream .show { grid-template-columns: minmax(0, 1fr) 30%; } }

@media (prefers-reduced-motion: reduce) {
  #stage.shake { animation: none; }
  .w.in { animation: none; }
}
@media (max-width: 899px) and (hover: none) {
  #stage.shake { animation-iteration-count: 1; }
}
