/* StackFast site. Warm ink and paper, one amber accent (the star in the logo), a serif for
   headlines and a monospace for numbers. No gradients, no glow. */

:root {
  --ink: #0D0C0A;
  --ink-raised: #15140F;
  --paper: #ECE6DA;
  --dim: #A19B8D;
  --faint: #6B665B;
  --amber: #F0A93B;
  --amber-hover: #F6BC5E;
  --alarm: #E27860;
  --ok: #A3C79F;
  --line: rgba(236, 230, 218, 0.14);
  --line-strong: rgba(236, 230, 218, 0.3);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 2px; }

#starfield { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.twinkle-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.twinkle-layer i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--paper); opacity: 0.2; animation: twinkle 5s ease-in-out infinite; }
.twinkle-layer i.amber { background: var(--amber); }
@keyframes twinkle { 0%, 100% { opacity: 0.12; } 50% { opacity: 0.95; } }
@media (prefers-reduced-motion: reduce) { .twinkle-layer i { animation: none; opacity: 0.5; } }
.page { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 28px; }

/* ---------- Navigation ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 0; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--serif); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.brand-small { font-size: 1.1rem; gap: 9px; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { text-decoration: none; color: var(--dim); font-size: 0.95rem; }
.nav-links a:hover { color: var(--paper); }
.link-btn { font: inherit; font-size: 0.95rem; color: var(--paper); background: none; border: 1px solid var(--line-strong); border-radius: 4px; padding: 7px 16px; cursor: pointer; }
.link-btn:hover { border-color: var(--paper); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none; padding: 14px 24px; border-radius: 4px; border: 1px solid transparent; cursor: pointer; }
.btn-solid { background: var(--amber); color: #1A1305; }
.btn-solid:hover { background: var(--amber-hover); }
.btn-line { background: transparent; color: var(--paper); border-color: var(--line-strong); }
.btn-line:hover { border-color: var(--paper); }
.btn-block { width: 100%; margin-top: 8px; }
.btn-danger { color: var(--alarm); border-color: rgba(226, 120, 96, 0.4); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.text-link { color: var(--paper); text-underline-offset: 5px; text-decoration-color: var(--line-strong); }
.text-link:hover { text-decoration-color: var(--amber); }

/* ---------- Hero ---------- */
.hero { padding-top: 80px; }
.eyebrow { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); margin-bottom: 22px; }
h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.6rem, 5.8vw, 4.7rem); line-height: 1.02; letter-spacing: -0.025em; max-width: 19em; text-wrap: balance; }
.hero-lead { margin-top: 28px; max-width: 34em; font-size: 1.25rem; line-height: 1.55; color: var(--dim); }
.hero-actions { margin-top: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; }

.hero-figure { margin-top: 64px; }
.hero-figure img { width: 100%; border: 1px solid var(--line); }
.hero-figure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding-top: 12px; font-family: var(--mono); font-size: 0.78rem; color: var(--faint); }

/* ---------- Sections ---------- */
.block { margin-top: 130px; border-top: 1px solid var(--line); padding-top: 26px; }
.block-head { display: flex; align-items: baseline; gap: 28px; margin-bottom: 36px; }
.block-no { font-family: var(--mono); font-size: 0.85rem; color: var(--amber); letter-spacing: 0.08em; }
h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 3.8vw, 2.9rem); line-height: 1.1; letter-spacing: -0.02em; }
.big-num { color: var(--amber); }
.block-lead { max-width: 38em; font-size: 1.15rem; color: var(--dim); margin-bottom: 36px; }
.fine { margin-top: 22px; max-width: 46em; font-size: 0.85rem; line-height: 1.6; color: var(--faint); }
.fine a { color: var(--dim); }

