[hidden] { display: none !important; }

:root {
  --bg: #0e1213;
  --bg2: #151b1c;
  --text: #e3e8de;
  --muted: #9aa49c;
  --gold: #c9973c;
  --gold-hi: #f0cf86;
  --gold-deep: #8a5d17;
  --line: rgba(201, 151, 60, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
}

.mark { width: 26px; height: 26px; }

/* the name is written TouchFi everywhere: capital T and F, not in all caps, no letter spacing
   (decision 182) — here and wherever the name stands (.resources h2) */
.name {
  font-weight: 650;
  font-size: 18px;
}

.lang {
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  font: 600 13px/1 system-ui, sans-serif;
  padding: 7px 11px;
  cursor: pointer;
}

.stage {
  position: relative;
  /* the sky from edge to edge of the screen, right under the header (the owner, 12.11): out of the
     page's side padding; a little taller than square — the countdown still fits on the first screen */
  width: calc(100% + 36px);
  margin: 0 -18px 4px;
  aspect-ratio: 1 / 1.12;
}

/* no frame: the sky fades into the page at the top and the bottom */
.stage.sky-on #spiral {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 5%, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 5%, #000 88%, transparent 100%);
}

#spiral {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.fi {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  height: auto;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 22px rgba(201, 151, 60, 0.35));
}

.stage.sky-on .fi, .stage.sky-on .caption { display: none; }

.caption {
  position: absolute;
  left: 50%;
  top: calc(50% + 17%);
  transform: translateX(-50%);
  color: var(--gold-hi);
  font: 600 13px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  white-space: nowrap;
  background: rgba(14, 18, 19, 0.92);
  padding: 4px 9px;
  border-radius: 999px;
}

.count { text-align: center; margin: 6px 0 16px; }

