/* SolFlip
   Layout: a duel lobby beside a fixed left rail. A create bar over a grid of open
   games, each card a face-off between two seats with the coin between them.
   Color: graphite grounds, white type, hairline borders. Heads is mint, tails is
   violet, and the side you call tints the controls. A soft mint glow sits behind.
   Type: Geist for everything, Geist Mono for numbers, addresses and labels. */
:root {
  color-scheme: dark;
  --ink: #1c1d23;
  --ink-raised: #24262d;
  --ink-raised-2: #2b2e36;
  --ink-deep: rgb(255 255 255 / 0.04);
  --rail-bg: rgb(23 24 29 / 0.94);
  --rule: rgb(255 255 255 / 0.08);
  --rule-2: rgb(255 255 255 / 0.14);
  --paper: #ffffff;
  --paper-dim: rgb(255 255 255 / 0.62);
  --paper-faint: #7d8187;
  --heads: #87efac;
  --heads-hi: #a7f3c0;
  --heads-lo: #3f9a63;
  --heads-ink: #0b1a10;
  --tails: #c084fc;
  --tails-hi: #d8b4fe;
  --tails-lo: #7e4bc4;
  --tails-ink: #1d0b33;
  --alert: #ff6b6b;
  --call: var(--heads);
  --call-hi: var(--heads-hi);
  --call-lo: var(--heads-lo);
  --call-ink: var(--heads-ink);

  --f-display: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-base: 0.9375rem;
  --t-md: 1.125rem;
  --t-lg: 1.5rem;
  --t-xl: 2rem;
  --t-xxl: 2.75rem;
  --wrap: 1180px;
  --rail: 232px;
  --radius: 20px;
  --radius-sm: 14px;
}

body[data-call="tails"] {
  --call: var(--tails);
  --call-hi: var(--tails-hi);
  --call-lo: var(--tails-lo);
  --call-ink: var(--tails-ink);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background-color: var(--ink);
  background-image: radial-gradient(900px 640px at 92% 30%, rgb(48 92 74 / 0.32), transparent 70%);
  background-attachment: fixed;
  color: var(--paper);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--ink);
}

[hidden] {
  display: none !important;
}

svg,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

code {
  font-family: var(--f-mono);
  font-size: 0.86em;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--call-hi);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.demo-banner {
  background: var(--heads);
  color: var(--heads-ink);
  text-align: center;
  font-size: var(--t-sm);
  font-weight: 600;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: rgb(28 29 35 / 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
}

.brand-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.site-nav a,
.text-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--paper-dim);
  text-decoration: none;
  font-size: var(--t-base);
  font-weight: 400;
  transition: color 0.15s, background-color 0.15s;
}

.site-nav a:hover,
.text-link:hover {
  color: var(--paper);
  background: var(--ink-deep);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  font-size: var(--t-base);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-call {
  background: var(--call);
  color: var(--call-ink);
  font-weight: 600;
}

.btn-call:hover {
  background: var(--call-hi);
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--rule-2);
}

.btn-ghost:hover {
  border-color: rgb(255 255 255 / 0.3);
  background: var(--ink-deep);
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: var(--t-xs);
}

.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: default;
  filter: none;
}

.link-btn {
  justify-self: start;
  background: none;
  border: 0;
  padding: 0;
  color: var(--paper-faint);
  font: inherit;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.copy {
  flex: none;
  background: none;
  border: 1px solid var(--rule-2);
  color: var(--paper-dim);
  border-radius: 999px;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
}

.copy:hover {
  color: var(--paper);
  border-color: rgb(255 255 255 / 0.3);
}

.field-label {
  display: block;
  font-size: var(--t-xs);
  color: var(--paper-faint);
  margin-bottom: 8px;
}

.hint {
  font-size: var(--t-xs);
  color: var(--paper-faint);
}

.addr,
.fp {
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* ---------------------------------------------------------------- sections */
.recent,
.steps,
.fair,
.token,
.faq {
  padding-block: clamp(40px, 6vw, 72px);
}

.recent h2,
.steps h2,
.fair h2,
.token h2,
.faq h2 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-xl);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* ---------------------------------------------------------------- lobby */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lobby {
  padding-block: clamp(24px, 4vw, 40px) clamp(48px, 7vw, 80px);
}

.lobby-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
}

