/* App styles. Tokens live in tokens.css. Sections: shell, hero,
   score readout, search, habit rows, card, ranks, waitlist, feedback. */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); border-bottom: 1px solid var(--line);
  position: -webkit-sticky; position: sticky; top: 0; z-index: 40; background: rgba(0, 0, 0, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@supports not ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .top { background: #000; }
}
.brand { letter-spacing: 0.25em; display: flex; gap: 10px; align-items: center; }
.logo {
  width: 30px; height: 30px; border-radius: 6px; display: block;
}
.name { font-size: 14px; }
nav { display: flex; gap: 14px; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; transition: color 150ms var(--ease-out); }
nav a:hover { color: var(--accent-soft); }
main { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
.hero { text-align: left; padding: 16px 0 8px; }
.hero-card {
  background: var(--card); border-radius: 20px; padding: 24px;
  display: grid; gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 24px 60px rgba(0, 0, 0, 0.55);
}
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-icon { width: 56px; height: 56px; border-radius: 13px; display: block; animation: breathe 4.5s ease-in-out infinite; }
@keyframes breathe { 50% { filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.25)); } }
.hero-eyebrow { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin: 0; }
.hero-app { margin: 0; font-size: 17px; font-weight: 700; }
h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.1; margin: 4px 0; font-weight: 800; letter-spacing: -0.02em; }
.sub { color: var(--muted); max-width: 520px; margin: 0; font-size: 15px; }
.cta-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--accent); background: transparent; color: var(--text);
  padding: 8px 26px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 150ms var(--ease-out), background 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
  text-decoration: none; display: inline-block; font-family: inherit;
}
.btn:hover { transform: scale(1.02); box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.98); }
.btn.gold { background: var(--accent); color: #000000; border-color: var(--accent); font-weight: 700; box-shadow: 0 0 28px rgba(255, 255, 255, 0.22); animation: glow 3.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 18px rgba(255, 255, 255, 0.14); } 50% { box-shadow: 0 0 34px rgba(255, 255, 255, 0.3); } }
.btn.ghost { background: transparent; }
.panel { background: var(--card); border: none; border-radius: 18px; padding: 20px; margin-top: 22px; }
.panel.kick { animation: kick 320ms var(--ease-out); }
@keyframes kick { 30% { transform: translateY(2px); } 100% { transform: none; } }
.panel-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.dateline { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--mono); }
.panel-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
#ranks h2, #waitlist h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
#ranks > p, #waitlist > p { color: var(--muted); font-size: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--field);
  border-radius: 12px; padding: 9px 12px; margin: 0 0 10px; color: var(--muted);
}
.search input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font-family: inherit; font-size: 16px; outline: none; min-width: 0;
}
.search input::placeholder { color: var(--muted); }
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out); }
.score-wrap { display: flex; gap: 22px; align-items: baseline; margin: 8px 0 12px; position: relative; }
.shock { position: absolute; inset: -6px -10px; border: 1.5px solid #fff; border-radius: 14px; pointer-events: none; animation: shock 600ms ease-out forwards; }
@keyframes shock { from { opacity: 0.8; transform: scale(0.94); } to { opacity: 0; transform: scale(1.1); } }
.score-num { font-family: var(--mono); font-size: 72px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; flex: none; min-width: 3.4em; }
.score-max { font-size: 16px; color: var(--muted); margin-left: 6px; letter-spacing: 0.1em; }
.score-meta { display: grid; gap: 4px; flex: none; min-width: 210px; }
.rank { color: var(--text); font-size: 13px; margin: 0; letter-spacing: 0.32em; text-transform: uppercase; min-height: 1.5em; white-space: nowrap; }
.rank.up { animation: rankflash 900ms var(--ease-out); }
@keyframes rankflash { 0% { text-shadow: 0 0 22px rgba(255, 255, 255, 0.9); letter-spacing: 0.5em; } 100% { text-shadow: none; } }
.rank.seal { animation: stamp 380ms var(--ease-out); }
@keyframes stamp { 0% { transform: scale(1.7); opacity: 0; } 55% { transform: scale(0.94); opacity: 1; } 100% { transform: scale(1); } }
.streak { color: var(--muted); margin: 0; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; min-height: 1.5em; white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.meter { height: 2px; background: #232323; border-radius: 2px; overflow: hidden; margin: 0 0 12px; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); }
.next { font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; min-height: 1.5em; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.week { display: flex; gap: 6px; margin: 0 0 14px; }
.day { flex: 1; display: grid; gap: 5px; justify-items: center; }
.day i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #3a3a3a; }
.day.done i { background: #fff; border-color: #fff; }
.day.today i { box-shadow: 0 0 0 2px #000, 0 0 0 3.5px #fff; }
.day span { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; font-family: inherit; font-size: 13px; }
.habits { display: grid; background: var(--row); border-radius: 14px; overflow: hidden; }
.hrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--field); min-height: 60px; }
.hrow:last-child { border-bottom: none; }
.habit {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  border: none; border-radius: 0;
  padding: 11px 4px 11px 12px; cursor: pointer;
  transition: transform 150ms var(--ease-out), background 200ms var(--ease-out);
  background: transparent; color: var(--text); font-family: inherit; font-size: 15px; text-align: left;
}
.habit:hover { transform: none; background: #1e1e22; }
.habit:active { transform: scale(0.99); }
.habit.on { background: #242428; }
.habit[hidden], .hrow[hidden] { display: none; }
.x {
  flex: none; background: none; border: none; color: var(--muted);
  font-size: 20px; padding: 0 14px 0 4px; cursor: pointer; font-family: inherit;
  transition: color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.x:hover { color: #fff; transform: scale(1.15); }
.tile {
  width: 44px; height: 44px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; font-family: var(--mono);
  background: var(--field); color: #fff; transition: background 200ms var(--ease-out), color 200ms var(--ease-out);
}
.habit.on .tile { background: #fff; color: #000; }
.ht { flex: 1; display: grid; gap: 2px; min-width: 0; }
.htitle { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hsub { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.pill {
  flex: none; min-width: 86px; text-align: center;
  background: #fff; color: #000; border-radius: 999px;
  padding: 7px 16px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  transition: background 200ms var(--ease-out), color 200ms var(--ease-out);
}
.habit.on .pill { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #fff; }
body.boot .hrow { animation: rise 350ms var(--ease-out) backwards; }
body.boot .hrow:nth-child(2) { animation-delay: 30ms; }
body.boot .hrow:nth-child(3) { animation-delay: 60ms; }
body.boot .hrow:nth-child(4) { animation-delay: 90ms; }
body.boot .hrow:nth-child(5) { animation-delay: 120ms; }
body.boot .hrow:nth-child(n+6) { animation-delay: 150ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.card-canvas { width: 100%; border-radius: 12px; border: 1px solid var(--line); margin-top: 14px; background: #000; transition: opacity 300ms var(--ease-out); }
.card-canvas.flash { opacity: 0.25; }
.rank-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; background: var(--row); border-radius: 14px; overflow: hidden; }
.rank-list li { border-bottom: 1px solid var(--field); padding: 12px; color: var(--muted); font-size: 15px; }
.rank-list li:last-child { border-bottom: none; }
.rank-list li.now { background: #242428; box-shadow: inset 2px 0 0 #fff; }
.rank-list li.now b { color: #fff; }
.rank-list b { color: var(--text); margin-right: 10px; font-variant-numeric: tabular-nums; font-family: var(--mono); font-weight: 600; }
.wl { display: flex; gap: 10px; margin-top: 10px; }
.adder { display: flex; gap: 8px; margin-top: 10px; }
.adder input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: none;
  background: var(--field); color: var(--text); font-family: inherit; font-size: 16px;
}
.adder input::placeholder { color: var(--muted); }
.adder select {
  flex: none; padding: 0 10px; border-radius: 12px; border: none;
  background: var(--field); color: var(--text); font-family: inherit; font-size: 14px;
}
.adder .btn { flex: none; }
.manage { margin: 8px 0 0; }
.honest { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.wl input {
  flex: 1; padding: 12px 14px; border-radius: 12px; border: none;
  background: var(--field); color: var(--text); font-family: inherit; font-size: 16px;
}
.wl-msg { color: var(--accent-soft); min-height: 20px; }
.foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; row-gap: 8px; column-gap: 10px; color: var(--muted); font-size: 12px; letter-spacing: 0.2em; padding: 20px 4px 0; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }
.tour-veil { position: fixed; inset: 0; z-index: 90; }
.tour-ring { position: fixed; z-index: 91; pointer-events: none; border: 1.5px solid #fff; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.74); }
.tour-tip { position: fixed; z-index: 92; width: 320px; width: min(320px, calc(100vw - 24px)); background: #141414; border: 1px solid var(--field); border-radius: 16px; padding: 16px; }
.tour-k { margin: 0; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }
.tour-t { margin: 8px 0 0; font-size: 17px; font-weight: 800; }
.tour-l { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.tour-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.tour-offer { position: fixed; left: 50%; bottom: max(76px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 89; background: #141414; border: 1px solid var(--field); border-radius: 999px; padding: 8px 8px 8px 16px; display: flex; gap: 10px; align-items: center; font-size: 14px; white-space: nowrap; }
.tour-offer .btn { padding: 6px 18px; font-size: 13px; }
.legal h1 { font-size: clamp(26px, 5vw, 36px); }
.legal h2 { font-size: 17px; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--muted); font-size: 15px; line-height: 1.6; }
.legal ul { padding-left: 20px; margin: 6px 0; display: grid; gap: 6px; }
.intro { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 100; background: #000; cursor: pointer; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.toast {
  position: fixed; left: 50%; bottom: 24px; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: #fff; color: #000; font-size: 14px; padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (max-width: 520px) {
  .score-wrap { flex-wrap: wrap; gap: 10px; }
  .score-num { font-size: 52px; min-width: 2.8em; }
  .score-meta { min-width: 0; flex: 1; }
  .rank { letter-spacing: 0.2em; }
  .streak { letter-spacing: 0.14em; }
  .adder { flex-wrap: wrap; }
  .adder .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
