/* How did the world sleep? — night sky, one tap, a globe. */
@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url("fonts/space-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url("fonts/space-grotesk-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk-vietnamese-500-normal.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 {
  color-scheme: dark;
  --bg: #0b1026;
  --bg-deep: #070b1c;
  --surface: #141b3a;
  --line: #2a3360;
  --fg: #f2efe6;
  --muted: #a9aec9;
  --well: #f6c76a;
  --well-ink: #1a1400;
  --poor: #8fa3ff;
  --poor-ink: #0b1026;
  --font: "Space Grotesk", "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Noto Sans Thai", sans-serif;
  --radius: 18px;
  --radius-lg: 28px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
::selection { background: var(--well); color: var(--well-ink); }
:focus-visible { outline: 2px solid var(--well); outline-offset: 3px; }
a { color: var(--muted); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; text-wrap: balance; font-weight: 500; }
h3 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.c-well { color: var(--well); } .c-poor { color: var(--poor); }

.gutter, .top, .ask-inner, .world, .foot {
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- top bar ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 16px; font-size: 13px; color: var(--muted); }
.mark { color: var(--fg); font-weight: 500; text-decoration: none; letter-spacing: 0.01em; }
.window { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--well); }
.sample { color: var(--well); }

/* ---------- ask ---------- */
.ask { display: flex; flex-direction: column; }
.ask-inner { width: 100%; max-width: 1180px; margin: 0 auto; padding-block: 8px 40px; display: flex; flex-direction: column; gap: 18px; min-height: calc(100svh - 120px); }
.from { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pin { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.step { display: flex; flex-direction: column; gap: 18px; flex: 1 1 auto; }
.question { font-size: clamp(34px, 9.5vw, 56px); line-height: 1.06; font-weight: 500; letter-spacing: -0.02em; }
.question.is-swapping { animation: swap 420ms var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.question[dir="rtl"] { text-align: right; }
.lead { font-size: 17px; color: var(--muted); max-width: 44ch; }
.fine { font-size: 13px; line-height: 1.4; color: var(--muted); text-align: center; }

.answers { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-height: 280px; }
.answer {
  flex: 1 1 0; min-height: 110px; border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--fg);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px;
  padding: 22px 24px; font: inherit; text-align: left; cursor: pointer;
  transition: transform 160ms var(--ease), filter 160ms;
  -webkit-tap-highlight-color: transparent;
}
.answer:hover { border-color: var(--muted); }
.answer-well:hover, .answer-well:focus-visible { border-color: var(--well); }
.answer-poor:hover, .answer-poor:focus-visible { border-color: var(--poor); }
.answer:active { transform: scale(0.985); }
.answer:disabled { cursor: default; }
.answer-well .glyph { color: var(--well); }
.answer-poor .glyph { color: var(--poor); }
.answer .glyph { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.answer-word { font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.answer-sub { font-size: 14px; font-weight: 400; color: var(--muted); }

.logged { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--well); color: var(--well); font-size: 14px; font-weight: 500; }
.logged.is-poor { border-color: var(--poor); color: var(--poor); }
.tick { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.words { display: flex; flex-direction: column; gap: 10px; }
.words input {
  width: 100%; height: 56px; border-radius: 14px; border: 1px solid var(--line); background: transparent;
  color: var(--fg); font: inherit; font-size: 22px; padding: 0 18px; outline: none; caret-color: var(--well);
}
.words input::placeholder { color: #8088b8; opacity: 1; }
.words input:focus { border-color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 500;
  text-decoration: none; cursor: pointer; border: 1.5px solid transparent; transition: filter 160ms, transform 160ms var(--ease);
}
.btn:hover { filter: brightness(1.08); } .btn:active { transform: scale(0.98); }
.btn-solid { background: var(--fg); color: var(--bg); flex: 2 1 auto; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); flex: 1 1 auto; }
.btn-ghost:hover { border-color: var(--muted); filter: none; }
.btn-ghost[aria-pressed="true"] { border-color: var(--muted); }
.step-dream .actions .btn-solid { flex: 2 1 auto; } .step-dream .actions .btn-ghost { flex: 1 1 auto; }
.step-dream, .step-done { flex: 1 1 auto; }
.moon { width: 44px; height: 44px; fill: none; stroke: var(--well); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.you-split { display: flex; flex-direction: column; gap: 8px; }
.split-head, .split-foot { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.split-foot b { font-weight: 500; }
.bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface); }
.bar-well { background: var(--well); transition: width 600ms var(--ease); } .bar-poor { background: var(--poor); transition: width 600ms var(--ease); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 15px; }
.chips:empty { display: none; }
.step-done .btn { align-self: stretch; margin-top: auto; flex: 0 0 auto; }

/* ---------- make tomorrow one tap ---------- */
.tomorrow { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tomorrow h3 { text-transform: none; letter-spacing: -0.01em; font-size: 16px; color: var(--fg); }
.opt { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.opt + .opt { padding-top: 14px; border-top: 1px solid var(--line); }
.opt-icon { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.opt-title { font-weight: 500; }
.opt-sub { font-size: 14px; color: var(--muted); }
.opt-act { grid-column: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.opt-state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--well); }
.opt-note { font-size: 13px; color: var(--muted); }
.opt-note:empty { display: none; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; flex: 0 0 auto; }
#wakeTime {
  height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums;
}
#wakeTime:focus-visible { outline: 2px solid var(--well); outline-offset: 2px; }
.ios-share { width: 14px; height: 14px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the world ---------- */
.world { background: var(--bg-deep); padding-block: 36px 48px; display: flex; flex-direction: column; gap: 22px; }
.world > * { width: 100%; max-width: 1180px; margin-inline: auto; }
.world-head { display: flex; flex-direction: column; gap: 6px; }
.world-head h2 { font-size: clamp(26px, 4.5vw, 36px); font-weight: 500; }
.world-sum { color: var(--muted); font-size: 16px; }
.globe-wrap { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-deep); border: 1px solid var(--line); }
#globe { width: 100%; height: min(78vh, 640px); min-height: 380px; cursor: grab; touch-action: pan-y; }
#globe:active { cursor: grabbing; }
.focus {
  position: absolute; left: 14px; bottom: 14px; max-width: min(420px, calc(100% - 28px));
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.focus-city { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.focus-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.focus .chips { margin-top: 4px; } .focus .chips span { font-size: 13px; padding: 4px 10px; }
.legend { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); background: var(--bg-deep); border: 1px solid var(--line); padding: 8px 10px; border-radius: 10px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.sw-well { background: var(--well); } .sw-poor { background: var(--poor); }
.tip { font-family: var(--font); background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--fg); font-size: 13px; line-height: 1.35; white-space: nowrap; }
.tip b { font-weight: 500; }

.replay { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-play { height: 48px; } .btn-play svg { width: 14px; height: 14px; }
.replay .btn { flex: 0 0 auto; height: 48px; }
.ruler { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ruler-lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ruler-lbl b { color: var(--fg); font-weight: 500; }
input[type="range"] { width: 100%; margin: 0; height: 28px; accent-color: var(--well); background: transparent; }

.stats { font-size: 17px; color: var(--muted); line-height: 1.6; font-variant-numeric: tabular-nums; padding-block: 4px 8px; border-bottom: 1px solid var(--line); }
.stats b { font-weight: 500; color: var(--fg); font-size: 22px; }
.stats .sep { color: var(--line); padding: 0 4px; }
.ranks:empty::after { content: "Not enough answers yet to rank cities."; color: var(--muted); font-size: 14px; }

.cols { display: grid; grid-template-columns: 1fr; gap: 28px; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cloud { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; line-height: 1.1; }
.cloud span { white-space: nowrap; }
.cloud .w1 { font-size: 36px; font-weight: 500; color: var(--well); }
.cloud .w2 { font-size: 28px; font-weight: 500; }
.cloud .w3 { font-size: 22px; font-weight: 500; color: var(--poor); }
.cloud .w4 { font-size: 18px; font-weight: 400; }
.cloud .w5 { font-size: 15px; color: var(--muted); }
.ranks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ranks { gap: 0; }
.ranks li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ranks .r-city { font-weight: 500; } .ranks .r-n { font-size: 12px; color: var(--muted); }
.ranks .r-pct { font-weight: 500; font-variant-numeric: tabular-nums; }
.data { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.data p { color: var(--muted); font-size: 14px; }
.data .btn { height: 48px; flex: 0 0 auto; }

.foot { padding-block: 28px 40px; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 70ch; margin: 0 auto; }

/* ---------- wider ---------- */
@media (min-width: 720px) {
  .ask-inner { padding-block: 16px 56px; }
  .answers { flex-direction: row; min-height: 0; }
  .answer { min-height: 150px; }
  .step-done .btn { align-self: flex-start; min-width: 280px; }
  .cols { grid-template-columns: 1.2fr 1fr; }
  .words { flex-direction: row; } .words input { flex: 1 1 0; }
}
@media (min-width: 1000px) {
  .ask-inner { min-height: 0; }
  .question { font-size: clamp(44px, 4.4vw, 60px); }
  .answers { min-height: 180px; max-width: 760px; }
  .step-ask { max-width: 760px; }
  .fine { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .question.is-swapping { animation: none; }
  .bar-well, .bar-poor, .answer, .btn { transition: none; }
}
@media (max-width: 719px) { #globe { height: min(100vw, 420px); min-height: 300px; } .focus { position: static; max-width: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; } .legend { position: static; order: 2; border: 0; border-top: 1px solid var(--line); border-radius: 0; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; } }