.lobby-title h1 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.lobby-title p {
  margin-top: 10px;
  color: rgb(255 255 255 / 0.45);
  font-size: var(--t-md);
}

.create-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.side-pick,
.amount-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 8px 0 16px;
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.bar-label {
  font-size: var(--t-sm);
  color: var(--paper-faint);
}

.side-btn {
  display: grid;
  place-items: center;
  padding: 3px;
  background: none;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s, border-color 0.15s;
}

.side-btn:hover {
  opacity: 0.8;
}

.side-btn[aria-pressed="true"] {
  opacity: 1;
  border-color: var(--call);
  box-shadow: 0 0 0 4px rgb(255 255 255 / 0.04);
}

.mini-face {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1.5px rgb(0 0 0 / 0.18);
}

.mini-face.heads {
  background: radial-gradient(circle at 35% 30%, #e4ffec, var(--heads) 50%, var(--heads-lo));
  color: var(--heads-ink);
}

.mini-face.tails {
  background: radial-gradient(circle at 35% 30%, #f5e8ff, var(--tails) 50%, var(--tails-lo));
  color: var(--tails-ink);
}

.amount-box {
  flex: 1 1 420px;
  min-width: 0;
}

.amount-box:focus-within {
  border-color: var(--call);
}

.token-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--heads) 10%, var(--tails) 90%);
}

.amount-box input {
  flex: 1 1 90px;
  width: 100%;
  min-width: 70px;
  height: 48px;
  background: none;
  border: 0;
  outline: none;
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: var(--t-md);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.amount-box input::placeholder {
  color: var(--paper-faint);
}

.chips {
  display: flex;
  gap: 4px;
}

.chip,
.chip-clear {
  height: 32px;
  padding: 0 12px;
  background: var(--ink-raised-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper-dim);
  font: inherit;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.chip-clear {
  background: none;
  border-color: transparent;
  padding: 0 8px;
}

.chip:hover,
.chip-clear:hover {
  color: var(--paper);
  border-color: var(--rule-2);
}

.btn-create {
  min-height: 52px;
  padding: 0 28px;
}

.lobby .form-error {
  margin-top: 10px;
  text-align: right;
}

.lobby-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 32px 0 14px;
}

.lobby-sub h2 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
}

.count {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgb(135 239 172 / 0.12);
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--heads);
  vertical-align: middle;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--paper-faint);
}

.filter select {
  height: 36px;
  padding: 0 12px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
}

/* Game cards */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game,
.ghost {
  min-height: 212px;
  border-radius: var(--radius);
}

.ghost {
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(255 255 255 / 0.02);
  border: 1px dashed var(--rule);
  color: var(--paper-faint);
  font-size: var(--t-sm);
  text-align: center;
}

.game {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 8px;
  padding: 12px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  transition: border-color 0.2s;
}

.game.is-new {
  animation: arrive 1.4s ease-out;
}

@keyframes arrive {
  from {
    box-shadow: 0 0 0 2px var(--heads);
  }
  to {
    box-shadow: 0 0 0 2px transparent;
  }
}

.game.is-mine {
  border-color: rgb(135 239 172 / 0.45);
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 14px 6px;
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: opacity 0.4s, box-shadow 0.4s, background-color 0.4s;
}

.seat.is-winner {
  background: linear-gradient(180deg, rgb(135 239 172 / 0.16), rgb(255 255 255 / 0.03) 70%);
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--heads);
}

.seat.is-loser {
  opacity: 0.4;
}

.avatar {
  position: relative;
  width: 58px;
  height: 58px;
}

.avatar svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.avatar .mini-face {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
}

.avatar.empty {
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--rule-2);
  border-radius: 50%;
  color: var(--paper-faint);
  font-weight: 600;
}

.seat-name {
  max-width: 100%;
  overflow: hidden;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  color: var(--paper-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stake {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stake .token-dot {
  width: 12px;
  height: 12px;
}

.seat .btn {
  min-height: 38px;
  padding: 0 20px;
  font-size: var(--t-sm);
}

.seat-note {
  font-size: var(--t-xs);
  color: var(--paper-dim);
  text-align: center;
}

.versus {
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--paper-faint);
  perspective: 600px;
}

.versus .coin-tilt {
  width: 42px;
  transform: rotateX(10deg);
}

.game-foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--t-xs);
  color: var(--paper-faint);
}

