:root {
  color-scheme: dark;
  --ink: #edf6ef;
  --muted: #a5bab0;
  --base: #121c17;
  --surface: #1b2921;
  --rule: #35483d;
  --green: #2ce697;
  --on-green: #092618;
  --red: #fb6861;
  --amber: #efbc57;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; color: var(--ink); background: var(--base); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--green); text-underline-offset: .24em; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page-width { width: min(590px, calc(100% - 44px)); margin-inline: auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 76px;
}
.wordmark { margin: 0; font-size: 26px; font-weight: 850; line-height: 1; letter-spacing: -.05em; white-space: nowrap; }
.wordmark span { color: var(--green); letter-spacing: -.02em; }
.wordmark small { font-size: .68em; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button {
  padding: 0 2px; border: 0; background: none; min-height: 42px; color: var(--muted);
  width: 35px; display: grid; place-items: center;
}
.icon-button:hover { color: var(--green); }
.quota-indicator {
  display: flex; align-items: center; gap: 4px; min-width: 30px; color: var(--green);
  font: 750 14px/1 var(--mono); font-variant-numeric: tabular-nums;
}
.quota-icon {
  width: 11px; height: 15px; background: currentColor;
  clip-path: polygon(56% 0, 12% 56%, 46% 56%, 33% 100%, 92% 40%, 56% 40%, 69% 0);
}
.rules-icon {
  position: relative; width: 15px; height: 18px; border: 1.5px solid currentColor; border-radius: 3px;
}
.rules-icon::before {
  content: ""; position: absolute; top: 4px; left: 3px; right: 3px; height: 1px;
  background: currentColor; box-shadow: 0 3px currentColor, 0 6px currentColor;
}
.invite-icon { position: relative; width: 22px; height: 18px; }
.invite-icon::before, .invite-icon::after { content: ""; position: absolute; border: 1.5px solid currentColor; }
.invite-icon::before { top: 0; left: 4px; width: 8px; height: 8px; border-radius: 50%; }
.invite-icon::after { left: 0; bottom: 0; width: 16px; height: 8px; border-radius: 8px 8px 3px 3px; }
.invite-icon i { position: absolute; right: 0; top: 6px; width: 8px; height: 8px; }
.invite-icon i::before, .invite-icon i::after { content: ""; position: absolute; inset: 3px 0; background: currentColor; border-radius: 1px; }
.invite-icon i::after { transform: rotate(90deg); }
.gift { position: relative; width: 18px; height: 13px; border: 1.5px solid var(--green); border-radius: 2px; margin-top: 4px; }
.gift::before {
  content: ""; position: absolute; height: 6px; width: 7px; left: 1px; top: -7px; border: inherit;
  border-radius: 5px 5px 0 5px; transform: rotate(14deg);
  box-shadow: 5px -2px 0 -1px var(--base), 6px -2px 0 0 var(--green);
}
.gift::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 44%, var(--green) 44% 56%, transparent 56%),
    linear-gradient(transparent 32%, var(--green) 32% 45%, transparent 45%);
}
.challenge { padding: clamp(56px, 15svh, 132px) 0 28px; text-align: center; }
.signal {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; width: max-content; gap: 6px; padding: 4px 7px;
  background: linear-gradient(145deg, #263930, #121e18 72%);
  border: 1px solid #42594c; border-radius: 999px;
  box-shadow: inset 0 1px 1px #a6c6b426, 0 5px 14px #08120d87;
}
.signal i {
  width: 9px; aspect-ratio: 1; border-radius: 50%;
  box-shadow: inset 0 2px 4px #080e0ba8, 0 0 0 1px #0b130f;
}
.signal i:nth-child(1) { background: #482d2d; }
.signal i:nth-child(2) { background: #463d27; }
.signal i:nth-child(3) { background: #284234; }
[data-phase="ready"] .signal i:nth-child(1) {
  background: radial-gradient(circle at 39% 29%, #ffb59d, var(--red) 35%, #a83338);
  box-shadow: 0 0 14px #fb68615c, inset 0 1px 1px #ffd9c799;
}
[data-phase="result"] .signal i:nth-child(2) {
  background: radial-gradient(circle at 39% 29%, #ffe6a6, var(--amber) 40%, #b77525);
  box-shadow: 0 0 14px #efbc575c, inset 0 1px 1px #fff2c999;
}
[data-phase="holding"] .signal i:nth-child(3) {
  background: radial-gradient(circle at 39% 29%, #c5ffe3, var(--green) 40%, #168358);
  box-shadow: 0 0 14px #2ce69761, inset 0 1px 1px #d4ffee99;
}

.timer-frame {
  --frame-edge: #779889;
  display: grid; place-items: center; position: relative; min-width: 0; min-height: clamp(106px, 26vw, 144px);
  width: min(100%, 355px); margin-inline: auto; padding: 7px clamp(12px, 2.5vw, 21px);
}
.timer-frame::before, .timer-frame::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 17px; pointer-events: none;
  border-block: 1px solid var(--frame-edge);
  mask-image: linear-gradient(#000 0 17px, transparent 17px calc(100% - 17px), #000 calc(100% - 17px));
}
.timer-frame::before { left: 0; border-left: 1px solid var(--frame-edge); border-radius: 5px 0 0 5px; }
.timer-frame::after { right: 0; border-right: 1px solid var(--frame-edge); border-radius: 0 5px 5px 0; }
.figure {
  min-width: 0; font-size: clamp(62px, 17.5vw, 109px); font-weight: 760;
  font-variant-numeric: lining-nums tabular-nums; line-height: .99; letter-spacing: .002em; white-space: nowrap;
}
.figure small { font-size: .21em; }
[data-phase="holding"] .timer-frame { --frame-edge: var(--green); }
[data-phase="holding"] .figure { color: var(--green); }

.prize-caption {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%);
  width: max-content; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.25;
}
.prize-caption strong { color: var(--green); font-size: 1.18em; font-weight: 850; font-variant-numeric: tabular-nums; }
.start-area { width: min(100%, 380px); margin: clamp(31px, 6vw, 43px) auto 0; }
.start {
  display: inline-grid; place-items: stretch; width: clamp(170px, 51vw, 233px); aspect-ratio: 1;
  padding: 12px; border: 1px solid #728b7e; border-radius: 50%;
  background: conic-gradient(from -46deg, #6e8a7b, #2b3b33 18%, #152820 42%, #526b5d 65%, #263b31 85%, #6e8a7b);
  box-shadow: inset 0 0 0 5px #243e31, inset 0 1px 2px #d4f8e27a,
    0 0 0 4px #101c16, 0 14px 24px #070e0aa6;
  touch-action: none; user-select: none; -webkit-touch-callout: none; vertical-align: top;
}
.start-face {
  display: grid; place-items: center; min-width: 0; border: 1px solid #9bf1be;
  border-radius: 50%; color: var(--on-green); font-size: clamp(24px, 6vw, 39px); font-weight: 850;
  line-height: 1; letter-spacing: .015em; transform: translateY(-6px);
  background: radial-gradient(ellipse at 38% 6%, #b5f7cd 0%, #6de0a0 31%, #38ba78 65%, #248453);
  box-shadow: inset 0 4px 4px #edfff58a, inset 0 -7px 1px #0f5d4259, 0 10px 0 #15714b, 0 14px 10px #06110bb5;
  text-shadow: 0 1px #c4eed64d;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
@media (hover: hover) {
  .start:hover .start-face { filter: brightness(1.07); }
}
[data-phase="holding"] .start-face {
  transform: translateY(3px); filter: brightness(1.03);
  font-size: clamp(20px, 5.2vw, 32px);
  box-shadow: inset 0 3px 8px #d5ffe288, inset 0 -4px 1px #0f5d4270, 0 2px 0 #166745, 0 0 19px #2ce69740;
}
.result-score { margin: 9px 0; color: var(--green); font: 800 36px/1 var(--mono); }
.closest-attempts {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px;
  width: min(100%, 380px); margin: 62px auto 0; border-block: 1px solid var(--rule);
}
.closest-list {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  list-style: none; margin: 0; padding: 0;
}
.closest-list li { display: grid; place-content: center; justify-items: center; gap: 4px; min-width: 0; padding: 5px 3px; }
.closest-list li + li { border-left: 1px solid var(--rule); }
.closest-list strong { font: 750 clamp(12px, 4vw, 16px)/1 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.attempt-icon { position: relative; width: 13px; height: 13px; border: 1px solid currentColor; border-radius: 50%; color: var(--muted); }
.attempt-icon::before { content: ""; position: absolute; }
.attempt-icon.best { color: var(--green); }
.attempt-icon.best::before { inset: 3px; background: currentColor; border-radius: 50%; }
.attempt-icon.recent::before { width: 4px; height: 4px; top: 2px; left: 4px; border-left: 1px solid; border-bottom: 1px solid; }
.leaderboard-button {
  display: grid; min-height: 44px; place-items: center; padding: 0; border: 0; border-left: 1px solid var(--rule);
  background: none; color: var(--muted);
}
.leaderboard-button:hover { color: var(--green); }
.leaderboard-icon { position: relative; width: 4px; height: 15px; background: currentColor; border-radius: 1px; }
.leaderboard-icon::before, .leaderboard-icon::after {
  content: ""; position: absolute; width: 4px; bottom: 0; border-radius: 1px; background: currentColor;
}
.leaderboard-icon::before { left: -6px; height: 8px; }
.leaderboard-icon::after { right: -6px; height: 11px; }
.closest-list li:first-child strong, .history tr[data-self="true"] td:nth-child(2) { color: var(--green); }
.wallet {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--rule); border-radius: 10px; background: var(--base); margin-block: 16px;
}
.wallet-balance { display: grid; align-content: start; justify-items: start; gap: 7px; padding: 13px; }
.wallet-balance + .wallet-balance { border-left: 1px solid var(--rule); }
.wallet-balance > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.wallet-pending { color: var(--amber); font-size: 11px; }
.wallet-amount { font: 800 clamp(16px, 5vw, 24px)/1.15 var(--mono); overflow-wrap: anywhere; }
.wallet-amount:is(a) { text-decoration: none; }
.wallet-amount:is(a)::after { content: " ↗"; font-size: .65em; }
.wallet-amount:is(a):hover { text-decoration: underline; }
.withdraw-button {
  min-height: 30px; border: 1px solid #607166; border-radius: 5px; padding: 4px 8px;
  background: #2b3830; color: #c3cec7; font-size: 12px; font-weight: 750;
}
.withdraw-button[data-available="true"] { border-color: var(--green); background: var(--green); color: var(--on-green); }
.withdraw-button:hover { filter: brightness(1.16); }
#withdraw-note { margin: -5px 0 14px; }
.invite-progress { color: var(--green); font-weight: 750; }
.share-link {
  width: 100%; padding: 9px; background: var(--base); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 7px; font: 500 13px/1.35 var(--mono);
}
.dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.action {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 11px; border: 1px solid var(--rule); border-radius: 7px;
  background: var(--base); color: var(--ink); font-size: 13px; font-weight: 750; text-decoration: none;
}
.action.primary { color: var(--on-green); background: var(--green); border-color: var(--green); }
.action:hover:not(:disabled) { filter: brightness(1.14); }
.history { margin-top: 8px; }
.history h3 { margin: 0; font-size: 15px; }
.history table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.history th, .history td { text-align: left; padding: 12px 6px; border-bottom: 1px solid var(--rule); }
.history th { color: var(--muted); font-size: 12px; font-weight: 600; }
.history td { font: 650 13px/1.35 var(--mono); font-variant-numeric: tabular-nums; }
.history th:first-child, .history td:first-child { padding-left: 0; }
.history th:last-child, .history td:last-child { text-align: right; padding-right: 0; width: 33%; }
.history td[data-exact="true"] { color: var(--green); }
.history td[data-exact="false"] { color: var(--muted); }
.history td small { display: block; margin-top: 3px; color: var(--muted); font: 500 11px/1.2 "Helvetica Neue", Arial, sans-serif; }
.withdrawal-list { list-style: none; padding: 0; margin: 3px 0 18px; }
.withdrawal-list li { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.withdrawal-list span { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
#empty-history td { color: var(--muted); font-family: inherit; font-weight: 400; text-align: left; padding: 15px 0; }

dialog {
  width: min(435px, calc(100% - 24px)); max-height: calc(100svh - 26px);
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 13px; padding: 0;
  box-shadow: 0 22px 75px #0009;
}
dialog::backdrop { background: #080f0bdc; backdrop-filter: blur(3px); }
.dialog-content { position: relative; padding: 22px; }
.dialog-content h2 { margin: 0 38px 13px 0; font-size: 24px; letter-spacing: -.035em; line-height: 1.1; }
.dialog-content p { line-height: 1.46; }
.dialog-close { position: absolute; top: 10px; right: 10px; }
.dialog-close button { width: 41px; height: 41px; border: 1px solid var(--rule); border-radius: 7px; font-size: 23px; background: var(--base); }
.dialog-note { color: var(--muted); font-size: 13px; }
.reward-tiers {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 11px 9px; border-block: 1px solid var(--rule);
  padding: 14px 0; font-size: 14px;
}
.reward-tiers dd { margin: 0; font-weight: 750; text-align: right; }
.reward-tiers dd:first-of-type { color: var(--green); }
.reward-tiers dt { color: var(--muted); }
.withdraw-form, .withdraw-form fieldset { display: grid; gap: 12px; }
.withdraw-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.withdraw-form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
.withdraw-form :is(input, select) {
  width: 100%; min-height: 42px; border: 1px solid var(--rule); border-radius: 6px; padding: 7px 10px;
  background: var(--base); color: var(--ink); font: inherit; font-size: 16px;
}
.withdraw-form .dialog-note { margin: 0; }
.withdraw-form #withdraw-status { color: var(--green); }

@media (max-width: 460px) {
  .page-width { width: calc(100% - 32px); }
  .topbar { min-height: 64px; }
  .wordmark { font-size: 23px; }
  .top-actions { gap: 6px; }
  .icon-button { width: 32px; }
  .challenge { padding-top: clamp(60px, 15svh, 116px); }
  .history th, .history td { padding-block: 10px; }
  .history th { font-size: 11px; }
  .history td { font-size: 12px; }
}
@media (max-height: 640px) {
  .challenge { padding-top: clamp(32px, 10svh, 68px); }
  .closest-attempts { margin-top: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .start-face { transition: none; }
}
