/* ============ Cookmark design system ============ */
:root {
  --brand: #c2410c;      /* paprika: appetizing and passes contrast with white text */
  --brand-dark: #9a3412;
  --brand-deep: #7c2d12; /* fixed accent: always used on yellow/white surfaces */
  --yellow: #ffd43b;
  --yellow-soft: #fff3bf;
  --cream: #fffaf0;
  --ink: #2b211b;
  --ink-soft: #6f6259;
  --heading: #7c2d12;
  --line: #ecdfd2;
  --card: #ffffff;
  --appbar-bg: rgba(255, 250, 240, 0.92);
  --danger: #e03131;
  --green: #2f9e44;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(124, 45, 18, 0.08);
  --shadow-lg: 0 16px 48px rgba(124, 45, 18, 0.16);
  font-size: 16px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #e8590c;
  --brand-dark: #f76707;
  --cream: #171310;
  --ink: #f0e9e2;
  --ink-soft: #b5a99d;
  --heading: #ffc078;
  --line: #372c24;
  --card: #221b16;
  --appbar-bg: rgba(23, 19, 16, 0.92);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #e8590c;
    --brand-dark: #f76707;
    --cream: #171310;
    --ink: #f0e9e2;
    --ink-soft: #b5a99d;
    --heading: #ffc078;
    --line: #372c24;
    --card: #221b16;
    --appbar-bg: rgba(23, 19, 16, 0.92);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The UA stylesheet's [hidden] { display: none } is weaker than any author
   `display` on a class, so `.btn`, `.menu button` and `.limit-banner` all beat
   it - elements toggled through the hidden property stayed on screen. Anything
   toggled with .hidden in JS depends on this rule. */
[hidden] { display: none !important; }

html {
  /* Stops iOS inflating text when a phone is turned sideways. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Nothing sideways-scrolls the page by accident on a narrow screen. */
img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Taps feel instant instead of leaving a grey flash behind. */
a, button, summary, label, .chip, .source-chip {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Anchor links land below the sticky header instead of under it. */
section[id], [id="main"] { scroll-margin-top: 84px; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--yellow);
  color: var(--brand-deep);
  padding: 10px 18px;
  border-radius: 0 0 12px 0;
  font-weight: 800;
  z-index: 300;
}
.skip-link:focus { left: 0; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  /* max() keeps content clear of the notch/rounded corners in landscape. */
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(194, 65, 12, 0.35); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-yellow { background: var(--yellow); color: var(--brand-deep); box-shadow: 0 4px 14px rgba(255, 212, 59, 0.3); }
.btn-yellow:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fff0f0; color: var(--danger); }
.btn-danger:hover { background: #ffe3e3; }
.btn-sm { padding: 8px 16px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.icon-btn {
  border: 2px solid var(--line);
  background: var(--card);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--brand); }

/* ============ Nav ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
/* The blurred backing lives on a pseudo-element rather than on the header
   itself: backdrop-filter would make the header a containing block, which
   would trap the fixed-position drawer inside the 65px-tall bar. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--appbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
/* The header only grows a hairline once you've scrolled past the hero. */
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 2px 14px rgba(124, 45, 18, 0.06);
}
:root[data-theme="dark"] .site-header.scrolled { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4); }

.nav {
  display: flex;
  align-items: center;
  padding: 14px 0;
  gap: 12px;
}
/* Auto margin does the pushing, so links and tools stay one tight cluster on
   the right instead of being spread apart by space-between. */
.nav .brand { margin-right: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--heading);
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: var(--yellow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 18px; font-weight: 700; }
.nav-links > a { color: var(--ink-soft); }
.nav-links > a:hover { color: var(--brand); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Hamburger + drawer chrome: desktop hides all of it. */
.nav-toggle,
.nav-close,
.nav-scrim { display: none; }

.nav-toggle {
  width: 44px; height: 44px;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 13px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-close {
  align-self: flex-end;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 800;
}

.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(28, 14, 4, 0.55);
  z-index: 110;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.nav-scrim.open { opacity: 1; }

/* Page underneath must not scroll while the drawer is open. */
body.nav-open { overflow: hidden; }

/* ============ Add to home screen ============ */
/* The drawer disclosure is mobile-only: on desktop the nav is a plain row and
   installing from the address bar is the obvious path anyway. */
.nav-install { display: none; }

.install-steps ol,
.install-steps-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
}
.install-steps-list { margin-top: 18px; max-width: 34rem; }
.install-steps-list li,
.install-steps li { line-height: 1.5; }
.install-steps-list b, .install-steps b { color: var(--ink); }

.install-section { padding-top: 12px; }
.install-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.install-mark {
  width: 66px; height: 66px;
  flex-shrink: 0;
  border-radius: 18px;
  background: var(--yellow-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
:root[data-theme="dark"] .install-mark { background: rgba(255, 212, 59, 0.15); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .install-mark { background: rgba(255, 212, 59, 0.15); }
}
/* Sits beside the icon, so it opts out of the centred section h2. Needs the
   extra class to outrank ".section h2", which is otherwise equally specific
   and declared later. */
.install-section .install-card h2 {
  text-align: left;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 8px;
}
.install-copy p { color: var(--ink-soft); max-width: 38rem; margin-bottom: 20px; }

/* ============ Landing ============ */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  /* padding-block only: this element is also a .container, and the shorthand
     would wipe out its side padding and shove the text against the edge. */
  padding-block: 64px 72px;
}
.hero h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.12;
  font-weight: 800;
  color: var(--heading);
  text-wrap: balance;
}
.hero h1 .hl {
  background: linear-gradient(transparent 62%, var(--yellow) 62%);
  padding: 0 4px;
  color: var(--ink);
}
/* In dark mode a solid yellow bar behind near-white text is unreadable, so
   the highlight drops below the letters and reads as a bright underline. */
:root[data-theme="dark"] .hero h1 .hl {
  background: linear-gradient(transparent 86%, var(--yellow) 86%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero h1 .hl {
    background: linear-gradient(transparent 86%, var(--yellow) 86%);
  }
}
.hero p.lead { font-size: clamp(1.02rem, 3.2vw, 1.2rem); color: var(--ink-soft); margin: 18px 0 28px; max-width: 34rem; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 0.9rem; color: var(--ink-soft); }

.hero-visual {
  background: linear-gradient(160deg, #e8590c 0%, #7c2d12 100%);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 14px;
}
.mock-card {
  background: #fff;
  color: #2b211b;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.mock-emoji {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: #fff3bf;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.mock-card b { display: block; }
.mock-card small { color: #6f6259; }

.source-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  /* Also a .container - keep its side padding intact. */
  padding-block: 8px 40px;
}
.source-chip {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  color: var(--ink-soft);
}

.section { padding: 56px 0; }
.section h2 {
  text-align: center;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--heading);
  margin-bottom: 10px;
}
.section .sub { text-align: center; color: var(--ink-soft); font-size: 1.1rem; max-width: 40rem; margin: 0 auto 40px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}
.feature {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.feature .icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--yellow-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 16px;
}
:root[data-theme="dark"] .feature .icon { background: rgba(255, 212, 59, 0.15); }
.feature h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature p { color: var(--ink-soft); font-size: 0.98rem; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; counter-reset: step; }
.step { background: var(--card); border-radius: var(--radius); padding: 26px 22px; box-shadow: var(--shadow); position: relative; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -16px; left: 22px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--brand-deep);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.step h3 { margin: 8px 0 6px; font-size: 1.08rem; }
.step p { color: var(--ink-soft); font-size: 0.95rem; }

/* ============ FAQ ============ */
.faq-list { max-width: 720px; margin: 0 auto; display: grid; gap: 12px; }
.faq-list details {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}
.faq-list summary {
  cursor: pointer;
  font-weight: 800;
  padding: 18px 22px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.3rem; color: var(--brand); font-weight: 800; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details p { padding: 0 22px 18px; color: var(--ink-soft); }

/* ============ Pricing ============ */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  gap: 26px;
  justify-content: center;
}
.plan {
  background: var(--card);
  border-radius: 22px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
}
.plan.featured { border-color: var(--yellow); box-shadow: var(--shadow-lg); position: relative; }
.plan .badge {
  position: absolute;
  top: -14px; right: 24px;
  background: var(--yellow);
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 14px;
  letter-spacing: 0.03em;
}
.plan h3 { font-size: 1.2rem; }
.plan .price { font-size: 2.4rem; font-weight: 800; color: var(--heading); margin: 8px 0 2px; }
.plan .price small { font-size: 1rem; color: var(--ink-soft); font-weight: 700; }
.plan ul { list-style: none; margin: 20px 0 26px; display: grid; gap: 10px; flex: 1; }
.plan li { padding-left: 28px; position: relative; color: var(--ink-soft); font-weight: 600; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }

/* ============ About ============ */
.about-card {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
}
.about-intro { display: flex; align-items: flex-start; gap: 20px; }
.about-mark {
  width: 60px; height: 60px;
  flex-shrink: 0;
  border-radius: 18px;
  background: var(--yellow-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
}
:root[data-theme="dark"] .about-mark { background: rgba(255, 212, 59, 0.15); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .about-mark { background: rgba(255, 212, 59, 0.15); }
}
.about-intro h3 { font-size: 1.2rem; color: var(--heading); margin-bottom: 8px; }
.about-intro p { color: var(--ink-soft); }

.about-heading {
  margin: 26px 0 14px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.about-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.about-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--cream);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.about-link:hover { border-color: var(--brand); transform: translateY(-2px); }
.about-link-name { font-weight: 800; color: var(--ink); }
.about-link-host { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }

/* ============ Footer ============ */
.footer {
  border-top: 2px solid var(--line);
  margin-top: 40px;
  padding: 44px 0 36px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}
.footer-grid h4 { color: var(--ink); font-size: 0.95rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-grid ul { list-style: none; display: grid; gap: 8px; }
.footer-grid a { color: var(--ink-soft); }
.footer-grid a:hover { color: var(--brand); }
.footer-about p { max-width: 26rem; margin-top: 10px; }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 20px; text-align: center; font-size: 0.85rem; }

/* ============ Static pages (legal, contact, 404) ============ */
.page-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.page-wrap .page-card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
}
.page-wrap h1 { color: var(--heading); font-size: 2rem; margin-bottom: 6px; }
.page-wrap .updated { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 26px; }
.page-wrap h2 { color: var(--heading); font-size: 1.2rem; margin: 26px 0 8px; }
.page-wrap p, .page-wrap li { color: var(--ink-soft); margin-bottom: 10px; }
.page-wrap ul { padding-left: 22px; margin-bottom: 10px; }

.error-hero { text-align: center; padding: 90px 20px; }
.error-hero .big { font-size: 5rem; }
.error-hero h1 { color: var(--heading); font-size: 2.2rem; margin: 10px 0 8px; }
.error-hero p { color: var(--ink-soft); margin-bottom: 26px; }

/* ============ Auth ============ */
.auth-wrap {
  min-height: 100vh;
  /* dvh tracks the shrinking/growing mobile browser toolbar; vh above is the fallback. */
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 16px calc(40px + env(safe-area-inset-bottom));
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.auth-card .brand { justify-content: center; width: 100%; margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 0.85rem; color: var(--ink-soft); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--cream); border-radius: 999px; padding: 4px; margin-bottom: 24px; }
.tabs button {
  border: none; background: transparent;
  padding: 10px; border-radius: 999px;
  font-weight: 800; color: var(--ink-soft);
}
.tabs button.active { background: var(--brand); color: #fff; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
}
.field textarea { resize: vertical; min-height: 96px; }
.field .hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-soft); opacity: 0.62; font-style: italic; }
.optional-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}
.import-simple-steps {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.5;
}
.import-simple-steps ol { margin: 7px 0 7px 22px; }
.import-simple-steps li + li { margin-top: 4px; }
.import-simple-steps p { color: var(--ink-soft); }
.website-import-tip {
  margin: -4px 0 18px;
  border: 2px solid var(--line);
  border-left: 5px solid var(--yellow);
  border-radius: 12px;
  background: var(--cream);
  overflow: hidden;
}
.website-import-tip summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}
.website-import-tip summary::-webkit-details-marker { display: none; }
.website-import-tip summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; }
.website-import-tip[open] summary::after { content: "−"; }
.website-import-tip-body { border-top: 1px solid var(--line); padding: 3px 14px 13px; font-size: 0.94rem; line-height: 1.5; }
.website-import-tip-body p { margin-top: 10px; color: var(--ink-soft); }
#form-import .field > label { font-size: 1rem; }
#form-import .field .hint { margin-top: 7px; font-size: 0.9rem; line-height: 1.5; }
.link-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.link-input-row .btn { min-width: 116px; padding-inline: 16px; }
.screenshot-helper {
  margin-top: 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  overflow: hidden;
}
.screenshot-helper summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 800;
  list-style: none;
}
.screenshot-helper summary::-webkit-details-marker { display: none; }
.screenshot-helper summary::after { content: "+"; color: var(--brand); font-size: 1.25rem; }
.screenshot-helper[open] summary::after { content: "–"; }
.screenshot-helper-body { border-top: 1px solid var(--line); padding: 13px; }
.screenshot-helper-body p, .screenshot-helper-body li { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.45; }
.screenshot-helper-body ol { margin: 9px 0 13px 20px; }
.screenshot-helper-body li + li { margin-top: 5px; }
.screenshot-helper-body .btn { width: 100%; min-height: 46px; }
.screenshot-privacy { margin-top: 9px; }
.screenshot-status { min-height: 1.25em; margin-top: 8px; font-weight: 700; }
.screenshot-status.success { color: #2b8a3e; }
.screenshot-status.error { color: #c92a2a; }
.screenshot-status.reading { color: #c2410c; }
.screenshot-queue { display: grid; gap: 10px; margin-top: 12px; }
.screenshot-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.screenshot-thumb {
  width: 84px;
  height: 108px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--cream);
  object-fit: cover;
}
.screenshot-item-body { min-width: 0; }
.screenshot-item-title { color: var(--heading); font-size: 0.9rem; font-weight: 800; }
.screenshot-item label { display: block; margin: 5px 0 3px; color: var(--ink-soft); font-size: 0.82rem; }
.screenshot-role {
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
}
.screenshot-item-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
.screenshot-helper-body .screenshot-item-actions .btn {
  width: auto;
  min-height: 46px;
  padding: 7px 5px;
  font-size: 0.82rem;
}
.screenshot-result { grid-column: 1 / -1; }
.screenshot-result label { color: var(--heading); font-size: 0.85rem; font-weight: 800; }
.screenshot-result textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}
.screenshot-item-note { grid-column: 1 / -1; margin: 0; font-weight: 700; }
.screenshot-read-all { margin-top: 10px; }
.screenshot-crop-editor {
  margin-top: 12px;
  padding: 12px;
  border: 2px solid var(--brand);
  border-radius: 12px;
  background: var(--card);
}
.screenshot-crop-editor canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 52vh;
  margin: 10px auto;
  border-radius: 9px;
  background: #17120f;
  cursor: crosshair;
  touch-action: none;
}
.screenshot-crop-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 7px; }
.screenshot-helper-body .screenshot-crop-actions .btn { width: auto; padding-inline: 8px; }
.screenshot-helper :disabled { cursor: wait; opacity: 0.58; }
.placeholder-note { color: var(--ink-soft); font-size: 0.8rem; margin: -8px 0 14px; }
.form-note { font-size: 0.85rem; color: var(--ink-soft); text-align: center; margin-top: 14px; }

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert.error { background: #fff0f0; color: #c92a2a; }
.alert.success { background: #ebfbee; color: #2b8a3e; }
.alert.info { background: #fff4e6; color: #c2410c; }
#editor-notice { white-space: pre-line; }
#import-status, #editor-notice { font-size: 1rem; line-height: 1.5; }
.editor-draft-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}
.editor-draft-status .btn { flex-shrink: 0; }
.editor-missing-guide, .duplicate-warning {
  margin-bottom: 16px;
  padding: 14px;
  border: 2px solid var(--yellow);
  border-radius: 14px;
  background: var(--cream);
}
.editor-missing-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.editor-missing-guide strong, .duplicate-warning > strong { color: var(--heading); }
.editor-missing-guide p, .duplicate-warning p { margin-top: 3px; color: var(--ink-soft); }
.editor-missing-guide .btn { flex-shrink: 0; }
.duplicate-warning { border-color: var(--brand); }
.duplicate-warning-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.editor-save-status p { margin-bottom: 10px; }
.field.needs-attention > label { color: var(--heading); }
.field.needs-attention > label::after {
  content: "Needs information";
  display: inline-block;
  margin-left: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--brand-deep);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.field.needs-attention input, .field.needs-attention textarea { border-color: var(--yellow); box-shadow: 0 0 0 2px rgba(255, 212, 59, 0.18); }

/* ============ App ============ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 2px solid var(--line);
}
/* Same reason as .site-header::before - keeps the bar from becoming a
   containing block for the fixed bottom action bar on phones. */
.appbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--appbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.appbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Also a .container - keep its side padding intact. */
  padding-block: 12px;
}
/* A plain wrapper on desktop; becomes the thumb-reachable bottom bar on phones. */
.appbar-actions { display: contents; }
.appbar .brand { font-size: 1.15rem; }
.appbar .brand-mark { width: 34px; height: 34px; font-size: 1.1rem; }
.search-box { flex: 1; max-width: 460px; position: relative; }
.search-box input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px 10px 42px;
  font-size: 0.98rem;
  background: var(--card);
  color: var(--ink);
}
.search-box input:focus { outline: none; border-color: var(--brand); }
.search-box::before {
  content: "🔍";
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.6;
}
.spacer { flex: 1; }

