/*
  Recipio — visual style.
  Editorial, like a good food magazine: the photo leads and the interface steps
  back. White space and hairlines instead of boxes and shadows, serif titles
  with small uppercase labels, near-black ink and one tomato-red accent.
*/
:root {
    --bg: #fbfaf8;
    --surface: #ffffff;
    --tint: #f4f1ec;
    --ink: #1b1917;
    --soft-ink: #45403b;
    --muted: #6e6862;
    --line: #e8e4dd;
    --accent: #d33a1f;
    --accent-dark: #a92a13;
    --accent-soft: #fdeee9;
    --green: #2f6b4a;
    --green-soft: #e8f1ea;
    --gold: #d99a1c;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(27, 25, 23, .05), 0 10px 30px rgba(27, 25, 23, .08);
    --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --dock-h: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 500 16px/1.55 var(--sans);
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
}
body.has-dock { --dock-h: 84px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
/* The small uppercase label above a title: a category, a group of ingredients. */
.kicker {
    display: block; font: 800 .72rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
:focus-visible { outline: 3px solid rgba(211, 58, 31, .4); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand {
    display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0;
    font: 800 1.42rem/1 var(--serif); letter-spacing: -.02em;
}
.brand svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang button { border: 0; background: none; padding: 6px 12px; font-weight: 800; font-size: .78rem; letter-spacing: .06em; color: var(--muted); }
.lang button.active { background: var(--ink); color: #fff; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 8px 18px;
    border: 1.5px solid var(--ink); border-radius: 999px;
    background: transparent; color: var(--ink);
    font-weight: 700; font-size: .93rem; text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.big { min-height: 50px; padding: 10px 26px; font-size: 1rem; }
.btn:disabled { opacity: .55; cursor: default; }
/* The one coloured button: adding a recipe. */
#add-btn { background: var(--accent); border-color: var(--accent); }
#add-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.speak { width: 36px; height: 36px; color: var(--muted); flex: none; }
.icon-btn.speak.on { background: var(--green); border-color: var(--green); color: #fff; }
.icon-btn.fav.on { color: var(--accent); border-color: var(--accent); }
.icon-btn.fav.on .icon { fill: currentColor; }
.link { border: 0; background: none; padding: 4px; color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

/* ---------- layout ---------- */
#app { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.loading { display: flex; justify-content: center; padding: 80px 0; }
.spinner {
    display: inline-block; width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
.spinner.big { width: 44px; height: 44px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: #9c2412; background: var(--accent-soft); border: 1px solid #f6cfc5; border-radius: 10px; padding: 10px 14px; }
.error small { display: block; margin-top: 4px; opacity: .8; }
.banner { background: #fdf4dc; border: 1px solid #efdca6; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.back {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; text-decoration: none;
    font: 800 .74rem/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.back:hover { color: var(--ink); }
.lead { color: var(--soft-ink); font-size: 1.1rem; line-height: 1.6; margin-top: 12px; max-width: 62ch; }
.foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }

/* ---------- forms ---------- */
.login { max-width: 360px; margin: 12vh auto 0; padding: 28px 24px; display: grid; gap: 14px; }
.login h2 { font-size: 1.7rem; }
input[type=password], input[type=text], input[type=number], input[type=search], textarea {
    width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--ink); outline: none; }
input::placeholder, textarea::placeholder { color: #9a948d; }
textarea { resize: vertical; }

/* ---------- shopping list ---------- */
.shop { margin-bottom: 14px; overflow: hidden; }
.shop-head {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 16px; border: 0; background: none; text-align: left;
    font: 700 1.12rem/1.2 var(--serif);
}
.shop-head > .icon:first-child { color: var(--accent); width: 22px; height: 22px; }
.shop-title { flex: 1; }
.shop-count {
    min-width: 26px; padding: 2px 8px; border-radius: 999px; text-align: center;
    background: var(--ink); color: #fff; font: 800 .8rem/1.5 var(--sans);
}
.shop-head > .icon:last-child { color: var(--muted); transition: transform .2s; }
.shop.open .shop-head > .icon:last-child { transform: rotate(180deg); }
.shop-body { padding: 0 16px 14px; display: grid; gap: 12px; }
.shop-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.shop-list li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.shop-list label { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; cursor: pointer; }
.shop-list input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.shop-list b { font-weight: 800; }
.shop-list li.done span { color: var(--muted); text-decoration: line-through; }
.shop-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.shop-x:hover { background: var(--tint); color: var(--ink); }
.shop-empty { padding-top: 2px; }
.shop-actions { display: flex; justify-content: flex-end; gap: 16px; flex-wrap: wrap; }
.shop-add { margin-top: 16px; width: 100%; }

/* ---------- list ---------- */
input.search { margin-bottom: 12px; border-radius: 999px; padding-left: 20px; background: var(--tint); border-color: transparent; }
input.search:focus { background: var(--surface); border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
    font-weight: 700; font-size: .88rem; transition: border-color .15s;
}
.chip:hover { border-color: var(--ink); }
.chip .count { color: var(--muted); font-weight: 600; font-size: .8rem; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active .count { color: rgba(255, 255, 255, .65); }
/* On a phone every recipe gets the whole row; wider screens show a grid. */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; } }
.recipe-card { position: relative; display: block; overflow: hidden; text-decoration: none; border: 0; border-radius: var(--radius); }
.card-img { position: relative; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.recipe-card:hover .card-img img { transform: scale(1.04); }
.card-img > .icon { width: 44px; height: 44px; opacity: .55; margin-bottom: 22%; }
@media (min-width: 560px) { .card-img { aspect-ratio: 4 / 5; } }
.card-img.cat-salad, .card-img.cat-side, .card-img.cat-soup, .card-img.cat-preserve { background: var(--green-soft); color: var(--green); }
.card-img.cat-dessert, .card-img.cat-bread, .card-img.cat-breakfast { background: #fbf1d9; color: #9a6a10; }
.card-img.cat-drink, .card-img.cat-sauce, .card-img.cat-other { background: #eceaf3; color: #5b4a7a; }
.badge {
    position: absolute; top: 10px; right: 10px; display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: .9rem;
}
.badge.fav { left: 10px; right: auto; color: var(--accent); }
.badge .icon { width: 16px; height: 16px; }
/* The title lies over the bottom of the photo on a see-through shade, instead of in a box under it. */
.card-body {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 44px 16px 14px; color: #fff;
    background: linear-gradient(to top, rgba(15, 13, 11, .88) 0%, rgba(15, 13, 11, .6) 50%, rgba(15, 13, 11, 0) 100%);
}
.card-body .kicker { color: rgba(255, 255, 255, .82); font-size: .66rem; margin-bottom: 4px; }
.card-body h3 {
    font-size: 1.28rem; line-height: 1.16; text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: .82rem; font-weight: 600; color: rgba(255, 255, 255, .88); }
.card-stars { color: #ffcf5c; letter-spacing: 1px; }
.card-stars i { font-style: normal; color: rgba(255, 255, 255, .36); }
/* A recipe without a photo is a pale tile: no shade needed, dark text straight on it. */
.no-photo .card-body { background: none; color: var(--ink); }
.no-photo .card-body .kicker { color: currentColor; opacity: .6; }
.no-photo .card-body h3 { text-shadow: none; }
.no-photo .card-meta { color: var(--muted); }
.no-photo .card-stars { color: var(--gold); }
.no-photo .card-stars i { color: rgba(27, 25, 23, .16); }
.empty { text-align: center; padding: 8vh 16px; display: grid; gap: 14px; justify-items: center; }
.empty h2 { font-size: 1.9rem; }
.empty p { color: var(--muted); max-width: 44ch; }
.empty-art { width: 96px; height: 96px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.empty-art .icon { width: 46px; height: 46px; }

/* ---------- add ---------- */
#app > h1 { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 800; margin-top: 6px; }
.add-card { margin-top: 20px; padding: 18px; display: grid; gap: 14px; max-width: 720px; }
.add-card.over { border-color: var(--accent); background: var(--accent-soft); }
.add-text { min-height: 120px; }
.pick { justify-self: start; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.video { width: auto; max-width: 260px; padding: 0 34px 0 12px; gap: 8px; }
.thumb.video span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(27, 25, 23, .78); color: #fff; line-height: 1; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.working { position: fixed; inset: 0; z-index: 60; background: rgba(251, 250, 248, .96); display: flex; align-items: center; justify-content: center; }
.working-box { display: grid; gap: 20px; justify-items: center; text-align: center; padding: 24px; font: 700 1.4rem/1.3 var(--serif); }

/* ---------- recipe ---------- */
.recipe-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recipe-actions { display: flex; gap: 8px; }
.hero { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); display: block; margin-bottom: 22px; background: var(--tint); }
@media (min-width: 700px) { .hero { aspect-ratio: 21 / 9; } }
.recipe > .kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rated { color: #a8730b; letter-spacing: .04em; }
.recipe h1 { font-size: clamp(2.1rem, 7vw, 3.4rem); font-weight: 800; line-height: 1.06; letter-spacing: -.02em; }
.author { color: var(--muted); margin-top: 10px; font-size: .92rem; font-weight: 600; }
/* Prep / cooking / total / serves / oven: a ruled row of small labels over bold values. */
.stats { display: flex; flex-wrap: wrap; gap: 6px 30px; margin: 22px 0 0; padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats:empty { display: none; }
.stat dt { font: 800 .66rem/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.stat dd { margin: 3px 0 0; font-weight: 800; font-size: 1.06rem; }
.cols { display: grid; gap: 4px; margin-top: 8px; }
@media (min-width: 860px) {
    .cols { grid-template-columns: 330px 1fr; gap: 56px; align-items: start; }
    .col-side { position: sticky; top: 70px; max-height: calc(100vh - 70px - var(--dock-h) - 16px); overflow-y: auto; padding-right: 6px; }
}
.block { padding: 26px 0 6px; scroll-margin-top: 70px; border-radius: var(--radius); transition: background .3s, box-shadow .3s; }
.block h2 { font-size: 1.6rem; margin-bottom: 14px; }
.block h3 { font: 800 .72rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 20px 0 6px; }
.block.focus { background: var(--accent-soft); box-shadow: 0 0 0 14px var(--accent-soft); }
.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px solid var(--line); }
.ingredients label { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; cursor: pointer; }
.ingredients input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.ingredients b { font-weight: 800; }
.ingredients input:checked + span { color: var(--muted); text-decoration: line-through; }
.ingredients .note { color: var(--muted); }
.ingredients .orig { color: var(--muted); font-size: .85rem; }
.cookware { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cookware li { padding: 7px 14px; background: var(--tint); border-radius: 999px; font-size: .92rem; font-weight: 600; }
/* Steps are not boxes: a large serif numeral and the text, with air between them. */
.steps { list-style: none; margin: 0 -14px; padding: 0; display: grid; gap: 4px; }
.steps li {
    display: flex; gap: 16px; padding: 14px; border-radius: 12px; cursor: pointer;
    scroll-margin: 90px 0 calc(var(--dock-h) + 20px);
    transition: background .25s, font-size .2s;
}
.steps li:hover { background: var(--tint); }
.steps .num { flex: none; width: 34px; font: 800 2.1rem/1 var(--serif); color: var(--accent); text-align: center; }
.steps li.focus { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); font-size: 1.3rem; line-height: 1.45; }
.step-body { flex: 1; min-width: 0; padding-top: 4px; }
.amt { font-weight: 800; white-space: nowrap; }
.step-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: .9rem; }
.chip-btn, .chip-static { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; font-weight: 700; }
.chip-btn { border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); transition: background .15s, color .15s; }
.chip-btn:hover { background: var(--ink); color: #fff; }
.chip-static { background: var(--tint); color: var(--soft-ink); }
.steps li.focus .chip-static { background: rgba(255, 255, 255, .7); }
.rate-stars { display: flex; gap: 2px; margin: 0 0 8px -8px; }
.rate-stars button {
    width: 48px; height: 48px; border: 0; background: none; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #cfc8be;
}
.rate-stars .icon { width: 34px; height: 34px; }
.rate-stars button.on { color: var(--gold); }
.rate-stars button.on .icon { fill: currentColor; }
.rate-stars button:hover { background: var(--tint); }
.tips { border-left: 3px solid var(--accent); padding: 2px 0 2px 18px; font: italic 600 1.18rem/1.55 var(--serif); color: var(--soft-ink); }
.source video, .embed { width: 100%; max-width: 720px; border-radius: var(--radius); background: #000; display: block; }
.source video { max-height: 70vh; }
.embed { aspect-ratio: 16 / 9; overflow: hidden; }
.embed iframe { width: 100%; height: 100%; border: 0; }
.source-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--ink); font-weight: 700; text-underline-offset: 3px; word-break: break-all; }
.source-link:hover { color: var(--accent); }
.originals { margin-top: 16px; display: grid; gap: 8px; }

/* ---------- dock (voice, steps, timer) ---------- */
.dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    box-shadow: 0 -8px 30px rgba(27, 25, 23, .07);
    padding: 10px max(12px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
}
.dock-row { display: flex; align-items: center; gap: 10px; max-width: 1080px; margin: 0 auto; }
.dock-mic {
    flex: none; width: 60px; height: 60px; border-radius: 50%;
    border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
    display: flex; align-items: center; justify-content: center;
}
.dock-mic .icon { width: 28px; height: 28px; }
.dock-mic.on { background: var(--accent); border-color: var(--accent); color: #fff; animation: pulse 2s ease-out infinite; }
.dock-mic.on.speaking { background: var(--green); border-color: var(--green); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(211, 58, 31, .45); } 70%, 100% { box-shadow: 0 0 0 14px rgba(211, 58, 31, 0); } }
.dock-status { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 4px; }
.ds-main { font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.ds-main.heard { font-style: italic; font-weight: 500; }
.ds-sub { font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-sub.ok { color: var(--green); }
.dock-btn {
    flex: none; width: 48px; height: 48px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    display: flex; align-items: center; justify-content: center; transition: border-color .15s;
}
.dock-btn:hover { border-color: var(--ink); }
.dock-btn .icon { width: 22px; height: 22px; }
.bubble {
    max-width: 720px; margin: 0 auto 10px; padding: 14px 18px;
    background: var(--ink); color: #fff; border-radius: var(--radius); cursor: pointer;
}
.bubble-q { font-size: .82rem; opacity: .65; font-style: italic; margin-bottom: 4px; }
.bubble-a { font-size: 1.2rem; font-weight: 600; line-height: 1.4; }

/* ---------- timers ---------- */
.timer-bar {
    /* Under the top bar, so it never covers the answers above the dock. */
    position: fixed; z-index: 40; left: 0; right: 0;
    top: calc(64px + env(safe-area-inset-top));
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    padding: 0 12px; pointer-events: none;
}
.timer-pill {
    pointer-events: auto; display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 10px 8px 18px; border-radius: 999px; border: 0;
    background: var(--ink); color: #fff; box-shadow: var(--shadow);
    font-weight: 700; font-size: .9rem;
}
.tp-clock { font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 800; }
.tp-x { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; line-height: 1; }
.timer-pill.ringing { background: var(--accent); animation: ring .5s ease-in-out infinite alternate; }
@keyframes ring { to { transform: scale(1.06); } }

/* ---------- sheets and toast ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(27, 25, 23, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
    width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
    background: var(--surface); border-radius: 22px 22px 0 0;
    padding: 18px 20px calc(22px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 1.45rem; }
.sheet-body { display: grid; gap: 12px; }
.menu-item {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 4px;
    border: 0; border-bottom: 1px solid var(--line); background: none; font-weight: 700; text-align: left;
}
.sheet-body .menu-item:last-of-type { border-bottom: 0; }
.menu-item:hover { color: var(--accent); }
.menu-item.danger { color: #9c2412; }
.stack { display: grid; gap: 12px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row-form { display: flex; gap: 8px; }
.row-form input { flex: 1; min-width: 0; }
.help-list { margin: 0; display: grid; gap: 2px; }
.help-list dt { font-weight: 700; margin-top: 10px; }
.help-list dd { margin: 0; color: var(--muted); font-size: .9rem; }
.toast {
    position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 70px);
    max-width: min(92vw, 520px); padding: 12px 20px; border-radius: 999px;
    background: var(--ink); color: #fff; box-shadow: var(--shadow); text-align: center; font-weight: 600; font-size: .92rem;
}

/* ---------- small screens ---------- */
@media (max-width: 359px) {
    .brand span { display: none; }
}
@media (max-width: 480px) {
    .topbar { gap: 8px; }
    .top-actions { gap: 8px; }
    .lang button { padding: 6px 10px; }
    .top-actions .btn { padding: 8px 13px; }
    .dock-mic { width: 54px; height: 54px; }
    .dock-btn { width: 44px; height: 44px; }
    .dock-row { gap: 8px; }
    .ds-main { font-size: .92rem; }
    .stats { gap: 8px 22px; }
}
@media (max-width: 420px) {
    /* Room for the name and the speaker button: "Add" becomes a round "+". */
    #add-btn { width: 40px; min-height: 40px; padding: 0; font-size: 1.35rem; }
    #add-btn [data-t] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .spinner { animation-duration: .8s !important; }
}