.link-btn.small {
  font-size: var(--t-xs);
  white-space: nowrap;
}

.game-foot .meta {
  margin-left: auto;
  text-align: right;
}

.game-foot .result-tag {
  color: var(--paper);
  font-weight: 500;
}

.ring {
  width: 40px;
  height: 40px;
}

.ring circle {
  fill: none;
  stroke-width: 3;
}

.ring .track {
  stroke: var(--rule);
}

.ring .bar {
  stroke: var(--call);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
}

/* Recent duels */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.tab {
  padding: 6px 16px;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--paper-dim);
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--ink-raised-2);
  color: var(--paper);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
}

.stat-row dt {
  font-size: var(--t-xs);
  color: var(--paper-faint);
}

.stat-row dd {
  margin: 6px 0 0;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.split dd {
  display: grid;
  gap: 6px;
  font-size: var(--t-sm);
}

.split-bar {
  display: flex;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tails), var(--tails-lo));
}

.split-heads {
  display: block;
  width: 50%;
  background: linear-gradient(90deg, var(--heads-lo), var(--heads));
  transition: width 0.6s ease;
}

.split-legend {
  display: flex;
  justify-content: space-between;
  font-weight: 400;
  color: var(--paper-dim);
}

.split-legend b {
  color: var(--paper);
}

.duels {
  margin: 0;
  padding: 4px 16px;
  list-style: none;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.duel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.duel.is-new {
  animation: flash 1.4s ease-out;
}

@keyframes flash {
  from {
    background: rgb(135 239 172 / 0.1);
  }
  to {
    background: transparent;
  }
}

.duelist {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.duelist.right {
  flex-direction: row-reverse;
  text-align: right;
}

.duelist .avatar {
  flex: none;
  width: 34px;
  height: 34px;
}

.duelist .avatar .mini-face {
  top: -5px;
  right: -7px;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
}

.duelist-text {
  display: grid;
  min-width: 0;
}

.duelist-text .seat-name {
  font-size: var(--t-xs);
}

.duelist.won .seat-name {
  color: var(--paper);
}

.duelist-amt {
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.duelist.won .duelist-amt {
  color: var(--heads);
}

.duelist.lost .duelist-amt {
  color: var(--paper-faint);
}

.duel-coin {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
}

.duel-when {
  min-width: 56px;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  color: var(--paper-faint);
  text-align: right;
  white-space: nowrap;
}

.duel .link-btn {
  white-space: nowrap;
}

.empty {
  padding: 24px 0;
  color: var(--paper-faint);
}

.escrow-line {
  margin-top: 18px;
  font-size: var(--t-sm);
  color: var(--paper-dim);
}

.escrow-line a {
  color: var(--paper);
}

/* Payment and duel dialog */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgb(10 11 14 / 0.72);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  padding: 24px;
  background: var(--ink-raised);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper-dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--paper);
}

.pay-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 32px;
}

.pay-head .mini-face {
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
}

.pay-title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.pay-sub {
  margin-top: 4px;
  font-size: var(--t-sm);
  color: var(--paper-dim);
}

.pay-step {
  display: grid;
  gap: 16px;
}

.pay-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
}

.qr {
  padding: 12px;
  background: #ffffff;
  border-radius: var(--radius-sm);
}

.qr svg {
  width: 100%;
  height: auto;
}

.qr-caption {
  margin-top: 8px;
  font-size: var(--t-xs);
  text-align: center;
  color: var(--paper-dim);
}

.pay-body {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.pay-label {
  font-size: var(--t-xs);
  color: var(--paper-faint);
}

.pay-amount {
  font-family: var(--f-mono);
  font-size: var(--t-xl);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pay-amount .unit {
  font-family: var(--f-body);
  font-size: var(--t-base);
  letter-spacing: 0;
  color: var(--paper-dim);
}

.pay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pay-actions .btn {
  flex: 1 1 auto;
}

.manual {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.manual-title {
  font-weight: 500;
  color: var(--paper);
}

.manual p {
  font-size: var(--t-sm);
}

.manual-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.3em;
  font-size: var(--t-sm);
}

.manual-steps .addr-row {
  margin-top: 6px;
}

.addr-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.addr-row .addr {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pay-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--call);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.timer {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: var(--t-sm);
  color: var(--paper-faint);
  font-variant-numeric: tabular-nums;
}

#stepLive {
  justify-items: center;
  text-align: center;
}

.live-coin {
  display: grid;
  place-items: center;
  height: 210px;
  perspective: 900px;
}

.live-coin {
  position: relative;
}

.live-coin .coin-tilt {
  width: 160px;
}

/* Countdown before a flip */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  /* In front of the 3D coin */
  transform: translateZ(200px);
  pointer-events: none;
}

