@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/sg-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/sg-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/sg-vietnamese.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  --bg: #07080d;
  --bg-2: #0e1424;
  --panel: #121a2d;
  --line: #232a3d;
  --text: #f3f1ec;
  --muted: #9aa3b2;
  --accent: #ffb224;
  --accent-ink: #1a1200;
  --radius: 14px;
  --gutter: 16px;
  --max: 640px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 60% at 10% 0%, #16203a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Korean breaks lines at spaces, between words, not inside them. */
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
/* Japanese has no spaces; break between phrases, not inside words (Chrome). */
:lang(ja) { word-break: auto-phrase; }
/* Wide tracking suits Latin capitals; it breaks Devanagari's joined
   headstroke and loosens CJK. */
:is(:lang(hi), :lang(ja), :lang(ko), :lang(zh)) :is(.kicker, .mark, .badge, .live-label, .tile-label, .ticker-label) {
  letter-spacing: 0;
}

.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Header with the live counter */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter) 0;
}
.brand {
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  flex: none;
}
.brand { width: auto; padding: 0 12px 0 4px; gap: 8px; display: inline-flex; align-items: center; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-ink);
  color: var(--accent);
  font-size: 20px;
}
.brand-name { font-size: 19px; letter-spacing: -0.02em; }
.brand-slogan { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }

