/* Head Up — clean, black, cinematic. System fonts only, no external requests. */
:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0c0c0d;
  --panel-2: #141416;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --faint: #5a5a60;
  --screen: #ff3b30;      /* head-down time: alarm red, impossible to miss */
  --screen-glow: rgba(255,59,48,.55);
  --link: #a9b6ff;
  --amber: #ffbe5c;       /* daylight: time taken back */
  --lived: #55555c;
  --free: #19191d;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-xl: 28px;
  --r-lg: 18px;
  --pad: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 520px at 50% -140px, rgba(124,147,255,.16), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0 var(--pad) calc(40px + env(safe-area-inset-bottom));
}
main, .foot { max-width: 640px; margin: 0 auto; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: #fff; color: #000; padding: 8px 12px; border-radius: 10px; z-index: 20; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 10; padding: calc(10px + env(safe-area-inset-top)) 0 10px; }
.nav__inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 8px 16px;
  background: rgba(20,20,22,.72);
  -webkit-backdrop-filter: saturate(160%) blur(20px); backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid var(--line); border-radius: 999px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand__mark { width: 18px; height: 18px; position: relative; }
.brand__mark::before { content: ""; position: absolute; left: 4px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--text); }
.brand__mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px; border-radius: 2px; background: var(--text); }