.countdown .pop {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 3rem;
  line-height: 1;
  color: var(--call);
  background: rgb(28 29 35 / 0.94);
  border: 2px solid var(--call);
  border-radius: 50%;
  box-shadow: 0 0 40px rgb(135 239 172 / 0.25), 0 10px 30px rgb(0 0 0 / 0.45);
}

.versus .count {
  margin: 0;
  padding: 0;
  background: none;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 1.9rem;
  letter-spacing: 0;
  line-height: 1;
  color: var(--heads);
}

.pop {
  display: inline-block;
  animation: pop 1s ease-out both;
}

@keyframes pop {
  0% {
    transform: scale(1.6);
    opacity: 0;
  }
  18% {
    transform: scale(1);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.25;
  }
}

.sound-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--paper-dim);
  background: none;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  cursor: pointer;
}

.sound-btn:hover {
  color: var(--paper);
}

.sound-btn svg {
  width: 20px;
  height: 20px;
}

.sound-btn .cross,
.sound-btn.is-muted .waves {
  display: none;
}

.sound-btn.is-muted .cross {
  display: inline;
}

.live-coin.is-waiting .coin-tilt {
  animation: hover 2.6s ease-in-out infinite;
}

@keyframes hover {
  0%,
  100% {
    transform: rotateX(16deg) translateY(0);
  }
  50% {
    transform: rotateX(24deg) translateY(-8px);
  }
}

.step-title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-xl);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.step-title.is-win {
  color: var(--heads);
}

