:root {
  --bg: #fbf6ec;
  --surface: #ffffff;
  --ink: #1f2a37;
  --muted: #5d6b7a;
  --line: #e6dccb;
  --accent: #f2a93b;
  --accent-ink: #3a2500;
  --warn-bg: #fdf0e3;
  --ok: #1f7a4d;
  --err: #b3261e;
  --hue: 38;               /* overridden per card */
  --tint: hsl(var(--hue) 70% 92%);
  --tint-strong: hsl(var(--hue) 65% 80%);
  --bar-h: 54px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d; --surface: #1b232d; --ink: #f1ece2; --muted: #a2adb9;
    --line: #2f3a47; --accent: #f2a93b; --accent-ink: #2a1a00; --warn-bg: #2a2118;
    --ok: #62c996; --err: #ff8a80;
    --tint: hsl(var(--hue) 30% 17%);
    --tint-strong: hsl(var(--hue) 35% 26%);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.muted { color: var(--muted); }

/* ---- top bar and progress ---- */
.bar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 20;
  width: min(100%, 520px); height: var(--bar-h); padding: env(safe-area-inset-top) 14px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.01em; }
.brand img { border-radius: 7px; }
.saved-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.saved-btn b { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; margin-left: 2px; font-size: 13px; }
.progress { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); height: 3px; z-index: 21; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

/* ---- the feed: one item per screen ---- */
.feed {
  position: relative; height: 100dvh; width: min(100%, 520px); margin: 0 auto; overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; overscroll-behavior-y: contain; scrollbar-width: none; outline: none;
}
.feed::-webkit-scrollbar { display: none; }
.item {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  padding: calc(var(--bar-h) + 6px) 16px 14px; display: flex; flex-direction: column;
  background: var(--bg);
}
.item.idea { background: linear-gradient(180deg, var(--tint) 0%, var(--bg) 62%); }

/* artwork */
.art { position: relative; flex: 0 0 auto; height: 31%; min-height: 150px; max-height: 300px; overflow: hidden; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
@media (prefers-color-scheme: light) { .art img { mix-blend-mode: multiply; } }
.art .fallback {
  position: absolute; inset: 0 15%; border-radius: 22px; display: grid; place-items: center;
  background: var(--tint-strong); font-size: 64px; font-weight: 800; color: var(--ink); opacity: .85;
}

/* the four panes of one idea, swiped sideways like a carousel */
.panes {
  flex: 1 1 auto; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; margin: 8px -16px 0; overscroll-behavior-x: contain;
}
.panes::-webkit-scrollbar { display: none; }
.pane {
  flex: 0 0 100%; scroll-snap-align: start; padding: 4px 22px 0; overflow-y: auto;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.kicker { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pane h2 { margin: 0 0 10px; font-size: clamp(25px, 7.4vw, 32px); line-height: 1.12; letter-spacing: -.02em; }
.pane p.body { margin: 0; font-size: clamp(18px, 5vw, 21px); line-height: 1.45; }
.pane.try .box { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 16px 18px; }
.pane.try .kicker { color: var(--accent-ink); opacity: .75; }
.pane.breaks .box { background: var(--warn-bg); border-left: 5px solid var(--accent); border-radius: 14px; padding: 16px 18px; }
.credit { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }

/* controls under the panes */
.foot { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; min-height: 56px; }
.dots { display: flex; gap: 7px; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line); transition: all .2s; }
.dots i.on { width: 22px; background: var(--ink); }
.next-pane { border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); padding: 10px 18px; font-weight: 700; font-size: 15px; cursor: pointer; }
.hint { position: absolute; left: 0; right: 0; bottom: 74px; text-align: center; font-size: 13px; color: var(--muted); pointer-events: none; }
.scroll-cue { text-align: center; font-size: 13px; color: var(--muted); padding-top: 2px; }

/* right-hand action rail, in thumb reach */
.rail { position: absolute; right: 10px; top: 36%; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.rail button {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: 22px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.rail button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rail button:active { transform: scale(.94); }

button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---- interstitial items ---- */
.item.special { justify-content: center; align-items: stretch; text-align: left; padding-left: 24px; padding-right: 24px; }
.item.special .kicker { color: var(--muted); }
.item.special h2 { font-size: clamp(28px, 8vw, 36px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -.02em; }
.item.special p { font-size: 19px; margin: 0 0 18px; color: var(--muted); }
.item.early { background: var(--warn-bg); }
.item.end { background: linear-gradient(180deg, var(--tint) 0%, var(--bg) 70%); }
.btn { display: inline-block; border: 1.5px solid var(--ink); background: transparent; border-radius: 14px; font-weight: 700; padding: 13px 20px; cursor: pointer; text-align: center; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-row { display: grid; gap: 10px; }
.email-form { display: grid; gap: 10px; }
.email-form input[type=email] { font: inherit; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.form-msg { margin: 0 !important; min-height: 1.4em; font-size: 15px !important; }
.form-msg.ok { color: var(--ok); } .form-msg.err { color: var(--err); }
.skip { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted); }
.legal { font-size: 12.5px !important; margin-top: 18px !important; }

/* ---- saved dialog ---- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 20px 18px; background: var(--surface); color: var(--ink); width: min(92vw, 440px); max-height: 80dvh; }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h2 { margin: 0 0 10px; font-size: 22px; }
.dlg-close { position: absolute; top: 6px; right: 8px; }
.dlg-close button { background: none; border: 0; font-size: 28px; color: var(--muted); cursor: pointer; line-height: 1; padding: 6px 10px; }
.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.saved-list button { width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; }

/* desktop: show the feed as a phone-width column on a quiet backdrop */
@media (min-width: 700px) {
  body { background: color-mix(in srgb, var(--bg) 88%, #000); }
  .feed { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0,0,0,.12); background: var(--bg); }
}
@media (max-height: 640px) { .art { height: 24%; min-height: 110px; } }
@media (prefers-reduced-motion: no-preference) { .feed, .panes { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { .progress i, .dots i { transition: none; } }
