:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6f6b64;
  --line: #e8e4dc;
  --accent: #d9542b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e2;
  --ok: #2f8f5b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141311;
    --surface: #1e1d1a;
    --text: #f1eee8;
    --muted: #a19c93;
    --line: #2c2a26;
    --accent: #ef6a3f;
    --accent-soft: #3a241b;
    --ok: #5cc088;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #141311;
    --surface: #1e1d1a;
    --text: #f1eee8;
    --muted: #a19c93;
    --line: #2c2a26;
    --accent: #ef6a3f;
    --accent-soft: #3a241b;
    --ok: #5cc088;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 34px; }
h2 { font-size: 22px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
input { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.wrap { position: relative; max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: "Fraunces", Georgia, serif; font-weight: 650; font-size: 27px; letter-spacing: -0.01em; font-variation-settings: "SOFT" 50, "opsz" 40; line-height: 1; }
.brand .mark { width: 30px; height: 30px; display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 16px;
  background: var(--surface); border: 1px solid var(--line); transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.big { padding: 16px 28px; font-size: 18px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: #c0392b; }
.btn.icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; }

/* Status lines */
.status { min-height: 22px; font-size: 15px; color: var(--muted); margin: 8px 0 0; }
.status.error { color: #c0392b; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .btn { padding: 10px 18px 10px 14px; font-size: 15px; }
.plus { font-size: 20px; line-height: 1; margin-right: 2px; font-weight: 500; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  position: relative; display: block; background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); transition: transform .12s ease;
}
.card-link { display: block; }
.card-del {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(20, 18, 16, .55); color: #fff; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s ease, background .15s ease;
  backdrop-filter: blur(4px);
}
.card:hover .card-del, .card-del:focus-visible { opacity: 1; }
.card-del:hover { background: #c0392b; }
@media (hover: none) { .card-del { opacity: 1; } }
.card:hover { transform: translateY(-2px); }
.card .img { aspect-ratio: 4/3; background: var(--accent-soft); object-fit: cover; width: 100%; display: block; }
.placeholder, .card .img.placeholder { display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.placeholder img { width: 64px; height: 64px; opacity: .9; }
.hero.placeholder img { width: 110px; height: 110px; }
.hero.placeholder { aspect-ratio: 16/6; overflow: hidden; }
.card .body { padding: 14px 16px 16px; }
.card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.card .small { line-height: 1.45; }
.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 20px; margin-bottom: 6px; }

/* Overview */
.hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; aspect-ratio: 16/8; background: var(--accent-soft); }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); margin: 10px 0 28px; font-size: 15px; }
.meta b { color: var(--text); font-weight: 600; }
.section { margin-bottom: 36px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 40px; }
@media (min-width: 680px) {
  .columns { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .columns .section + .section { border-left: 1px solid var(--line); padding-left: 32px; }
  .columns .section { margin-bottom: 36px; }
}
.section h2 { margin-bottom: 14px; }
.ingredients li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.ingredients li:last-child { border-bottom: 0; }
.ingredients input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; transform: translateY(3px); }
.ingredients label { cursor: pointer; }
.ingredients input:checked + label { color: var(--muted); text-decoration: line-through; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.equipment li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.equipment li:last-child { border-bottom: 0; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.chip.accent { background: var(--accent-soft); border-color: transparent; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 8px 0 32px; }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--muted); margin-bottom: 24px; }

.finish { text-align: center; padding: 12vh 16px; position: relative; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.clap { width: 84px; height: 84px; margin: 0 auto 18px; display: block; color: var(--accent); fill: currentColor; }
.clap .arm { transform-box: view-box; transform-origin: 0 0; }
.clap .upper { transform: translate(11px, 47px) rotate(-42deg); animation: clapU 1.1s ease-in-out .2s 3; }
.clap .lower { transform: translate(11px, 47px) rotate(-20deg); animation: clapD 1.1s ease-in-out .2s 3; }
@keyframes clapU { 0%, 100% { transform: translate(11px, 47px) rotate(-42deg); } 45%, 60% { transform: translate(11px, 47px) rotate(-34deg); } }
@keyframes clapD { 0%, 100% { transform: translate(11px, 47px) rotate(-20deg); } 45%, 60% { transform: translate(11px, 47px) rotate(-28deg); } }
.finish h1 { animation: riseIn .5s ease both; }
.finish .step-label, .finish .muted, .finish .actions { animation: riseIn .5s ease .12s both; }
@keyframes riseIn { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .clap .arm, .finish h1, .finish .step-label, .finish .muted, .finish .actions { animation: none; } }
.finish h1 { margin-bottom: 10px; }
.finish .actions { justify-content: center; margin-top: 32px; }

/* Lesson feedback on the finish screen */
.feedback { max-width: 440px; margin: 36px auto 0; padding: 22px 22px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); text-align: left; animation: riseIn .5s ease .24s both; }
.feedback h2 { font-size: 19px; margin-bottom: 14px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices .btn { flex: 1 1 110px; display: inline-flex; justify-content: center; padding: 12px 8px; font-size: 15px; }
.choices .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.feedback textarea { width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: inherit; font: inherit; font-size: 15px; line-height: 1.45; outline: none; resize: vertical; min-height: 84px; }
.feedback textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.fb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.fb-actions .status { margin: 0; flex: 1; }
.feedback .thanks { text-align: center; padding: 8px 0; font-size: 17px; margin: 0; }
@media (prefers-reduced-motion: reduce) { .feedback { animation: none; } }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Task checklists in the lesson */
.tasks h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.tasks li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 19px; }
.tasks li:last-child { border-bottom: 0; }
.tasks input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; margin-top: 3px; }
.tasks label { cursor: pointer; }
.tasks input:checked + label { color: var(--muted); text-decoration: line-through; }
.tasks .min { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* Servings stepper */
.servings { display: inline-flex; align-items: center; gap: 6px; }
.servings .step { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.servings .step:hover { border-color: var(--accent); color: var(--accent); }
.servings .reset, .reset { font-size: 13px; color: var(--accent); margin-left: 6px; }

/* Search and sort on the home screen */
.tools { display: flex; gap: 8px; margin: 0 0 20px; align-items: center; }
.tools input { flex: 1; min-width: 0; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; outline: none; -webkit-appearance: none; appearance: none; }
.tools input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tools select { padding: 10px 36px 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%236f6b64' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center / 14px; font: inherit; font-size: 15px; color: inherit; -webkit-appearance: none; appearance: none; cursor: pointer; }

/* Settings */
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text); transition: background .15s ease; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn.small { width: 32px; height: 32px; font-size: 20px; color: var(--muted); }
.burger { display: flex; flex-direction: column; gap: 4px; width: 18px; }
.burger i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.topbar { position: relative; }
.sheet {
  position: absolute; z-index: 20; right: 16px; top: 76px; width: min(340px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.14);
  padding: 6px 18px 10px; animation: drop .16s ease;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 6px; }
.sheet-head h2 { font-size: 17px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.row-title { font-weight: 600; font-size: 15px; }
.row > .btn { white-space: nowrap; flex: none; }
.row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.backdrop { position: fixed; inset: 0; z-index: 19; background: transparent; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 600px) {
  .sheet { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; border-radius: 22px 22px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: rise .2s ease; }
  .backdrop { background: rgba(0,0,0,.35); }
  @keyframes rise { from { transform: translateY(24px); opacity: 0; } }
}
.theme { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--bg); flex: none; }
.theme button { padding: 5px 11px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.theme button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Install page and nudge */
.nudge { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin: 0 0 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.nudge svg { flex: none; }
.nudge-text { flex: 1 1 200px; display: flex; flex-direction: column; font-size: 15px; }
.nudge-text .muted { font-size: 14px; }
.nudge-actions { display: flex; gap: 6px; align-items: center; }
.nudge-actions .btn { padding: 9px 16px; font-size: 15px; }
.install h1 { margin-bottom: 10px; }
.install .lead { max-width: 58ch; margin-bottom: 18px; }
.install .tabs { margin: 0 0 18px; }
.install .actions { margin: 0 0 22px; }
.installed-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin: 0 0 28px; background: var(--accent-soft); border-radius: var(--radius); }
.installed-card strong { display: block; margin-bottom: 2px; }
.installed-card p { font-size: 15px; }
.install-steps { display: grid; gap: 14px; counter-reset: step; }
.install-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; gap: 8px 14px; padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); align-items: start; }
.install-steps .n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; grid-row: 1; }
.install-steps h3 { font-size: 18px; margin-bottom: 4px; }
.install-steps p { font-size: 15px; }
.illo-install { width: 100%; max-width: 260px; height: auto; aspect-ratio: 200/120; display: block; grid-column: 1 / -1; grid-row: 2; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.illo-install text { font-family: var(--font); }
@media (min-width: 680px) {
  .install-steps li { grid-template-columns: 34px 200px minmax(0, 1fr); grid-template-rows: auto; }
  .illo-install { grid-column: 2; grid-row: 1; max-width: 200px; }
  .install-steps li > div:last-child { grid-column: 3; }
}
.install .fine { margin-top: 24px; }

/* Toast: updates and offline notes */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 12px 10px 12px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 15px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: rise .2s ease;
}
.toast-action { color: var(--accent); font-weight: 600; padding: 4px 6px; }
.toast-close { width: 28px; height: 28px; border-radius: 50%; font-size: 18px; color: var(--bg); opacity: .7; }
.toast-close:hover { opacity: 1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast-action { color: #ffb08f; } }
:root[data-theme="dark"] .toast-action { color: #ffb08f; }

/* Confirmation dialog */
dialog.confirm { border: 0; padding: 0; background: transparent; max-width: min(380px, calc(100vw - 32px)); }
dialog.confirm::backdrop { background: rgba(20, 18, 16, .4); backdrop-filter: blur(3px); }
dialog.confirm form { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 24px 24px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .16s ease; }
dialog.confirm h2 { font-size: 19px; margin-bottom: 8px; }
dialog.confirm p { font-size: 15px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn.danger-fill { background: #c0392b; color: #fff; border-color: transparent; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }

/* Add-recipe dialog */
dialog.import-dialog input {
  width: 100%; margin-top: 14px; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  font-size: 16px; outline: none;
}
dialog.import-dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
dialog.import-dialog input:disabled { opacity: .6; }
dialog.import-dialog .confirm-actions { margin-top: 12px; }
dialog.import-dialog .link-row { display: flex; gap: 8px; align-items: flex-start; }
dialog.import-dialog .link-row .btn { margin-top: 14px; padding: 12px 16px; flex: none; }

/* ---------- Lesson: full-screen, clock always in view ---------- */
.lesson { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr); background: var(--bg); }
.lesson-ask { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface); font-size: 15px; }
.lesson-ask span { flex: 1 1 200px; }
.lesson-ask .btn { padding: 8px 14px; font-size: 14px; }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; }
.lesson-top .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lesson-top .icon-btn { text-decoration: none; font-size: 22px; flex: none; }
.lesson-top .count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lesson .progress { height: 3px; background: var(--line); margin: 0 14px; border-radius: 2px; overflow: hidden; }
.lesson .progress i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }

.lesson-split { display: grid; min-height: 0; min-width: 0; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.clock-pane { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px 6px; --ring: min(46vw, 210px); }
.step-pane { min-height: 0; min-width: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; }
.step-scroll { padding: 12px 20px 28px; max-width: 64ch; width: 100%; margin: auto; }
.illo { width: 84px; height: 84px; display: block; margin: 0 auto 14px; animation: illoIn .35s ease both; }
@keyframes illoIn { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.step-label { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.step-title { font-size: clamp(24px, 4.5vw, 34px); margin-bottom: 14px; }
.step-text { font-size: clamp(18px, 2.3vw, 21px); line-height: 1.55; }
.tip { color: var(--muted); font-size: 16px; padding-left: 14px; border-left: 3px solid var(--line); margin: 14px 0 0; }
.tasks { margin-top: 20px; }

/* The clock: thin digits in a thin ring */
.clock { position: relative; width: var(--ring); height: var(--ring); }
.clock .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clock .ring circle { fill: none; stroke-width: 2.2; }
.clock .track { stroke: var(--line); }
.clock .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s ease; }
.clock { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.clock.dialing { cursor: grabbing; }
.clock.dialing .fill { transition: none; stroke: var(--accent); stroke-width: 3; }
.clock.dialing .track { stroke-width: 3; }
.clock.paused .fill { stroke: var(--muted); }
.clock.done .fill { stroke: var(--ok); }
.clock.none .fill { stroke: var(--line); }
.clock .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.digits { font-size: calc(var(--ring) * .27); font-weight: 200; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); display: flex; align-items: baseline; }
.clock.long .digits { font-size: calc(var(--ring) * .19); }
.clock.none .digits { font-weight: 300; color: var(--muted); }
.clock.done .digits { color: var(--ok); }
.colon { font-weight: 200; margin: 0 .02em; transform: translateY(-.06em); }
.clock.running .colon { animation: blink 1s steps(1) infinite; }
.clock.done .face { animation: pulse 1.6s ease-in-out infinite; }
.under, .over { font-size: 13px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; height: 16px; line-height: 16px; }
.over { margin-bottom: 6px; }
.under { margin-top: 6px; }
.clock.done .under { color: var(--ok); }
@keyframes blink { 50% { opacity: 0; } }

.clock-controls { display: flex; gap: 22px; height: 70px; }
.round { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.round svg { width: 48px; height: 48px; padding: 13px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: border-color .15s ease, color .15s ease; }
.round:hover svg { border-color: var(--accent); color: var(--accent); }

.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.lesson-nav .hint { font-size: 13px; color: var(--muted); display: none; }
.lesson-nav .btn.big { padding: 14px 26px; }

@media (min-width: 900px) {
  .lesson-split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: minmax(0, 1fr); }
  .clock-pane { --ring: min(52vh, 34vw, 440px); gap: 22px; padding: 24px; border-right: 1px solid var(--line); position: relative; }
  .clock-controls { position: absolute; left: 0; right: 0; justify-content: center; top: calc(50% + var(--ring) / 2 + 20px); }
  .step-scroll { padding: 36px 48px 48px; }
  .illo { width: 104px; height: 104px; margin-bottom: 18px; }
  .lesson-nav .hint { display: block; }
  .lesson-top { padding: 14px 20px 8px; }
  .lesson .progress { margin: 0 20px; }
}

/* Meal filter and picker */
.meals { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.meals button { padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); border: 1px solid transparent; }
.meals button:hover { color: var(--text); }
.meals button[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--text); font-weight: 600; }
.meal-pick select { font: inherit; font-size: 15px; color: var(--text); background: transparent; border: 0; padding: 0 18px 0 0; cursor: pointer; -webkit-appearance: none; appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%236f6b64' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right center / 12px; font-weight: 600; }

/* Add-recipe dialog: tabs, text and file panes */
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--bg); margin: 6px 0 12px; }
.tabs .tab { padding: 6px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.tabs .tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
dialog.import-dialog textarea { width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font: inherit; font-size: 15px; line-height: 1.45; outline: none; resize: vertical; min-height: 140px; }
dialog.import-dialog textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.drop { display: block; margin-top: 12px; padding: 26px 16px; border: 1.5px dashed var(--line); border-radius: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: 15px; background: var(--bg); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
dialog.import-dialog { max-width: min(440px, calc(100vw - 32px)); }

/* Music */
.music-btn { color: var(--muted); }
.music-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.music-btn[aria-pressed="true"] svg { animation: sway 2.4s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
input[type=range]#musicVol { width: 140px; accent-color: var(--accent); }

/* Favorites */
.heart { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.heart svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; transition: transform .15s ease; }
.heart.on { color: var(--accent); }
.heart.on svg { fill: currentColor; }
.heart:active svg { transform: scale(.85); }
.card .heart { position: absolute; top: 10px; left: 10px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.85); color: #6f6b64; backdrop-filter: blur(4px); }
.card .heart.on { color: var(--accent); }
.heart.filter { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); flex: none; }
.heart.filter.on { background: var(--accent-soft); border-color: transparent; }
.heart.page { width: 40px; height: 40px; border-radius: 50%; }
.heart.page:hover { background: var(--surface); }

/* Sign-in */
.signin { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 96px); }
.signin-card { width: 100%; max-width: 440px; padding: 36px 28px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); text-align: center; }
.signin-card .brand { justify-content: center; margin-bottom: 26px; }
.signin-card h1 { font-size: 28px; margin-bottom: 10px; }
.signin-card .lead { margin-bottom: 22px; }
.signin-card .notice { text-align: left; margin-bottom: 18px; background: var(--bg); }
.signin-buttons { display: grid; gap: 10px; }
.btn.provider { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px 20px; font-size: 17px; font-weight: 600; background: var(--bg); }
.signin-card .fine { margin-top: 22px; }
dialog.import-dialog .allowance { margin: 10px 0 0; }

/* The feed: Recipes / Feed tabs on the home screen, and a post per cook */
.home-tabs { margin: -8px 0 22px; }
.home-tabs .tab { padding: 7px 18px; font-size: 15px; font-weight: 600; }
.feed { display: grid; gap: 12px; }
.post { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 72px; gap: 14px; align-items: start; padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.avatar svg { display: block; width: 100%; height: 100%; }
.avatar.big { width: 64px; height: 64px; }

/* Profile: the row in Settings and the picture picker */
.profile-btn { display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; flex: 1; border-radius: 12px; padding: 4px; margin: -4px; }
.profile-btn:hover { background: var(--bg); }
.profile-btn .avatar { width: 44px; height: 44px; }
.profile-btn > span:last-child { display: flex; flex-direction: column; min-width: 0; }
/* The profile row: Sign out sits on its own line under the picture, name and address, which cannot break
   and ran under the button when it shared the line; a very long address still breaks rather than overflow */
.row.profile { flex-wrap: wrap; }
.row.profile .profile-btn { flex-basis: 100%; }
.profile-btn .row-sub { overflow-wrap: anywhere; }
dialog.profile-dialog { max-width: min(420px, calc(100vw - 32px)); width: 100%; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head h2 { font-size: 22px; margin-bottom: 4px; }
.profile-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-pick { display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 16px; border: 2px solid transparent; transition: transform .1s ease, border-color .15s ease; }
.avatar-pick svg { width: 100%; height: auto; max-width: 56px; }
.avatar-pick:hover { transform: scale(1.06); }
.avatar-pick[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
dialog.profile-dialog .status { margin-top: 10px; }
dialog.profile-dialog .confirm-actions { margin-top: 14px; }
.post-line { font-size: 16px; line-height: 1.4; }
.post-line a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.post-line a:hover { text-decoration-color: var(--accent); }
.post-meta { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.post-meta span { display: inline-flex; align-items: center; gap: 4px; }
.post-note { margin-top: 8px; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.post-heart { gap: 5px; height: 32px; padding: 0 10px 0 6px; border-radius: 999px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.post-heart:hover { background: var(--accent-soft); }
.post-heart svg { width: 18px; height: 18px; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.small.ghost { color: var(--ok); }
/* Delete, on your own posts: the same corner button as a recipe card, shown on hover and always on touch */
.post-del { top: 8px; right: 8px; width: 26px; height: 26px; font-size: 16px; }
.post:hover .post-del, .post-del:focus-visible { opacity: 1; }
.post-img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--accent-soft); display: block; }
.post-img.placeholder { display: flex; }
.post-img.placeholder img { width: 36px; height: 36px; }
@media (max-width: 480px) {
  .post { grid-template-columns: 36px minmax(0, 1fr) 56px; gap: 10px; padding: 14px 12px 12px; }
  .avatar { width: 36px; height: 36px; font-size: 15px; }
  .post-img { width: 56px; height: 56px; }
  .post-actions { flex-wrap: wrap; }
}

/* Share to the feed: the card on the finish screen and the "I cooked this" dialog */
.share-head { display: flex; gap: 14px; align-items: center; }
.share-head h2 { font-size: 19px; margin-bottom: 2px; }
.share-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--accent-soft); }
.share-thumb.placeholder { display: flex; align-items: center; justify-content: center; }
.share-thumb.placeholder img { width: 28px; height: 28px; }
.share input { width: 100%; margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: inherit; font: inherit; font-size: 15px; outline: none; }
.share input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.share-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.share-actions select { padding: 9px 32px 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%236f6b64' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px; font: inherit; font-size: 14px; color: inherit; -webkit-appearance: none; appearance: none; cursor: pointer; max-width: 60%; }
.share-actions .status { margin: 0; flex: 1; text-align: right; }
.share .thanks a { color: var(--accent); font-weight: 600; }
dialog.share-dialog { max-width: min(460px, calc(100vw - 32px)); width: 100%; }
dialog.share-dialog form { position: relative; padding-right: 56px; }
dialog.share-dialog .share-actions, dialog.share-dialog input { margin-right: -32px; }
.dlg-close { position: absolute; top: 14px; right: 14px; }

/* Plain pages: /privacy and /terms, served without sign-in */
.legal { max-width: 640px; }
.legal h1 { font-size: 30px; margin-bottom: 6px; }
.legal .effective { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.legal .lead { font-size: 18px; margin-bottom: 8px; }
.legal h2 { font-size: 19px; margin: 32px 0 10px; }
.legal p { margin: 0 0 12px; }
.legal ul { list-style: disc; padding-left: 22px; margin: 0 0 12px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
/* The About row: the links sit on their own line under the text, which holds an unbreakable email address */
.row.about { flex-wrap: wrap; }
.row-links { display: flex; gap: 6px; flex: none; }
.signin-card .fine a { text-decoration: underline; text-underline-offset: 2px; }

/* The landing page: /welcome, where a signed-out visit to / is sent */
.landing { max-width: 880px; }
.landing .hero-copy { text-align: center; max-width: 640px; margin: 24px auto 36px; }
.landing .hero-copy h1 { font-size: clamp(34px, 6vw, 52px); margin-bottom: 16px; font-family: "Fraunces", Georgia, serif; font-weight: 650; font-variation-settings: "SOFT" 50, "opsz" 72; letter-spacing: -0.02em; }
.landing .lead { font-size: 19px; color: var(--muted); margin-bottom: 26px; }
.landing .cta { display: grid; justify-items: center; gap: 14px; }
.landing .beta { max-width: 42ch; line-height: 1.5; }
.landing .beta a { color: var(--accent); font-weight: 600; }
.landing .clip video { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #000; box-shadow: var(--shadow); }
.landing .clip-note { text-align: center; margin-top: 10px; }
.landing h2 { font-size: 26px; margin: 56px 0 20px; text-align: center; }
.landing .how-steps { display: grid; gap: 18px; max-width: 640px; margin: 0 auto; }
.landing .how-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: start; }
.landing .how-steps .n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; margin-top: 2px; }
.landing .how-steps strong { display: block; margin-bottom: 2px; }
.landing .plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.landing .plan { display: flex; flex-direction: column; padding: 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.landing .plan.featured { border-color: var(--accent); }
.landing .plan h3 { font-size: 20px; }
.landing .price { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.landing .price .per { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.landing .plan .alt { margin-top: -2px; }
.landing .plan ul { margin: 16px 0 22px; display: grid; gap: 8px; flex: 1; font-size: 15px; }
.landing .plan li { padding-left: 22px; position: relative; }
.landing .plan li::before { content: ""; position: absolute; left: 0; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); }
.landing .plan .btn { justify-content: center; }
.landing .btn.soon { color: var(--muted); cursor: default; }
.landing .btn.soon:active { transform: none; }
.landing .plans-note { text-align: center; margin-top: 18px; }
.landing .landing-foot { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); text-align: center; display: grid; gap: 6px; }
.landing .landing-foot a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 480px) { .landing .hero-copy { margin-top: 8px; } .landing .lead { font-size: 17px; } }
.signin-card .more { color: var(--accent); font-weight: 600; }

/* Tastes and the starter library: the welcome screens, Discover, picked-for-you, library cards and tiles */
.tastes .topbar { margin-bottom: 18px; }
.tastes-card-page { max-width: 560px; margin: 0 auto; padding: 28px 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.tastes-card-page .step-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.tastes-card-page h1 { font-size: 28px; margin-bottom: 8px; }
.tastes-card-page .lead { margin-bottom: 20px; font-size: 16px; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-list { display: grid; gap: 8px; }
.choice { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 15px; text-align: left; transition: background .12s ease, border-color .12s ease, transform .08s ease; }
.choice:hover { border-color: var(--muted); }
.choice:active { transform: scale(.98); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.choice-list .choice { border-radius: 14px; padding: 12px 16px; }
.choice-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
.tastes-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }
@media (max-width: 480px) { .tastes-card-page { padding: 22px 16px 18px; } .tastes-card-page h1 { font-size: 24px; } }

.tile { display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.tile-icon { width: 46%; height: 46%; max-width: 120px; max-height: 120px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.08)); }
.hero.tile { aspect-ratio: 16/7; }
.hero.tile .tile-icon { width: 34%; height: 56%; max-width: 160px; max-height: 160px; }
.tile-italian { background: #f8dcd2; } .tile-mexican { background: #fbe2b8; } .tile-american { background: #d9e6f4; } .tile-chinese { background: #f6d2cf; }
.tile-japanese { background: #e4e4ee; } .tile-thai { background: #dff0d5; } .tile-indian { background: #fbe4bf; } .tile-mediterranean { background: #d6ecef; }
.tile-french { background: #e8dcef; } .tile-middle-eastern { background: #efe3c9; } .tile-korean { background: #f7d5da; } .tile-vietnamese { background: #d8efe3; } .tile-other { background: var(--accent-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile[class*="tile-"] { filter: saturate(.7) brightness(.72); } }
:root[data-theme="dark"] .tile[class*="tile-"] { filter: saturate(.7) brightness(.72); }

.lib-card .card-link { padding-bottom: 0; }
.lib-card .body { padding-bottom: 10px; }
.lib-desc { color: var(--muted); margin-top: 8px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 14px; }
.lib-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn.small.primary { font-weight: 600; }
.lib-card.compact .body { padding: 12px 14px 8px; }
.lib-card.compact h3 { font-size: 15px; }
.lib-card.compact .lib-actions { padding: 0 14px 12px; }

.picked { margin: 0 0 30px; }
.picked-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.picked-head h2 { font-size: 20px; margin-bottom: 2px; }
.picked-head .btn { flex: none; margin-top: 2px; }
.picked-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.picked-grid .tile-icon { width: 40%; height: 40%; }
.or-add { padding-top: 8px; }
.tastes-card svg { width: 40px; height: 40px; }

.discover-lead { margin: 0 0 16px; font-size: 15px; }
.discover-lead a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.discover-filters { margin-bottom: 20px; }
.discover-filters .mine { margin-left: auto; border-color: var(--line); }
.discover-filters .mine[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: transparent; }

.tag-chips { margin: -8px 0 24px; }
.ingredients.plain li { align-items: center; }
.ingredients .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; opacity: .7; }
.plan-steps { counter-reset: plan; display: grid; gap: 2px; }
.plan-steps li { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.plan-steps li:last-child { border-bottom: 0; }
.plan-icon { width: 30px; height: 30px; flex: none; }