.step-text {
  max-width: 46ch;
  color: var(--paper-dim);
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* The 3D coin (shared by cards and the dialog) */
.coin-tilt {
  position: relative;
  aspect-ratio: 1;
  transform: rotateX(16deg);
  transform-style: preserve-3d;
}

.coin {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.coin-layer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #4a4d57 0 62%, #24262d 100%);
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.coin-face svg {
  width: 100%;
  height: 100%;
}


/* How it works */
.step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step-list li {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 24px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  counter-increment: step;
}

.step-list li::before {
  content: "0" counter(step);
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: var(--t-sm);
  line-height: 1;
  color: var(--heads);
}

@supports (-webkit-text-stroke: 1px black) {
  .step-list li::before {
    color: transparent;
    -webkit-text-stroke: 1.2px var(--paper-faint);
  }
}

.step-list h3 {
  font-size: var(--t-md);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.step-list p {
  color: var(--paper-dim);
  max-width: 36ch;
}

/* Fairness */
.fair-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 5vw, 72px);
}

.fair-text {
  display: grid;
  gap: 16px;
  max-width: 62ch;
}

.fair-text > p,
.inputs {
  color: var(--paper-dim);
}

.fair-text strong {
  color: var(--paper);
}

.inputs {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.1em;
}

.client-seed {
  margin-top: 8px;
}

.seed-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.seed-row input,
.verifier input {
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  transition: border-color 0.15s;
}

.seed-row input {
  flex: 1;
}

.seed-row input:focus,
.verifier input:focus {
  border-color: var(--call);
  outline: none;
}

.verifier {
  display: grid;
  gap: 4px;
  padding: 24px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.verifier h3 {
  margin-bottom: 12px;
  font-size: var(--t-md);
  font-weight: 500;
}

.verifier input {
  width: 100%;
  margin-bottom: 10px;
}

.verifier .btn {
  margin-top: 4px;
}

.verify-out {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: var(--t-sm);
  color: var(--paper-dim);
}

.verify-out code {
  overflow-wrap: anywhere;
  color: var(--paper);
}

.verify-out .verdict {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
  color: var(--heads);
}

.verify-out .bad {
  color: var(--alert);
}

/* Token */
.token-inner {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.token .token-inner h2 {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  background: linear-gradient(90deg, var(--heads), var(--tails));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.token-inner > p {
  max-width: 48ch;
  color: var(--paper-dim);
}

.ca {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 10px 10px 20px;
  background: var(--ink-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.ca-label {
  font-size: var(--t-sm);
  color: var(--paper-faint);
}

.token-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Questions */
.faq-inner {
  max-width: 820px;
}

.faq h2 {
  margin-bottom: 16px;
}

.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font-size: var(--t-md);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-weight: 400;
  color: var(--paper-faint);
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  max-width: 64ch;
  padding-bottom: 18px;
  color: var(--paper-dim);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px));
}

.footer-inner {
  display: grid;
  gap: 8px;
  font-size: var(--t-xs);
  color: var(--paper-faint);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  padding: 10px 18px;
  transform: translateX(-50%);
  background: var(--heads);
  color: var(--heads-ink);
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 600;
}

/* ---------------------------------------------------------------- extras for the new look */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.link-btn:hover {
  color: var(--paper);
}

.duel:last-child {
  border-bottom: 0;
}

.duels:empty {
  display: none;
}

.faq .faq-inner {
  max-width: var(--wrap);
}

.faq details {
  max-width: 820px;
}

.stat-row > div {
  padding: 16px 18px;
  background: var(--ink-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.site-nav svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.site-nav a[aria-current="true"] {
  color: var(--heads);
  font-weight: 600;
}

.rail-foot {
  display: none;
}

.lobby-sub h2,
.recent h2 {
  display: flex;
  align-items: center;
}

/* Fixed left rail on wide screens */
@media (min-width: 1100px) {
  .site-header {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail);
    background: var(--rail-bg);
    border-bottom: 0;
    border-right: 1px solid var(--rule);
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
    height: 100%;
    padding: 20px 12px 16px;
  }

  .brand {
    padding: 2px 12px;
  }

  .site-nav {
    flex-direction: column;
    gap: 2px;
    margin-left: 0;
  }

  .site-nav a {
    padding: 10px 12px;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: auto;
  }

  .header-actions .btn {
    width: 100%;
  }

  .rail-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 0;
    border-top: 1px solid var(--rule);
  }

  .rail-foot .brand-mark {
    width: 32px;
    height: 32px;
  }

  .rail-id {
    display: grid;
    min-width: 0;
    line-height: 1.25;
  }

  .rail-id b {
    font-size: var(--t-sm);
    font-weight: 600;
    text-transform: uppercase;
  }

  .rail-id span {
    overflow: hidden;
    font-size: var(--t-xs);
    color: var(--paper-faint);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rail-foot .sound-btn {
    margin-left: auto;
  }

  .header-actions > .sound-btn {
    display: none;
  }

  body > main,
  body > .site-footer,
  body > .demo-banner {
    margin-left: var(--rail);
  }
}

@media (max-width: 1099px) {
  .site-nav svg {
    display: none;
  }

  .header-actions .rail-only {
    display: none;
  }
}

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1080px) {
  .create-bar {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .step-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .fair-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-nav {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .step-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .amount-box {
    flex-wrap: wrap;
    padding-block: 6px;
    padding-right: 12px;
    border-radius: var(--radius);
  }

  .side-pick {
    flex: 1 1 100%;
  }

  .chips {
    flex: 1 1 100%;
    padding-bottom: 4px;
  }

  .chip {
    flex: 1;
  }

  .btn-create {
    flex: 1 1 100%;
  }

  .lobby .form-error {
    text-align: left;
  }

  .duel {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    row-gap: 6px;
  }

  .duel-when,
  .duel .link-btn {
    grid-row: 2;
    text-align: left;
  }

  .duel-when {
    grid-column: 1;
  }

  .duel .link-btn {
    grid-column: 3;
    justify-self: end;
  }
}

@media (max-width: 640px) {
  .pay-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pay-qr {
    order: 2;
    justify-self: center;
    width: min(220px, 100%);
  }

  .modal {
    align-items: start;
  }

  .modal-card {
    padding: 20px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .live-coin.is-waiting .coin-tilt,
  .pulse,
  .game.is-new,
  .duel.is-new,
  .pop {
    animation: none;
  }
}

