/* SelectPulse: shared styles for every page.
   Layout: wordmark masthead with an account link, a sticky bar (All stories / Saved, signed-in only), then one full-width
   colour band per story; content column 720px. Built-in fonts only, so no visitor data
   goes to a font service. */
:root {
  --bg: #FAF9FF;
  --fg: #1B1633;
  --muted: #5D5878;
  --sheet: #FFFFFF;
  --line: #DCD8EE;
  --chip: #EEEBFA;
  --good: #187A4C;
  --bad: #B3262A;
  --warn: #FFE7A3;
  --warn-fg: #4A3500;
  --coral: #FF7B61;
  --sun: #FFCB47;
  --lime: #A8E063;
  --teal: #3CCFBF;
  --sky: #6CC6FF;
  --violet: #A893FF;
  --on-band: #1B1633;
  --on-band-soft: #2E2850;
  --btn-bg: #1B1633;
  --btn-fg: #FAF9FF;
  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "sans-serif-condensed", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --col: 720px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141128; --fg: #F2F0FF; --muted: #B4AED6; --sheet: #221D40; --line: #3A3460;
    --chip: #2C2650; --good: #5ED39A; --bad: #FF8F91; --warn: #4A3A0A; --warn-fg: #FFE7A3;
    --btn-bg: #1B1633; --btn-fg: #FAF9FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141128; --fg: #F2F0FF; --muted: #B4AED6; --sheet: #221D40; --line: #3A3460;
  --chip: #2C2650; --good: #5ED39A; --bad: #FF8F91; --warn: #4A3A0A; --warn-fg: #FFE7A3;
  --btn-bg: #1B1633; --btn-fg: #FAF9FF;
  color-scheme: dark;
}

:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 17px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; border-radius: 4px; }
.band :focus-visible { outline-color: var(--on-band); }
.wrap {
  max-width: var(--col); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Masthead */
.mast { padding-block: 22px 14px; }
.mast-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
.account-link { font-weight: 700; font-size: 15px; text-decoration: none; border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.mast h1, .logo {
  margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-stretch: condensed;
  font-size: clamp(44px, 13vw, 116px); line-height: .9; letter-spacing: -0.02em;
}
.mast p { margin: 12px 0 0; color: var(--muted); font-size: 16px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.mast p strong { color: var(--fg); font-weight: 700; }
.logo-small { font-family: var(--display); font-weight: 800; font-stretch: condensed; font-size: 36px; text-decoration: none; letter-spacing: -0.01em; }

/* Section bar */
.tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs .wrap { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-block: 10px 0; }
.tabs .wrap::-webkit-scrollbar { display: none; }
.tab {
  flex: none; appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 17px; padding: 8px 10px 12px; border-bottom: 4px solid transparent;
}
.tab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }

/* Notices */
.notice { margin-block: 16px; padding: 12px 14px; border-radius: 10px; background: var(--chip); color: var(--fg); font-size: 15px; }
.notice.warn { background: var(--warn); color: var(--warn-fg); }
.state { padding-block: 48px; color: var(--muted); }
.state strong { display: block; color: var(--fg); font-family: var(--display); font-size: 24px; margin-bottom: 4px; }

/* Story bands */
.feed { display: flex; flex-direction: column; }
.band { background: var(--band, var(--coral)); color: var(--on-band); overflow: hidden; }
.band .wrap { padding-block: 22px 24px; display: grid; gap: 12px; }
.band-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.meta { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--on-band-soft); font-weight: 700; }
.meta span:last-child { font-weight: 400; }
.headline {
  margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-stretch: condensed;
  font-size: clamp(32px, 9vw, 50px); line-height: 1; letter-spacing: -0.01em; text-wrap: balance;
}
.emoji {
  font-size: clamp(72px, 22vw, 124px); line-height: 1; margin-right: -0.28em; margin-top: -4px;
  transform: rotate(var(--tilt, -8deg)); user-select: none;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.one-liner { margin: 0; font-size: 19px; line-height: 1.4; max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 999px; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-fg); font: 700 15px/1 var(--body);
  padding: 12px 18px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn .chev {
  width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s ease;
}
.btn[aria-expanded="true"] .chev { transform: translateY(2px) rotate(-135deg); }
.save {
  appearance: none; cursor: pointer; border: 2px solid var(--on-band); background: transparent; color: var(--on-band);
  font: 700 15px/1 var(--body); padding: 10px 14px; border-radius: 999px; min-height: 44px;
}
.save[aria-pressed="true"] { background: var(--on-band); color: var(--btn-fg); }
.extras { font-size: 14px; color: var(--on-band-soft); }
.gate { background: var(--sheet); color: var(--fg); border-radius: 12px; padding: 12px 14px; font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.gate a { font-weight: 700; }

/* Expanded sheet */
.sheet-outer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.sheet-outer.open { grid-template-rows: 1fr; }
.sheet-outer > div { overflow: hidden; min-height: 0; }
.sheet { background: var(--sheet); color: var(--fg); border-radius: 14px; padding: 18px; display: grid; gap: 18px; margin-top: 4px; }
.sheet h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 800; font-size: 18px; }
.sheet h3.later { margin-top: 14px; }
.sheet p { margin: 0; }
.block + .block { border-top: 1px solid var(--line); padding-top: 18px; }
.q { font-weight: 700; margin: 0 0 10px; }
.opts { display: grid; gap: 8px; }
.opt {
  appearance: none; text-align: left; cursor: pointer; width: 100%;
  border: 2px solid var(--line); background: transparent; color: var(--fg);
  font: 400 16px/1.35 var(--body); padding: 11px 14px; border-radius: 10px; min-height: 44px;
}
.opt:hover:not(:disabled) { border-color: var(--fg); }
.opt:disabled { cursor: default; }
.result { display: grid; gap: 4px; }
.result-row { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.result-row b { font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--band, var(--coral)); transition: width .5s ease; }
.mine { font-weight: 700; }
.small { font-size: 14px; color: var(--muted); }
.opt.right { border-color: var(--good); color: var(--good); font-weight: 700; }
.opt.wrong { border-color: var(--bad); color: var(--bad); }
.verdict { margin-top: 10px; font-weight: 700; }
.verdict.ok { color: var(--good); } .verdict.no { color: var(--bad); }
.source { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.source a { font-weight: 700; }
.ghost {
  appearance: none; cursor: pointer; border: 2px solid var(--line); background: transparent; color: var(--fg);
  font: 700 14px/1 var(--body); padding: 10px 14px; border-radius: 999px; min-height: 40px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
}
.ghost.danger { border-color: var(--bad); color: var(--bad); }

/* Forms (account page) */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-block: 18px; display: grid; gap: 16px; }
.panel h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.05; }
.panel p { margin: 0; }
.field { display: grid; gap: 6px; }
.field label, .legend { font-weight: 700; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
input[type="email"], input[type="text"], select {
  font: 400 17px/1.3 var(--body); color: var(--fg); background: var(--bg);
  border: 2px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 48px; width: 100%;
}
input:focus-visible, select:focus-visible { border-color: var(--fg); outline: none; }
input.code { font: 700 26px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .25em; text-align: center; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 16px; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--fg); }
.choice { display: grid; gap: 10px; }
.status { min-height: 1.4em; font-weight: 700; }
.status.error { color: var(--bad); }
.status.ok { color: var(--good); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 10px; }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; color: var(--fg); font: 700 15px/1.4 var(--body); text-decoration: underline; cursor: pointer; justify-self: start; }

/* Long-form pages (privacy, terms, support) */
.doc h1 { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 10vw, 56px); line-height: 1; margin: 28px 0 8px; text-wrap: balance; }
.doc h2 { font-family: var(--display); font-weight: 800; font-size: 24px; margin: 36px 0 6px; }
.doc h3 { font-size: 17px; margin: 22px 0 4px; }
.doc p, .doc li { max-width: 64ch; }
.doc ul { padding-left: 1.2em; }
.doc li + li { margin-top: 6px; }
.doc .lede { color: var(--muted); margin: 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; margin-block: 8px; }
.doc th, .doc td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 8px 8px 8px 0; }
.doc th { font-size: 14px; color: var(--muted); }
.tablewrap { overflow-x: auto; }
.box { background: var(--chip); border-radius: 12px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Footer */
.foot { padding-block: 36px 48px; color: var(--muted); font-size: 15px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; }
.foot nav a { color: var(--fg); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 15px; z-index: 20;
  max-width: calc(100% - 32px); text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .sheet-outer, .bar i, .btn .chev { transition: none; }
}

.tabs[hidden] { display: none; }
