/* Through the deck: a green (card-table) event field with the deck, the card and the calls, beside a navy panel. */
.stage { display: grid; }
.field { position: relative; background: var(--green); color: #fff; padding: 0 var(--pad) 26px; display: flex; flex-direction: column; }
.field h1 { font-size: clamp(36px, 9vw, 68px); margin: 22px 0 22px; }

/* The deck to come (navy, its count under it) and the card showing, white with the rank in two corners. */
.table { --w: clamp(110px, 24vw, 170px); display: flex; align-items: flex-end; gap: clamp(20px, 5vw, 48px); }
.pile { position: relative; width: calc(var(--w) * 0.62); height: calc(var(--w) * 0.87); background: var(--ink); outline: 2px solid #fff; outline-offset: -2px; display: grid; place-items: end center; }
.pile span { position: absolute; bottom: calc(-1 * 26px); left: 0; white-space: nowrap; color: rgba(255, 255, 255, 0.9); }
.pile.empty { background: transparent; box-shadow: none; outline-style: dashed; }
.card { position: relative; width: var(--w); height: calc(var(--w) * 1.4); background: #fff; color: var(--ink); display: grid; place-items: center; }
.card.red { color: var(--red); }
.card .rank { position: absolute; left: 9%; top: 5%; font-weight: 800; font-size: calc(var(--w) * 0.24); letter-spacing: -0.04em; line-height: 1; }
.card .rank.flip { left: auto; top: auto; right: 9%; bottom: 5%; transform: rotate(180deg); }
.card .pip { width: 48%; }
.card .pip svg { display: block; width: 100%; height: auto; }
.card.dealt { animation: deal 0.3s var(--ease) both; transform-origin: left center; }
.card.wrong::after { content: ""; position: absolute; inset: 0; border: 6px solid var(--orange); }
@keyframes deal { from { transform: translateX(calc(-1 * var(--w) * 0.9)) scaleX(0.1); } }

.prompt { min-height: 3em; line-height: 1.5; margin: 36px 0 12px; font-size: 18px; font-weight: 700; max-width: 30em; }

/* The two calls: white tiles, navy text, orange on hover. */
.calls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 520px; }
.call { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 72px; border: 0; border-radius: 0; background: #fff; color: var(--ink); font: inherit; cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease); }
.call .arrow { font-size: 18px; line-height: 1; }
.call .ev { font-size: 16px; }
@media (hover: hover) { .call:hover:not(:disabled) { background: var(--orange); } }
.call:active:not(:disabled) { transform: scale(0.97); }
.call:disabled { opacity: 0.5; cursor: default; }

/* One square per call (51), white when called right, the ending call outlined orange. */
.run { display: grid; grid-template-columns: repeat(17, minmax(0, 1fr)); gap: 4px; margin-top: 22px; max-width: 520px; }
.run i { aspect-ratio: 1; border: 2px solid rgba(255, 255, 255, 0.45); }
.run i.on { background: #fff; border-color: #fff; }
.run i.out { background: var(--orange); border-color: var(--orange); }

.status { display: flex; gap: clamp(24px, 5vw, 56px); margin-top: 18px; padding-top: 10px; border-top: 2px solid rgba(255, 255, 255, 0.6); max-width: 520px; }
.num { font-size: clamp(30px, 6vw, 48px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }

.check { display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; cursor: pointer; align-self: flex-start; }
.check input { appearance: none; width: 22px; height: 22px; margin: 0; border: 2px solid #fff; display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: #fff; }
.check input:checked::after { content: ""; width: 10px; height: 10px; background: var(--ink); }

/* Drawn cards: 13 ranks across, 4 suits down. Drawn is white, the card showing is outlined orange. */
.seen { display: grid; grid-template-columns: 28px repeat(13, minmax(0, 1fr)); gap: 3px; margin-top: 12px; max-width: 520px; }
.seen b { font-size: 12px; font-weight: 800; text-align: center; color: rgba(255, 255, 255, 0.9); }
.seen .s { width: 18px; height: 18px; align-self: center; color: #fff; }
.seen .s svg { display: block; width: 100%; height: 100%; }
.seen i { position: relative; aspect-ratio: 0.72; border: 2px solid rgba(255, 255, 255, 0.35); }
.seen i.on { background: #fff; border-color: #fff; }
.seen i.now { background: #fff; border: 3px solid var(--orange); }

.panel { background: var(--navy); color: #fff; padding: 24px var(--pad) 28px; }
.soft { color: var(--navy-soft); }
.panel-title { font-size: clamp(28px, 5vw, 38px); letter-spacing: -0.02em; line-height: 1.05; }
.panel .keys { margin-top: 18px; font-size: 15px; }
.panel .more { display: inline-block; margin-top: 28px; color: #fff; }
@media (hover: none) { .panel .keys { display: none; } }

/* The leaderboards: Today and All time, cells of name and cards through, your row white. */
.board { margin-top: 30px; padding-top: 14px; border-top: 2px solid rgba(255, 255, 255, 0.3); max-width: 520px; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.board h3 { font-size: 24px; letter-spacing: -0.02em; }
.tabs { display: flex; }
.tabs button { padding: 8px 12px; border: 2px solid #fff; background: transparent; color: #fff; cursor: pointer; border-radius: 0; }
.tabs button + button { border-left: 0; }
.tabs button.on { background: #fff; color: var(--ink); }
@media (hover: hover) { .tabs button:not(.on):hover { background: var(--orange); border-color: var(--orange); color: var(--ink); } }
.who { margin-top: 10px; font-size: 15px; }
.who b { color: #fff; }
.link { padding: 0; border: 0; background: none; color: #fff; font: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
@media (hover: hover) { .link:hover { color: var(--orange); } }
.cta { margin-top: 14px; padding: 14px 20px; border: 2px solid #fff; border-radius: 0; background: #fff; color: var(--ink); font: 800 13px var(--font); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
@media (hover: hover) { .cta:hover { background: var(--orange); border-color: var(--orange); } }
.top { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: r; }
.top li { counter-increment: r; display: grid; grid-template-columns: 2.2em 1fr auto; align-items: baseline; gap: 10px; padding: 8px 6px; border-top: 1px solid rgba(255, 255, 255, 0.15); font-size: 16px; }
.top li::before { content: counter(r); font-weight: 800; color: var(--navy-soft); font-variant-numeric: tabular-nums; }
.top li[data-rank]::before { content: attr(data-rank); }
.top li b { font-weight: 800; font-variant-numeric: tabular-nums; }
.top li .tries { margin-left: 8px; font-size: 13px; color: var(--navy-soft); }
.top li.you { background: #fff; color: var(--ink); }
.top li.you::before, .top li.you .tries { color: var(--ink); }
.top li.empty, .top li.gap { display: block; border: 0; padding: 4px 0; }
.top li.empty::before, .top li.gap::before { content: none; }
.note { margin-top: 10px; font-size: 15px; }
.cta.submit { display: block; width: 100%; margin-top: 18px; }
.cta:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) { .cta:disabled:hover { background: #fff; border-color: #fff; } }
.note:empty { display: none; }

/* The math: three ways to play, with bars on a log scale of tries. */
.math { padding-top: clamp(40px, 7vw, 72px); }
.math h2 { font-size: clamp(36px, 6vw, 64px); padding-bottom: 14px; border-bottom: var(--rule) solid var(--ink); }
.math .therefore { margin-top: clamp(20px, 3vw, 32px); font-size: clamp(18px, 2vw, 22px); max-width: 36em; color: var(--ink-soft); }
.math .ladder { list-style: none; margin: clamp(20px, 3vw, 32px) 0 0; padding: 0; max-width: 900px; }
.math .ladder li { display: grid; grid-template-columns: 10em 11em 1fr; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(20, 33, 61, 0.15); }
.math .ladder span { font-weight: 700; }
.math .ladder b { font-size: clamp(17px, 2vw, 22px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
.math .ladder b small { display: block; font-size: 14px; font-weight: 400; color: var(--ink-soft); letter-spacing: 0; }
.math .ladder i { display: block; height: 14px; min-width: 2px; background: var(--ink); }
.math .ladder .last { border-top: var(--rule) solid var(--ink); }
.math .ladder .last i { background: var(--orange); }
.math .steps-math { margin: clamp(28px, 4vw, 44px) 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; max-width: 40em; }
.math .steps-math li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; font-size: clamp(17px, 1.8vw, 20px); color: var(--ink-soft); }
.math .steps-math li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: #fff; font-weight: 800; }
.math .steps-math b { color: var(--ink); }
.math .source { margin-top: 32px; font-size: 15px; color: var(--ink-soft); max-width: 60em; }

@media (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1.55fr) minmax(380px, 1fr); min-height: 100svh; }
  .field { padding-bottom: 36px; }
  .panel { padding-top: 76px; padding-bottom: 36px; display: flex; flex-direction: column; }
  .panel .more { margin-top: auto; padding-top: 28px; align-self: flex-start; }
}
@media (max-width: 640px) {
  .math .ladder li { grid-template-columns: 1fr 1fr; }
  .math .ladder i { grid-column: 1 / -1; }
  .seen { grid-template-columns: 20px repeat(13, minmax(0, 1fr)); gap: 2px; }
  .seen b { font-size: 10px; }
  .seen .s { width: 14px; height: 14px; }
  .call { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) { .card.dealt { animation: none; } }