/* ---------- buttons ---------- */
.pill {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 9px 16px; min-height: 40px; border: 1px solid transparent;
  transition: transform .15s ease, background .2s, opacity .2s;
}
.pill:active { transform: scale(.97); }
.pill--light { background: var(--text); color: #000; }
.pill--light:hover { background: #fff; }
.pill--ghost { background: transparent; color: var(--muted); border-color: var(--line-2); }
.pill--big { font-size: 17px; padding: 14px 22px; min-height: 52px; }
.pill[disabled] { opacity: .4; cursor: default; }
.link { font: inherit; font-size: 15px; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 52px 0 28px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.hero__title {
  font-size: clamp(40px, 11.5vw, 72px); line-height: 1.02; letter-spacing: -.045em; font-weight: 800;
  margin: 0 0 18px;
}
.br-wide { display: none; }
@media (min-width: 560px) { .br-wide { display: inline; } }
.hero__sub { color: var(--muted); font-size: clamp(17px, 4.4vw, 20px); max-width: 30em; margin: 0 auto; }
.focus-in { animation: focus-in 2.2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes focus-in { from { filter: blur(16px); opacity: 0; transform: translateY(6px); } to { filter: blur(0); opacity: 1; transform: none; } }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 24px 20px; margin: 16px 0;
  scroll-margin-top: 88px;
}
@media (min-width: 560px) { .panel { padding: 32px; } }
.panel__title { font-size: clamp(26px, 7vw, 34px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 0 0 18px; text-align: center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.fine { color: var(--faint); font-size: 13px; margin: 14px 0 0; }

/* ---------- controls ---------- */
.control { padding: 4px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 22px; text-align: center; }
.control:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.control__head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.control__label { display: block; font-size: 15px; font-weight: 600; color: var(--muted); }
.control__value { display: block; font-size: clamp(38px, 11vw, 52px); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; margin: 10px 0 14px; font-variant-numeric: tabular-nums; }
.control__value small { font-size: .42em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.unset { font-size: .5em; font-weight: 600; color: var(--faint); letter-spacing: -.01em; }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 6px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; cursor: pointer;
  --p: 0%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--fill, #fff) var(--p), #2a2a2e var(--p));
}
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: #2a2a2e; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--fill, #fff); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.5), 0 0 0 1px rgba(0,0,0,.2);
}
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
input[type=range].untouched::-webkit-slider-thumb { background: #8e8e93; }
input[type=range].untouched::-moz-range-thumb { background: #8e8e93; }

.control--row { text-align: left; }
.control--row .control__label { margin-bottom: 10px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
select {
  width: 100%; font: inherit; font-size: 17px; color: var(--text); background: #1c1c1f; border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 44px 14px 16px; appearance: none; -webkit-appearance: none; min-height: 52px;
}
.le-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; color: var(--muted); }
.le-row label { flex: 1; }
.le-row input {
  width: 92px; font: inherit; font-size: 17px; font-weight: 600; text-align: center; color: var(--text);
  background: #1c1c1f; border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 44px; font-variant-numeric: tabular-nums;
}

/* ---------- result ---------- */
.result { position: relative; overflow: hidden; }
.result__body { transition: filter 1.1s cubic-bezier(.2,.7,.2,1), opacity 1.1s; }
.result.is-blurred .result__body { filter: blur(14px); opacity: .5; pointer-events: none; user-select: none; }
.veil {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  margin: 0; padding: 24px; z-index: 2; font-size: 18px; font-weight: 600; line-height: 1.4; transition: opacity .5s;
}
.result:not(.is-blurred) .veil { opacity: 0; pointer-events: none; }

.bignums { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 22px; }
.bignum { text-align: center; padding: 0 8px; }
.bignum + .bignum { border-left: 1px solid var(--line); }
.bignum__n { font-size: clamp(56px, 17vw, 92px); font-weight: 800; letter-spacing: -.06em; line-height: 1; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.bignum__n--screen { color: var(--screen); text-shadow: 0 0 40px var(--screen-glow); }
.bignum__t { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.35; }

.lived { margin-bottom: 24px; }
.lived__row { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); margin-bottom: 10px; }
.lived__row strong { color: var(--text); font-size: 17px; }
.bar { height: 6px; border-radius: 6px; background: #2a2a2e; overflow: hidden; }
.bar__fill { display: block; height: 100%; width: 0; background: var(--text); border-radius: 6px; transition: width 1s cubic-bezier(.2,.7,.2,1); }

.takeback { background: rgba(255,190,92,.06); border: 1px solid rgba(255,190,92,.18); border-radius: var(--r-lg); padding: 16px 16px 14px; margin-bottom: 26px; }
.takeback__head label { font-size: 16px; font-weight: 600; }
.takeback__head strong { color: var(--amber); }
.takeback input[type=range] { --fill: var(--amber); }
.takeback__result { margin: 4px 0 0; font-size: 16px; color: var(--muted); }
.amber { color: var(--amber); font-size: 1.25em; font-weight: 800; letter-spacing: -.02em; }

.viewswitch { display: flex; gap: 4px; width: max-content; margin: 0 auto 20px; padding: 4px; background: #1c1c1f; border-radius: 999px; }
.seg { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.seg.is-on { background: #3a3a3f; color: var(--text); }
.grid-title { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.grid-sub { text-align: center; color: var(--faint); font-size: 13px; margin: 4px 0 16px; }

.grid { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.grid.is-year { grid-template-columns: repeat(21, 1fr); gap: 3px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(36, 1fr); } .grid.is-year { grid-template-columns: repeat(28, 1fr); } }
.grid i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--free); }
.grid i.l { background: var(--lived); }
.grid i.r { background: var(--amber); }
.grid i.s { background: var(--screen); box-shadow: 0 0 7px var(--screen-glow); }
/* the red squares light up one after another, eating into what is ahead */
.grid.ignite i.s, .grid.ignite i.r { animation: ignite .28s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes ignite {
  0% { background: var(--free); box-shadow: none; transform: scale(.6); }
  60% { background: #ff7a6e; box-shadow: 0 0 14px rgba(255,59,48,.9); transform: scale(1.15); }
  100% { transform: scale(1); }
}
.grid-wrap { position: relative; }
.lookup { text-align: center; font-size: clamp(22px, 6vw, 30px); font-weight: 800; letter-spacing: -.035em; line-height: 1.2; margin: 22px 0 6px; }
.lookup .red { color: var(--screen); text-shadow: 0 0 24px var(--screen-glow); }
.lookup-sub { text-align: center; font-size: 16px; color: var(--muted); margin: 0; }
.lookup-sub .amber { font-size: 1em; }
.grid.ignite ~ .lookup, .grid.ignite ~ .lookup-sub { animation: fadein .6s both; animation-delay: var(--after, 1.6s); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.legend { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw--lived { background: var(--lived); }
.sw--free { background: var(--free); box-shadow: inset 0 0 0 1px #3a3a3f; }
.sw--returned { background: var(--amber); }
.sw--screen { background: var(--screen); box-shadow: 0 0 6px var(--screen-glow); }
.share-line { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.share-line strong { color: var(--text); }
.estimate { text-align: center; color: var(--faint); font-size: 13px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- challenge ---------- */
.challenge { text-align: center; }
.challenge .panel__title { letter-spacing: .02em; font-size: clamp(24px, 7vw, 32px); }
.letters { list-style: none; padding: 0; margin: 22px 0 14px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.letters li {
  background: #1c1c1f; border-radius: 14px; padding: 14px 0 10px;
  font-size: clamp(16px, 4.6vw, 22px); font-weight: 800; letter-spacing: .02em;
  filter: blur(6px); color: var(--muted); transition: filter 1s, color 1s, background 1s;
}
.letters li small { display: block; font-size: 10px; font-weight: 600; color: var(--faint); margin-top: 4px; letter-spacing: .04em; }
.letters li.done { filter: none; color: #000; background: var(--amber); }
.letters li.done small { color: rgba(0,0,0,.55); }
.letters li.today { filter: blur(3px); box-shadow: inset 0 0 0 1px var(--line-2); }
.ch-status { min-height: 1.5em; color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ---------- quote + book ---------- */
.quote { text-align: center; padding: 44px 8px 36px; }
.quote p { font-size: clamp(22px, 6vw, 30px); font-weight: 700; letter-spacing: -.03em; line-height: 1.25; margin: 0 0 14px; }
.quote .quote__by { font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.book { text-align: center; }
.book .panel__title em { font-style: normal; }

/* ---------- footer ---------- */
.foot { color: var(--muted); font-size: 14px; padding: 28px 4px 0; }
.foot h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text); margin: 22px 0 8px; }
.foot ul { padding-left: 18px; margin: 0; }
.foot li { margin-bottom: 6px; }
.foot strong { color: var(--text); }
.foot a { color: var(--text); }

/* ---------- sheets ---------- */
.sheet {
  border: 0; padding: 0; background: transparent; color: var(--text);
  width: 100%; max-width: 520px; margin: auto auto 0; max-height: 90vh;
}
.sheet::backdrop { background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sheet__inner {
  background: #161618; border: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); font-size: 16px;
}
@media (min-width: 560px) { .sheet { margin: auto; } .sheet__inner { border-radius: 24px; } }
.sheet[open] .sheet__inner { animation: rise .35s cubic-bezier(.2,.7,.2,1); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__grip { width: 40px; height: 5px; border-radius: 5px; background: #3a3a3f; margin: 0 auto 16px; }
.sheet h2 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 8px; }
.sheet h3 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 0 6px; }
.sheet ol { padding-left: 20px; margin: 0; }
.sheet li { margin-bottom: 4px; }
.sheet .pill { width: 100%; margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
