/* Plonk web — mirrors the iPhone app's design tokens (Color+Plonk.swift, Typography.swift) */
:root {
  --wine: #C0392B;  --wine-fill: #C0392B;
  --bg: #F8F5F0;    --card: #FFFFFF;  --card-alt: #F2EDE8;
  --text: #1A1410;  --text2: #6B6560; --muted: #7A726B;
  --green: #1E8449; --green-fill: #1E8449;
  --gold: #B9770E;  --gold-fill: #9A630B;
  --blue: #2980B9;  --blue-fill: #2471A3;
  --navy: #0D1B2A;
  --sep: rgba(60, 50, 40, .14);
  --bar: rgba(248, 245, 240, .82);
  --shadow: 0 2px 6px rgba(0, 0, 0, .06);
  --grouped: #F2EDE8;
  --font: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --rounded: "Nunito", ui-rounded, "Inter", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wine: #E0584B;
    --bg: #14110F;    --card: #221C18;  --card-alt: #2C2520;
    --text: #F3EEE9;  --text2: #BDB4AC; --muted: #9C938B;
    --green: #4CC27E; --gold: #E3A740;  --blue: #5DADE2;
    --sep: rgba(243, 238, 233, .12);
    --bar: rgba(20, 17, 15, .82);
    --shadow: none;
    --grouped: #0E0C0A;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 17px; line-height: 1.35; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Splash (navy, like the app's launch screen) ── */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  transition: opacity .35s ease;
}
.splash.gone { opacity: 0; pointer-events: none; }
.splash-logo { width: 180px; filter: brightness(0) invert(1); animation: pop .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash-glass { width: 120px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
.splash-fill { display: block; height: 100%; width: 40%; border-radius: 2px; background: var(--wine-fill); animation: pour 1.1s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pour { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ── Navigation bar (iOS: inline title appears once the large title scrolls away) ── */
.navbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(48px + var(--safe-t)); padding: var(--safe-t) 6px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--bg); transition: background .2s, box-shadow .2s;
}
.navbar.scrolled {
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--sep);
}
.nav-left { justify-self: start; min-width: 0; }
.nav-right { justify-self: end; display: flex; }
.nav-title { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.navbar.scrolled .nav-title, .navbar.inline .nav-title { opacity: 1; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--wine); border-radius: 22px; }
.iconbtn svg { width: 23px; height: 23px; }
.iconbtn:active { opacity: .5; }
.backbtn { display: flex; align-items: center; gap: 0; height: 44px; padding-right: 10px; color: var(--wine); font-size: 17px; max-width: 40vw; }
.backbtn svg { width: 28px; height: 28px; flex: none; }
.backbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backbtn:active { opacity: .5; }

.largetitle { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin: 0; padding: 0 16px 6px; line-height: 1.1; }

/* ── Page ── */
main { min-height: calc(100vh - 48px); padding-bottom: calc(84px + var(--safe-b)); outline: none; }
.page { padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 20px; }
.page.push { animation: push .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes push { from { transform: translateX(28%); opacity: .4; } to { transform: none; opacity: 1; } }
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.h2 { font-size: 17px; font-weight: 700; margin: 0; }
.seeall { color: var(--wine); font-size: 15px; font-weight: 500; padding: 4px 0 4px 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.caption { font-size: 12px; font-weight: 500; color: var(--text2); }
.caption2 { font-size: 11px; color: var(--muted); }
.small { font-size: 15px; color: var(--text2); }
.muted { color: var(--muted); }
.cardbox { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); }
.note { padding: 12px; border-radius: 10px; font-size: 15px; color: var(--text2); background: color-mix(in srgb, var(--gold) 10%, transparent); display: flex; gap: 10px; }
.note.plain { background: var(--card-alt); }
.empty-row { padding: 14px; font-size: 15px; color: var(--text2); }

/* ── Supermarket logo tile ── */
.logo { width: 22px; height: 22px; border-radius: 5px; flex: none; object-fit: cover; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.08); background: #fff; }
.logo.sm { width: 18px; height: 18px; border-radius: 4px; }
.logo.lg { width: 30px; height: 30px; border-radius: 7px; }
.logo.txt { display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; width: auto; min-width: 22px; padding: 0 5px; }

/* ── Wine card (WineCard.swift) ── */
.wcard { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0 12px 12px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); position: relative; }
.wcard > a { display: flex; gap: 12px; flex: 1; min-width: 0; }
.wcard > a:active { opacity: .6; }
.wbody { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.wname { font-size: 17px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wmeta { font-size: 12px; font-weight: 500; color: var(--text2); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.wmeta span { overflow: hidden; text-overflow: ellipsis; }
.wprice { display: flex; align-items: center; gap: 6px; }
.price { font-family: var(--rounded); font-weight: 800; font-size: 20px; letter-spacing: 0; }
.price.deal { color: var(--green); }
.price.big { font-size: 28px; }
s.was { font-size: 12px; font-weight: 500; color: var(--muted); }
.wcap { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heart { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--wine); margin-top: -6px; }
.heart svg { width: 22px; height: 22px; }
.heart .on { display: none; } .heart.is-on .on { display: block; } .heart.is-on .off { display: none; }
.heart:active { transform: scale(.88); }

.bottle { width: 56px; height: 70px; border-radius: 8px; background: var(--bg); flex: none; display: grid; place-items: center; overflow: hidden; position: relative; }
.bottle img { width: 100%; height: 100%; object-fit: contain; padding: 4px; background: #fff; }
.bottle .glyph { color: color-mix(in srgb, var(--wine) 60%, transparent); }
.bottle .glyph svg { width: 28px; height: 28px; }
.bottle.lg { width: 80px; height: 100px; border-radius: 12px; }
.bottle.lg .glyph svg { width: 40px; height: 40px; }
.tglyph { width: 12px; height: 12px; flex: none; }

/* ── Deal banner (DealBanner.swift) ── */
.banner { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--green) 8%, var(--bg)); border: 1.5px solid color-mix(in srgb, var(--green) 30%, transparent); }
.banner.check { background: color-mix(in srgb, var(--gold) 8%, var(--bg)); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
a.banner:active { opacity: .7; }
.banner-top { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.dot.sm { width: 8px; height: 8px; }
.banner.check .dot { background: var(--gold); }
.banner-title { font-size: 15px; font-weight: 700; color: var(--green); flex: 1; }
.banner.check .banner-title { color: var(--gold); }
.chev { width: 14px; height: 14px; color: var(--muted); flex: none; }
.banner-desc { font-size: 15px; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.banner-scope { font-size: 12px; font-weight: 600; color: var(--gold); display: flex; align-items: center; gap: 5px; }
.banner-scope.most { color: var(--text2); }
.banner-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 500; color: var(--text2); }
.banner-foot .end { color: var(--muted); }
.ico { width: 14px; height: 14px; flex: none; }
.also { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--green) 6%, transparent); font-size: 15px; color: var(--text2); }
.also > span:not(.dot) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.also:active { opacity: .6; }

/* ── Chips ── */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px;
  font-size: 12px; font-weight: 600; background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 25%, transparent); white-space: nowrap; }
.chip.sel { background: var(--wine-fill); color: #fff; box-shadow: none; }

/* ── Search ── */
.searchfield { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 10px; background: color-mix(in srgb, var(--muted) 14%, transparent); }
.searchfield svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.searchfield input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 17px; height: 100%; }
.searchfield input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchfield .clear { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select { appearance: none; -webkit-appearance: none; height: 36px; padding: 0 30px 0 12px; border-radius: 18px; border: 0; font-size: 13px; font-weight: 600;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A726B' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 25%, transparent); color: var(--text); }
.toggle-chip[aria-pressed="true"] { background: var(--green-fill); color: #fff; box-shadow: none; }
.count { font-size: 13px; color: var(--muted); }
.morebtn { height: 44px; border-radius: 12px; background: var(--card); color: var(--wine); font-weight: 600; font-size: 15px; box-shadow: var(--shadow); }

/* ── Wine detail ── */
.dhead { display: flex; gap: 16px; align-items: flex-start; }
.dhead .bottle { cursor: zoom-in; }
.dname { font-size: 20px; font-weight: 700; line-height: 1.2; margin: 0 0 6px; }
.dline { font-size: 15px; color: var(--text2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dprice { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.verdict { font-size: 12px; font-weight: 800; letter-spacing: .02em; padding: 3px 8px; border-radius: 6px; color: #fff; background: var(--green-fill); }
.verdict.good { background: var(--blue-fill); }
.desc { padding: 12px; border-radius: 10px; background: var(--card-alt); color: var(--text2); font-size: 17px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0; border-radius: 10px; font-size: 11px; color: var(--text2); }
.action svg { width: 22px; height: 22px; }
.action.red { background: color-mix(in srgb, var(--wine) 10%, transparent); } .action.red svg { color: var(--wine); }
.action.blue { background: color-mix(in srgb, var(--blue) 10%, transparent); } .action.blue svg { color: var(--blue); }
.action.green { background: color-mix(in srgb, var(--green) 10%, transparent); } .action.green svg { color: var(--green); }
.action:active { opacity: .6; }
.label-sm { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.prows { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.prow { display: flex; align-items: center; gap: 12px; padding: 12px; position: relative; }
.prow + .prow::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; border-top: .5px solid var(--sep); }
.prow.best { background: color-mix(in srgb, var(--green) 5%, transparent); }
a.prow:active { background: var(--card-alt); }
.prow-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prow-shop { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.prow-note { font-size: 12px; font-weight: 500; color: var(--green); }
.prow-note.warn { color: var(--gold); }
.prow-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.prow-right .price { font-size: 20px; }
.prow-ext { width: 14px; height: 14px; color: var(--muted); flex: none; }
.bestpill { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; color: #fff; background: var(--green-fill); letter-spacing: .03em; }
.meters { display: grid; gap: 8px; padding: 14px; }
.meter { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); }
.meter-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.meter-bar i { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.meter-bar i.on { background: var(--wine); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; padding: 5px 10px; border-radius: 14px; background: var(--card-alt); color: var(--text2); }
.spark { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.spark svg { width: 100%; height: 90px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 4px; background: var(--muted); }
.legend i.w { background: var(--wine); }
.linkrow { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; background: var(--card-alt); font-size: 15px; color: var(--text2); }
.linkrow span { flex: 1; }
.linkrow svg { width: 16px; height: 16px; flex: none; }

/* ── Grouped list (iOS Form / inset grouped) ── */
.group-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin: 0 0 6px 16px; }
.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.group-foot { font-size: 13px; color: var(--muted); margin: 6px 16px 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; position: relative; font-size: 17px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.row .grow { flex: 1; min-width: 0; }
.row .sub { font-size: 13px; color: var(--muted); }
a.row:active, button.row:active { background: var(--card-alt); }
button.row { width: 100%; text-align: left; }
.row .val { color: var(--muted); font-size: 15px; }
.row .chev { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.row.danger { color: var(--wine); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: color-mix(in srgb, var(--muted) 30%, transparent); position: relative; flex: none; transition: background .2s; cursor: pointer; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: #34C759; }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .4; }
.heartsel { width: 44px; height: 44px; display: grid; place-items: center; color: var(--wine); margin-right: -10px; }
.heartsel svg { width: 22px; height: 22px; }
.heartsel:disabled { opacity: .3; }
.seg { display: flex; padding: 2px; border-radius: 9px; background: color-mix(in srgb, var(--muted) 16%, transparent); margin: 8px 16px 10px; }
.seg button { flex: 1; height: 32px; border-radius: 7px; font-size: 13px; font-weight: 500; }
.seg button.sel { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* ── Sheet (iOS page sheet) ── */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); animation: fade .25s ease both; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--safe-t) + 12px); background: var(--grouped); border-radius: 12px 12px 0 0;
  display: flex; flex-direction: column; animation: up .32s cubic-bezier(.2, .9, .25, 1) both; max-width: 640px; margin: 0 auto; }
.sheet.closing .sheet-panel { animation: down .22s ease-in both; }
.sheet.closing .sheet-backdrop { animation: fade .22s ease-in reverse both; }
.sheet-grab { width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 40%, transparent); margin: 6px auto 0; }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 48px; padding: 0 16px; }
.sheet-bar h2 { font-size: 17px; font-weight: 600; margin: 0; }
.sheet-bar .textbtn { justify-self: end; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 22px; -webkit-overflow-scrolling: touch; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.textbtn { color: var(--wine); font-size: 17px; height: 44px; }
.textbtn.strong { font-weight: 600; }

/* ── Buttons ── */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border-radius: 12px; background: var(--wine-fill); color: #fff; font-weight: 600; font-size: 17px; width: 100%; }
.btn.ghost { background: var(--card-alt); color: var(--text); }
.btn:active { opacity: .75; }
.btn svg { width: 20px; height: 20px; }

/* ── Scan ── */
.scanbox { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 62vh; width: 100%; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanframe { position: absolute; left: 12%; right: 12%; top: 36%; height: 26%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scanhint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-size: 15px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scanidle { aspect-ratio: auto; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; color: rgba(255,255,255,.85); text-align: center; background: var(--navy); }
.scanidle svg { width: 64px; height: 64px; }
.inputrow { display: flex; gap: 8px; }
.inputrow input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 0; padding: 0 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--sep); font-size: 17px; }
.inputrow .btn { width: auto; padding: 0 18px; height: 44px; }
textarea.field { width: 100%; min-height: 150px; border: 0; border-radius: 12px; padding: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--sep); font-size: 17px; resize: vertical; }

/* ── Rack ── */
.rrow { display: flex; align-items: center; gap: 12px; padding: 12px; }
.rrow + .rrow { border-top: .5px solid var(--sep); }
.rrow a { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.stepper { display: flex; align-items: center; border-radius: 9px; background: color-mix(in srgb, var(--muted) 14%, transparent); flex: none; }
.stepper button { width: 38px; height: 34px; font-size: 20px; font-weight: 500; color: var(--text); }
.stepper b { min-width: 22px; text-align: center; font-family: var(--rounded); font-size: 17px; }
.low { font-size: 12px; font-weight: 600; color: var(--gold); }

/* ── Empty states ── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty svg { width: 52px; height: 52px; color: var(--muted); opacity: .6; }
.empty h2 { margin: 6px 0 0; font-size: 20px; }
.empty p { margin: 0; color: var(--text2); font-size: 15px; max-width: 320px; }
.empty .btn { width: auto; padding: 0 22px; height: 44px; margin-top: 6px; }

/* ── Help ── */
.help h3 { font-size: 17px; margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.help h3 svg { width: 20px; height: 20px; color: var(--wine); }
.help p { margin: 0; color: var(--text2); font-size: 15px; }
.help .cardbox { padding: 14px; }

/* ── Tab bar (iOS) ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 0 calc(4px + var(--safe-b)); background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; min-height: 50px; color: color-mix(in srgb, var(--muted) 90%, transparent); font-size: 10px; font-weight: 500; letter-spacing: .01em; }
.tabbar svg { width: 26px; height: 26px; }
.tabbar a.active { color: var(--wine); }

/* ── Image viewer, toast, gate ── */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; place-items: center; animation: fade .2s both; }
.viewer img { max-width: 92vw; max-height: 86vh; object-fit: contain; background: #fff; border-radius: 8px; }
.viewer button { position: absolute; top: calc(var(--safe-t) + 10px); right: 12px; width: 36px; height: 36px; border-radius: 18px; background: rgba(255,255,255,.2); color: #fff; font-size: 20px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 70; max-width: 88vw;
  background: rgba(30, 24, 20, .92); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.gate { position: fixed; inset: 0; z-index: 90; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; }
.gate-box img { width: 150px; filter: brightness(0) invert(1); margin-bottom: 12px; }
.gate-box h2 { margin: 0; font-size: 24px; }
.gate-box p { margin: 0; color: rgba(255,255,255,.7); font-size: 15px; }
.gate-box .btn.ghost { background: rgba(255,255,255,.12); color: #fff; }
.gate-box .fine { font-size: 13px; margin-top: 8px; }
.gate-box a { text-decoration: underline; }
.footer { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 8px 0; }
.footer a { text-decoration: underline; }

@media (min-width: 700px) {
  main, .navbar { max-width: 640px; margin: 0 auto; }
  .tabbar { padding-left: calc(50vw - 320px); padding-right: calc(50vw - 320px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