/* Rank tabs: one row, scrolls sideways on narrow phones instead of wrapping */
.tabs {
  display: flex;
  gap: 6px;
  max-width: var(--max);
  margin: 14px auto 0;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.tabs a:hover { color: var(--text); border-color: var(--muted); }
.tabs a[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.live { margin-top: 18px; line-height: 1.2; }
.live-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.live-num { font-size: 18px; font-weight: 600; white-space: nowrap; }

.kicker { margin: 0 0 8px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 14px; }
.badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  vertical-align: 2px;
}

/* Rank forms */
.rank-form { display: grid; gap: 12px; }
.money { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.money .field:only-child { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.field-label { margin: 6px 0 0; font-weight: 600; }
.rank-form .actions .btn { flex: 1 1 140px; }
.btn.ghosted { background: transparent; color: var(--accent); }

/* My card */
.tiles { display: grid; gap: 10px; margin: 8px 0 24px; }
.tile {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  color: var(--muted);
  text-decoration: none;
}
.tile.done { border-style: solid; background: var(--panel); color: var(--text); }
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.tile-value { font-size: 19px; font-weight: 600; }
.tile:not(.done) .tile-value { color: var(--accent); }
.tile:not(.done) .tile-value::after { content: " \2192"; }

/* Where else do you rank? */
.next { margin: 30px 0; }
.next h2 { font-size: 20px; margin: 0 0 12px; }
.next-links { display: flex; flex-wrap: wrap; gap: 8px; }
.next-links a {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.next-links a:hover { border-color: var(--accent); }
.foot-brand { color: var(--text); font-size: 15px; }

main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Ask */
.ask { padding: 40px 0 8px; }
h1 {
  font-size: clamp(38px, 9vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  font-weight: 700;
}
.sub { color: var(--muted); font-size: 18px; margin: 0 0 28px; max-width: 34ch; }

.friend-banner {
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255, 178, 36, 0.12);
  border: 1px solid rgba(255, 178, 36, 0.4);
  font-weight: 500;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; margin-bottom: 10px; padding: 0; }

.fields {
  display: grid;
  grid-template-columns: 0.8fr 1.6fr 1fr;
  gap: 10px;
}
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.field.wide { margin: 14px 0; }

select, input[type="text"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 600 18px/1 var(--font);
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-end: 30px;
}
select:focus, input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(255, 178, 36, 0.25); }

.msg { min-height: 1.5em; margin: 10px 0 0; color: var(--accent); font-weight: 500; }
.private { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* Result */
.result { padding: 12px 0 24px; }
.hero-result { padding: 24px 0 8px; }
.mark { margin: 0; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 14px; }
.number {
  margin: 6px 0 10px;
  font-weight: 700;
  font-size: min(64px, 8.4vw);
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.number .approx { color: var(--muted); font-weight: 500; font-size: 0.7em; margin-inline-end: 0.12em; }
.number .hash { color: var(--accent); }
.lead { font-size: 22px; font-weight: 500; margin: 0; }

.friend-result {
  margin: 18px 0 0;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 178, 36, 0.12);
  border: 1px solid rgba(255, 178, 36, 0.4);
  font-size: 19px;
  font-weight: 600;
}

.people { margin: 26px 0 8px; }
.grid100 {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  max-width: 340px;
}
/* Each cell holds the page's icon (an inline SVG drawn in currentColor). */
.grid100 i {
  display: block;
  aspect-ratio: 1;
  color: var(--line);
  transform: scale(0.84);
  transition: color 0.25s ease, transform 0.25s ease;
}
.grid100 i.on { color: var(--accent); transform: scale(1); }
.grid100 svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.people figcaption { color: var(--muted); font-size: 15px; margin-top: 10px; }

.twins { font-size: 18px; margin: 18px 0; }

.ticker {
  margin: 22px 0;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.ticker-label { display: block; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.ticker-num { display: block; font-size: clamp(26px, 7.5vw, 40px); font-weight: 700; margin: 4px 0 2px; }
.ticker-open { color: var(--muted); font-size: 14px; }

.thennow { font-size: 18px; }
.note { color: var(--muted); font-size: 14px; }

.country {
  margin: 22px 0;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.country label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.country p { margin: 12px 0 0; }
#r-country-older { font-size: 19px; font-weight: 600; }

.milestone {
  font-size: 17px;
  padding-inline-start: 14px;
  border-inline-start: 3px solid var(--accent);
}

/* Share and challenge */
.share, .challenge {
  margin: 30px 0;
  padding: 20px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.share h2, .challenge h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -0.01em; }
.challenge p { color: var(--muted); margin: 0; }
.challenge .actions { margin-top: 4px; }
.challenge .note { margin-top: 12px; font-size: 13px; }
/* Post-it links: for desktops; phones have the share sheet. */
.challenge .intents { margin-top: 14px; font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.intents a { font-weight: 600; }
@media (pointer: coarse) { .challenge .intents { display: none; } }

/* A friend's rank, above the form on a challenge link */
.rc-banner {
  margin: 0 0 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 178, 36, 0.12);
  border: 1px solid rgba(255, 178, 36, 0.4);
}
.rc-banner p { margin: 0; }
.rc-who { color: var(--accent); font-weight: 600; font-size: 14px; }
.rc-top { font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 4px 0 2px !important; }
.rc-lead { font-weight: 500; }
.rc-cta { color: var(--muted); margin-top: 8px !important; font-size: 15px; }

/* Compare with someone famous */
.famous { margin: 22px 0; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.famous label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.famous .note { margin: 10px 0 0; font-size: 13px; }

/* Privacy page */
.doc h2 { font-size: 21px; margin: 30px 0 8px; }
.doc p, .doc li { color: var(--muted); max-width: 62ch; }
.doc ul { padding-inline-start: 20px; }
.doc li { margin: 8px 0; }
.doc code { font-size: 0.9em; color: var(--text); overflow-wrap: anywhere; }
.doc .btn { margin-top: 8px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 15px var(--font);
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--text); color: var(--bg); }

.check { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.card-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 14px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: 600 17px var(--font);
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.share-hint { color: var(--muted); font-size: 14px; margin: -4px 0 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn-link { display: inline-grid; place-items: center; text-decoration: none; }
.btn.ghost { border-color: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.btn:active { transform: translateY(1px); }

/* How it works */
.how { margin: 24px 0; }
.how details { border-top: 1px solid var(--line); padding-top: 16px; }
.how summary { cursor: pointer; font-weight: 600; font-size: 18px; }
.how h3 { font-size: 15px; margin: 18px 0 4px; color: var(--accent); }
.how p { margin: 0; color: var(--muted); }
.sources { padding-inline-start: 18px; color: var(--muted); }
.sources li { margin: 6px 0; }

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.lang { display: inline-flex; align-items: center; gap: 10px; }
.lang select { min-height: 40px; width: auto; font-size: 15px; }

.noscript { max-width: var(--max); margin: 24px auto; padding: 0 var(--gutter); }

/* Reveal */
.result.reveal .hero-result { animation: rise 0.6s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 720px) {
  body { font-size: 18px; }
  .ask { padding-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