/* ---------- Steps ---------- */
.steps { list-style: none; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px 24px; align-items: baseline; padding: 30px 0; border-bottom: 1px solid var(--line); }
.step-no { font-family: var(--mono); color: var(--faint); font-size: 0.95rem; }
.steps h3 { font-family: var(--serif); font-weight: 500; font-size: 1.55rem; letter-spacing: -0.01em; margin-bottom: 4px; }
.steps p { color: var(--dim); max-width: 36em; }
.step-note { font-family: var(--mono); font-size: 0.8rem; color: var(--faint); white-space: nowrap; }

/* ---------- The app window ---------- */
.appwin { margin: 0 0 56px; border: 1px solid var(--line-strong); background: #0D0C0A; font-size: 0.82rem; line-height: 1.45; }
.appwin figcaption { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); padding: 10px 14px; border-top: 1px solid var(--line); }
.appwin-top, .appwin-bottom { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #15140F; }
.appwin-top { border-bottom: 1px solid var(--line); justify-content: space-between; }
.appwin-bottom { border-top: 1px solid var(--line); color: var(--dim); font-size: 0.78rem; }
.appwin-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; }
.appwin-top-right { display: flex; gap: 8px; }
.appwin-btn { display: inline-block; padding: 4px 10px; background: #22201A; border-radius: 3px; color: var(--paper); }
.appwin-wide { display: block; text-align: center; padding: 6px 10px; margin: 6px 0; }
.appwin-body { display: grid; grid-template-columns: 250px 1fr; min-height: 320px; }
.appwin-side { padding: 14px; background: #0D0C0A; border-right: 1px solid var(--line); }
.appwin-side h4 { font-size: 0.88rem; margin: 14px 0 6px; }
.appwin-side h4:first-child { margin-top: 0; }
.appwin-side p { margin: 2px 0; color: var(--paper); }
.appwin-strong { font-weight: 700; }
.appwin-dim { color: var(--dim) !important; }
.appwin-faint { color: var(--faint) !important; font-size: 0.72rem; }
.appwin-slider { height: 4px; background: #22201A; border-radius: 2px; margin: 8px 0 6px; position: relative; }
.appwin-slider i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: #6E4E1A; border-radius: 2px; }
.appwin-slider i::after { content: ""; position: absolute; right: -5px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); }
.appwin-go { display: block; text-align: center; background: var(--amber); color: #1A1305; font-weight: 700; padding: 8px 10px; border-radius: 3px; margin: 4px 0 6px; }
.appwin-image { position: relative; background: #080807; overflow: hidden; }
.appwin-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.appwin-on { background: #6E4E1A; color: var(--paper); padding: 2px 8px; border-radius: 3px; }
.appwin-gap { flex: 1; }

/* ---------- Race ---------- */
.race { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.race-lane { min-width: 0; }
.race-title { font-family: var(--serif); font-size: 1.35rem; margin-bottom: 10px; }
.race-lane-dim .race-title { color: var(--dim); }
.race-frame { position: relative; aspect-ratio: 480 / 315; background: #000; border: 1px solid var(--line); overflow: hidden; }
.race-frame img, .race-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.race-frame canvas { display: none; }
.js-race .race-frame canvas { display: block; }
.race-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.race-time { font-size: 1.7rem; color: var(--dim); }
.race-lane[data-lane="sf"] .race-time { color: var(--amber); }
.race-lane.done .race-time::after { content: "  done"; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.race-count { font-size: 0.8rem; color: var(--faint); }
.race-track { height: 3px; margin-top: 10px; background: var(--line); }
.race-fill { height: 100%; width: 100%; background: var(--faint); transform-origin: left center; }
.race-lane[data-lane="sf"] .race-fill { background: var(--amber); }

/* ---------- Facts ---------- */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 56px; }
.facts > div { border-top: 1px solid var(--line); padding: 26px 0 30px; }
.facts dt { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 6px; }
.facts dd { color: var(--dim); }
.needs { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 26px; }
.needs h3 { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); margin-bottom: 14px; }
.needs ul { list-style: none; }
.needs li { color: var(--dim); padding: 4px 0 4px 22px; position: relative; max-width: 44em; }
.needs li::before { content: "\2013"; position: absolute; left: 0; color: var(--faint); }

/* ---------- Download ---------- */
.download-meta { margin-top: 20px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.8; color: var(--faint); word-break: break-all; }
.download-meta strong { color: var(--dim); font-weight: 500; }
.download-meta a { color: var(--dim); }

/* ---------- Footer ---------- */
.foot { margin-top: 130px; border-top: 1px solid var(--line); padding: 28px 0 52px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.foot nav a { color: var(--dim); text-decoration: none; font-size: 0.9rem; }
.foot nav a:hover { color: var(--paper); }
.copy { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); }

/* ---------- Account dialog ---------- */
.modal-overlay { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(6, 6, 5, 0.82); align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-card { width: min(420px, 100%); background: var(--ink-raised); border: 1px solid var(--line-strong); border-radius: 6px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-title { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.15rem; }
.modal-close-btn { background: none; border: none; color: var(--dim); font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-close-btn:hover { color: var(--paper); }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); }
.auth-tab-btn { flex: 1; font: inherit; font-size: 0.95rem; color: var(--dim); background: none; border: none; border-bottom: 2px solid transparent; padding: 13px 0; cursor: pointer; }
.auth-tab-btn.active { color: var(--paper); border-bottom-color: var(--amber); }
.modal-body { padding: 22px; }
.auth-message { margin-bottom: 14px; padding: 10px 12px; font-size: 0.92rem; border-left: 2px solid var(--line-strong); }
.auth-message:empty { display: none; }
.auth-message.error { color: var(--alarm); border-left-color: var(--alarm); }
.auth-message.success { color: var(--ok); border-left-color: var(--ok); }
.auth-form-group { margin-bottom: 16px; }
.auth-label { display: block; font-size: 0.85rem; color: var(--dim); margin-bottom: 6px; }
.auth-input { width: 100%; font: inherit; color: var(--paper); background: var(--ink); border: 1px solid var(--line-strong); border-radius: 4px; padding: 11px 12px; }
.auth-input:focus { outline: none; border-color: var(--amber); }
.account-profile-box { border: 1px solid var(--line); border-radius: 4px; margin-bottom: 14px; }
.account-profile-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.account-profile-row:last-child { border-bottom: none; }
.account-profile-label { color: var(--dim); }
.account-profile-value { word-break: break-all; text-align: right; }
.account-badge-pill { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--amber); }

/* ---------- Text pages (help, privacy, terms) ---------- */
.doc { max-width: 720px; padding: 64px 0 0; }
.doc h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); max-width: none; margin-bottom: 20px; }
.doc h2 { font-size: 1.3rem; margin: 2.2rem 0 0.6rem; }
.doc p, .doc li, .doc pre { color: var(--dim); line-height: 1.7; }
.doc pre { white-space: pre-wrap; font-family: var(--sans); font-size: 0.98rem; }
.doc a { color: var(--paper); text-underline-offset: 3px; }
.doc details { border-top: 1px solid var(--line); padding: 18px 0; }
.doc details:last-of-type { border-bottom: 1px solid var(--line); }
.doc summary { cursor: pointer; font-family: var(--serif); font-size: 1.2rem; color: var(--paper); }
.doc details p { margin-top: 10px; }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .appwin-body { grid-template-columns: 1fr; }
  .appwin-image { min-height: 220px; }
  .appwin-top-right .appwin-btn:first-child { display: none; }
  .race { grid-template-columns: 1fr; gap: 36px; }
  .facts { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 44px 1fr; }
  .step-note { grid-column: 2; }
}
@media (max-width: 640px) {
  .page { padding: 0 20px; }
  .nav-links a:not([href="support.html"]) { display: none; }
  .nav-links { gap: 18px; }
  .hero { padding-top: 44px; }
  .block { margin-top: 90px; }
  .block-head { flex-direction: column; gap: 6px; }
  .foot { margin-top: 90px; }
}
