:root {
  --felt: #1a1c18;
  --felt-2: #22251f;
  --felt-3: #2c3028;
  --cream: #fdfdf6;
  --cream-muted: #e3e3dc;
  --muted: #b8bdb3;
  --outline: #73796d;
  --green: #92d872;
  --green-deep: #2c6c11;
  --green-container: #adf58b;
  --on-green: #0e3900;
  --brand: #469e7f;
  --font-sans: "Helvetica Neue", Helvetica, ui-sans-serif, system-ui, sans-serif;
  --max: 72rem;
  --narrow: 36rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background: var(--felt);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

::selection {
  background: color-mix(in srgb, var(--green) 40%, transparent);
  color: var(--cream);
}

a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-container); }

.skip {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background: var(--green);
  color: var(--on-green);
  text-decoration: none;
  clip-path: inset(50%);
}
.skip:focus { clip-path: none; }

.glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at top, rgba(146, 216, 114, 0.12), transparent 55%);
}

.wrap {
  width: min(var(--narrow), calc(100% - 2rem));
  margin-inline: auto;
}

.wrap-wide {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: color-mix(in srgb, var(--felt) 85%, transparent);
  padding-top: env(safe-area-inset-top);
  backdrop-filter: blur(12px);
}

.nav-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 0.75rem;
  padding: 0.75rem 0;
}

.nav-spacer { height: calc(env(safe-area-inset-top) + 4.25rem); }

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.625rem;
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.brand:hover { color: var(--cream); }

.brand-mark {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.brand-name { font-size: 0.875rem; }
@media (min-width: 40rem) { .brand-name { font-size: 1rem; } }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.nav-links > a:not(.btn) {
  color: var(--cream-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-links > a:not(.btn):hover { color: var(--green); }

.btn {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--green);
  color: var(--on-green);
}

.btn-primary:hover {
  background: var(--green-container);
  color: var(--on-green);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--cream);
}

.btn-ghost:hover {
  border-color: color-mix(in srgb, var(--green) 40%, transparent);
  color: var(--green);
}

.ad-slot {
  margin: 1rem auto;
  min-height: 5.5rem;
  border: 1px dashed color-mix(in srgb, var(--green) 30%, transparent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--green) 6%, transparent);
}

.ad-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-height: 5.5rem;
  padding: 0.9rem 1.1rem;
}

.ad-kicker {
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ad-copy { color: var(--muted); font-size: 0.8rem; }

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 0 3rem;
  text-align: center;
}

.badge,
.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.28rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  padding: 0;
  border: 0;
  background: none;
  letter-spacing: 0.1em;
}

h1 {
  margin: 1.25rem 0 0;
  max-width: 16ch;
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h2 {
  margin: 0.35rem 0 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 38ch;
  color: var(--cream-muted);
  font-size: 1rem;
  line-height: 1.625;
}

.lede-sm {
  margin: 0.4rem 0 0;
  color: var(--cream-muted);
  font-size: 0.95rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 2rem;
}

.store-link {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--cream);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.store-link span {
  color: var(--green);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.planner { padding: 1rem 0 2rem; scroll-margin-top: 5.5rem; }

.planner-head { margin-bottom: 1.25rem; }

.planner-grid {
  display: grid;
  gap: 1rem;
}

.stack { display: grid; gap: 1rem; }

.card {
  background: var(--felt-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.15rem 1.2rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

fieldset.card {
  margin: 0;
  min-width: 0;
}

legend,
.field-label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--cream);
  font-size: 0.88rem;
  font-weight: 600;
}

.solvers {
  display: grid;
  gap: 0.55rem;
}

.solvers label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--cream-muted);
  font-size: 0.95rem;
}

.solvers input { accent-color: var(--green); }

.unit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.unit-row label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: var(--felt);
  color: var(--cream);
  font: inherit;
}

.field:focus {
  outline: 2px solid color-mix(in srgb, var(--green) 45%, transparent);
  outline-offset: 1px;
}

.preview { display: grid; gap: 0.75rem; }
.solved { margin: 0; color: var(--green); font-weight: 600; }

.numbers {
  margin: 0;
  white-space: pre-wrap;
  color: var(--cream-muted);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
}

.summary {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hints {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.stage {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 5.5rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--green) 12%, transparent);
}

.shutter-icon {
  display: inline-flex;
  color: var(--green);
  transition: transform 0.12s ease, opacity 0.08s ease;
}

.phase {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 8px;
  background: var(--green);
  color: var(--on-green);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.beats {
  display: grid;
  gap: 1rem;
  padding: 0.5rem 0 1.5rem;
}

.beats h2 { margin-bottom: 0.4rem; }
.beats p { margin: 0; color: var(--muted); }

.example { margin: 0.5rem auto 2rem; }
.math {
  margin: 0.65rem 0 0;
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.history { padding-bottom: 2rem; }

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.empty { color: var(--muted); }

.history-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: var(--felt-2);
}

.history-load {
  display: grid;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.history-meta { color: var(--green); font-size: 0.75rem; font-weight: 600; }
.history-summary { font-weight: 650; }

.cta { padding: 0.5rem 0 3rem; }
.cta p { color: var(--muted); }
.cta .btn { margin-top: 0.75rem; }

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--felt-2);
}

.footer-grid {
  display: grid;
  gap: 2.5rem;
  padding: 3.5rem 0;
}

.footer-blurb {
  max-width: 28rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.625;
}

.footer-links {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.footer-links li + li { margin-top: 0.5rem; }
.footer-links a {
  color: var(--cream-muted);
  text-decoration: none;
  font-size: 0.875rem;
}
.footer-links a:hover { color: var(--green); }

.footer-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 0 max(1.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--outline);
  font-size: 0.75rem;
}

.privacy { padding-bottom: 2.5rem; }
.privacy h2 { margin-bottom: 0.5rem; }
.privacy p { color: var(--cream-muted); }
.privacy code {
  padding: 0.1em 0.4em;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--green-container);
  font-size: 0.875em;
}

@media (min-width: 40rem) {
  .hero { padding: 6rem 0 4rem; }
  h1 { font-size: 3rem; }
  .unit-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .planner-grid {
    grid-template-columns: 14rem minmax(0, 1fr) minmax(18rem, 22rem);
    align-items: start;
  }
  .beats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 14rem; }
  .footer-bar { flex-direction: row; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shutter-icon { transition: none; }
}
