:root {
  --bg: #12141A;
  --bg2: #191C24;
  --ink: #F4F2EC;
  --ink-dim: #9AA0AE;
  --accent: #3FE0B0;
  --accent-ink: #06231B;
  --line: #262A34;
  --bad: #E8607A;
  --bar-h: 52px;
  --display: "Space Grotesk", "Inter", sans-serif;
  --body: "Inter", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
#app { display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- CA bar: fixed to the top, on screen at every width ---------- */
.ca-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: rgba(18, 20, 26, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.ca-bar__label {
  font-family: var(--display); font-weight: 700; font-size: 12px;
  letter-spacing: 0.08em; color: var(--accent); flex: none;
}
.ca-bar__addr {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 13px; color: var(--ink);
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.ca-bar__addr::-webkit-scrollbar { display: none; }
.ca-bar__copy {
  flex: none; border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  border-radius: 7px; padding: 6px 10px; font-size: 12px; font-weight: 600;
}
.ca-bar__copy.is-copied { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ca-bar__copy:disabled { opacity: 0.45; cursor: default; }
.ca-bar__gmgn {
  flex: none; font-size: 12px; color: var(--ink-dim); text-decoration: none; border-left: 1px solid var(--line); padding-left: 10px;
}
.ca-bar__gmgn:hover { color: var(--accent); }

/* ---------- masthead: name + connect, deliberately NOT in the fixed CA bar ---------- */
.masthead {
  margin-top: calc(var(--bar-h) + 14px);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.masthead__id { display: flex; align-items: center; gap: 10px; }
.masthead__logo { width: 34px; height: 34px; border-radius: 9px; }
.masthead__name { display: flex; flex-direction: column; line-height: 1.15; font-family: var(--display); }
.masthead__name strong { font-size: 17px; }
.masthead__name span { font-size: 12px; color: var(--ink-dim); }
.masthead__links { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
}
.pill--accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- layout: single column on the phone, recomposes past 1000px ---------- */
.stage {
  flex: 1;
  padding: 16px;
  display: flex; flex-direction: column; gap: 18px;
  max-width: 1180px; margin: 0 auto; width: 100%;
}
.dial-col, .board-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.round-strip { display: flex; align-items: baseline; justify-content: space-between; }
.round-phase { font-family: var(--display); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.round-clock { font-family: var(--mono); font-size: 13px; color: var(--ink-dim); }

/* ---------- the dial: the hero object ---------- */
.dial {
  position: relative;
  background: radial-gradient(circle at 50% 38%, var(--bg2), var(--bg) 72%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 14px;
  display: flex; align-items: center; justify-content: center;
}
.dial svg { width: min(100%, 420px); height: auto; display: block; }
.dial__ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.dial__spoke { fill: var(--ink-dim); opacity: 0.85; transition: d 0.4s ease; }
.dial__spoke.is-leader { fill: var(--accent); }
.dial__tick { fill: var(--ink-dim); font-family: var(--mono); font-size: 11px; }
.dial__needle { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transform-origin: 160px 160px; transition: transform 0.6s cubic-bezier(.2,.7,.3,1); }
.dial__hub { fill: var(--ink); }
.dial__readout {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.dial__leader { font-family: var(--display); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: 0.04em; }
.dial__weight { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); margin-top: 2px; }

/* ---------- turn form ---------- */
.turn-form { display: flex; flex-direction: column; gap: 10px; }
.heading-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.heading-btn {
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
  border-radius: 10px; padding: 9px 4px; font-family: var(--mono); font-size: 12px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.heading-btn span.pct { font-family: var(--body); font-weight: 500; font-size: 10px; color: var(--ink-dim); }
.heading-btn.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.heading-btn.is-leader span.pct { color: var(--accent); }
.turn-form__row { display: flex; gap: 8px; }
.turn-form__amount {
  flex: 1 1 auto; min-width: 0; background: var(--bg2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 12px; font-size: 15px; font-family: var(--mono);
}
.turn-form__submit {
  flex: none; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 10px;
  padding: 0 20px; font-family: var(--display); font-weight: 700; font-size: 14px;
}
.turn-form__submit:disabled { opacity: 0.5; }
.turn-form__msg { min-height: 16px; font-size: 12px; color: var(--ink-dim); margin: 0; }
.turn-form__msg.is-bad { color: var(--bad); }
.turn-form__msg.is-good { color: var(--accent); }

.how { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--bg2); }
.how summary { font-family: var(--display); font-weight: 600; font-size: 14px; cursor: pointer; }
.how__list { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }
.how__list li { margin-bottom: 6px; }

/* ---------- side column: leaderboard, moves, primer ---------- */
.panel { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg2); }
.panel__h { font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 10px; color: var(--ink-dim); }
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.leaderboard li { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; }
.leaderboard .rank { color: var(--ink-dim); width: 1.4em; flex: none; }
.leaderboard .head { width: 2.6em; flex: none; font-weight: 700; }
.leaderboard .bar { flex: 1 1 auto; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.leaderboard .bar span { display: block; height: 100%; background: var(--ink-dim); }
.leaderboard li.is-leader .bar span { background: var(--accent); }
.leaderboard .amt { flex: none; color: var(--ink-dim); font-size: 11px; }

.moves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.moves__empty { color: var(--ink-dim); }
.moves li { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); color: var(--ink-dim); }
.moves li b { color: var(--ink); font-family: var(--body); font-weight: 600; }

.primer { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.primer dt { color: var(--ink-dim); }
.primer dd { margin: 0; font-family: var(--mono); font-weight: 600; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 14px 16px 26px; }
.foot__row {
  max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 11px; color: var(--ink-dim);
}
.foot__mono { font-family: var(--mono); }

/* ---------- ~720-1000px: wider measure, bigger dial, still one column ---------- */
@media (min-width: 720px) {
  .stage { padding: 20px 24px; gap: 22px; }
  .dial svg { width: min(100%, 480px); }
  .heading-picker { grid-template-columns: repeat(8, 1fr); }
}

/* ---------- >=1000px: the page recomposes into two columns ---------- */
@media (min-width: 1000px) {
  .stage { flex-direction: row; align-items: flex-start; padding: 28px 24px; }
  .dial-col { flex: 1.35 1 0; }
  .board-col { flex: 1 1 0; position: sticky; top: calc(var(--bar-h) + 24px); }
  .dial svg { width: min(100%, 420px); }
}