.avatar-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--brand-deep);
  color: var(--yellow);
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}
.menu {
  position: absolute;
  right: 20px;
  /* Anchored to the bar's real height so it still lands right when the
     bar wraps to two rows on a phone. */
  top: calc(100% + 8px);
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  padding: 8px;
  min-width: 230px;
  display: none;
  z-index: 60;
}
.menu.open { display: block; }
.menu .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .menu-head b { display: block; }
.menu .menu-head small { color: var(--ink-soft); word-break: break-all; }
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.menu button:hover { background: var(--cream); }

.plan-pill {
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-pill.free { background: var(--line); color: var(--ink-soft); }
.plan-pill.premium { background: var(--yellow); color: var(--brand-deep); }

.app-main { padding: 26px 0 80px; }

.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  background: var(--card);
}
.draft-banner strong { color: var(--heading); }
.draft-banner p { margin-top: 2px; color: var(--ink-soft); }
.draft-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }

.recipe-load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding: 16px 18px;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  background: var(--card);
}
.recipe-load-error strong { display: block; color: var(--heading); font-size: 1.05rem; }
.recipe-load-error p { margin-top: 3px; color: var(--ink-soft); }
.recipe-load-error .btn { flex-shrink: 0; }

.limit-banner {
  background: var(--card);
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.limit-banner .bar {
  flex: 1;
  min-width: 140px;
  height: 10px;
  border-radius: 999px;
  background: var(--cream);
  overflow: hidden;
}
.limit-banner .bar > div { height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.3s; }
.limit-banner b { white-space: nowrap; }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; align-items: center; }
.chip-rail { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.chip {
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.sort-select {
  margin-left: auto;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.recipe-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.recipe-thumb {
  height: 160px;
  background: linear-gradient(140deg, #e8590c 0%, #7c2d12 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  overflow: hidden;
}
.recipe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-body { padding: 14px 16px 16px; }
.recipe-body h3 { font-size: 1.02rem; line-height: 1.3; margin-bottom: 6px; }
.recipe-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-soft); font-weight: 700; }
.src-badge {
  background: var(--cream);
  border-radius: 999px;
  padding: 2px 10px;
  text-transform: capitalize;
}
.fav-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* skeleton loading */
@keyframes sk-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.sk-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sk-card .sk-thumb { height: 160px; background: var(--line); animation: sk-pulse 1.4s ease-in-out infinite; }
.sk-card .sk-line {
  height: 14px;
  border-radius: 7px;
  background: var(--line);
  margin: 14px 16px;
  animation: sk-pulse 1.4s ease-in-out infinite;
}
.sk-card .sk-line.short { width: 45%; margin-top: 0; }

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--ink-soft);
}
.empty-state .big { font-size: 3.4rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--ink); font-size: 1.3rem; margin-bottom: 8px; }
.empty-state p { max-width: 26rem; margin: 0 auto 22px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ============ Modals ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(46, 21, 5, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 22px;
  width: 100%;
  max-width: 560px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 4vh;
}
.modal.wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.modal-head h2 { font-size: 1.3rem; color: var(--heading); }
.modal-close {
  border: none;
  background: var(--cream);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.editor-delete-row { margin: 18px 0 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.delete-confirm-modal { max-width: 460px; }
.delete-confirm-modal > p { color: var(--ink-soft); margin-bottom: 16px; }
.delete-confirm-modal .btn-danger { background: #dc2626; color: #fff; }
.delete-confirm-modal .btn-danger:hover { background: #b91c1c; }
.settings-section { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.settings-section h3 { font-size: 1rem; color: var(--heading); margin-bottom: 12px; }
.settings-section.danger h3 { color: var(--danger); }
.settings-copy { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 12px; }
.text-size-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.text-size-choice {
  min-height: 52px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}
.text-size-choice-large { font-size: 1.12rem; }
.text-size-choice[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }

/* recipe viewer */
.viewer-hero {
  border-radius: 16px;
  overflow: hidden;
  height: 220px;
  background: linear-gradient(140deg, #e8590c 0%, #7c2d12 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  margin-bottom: 18px;
}
.viewer-hero img { width: 100%; height: 100%; object-fit: cover; }
.viewer-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.viewer-meta span {
  background: var(--cream);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.viewer-section h3 {
  font-size: 1.05rem;
  color: var(--heading);
  margin: 18px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.ing-list { list-style: none; display: grid; gap: 6px; }
.ing-list li {
  background: var(--cream);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.95rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.ing-list li.done { opacity: 0.45; text-decoration: line-through; }
.step-list { list-style: none; display: grid; gap: 12px; counter-reset: instr; }
.step-list li { display: flex; gap: 12px; font-size: 0.97rem; }
.step-list li::before {
  counter-increment: instr;
  content: counter(instr);
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--brand-deep);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

/* ============ Shopping list ============ */
.shop-add { display: flex; gap: 10px; margin-bottom: 18px; }
.shop-add input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}
.shop-add input:focus { outline: none; border-color: var(--brand); }
.shop-add .btn { flex-shrink: 0; }

.shop-list { list-style: none; display: grid; gap: 8px; margin-bottom: 18px; }
.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--cream);
  border-radius: 12px;
  padding: 11px 12px 11px 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.shop-remove {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shop-remove:hover { border-color: var(--danger); color: var(--danger); }
.shop-empty { color: var(--ink-soft); text-align: center; padding: 22px 6px 26px; }
/* .alert is display:none until it gets .show; this one is driven by the hidden
   attribute instead, so it needs a display of its own to be visible at all.
   The global [hidden] rule still wins when it is hidden. */
.shop-lapsed { display: block; }

.upgrade-hero {
  text-align: center;
  padding: 8px 0 4px;
}
.upgrade-hero .big { font-size: 3rem; }
.upgrade-hero .price { font-size: 2.2rem; font-weight: 800; color: var(--heading); }
.upgrade-hero .price small { font-size: 1rem; color: var(--ink-soft); }
.upgrade-list { list-style: none; margin: 18px 0 22px; display: grid; gap: 10px; }
.upgrade-list li { padding-left: 28px; position: relative; font-weight: 600; color: var(--ink-soft); }
.upgrade-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--brand-deep);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-width: 90vw;
  text-align: center;
  /* Parked off-screen isn't enough on its own: hidden + non-interactive keeps
     the empty pill from ever swallowing taps meant for what's underneath. */
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  transition: transform 0.25s ease, visibility 0s;
}

.loading-dots::after {
  content: "…";
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ============ Help page ============ */
.help-page { padding: 44px 0 70px; }
.help-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding-top: 24px;
  padding-bottom: 36px;
}
.help-hero > div { max-width: 700px; }
.help-kicker { color: var(--brand); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.help-hero h1 { margin: 6px 0 12px; color: var(--heading); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; }
.help-hero p:not(.help-kicker), .help-intro { color: var(--ink-soft); font-size: 1.08rem; }
.help-hero-actions { display: grid; gap: 10px; flex: 0 0 auto; min-width: 210px; text-align: center; }
.help-start-link { color: var(--brand); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.help-reading-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 20px;
  border: 2px solid var(--yellow);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.help-reading-tools strong { color: var(--heading); font-size: 1.12rem; }
.help-reading-tools p { margin-top: 2px; color: var(--ink-soft); }
.help-text-size-choices { width: min(100%, 320px); flex: 0 0 auto; }
.help-section { padding-top: 30px; padding-bottom: 30px; }
.help-section > h2 { color: var(--heading); font-size: 1.75rem; margin-bottom: 5px; }
.help-intro { margin-bottom: 22px; }
.help-chooser-section, #website-help, .help-source-card, #screenshot-help { scroll-margin-top: 90px; }
.help-source-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.help-source-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 11px;
  align-items: center;
  min-height: 78px;
  padding: 13px 15px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.help-source-choice > span { grid-row: 1 / 3; font-size: 1.8rem; }
.help-source-choice strong { align-self: end; color: var(--heading); font-size: 1.02rem; }
.help-source-choice small { align-self: start; color: var(--ink-soft); font-weight: 700; }
.help-source-choice:hover, .help-source-choice:focus-visible { border-color: var(--brand); transform: translateY(-1px); }
.help-source-choice.best { border-color: var(--yellow); background: var(--yellow-soft); }
.help-source-choice.best strong, .help-source-choice.best small { color: var(--brand-deep); }
.help-best-answer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 15px 17px;
  border-left: 6px solid var(--yellow);
  border-radius: 13px;
  background: var(--cream);
  color: var(--ink-soft);
}
.help-best-answer > span { font-size: 1.4rem; }
.help-best-answer strong { color: var(--heading); }
.help-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.help-step-card, .help-source-card, .help-info-card, .help-contact-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.help-step-card { position: relative; padding: 20px; }
.help-step-card h3 { margin: 15px 0 5px; color: var(--heading); }
.help-step-card p, .help-source-card li, .help-info-card li, .help-contact-card p { color: var(--ink-soft); }
.help-step-number {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--brand-deep);
  font-weight: 800;
  box-shadow: var(--shadow);
}
.help-picture {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: var(--cream);
  border: 2px solid var(--line);
  color: var(--ink-soft);
}
.help-picture b { display: inline-flex; align-self: flex-start; padding: 7px 12px; border-radius: 999px; background: var(--brand); color: #fff; }
.help-picture-address span { padding: 8px; border-radius: 9px; background: var(--card); color: var(--ink); word-break: break-all; }
.help-picture-address b { background: var(--yellow); color: var(--brand-deep); }
.help-picture-cookmark b { align-self: stretch; justify-content: center; }
.help-source-card {
  display: block;
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
}
.help-source-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}
.help-source-summary::-webkit-details-marker { display: none; }
.help-source-summary:focus-visible { outline: 3px solid var(--yellow); outline-offset: -4px; }
.help-source-card[open] .help-source-summary { border-bottom: 1px solid var(--line); background: var(--cream); }
.help-source-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.help-source-name > span:first-child { font-size: 1.75rem; }
.help-source-name > span:last-child { display: grid; }
.help-source-name strong { color: var(--heading); font-size: 1.22rem; }
.help-source-name small { color: var(--ink-soft); font-weight: 700; }
.help-source-show { flex: 0 0 auto; color: var(--brand); font-size: 0.9rem; font-weight: 800; }
.help-source-show::after { content: "+"; display: inline-block; margin-left: 8px; font-size: 1.3rem; line-height: 1; }
.help-source-show .when-open { display: none; }
.help-source-card[open] .help-source-show::after { content: "−"; }
.help-source-card[open] .help-source-show .when-closed { display: none; }
.help-source-card[open] .help-source-show .when-open { display: inline; }
.help-source-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: center;
  gap: 28px;
  padding: 24px;
}
.help-source-copy { display: grid; gap: 14px; }
.help-source-copy ol, .help-info-card ol, .help-info-card ul { margin-left: 22px; display: grid; gap: 8px; }
.help-do-first { padding: 11px 13px; border-radius: 11px; background: var(--yellow-soft); color: var(--brand-deep); }
.help-phone {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  padding: 12px;
  border: 5px solid var(--ink);
  border-radius: 26px;
  background: var(--cream);
  box-shadow: var(--shadow);
}
.help-phone-top { display: flex; justify-content: space-between; color: var(--ink); font-weight: 800; padding: 2px 4px 9px; }
.help-phone-photo { min-height: 112px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--yellow-soft), #ffd8a8); font-size: 3rem; }
.help-phone-lines { display: grid; gap: 6px; padding: 10px 3px; }
.help-phone-lines span { display: block; width: 95%; height: 6px; border-radius: 999px; background: var(--line); }
.help-phone-lines span:last-child { width: 65%; }
.help-phone-site, .help-phone-share { padding: 9px; border-radius: 10px; text-align: center; font-weight: 800; }
.help-phone-site { background: var(--brand); color: #fff; }
.help-phone-share { margin-top: 7px; border: 1px solid var(--line); color: var(--ink); font-size: 0.88rem; }
.help-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.help-info-card { padding: 24px; }
.help-info-card h2 { color: var(--heading); font-size: 1.3rem; margin: 8px 0 12px; }
.help-info-icon { font-size: 2rem; }
.help-privacy-note { margin-top: 16px; padding: 11px 12px; border-radius: 11px; background: var(--cream); color: var(--ink-soft); font-weight: 700; }
.help-fix-list { display: grid; gap: 10px; }
.help-fix-list details { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.help-fix-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 14px 17px;
  color: var(--heading);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}
.help-fix-list summary::-webkit-details-marker { display: none; }
.help-fix-list summary::after { content: "+"; color: var(--brand); font-size: 1.35rem; }
.help-fix-list details[open] summary { border-bottom: 1px solid var(--line); background: var(--cream); }
.help-fix-list details[open] summary::after { content: "−"; }
.help-fix-list details > div { padding: 16px 18px 18px; color: var(--ink-soft); }
.help-fix-list details ol { display: grid; gap: 7px; margin: 12px 0 0 22px; }
.help-contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding: 24px;
}
.help-contact-card h2 { color: var(--heading); }
.help-contact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* ================================================================
   Responsive: tablet (<=880px) then phone (<=600px) then small (<=380px)
   ================================================================ */

@media (max-width: 880px) {
  .help-steps { grid-template-columns: 1fr 1fr; }
  .help-step-card:last-child { grid-column: 1 / -1; }
  .help-source-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-source-body { grid-template-columns: 1fr; }

  /* ---- Nav collapses into a drawer ---- */
  .nav-toggle { display: inline-flex; }
  .nav-close { display: inline-flex; }
  .nav-scrim { display: block; }
  .nav-scrim[hidden] { display: none; }

  .nav-links {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(84vw, 330px);
    z-index: 120;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    background: var(--card);
    box-shadow: -18px 0 50px rgba(0, 0, 0, 0.25);
    padding: calc(16px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
    padding-right: max(22px, env(safe-area-inset-right));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.28s;
  }
  .nav-links.open {
    transform: none;
    visibility: visible;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
  }
  .nav-links > a {
    color: var(--ink);
    font-size: 1.05rem;
    padding: 15px 2px;
    border-bottom: 1px solid var(--line);
  }
  .nav-links > a:active { color: var(--brand); }
  /* Install disclosure, styled to sit in the drawer's list of rows. */
  .nav-install { display: block; }
  .nav-install > summary {
    list-style: none;
    cursor: pointer;
    padding: 15px 2px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .nav-install > summary::-webkit-details-marker { display: none; }
  .nav-install > summary::after {
    content: "+";
    color: var(--brand);
    font-size: 1.25rem;
    font-weight: 800;
  }
  .nav-install[open] > summary::after { content: "–"; }
  .nav-install .install-steps { padding: 14px 2px 16px; }
  .nav-install .install-steps ol { font-size: 0.92rem; gap: 10px; }
  .nav-install .install-go { width: 100%; margin-bottom: 14px; }

  .nav-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 20px;
  }
  .nav-actions .btn { width: 100%; padding: 13px 20px; font-size: 1rem; }

  /* ---- Comfortable touch targets across the board ---- */
  .btn { min-height: 46px; }
  .btn-sm { min-height: 42px; padding: 9px 16px; }
  .icon-btn { width: 44px; height: 44px; }
  .chip { min-height: 40px; }
  .faq-list summary { padding: 17px 18px; }

  /* ---- Hero: single column, and the preview stays instead of vanishing ---- */
  .hero { grid-template-columns: 1fr; gap: 30px; padding-block: 30px 44px; }
  .hero-visual { padding: 18px; border-radius: 22px; gap: 12px; }
  .mock-emoji { width: 46px; height: 46px; font-size: 1.4rem; }
  .mock-card { padding: 12px 14px; gap: 12px; }

  .section { padding: 44px 0; }
  .section .sub { margin-bottom: 30px; font-size: 1.02rem; }
  .feature { padding: 24px 20px; }
  .two-col, .three-col { grid-template-columns: 1fr; }

  /* ---- App bar: brand row on top, search on its own line ---- */
  .appbar-inner { flex-wrap: wrap; }
  .search-box { order: 3; max-width: none; flex-basis: 100%; }
  .sort-select { margin-left: auto; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
  .footer-about { grid-column: 1 / -1; }

  .page-wrap { padding: 26px 16px 60px; }
  .page-wrap .page-card { padding: 28px 22px; }
}

@media (max-width: 600px) {
  section[id], [id="main"] { scroll-margin-top: 74px; }

  .help-page { padding-top: 20px; }
  .help-hero, .help-reading-tools, .help-contact-card { align-items: stretch; flex-direction: column; }
  .help-hero-actions, .help-text-size-choices, .help-contact-actions { width: 100%; }
  .help-hero .btn, .help-contact-card .btn { width: 100%; }
  .help-steps, .help-two-column { grid-template-columns: 1fr; }
  .help-step-card:last-child { grid-column: auto; }
  .help-source-summary { min-height: 72px; padding: 14px 16px; }
  .help-source-body, .help-info-card { padding: 20px; }
  .help-phone { max-width: 260px; }
  .help-contact-actions { display: grid; }

  .nav { padding: 10px 0; }
  /* "← Back to home" shortens to "← Back" so it fits beside the logo. */
  .nav-long { display: none; }
  .brand { font-size: 1.2rem; }
  .brand-mark { width: 36px; height: 36px; font-size: 1.15rem; }

  /* ---- Hero CTAs go full width: easy to hit, no awkward half-buttons ---- */
  .hero { padding-block: 22px 36px; gap: 26px; }
  .hero p.lead { margin: 14px 0 24px; }
  .hero-cta { flex-direction: column; align-items: stretch; gap: 12px; }
  .hero-cta .btn { width: 100%; padding: 15px 22px; font-size: 1.02rem; min-height: 52px; }
  .hero-note { text-align: center; }

  /* ---- Chip rows scroll sideways instead of stacking into a wall ----
     This row is itself a .container, so it already spans edge to edge and
     carries its own side padding - no negative-margin bleed here. */
  .source-row {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-top: 4px;
    padding-bottom: 32px;
  }
  .source-row::-webkit-scrollbar { display: none; }
  .source-chip { flex: 0 0 auto; scroll-snap-align: start; }

  .section { padding: 36px 0; }
  .section h2 { font-size: clamp(1.5rem, 6vw, 1.9rem); }
  .section .sub { font-size: 0.98rem; margin-bottom: 26px; }
  .feature-grid, .steps { gap: 16px; }
  .feature { padding: 22px 18px; }
  .feature .icon { width: 46px; height: 46px; font-size: 1.4rem; margin-bottom: 12px; }
  .about-card { padding: 24px 20px; }
  .about-intro { flex-direction: column; gap: 14px; }
  .about-mark { width: 52px; height: 52px; font-size: 1.6rem; }
  .about-links { grid-template-columns: 1fr; }
  .install-card { flex-direction: column; gap: 18px; padding: 26px 20px; }
  .install-mark { width: 56px; height: 56px; font-size: 1.7rem; }
  .install-copy .install-go { width: 100%; }
  .plan { padding: 28px 22px; }
  .plan .price { font-size: 2.1rem; }
  .pricing-grid { grid-template-columns: 1fr; gap: 22px; }

  /* ---- Forms: 16px keeps iOS from zooming the page on focus ---- */
  .field input, .field textarea, .field select,
  .search-box input, .sort-select, .shop-add input { font-size: 16px; }
  .shop-item { min-height: 50px; }
  .shop-remove { width: 38px; height: 38px; }
  .draft-banner, .recipe-load-error, .editor-missing-guide { align-items: stretch; flex-direction: column; }
  .draft-banner-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .draft-banner-actions .btn, .recipe-load-error .btn, .editor-missing-guide .btn { width: 100%; min-height: 48px; }
  .editor-draft-status { align-items: stretch; flex-direction: column; }
  .duplicate-warning-actions { display: grid; grid-template-columns: 1fr; }
  .duplicate-warning-actions .btn { width: 100%; min-height: 46px; }

  .auth-wrap { padding: 20px 14px calc(20px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 26px 20px; }

  /* ---- App: primary actions move to a fixed bottom bar ---- */
  .appbar-actions {
    display: flex;
    gap: 10px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    padding: 10px max(14px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    background: var(--appbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 2px solid var(--line);
  }
  .appbar-actions .btn { flex: 1; min-height: 48px; font-size: 0.95rem; padding: 10px 12px; }
  .app-main { padding: 20px 0 calc(96px + env(safe-area-inset-bottom)); }

  .menu { left: 12px; right: 12px; min-width: 0; }

  .limit-banner { padding: 14px; gap: 12px; }
  .limit-banner .btn { width: 100%; }
  .limit-banner .bar { flex-basis: 100%; }

  /* Filters: chips scroll sideways, sort keeps its own line below.
     The row goes block rather than column-flex on purpose - a stretched flex
     item sizes itself from the chips' min-content width and blows the layout
     viewport wide open, while block auto-width honours the bleed margins. */
  .filter-row { display: block; margin-bottom: 18px; }
  .chip-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 20px;
    margin: 0 -20px;
  }
  .chip-rail::-webkit-scrollbar { display: none; }
  .chip-rail .chip { flex: 0 0 auto; }
  .sort-select { display: block; margin: 12px 0 0 auto; }

  /* Two cards across reads like a real cookbook rather than one giant column. */
  .recipe-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .recipe-thumb, .sk-card .sk-thumb { height: 118px; }
  .recipe-thumb { font-size: 2.2rem; }
  .recipe-body { padding: 11px 12px 14px; }
  .recipe-body h3 { font-size: 0.93rem; }
  .recipe-meta { font-size: 0.72rem; gap: 6px; }
  .src-badge { padding: 2px 8px; }
  .fav-btn { width: 34px; height: 34px; top: 8px; right: 8px; font-size: 0.95rem; }
  .empty-state { padding: 50px 10px; }

  /* ---- Modals become bottom sheets ---- */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: contain;
  }
  .modal, .modal.wide {
    max-width: 100%;
    margin: 0;
    border-radius: 22px 22px 0 0;
    padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: sheet-up 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  }
  /* Grab handle, so it reads as a sheet you can dismiss. */
  .modal::before {
    content: "";
    display: block;
    width: 42px; height: 4px;
    border-radius: 999px;
    background: var(--line);
    margin: 0 auto 10px;
  }
  .modal-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--card);
    padding: 6px 0 12px;
    margin-bottom: 8px;
  }
  #modal-import .modal-head {
    position: static;
  }
  .modal-head h2 { font-size: 1.15rem; }
  .modal-actions { gap: 10px; }
  .modal-actions .btn { flex: 1 1 130px; min-height: 48px; }
  #form-import > .modal-actions {
    position: sticky;
    bottom: -1px;
    z-index: 3;
    margin: 8px -2px -8px;
    padding: 12px 2px 8px;
    border-top: 1px solid var(--line);
    background: var(--card);
  }
  .viewer-hero { height: 170px; font-size: 3rem; }

  /* Clears the fixed action bar; parked further down to match the taller offset. */
  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(200px);
  }

  .footer { padding: 34px 0 30px; }
  .error-hero { padding: 60px 18px; }
  .error-hero .big { font-size: 4rem; }
  .error-hero .btn { margin: 5px; }
}

@keyframes sheet-up { from { transform: translateY(100%); } }

@media (max-width: 380px) {
  .help-source-picker { grid-template-columns: 1fr; }
  .help-source-show { font-size: 0.82rem; }

  .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .chip-rail { padding-left: 16px; padding-right: 16px; margin: 0 -16px; }
  .brand { font-size: 1.1rem; }
  .recipe-grid { gap: 12px; }
  .appbar-actions .btn { font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* A user-controlled reading size. This is stored on the device and applies to
   every page that loads theme.js. */
html[data-text-size="large"] { font-size: 19px; }
html[data-text-size="large"] .field input,
html[data-text-size="large"] .field textarea,
html[data-text-size="large"] .field select,
html[data-text-size="large"] .search-box input,
html[data-text-size="large"] .sort-select,
html[data-text-size="large"] .shop-add input { font-size: 1rem; }

@media (max-width: 720px) {
  html[data-text-size="large"] .recipe-grid { grid-template-columns: 1fr; }
  html[data-text-size="large"] .help-source-picker { grid-template-columns: 1fr; }
  html[data-text-size="large"] .recipe-thumb,
  html[data-text-size="large"] .sk-card .sk-thumb { height: 180px; }
}

/* ============ Print (recipe viewer only) ============ */
@media print {
  body * { visibility: hidden; }
  #modal-viewer.open, #modal-viewer.open * { visibility: visible; }
  #modal-viewer.open {
    position: absolute;
    inset: 0;
    padding: 0;
    background: #fff;
    overflow: visible;
    display: block;
  }
  #modal-viewer .modal {
    box-shadow: none;
    max-width: 100%;
    margin: 0;
    /* Undo the mobile bottom-sheet treatment when printing from a phone. */
    max-height: none;
    overflow: visible;
    border-radius: 0;
    animation: none;
  }
  #modal-viewer .modal::before { display: none; }
  #modal-viewer .modal-head { position: static; }
  #modal-viewer .modal-actions, #modal-viewer .modal-close { display: none !important; }
  .appbar-actions { display: none !important; }
  .viewer-hero { height: auto; max-height: 300px; }
}