.count-label {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.count-digits {
  font-size: clamp(34px, 11vw, 48px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--gold-hi);
  margin-top: 2px;
}

.count-digits.small {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.count-when {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  min-height: 1em;
}

.cta {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 19px;
  color: #1b1408;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 8px 28px rgba(201, 151, 60, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

button.cta {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

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

.cta:disabled {
  background: var(--bg2);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.cta[aria-disabled="true"] {
  background: var(--bg2);
  color: var(--muted);
  box-shadow: none;
  pointer-events: none;
}

.note {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin: 10px 4px 0;
}

.waiting {
  text-align: center;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin: 12px 0 0;
}

.entry, .me { margin: 0 0 14px; }

.entry-who, .me-clan {
  text-align: center;
  font-size: 17px;
  margin: 0 6px 14px;
}

.entry-msg {
  text-align: center;
  font-size: 15px;
  margin: 12px 4px 0;
  min-height: 1em;
}

.entry-msg.refused { color: var(--gold-hi); }
/* a phone that does not fit: the refusal in the place of the button (owner, 12.11) */
.entry-who.refused { color: var(--gold-hi); font-weight: 650; }
.entry-next { margin: 0 6px 10px; text-align: center; font-size: 16px; }

/* phase 0 after the finger (decisions 156–160): the place for ever, pre-registered, what comes at X */
.reserved { text-align: center; }
.reserved .me-title { font-size: 24px; margin: 0 0 6px; }
.res-sub { margin: 0 0 10px; font-size: 17px; font-weight: 650; }
.res-next { margin: 0; color: var(--muted); font-size: 15px; }
a.text-btn { text-align: center; }
/* a window without the phone's key (owner, 12.11): Chrome in one tap, or the QR code for an Android phone */
.away-qr { display: block; width: 208px; height: 208px; margin: 2px auto 8px; border-radius: 10px; image-rendering: pixelated; }
.away-url { margin: 0 0 4px; text-align: center; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.remind + .note { margin-top: 0; }

/* the table of clans (decisions 101, 117): a row — a clan, colour — its root clan */
.clans { margin: 22px 0 8px; }

.clans h2 {
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.clan-summary {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 10px;
}

.clan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg2);
  overflow: hidden;
}

.clan-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.clan-row:first-child { border-top: 0; }
.clan-row.sep { border-top: 1px dashed var(--line); }
.clan-row.mine { background: rgba(201, 151, 60, 0.1); box-shadow: inset 3px 0 0 var(--gold); }

.clan-dot { width: 14px; height: 14px; border-radius: 50%; }
.clan-dot.glow { box-shadow: 0 0 9px 2px currentColor; }

/* the name stays on one line in the table (decision 135); two lines are for the circle in the sky */
.clan-name { font-weight: 650; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clan-sub { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.clan-people { font-weight: 700; font-variant-numeric: tabular-nums; }

.clan-more {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

/* phase 2: the primitive screen (decisions 36, 48, 54, 149) — the block counter; what is held, only when
   there is something; in the balance's place the call to touch or what ripens with the one countdown on
   the screen; the gold fingerprint as the one button to put a finger on; one line for the checks */
.touch { text-align: center; margin: 4px 0 16px; }
.touch-hero { margin: 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.touch-held { margin: 8px 0 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.touch-held b { color: var(--gold-hi); font-weight: 800; }
.touch-main { margin: 6px 0 12px; font-weight: 800; color: var(--gold-hi); font-variant-numeric: tabular-nums; line-height: 1.3; text-wrap: balance; }
.touch-main.ready { font-size: 26px; }
.touch-main.ripening, .touch-main.ripe { font-size: 17px; }
.touch-main .touch-amt { font-size: 26px; }
.touch-main .touch-when { display: inline-block; white-space: nowrap; }
.touch-main .touch-when.under { display: block; }
/* what ripens is in the muted gold of the resting button; ripe — it lights up */
.touch-main.ripening { filter: grayscale(0.6) brightness(0.7); }
.touch-btn {
  display: block;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  filter: drop-shadow(0 8px 26px rgba(201, 151, 60, 0.4));
}
.touch-btn img { display: block; width: 160px; height: 160px; }
.touch-btn:active { transform: scale(0.97); }
.touch-btn:disabled { filter: grayscale(0.6) brightness(0.7); cursor: default; }
.touch-line { margin: 12px 4px 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.touch-line.refused { color: var(--gold-hi); }

.transfer-link { word-break: break-all; }

/* phase 2: the race of the round for the treasury (decision 106) */
.race { margin: 0 0 10px; }
.race-list { margin: 0; padding: 0 0 0 22px; color: var(--text); font-size: 15px; }
.race-list li { margin: 2px 0; }
.race-list li::marker { color: var(--gold-hi); font-weight: 700; }

/* the second way in on a link page: quiet, under the one gold button */
.text-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 8px 0 0;
  padding: 10px 8px;
  border: 0;
  background: none;
  color: var(--gold-hi);
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-btn:disabled { color: var(--muted); cursor: default; }

.me {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg2);
  padding: 18px 16px;
}

.me-title {
  text-align: center;
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}

.me-label {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 6px;
}

.me-link {
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
  margin: 0 0 14px;
  user-select: all;
}

.lines {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: line;
  border-top: 1px solid var(--line);
}

.lines li {
  counter-increment: line;
  position: relative;
  padding: 12px 0 12px 34px;
  border-bottom: 1px solid var(--line);
}

.lines li::before {
  content: counter(line);
  position: absolute;
  left: 0;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold-hi);
  font: 600 13px/22px system-ui, sans-serif;
  text-align: center;
}

.phone {
  color: var(--muted);
  font-size: 14px;
  margin: 14px 0 0;
}

.resources { margin-top: 26px; }

.resources h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
}

.resources ul { list-style: none; margin: 0; padding: 0; }

.resources a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
}

@media (prefers-reduced-motion: reduce) {
  .cta:active { transform: none; }
}
