/* Cupboard. Phone first: big buttons, high contrast, dark mode, small phones. Its own color: tomato. */
:root {
  --bg: #fbf7f2; --card: #ffffff; --ink: #1f1a16; --sub: #6b6158; --line: #e8dfd5; --soft: #f3ece4;
  --accent: #c9442a; --accent-ink: #ffffff; --accent-soft: #fbe5de;
  --ok: #2e7d32; --ok-soft: #e3f2e4; --warn: #a15c00; --warn-soft: #fff1d6; --bad: #c62828; --bad-soft: #fde4e4; --info: #33507a; --info-soft: #e5ecf7;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 10px rgba(0,0,0,.05);
  --tabh: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15110e; --card: #221c17; --ink: #f5ede6; --sub: #b4a89c; --line: #3a3029; --soft: #2b231d;
    --accent: #ff7a5c; --accent-ink: #1a0d08; --accent-soft: #4a2219;
    --ok: #7bd389; --ok-soft: #1d3320; --warn: #f2b45a; --warn-soft: #3a2a10; --bad: #ff8a80; --bad-soft: #3d1a1a; --info: #9cb8e6; --info-soft: #1d2a40;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15110e; --card: #221c17; --ink: #f5ede6; --sub: #b4a89c; --line: #3a3029; --soft: #2b231d;
  --accent: #ff7a5c; --accent-ink: #1a0d08; --accent-soft: #4a2219;
  --ok: #7bd389; --ok-soft: #1d3320; --warn: #f2b45a; --warn-soft: #3a2a10; --bad: #ff8a80; --bad-soft: #3d1a1a; --info: #9cb8e6; --info-soft: #1d2a40;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; flex: 1; min-width: 0; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { min-width: 44px; min-height: 44px; border: 0; background: transparent; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; color: var(--ink); }
.iconbtn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip-house { font-size: 14px; background: var(--soft); border-radius: 999px; padding: 6px 12px; min-height: 36px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; }
.sync { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync.off { background: var(--sub); } .sync.wait { background: var(--warn); }
main { padding: 12px 12px calc(var(--tabh) + 24px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
#tabs button { flex: 1; min-height: var(--tabh); border: 0; background: transparent; color: var(--sub); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; }
#tabs button svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tabs button.on { color: var(--accent); }
#tabs .badge { position: absolute; transform: translate(14px, -14px); background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; line-height: 18px; }
#tabs button { position: relative; }
h1 { font-size: 24px; margin: 6px 2px 12px; line-height: 1.2; }
h2 { font-size: 19px; margin: 18px 2px 8px; }
h3 { font-size: 16px; margin: 12px 0 6px; color: var(--sub); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 14px; margin-bottom: 12px; }
.sub { color: var(--sub); }
.small { font-size: 14px; }
.fine { font-size: 13px; color: var(--sub); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.big { width: 100%; min-height: 58px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 16px; }
.big small { display: block; font-weight: 500; font-size: 13px; opacity: .85; }
.big.sec { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.big svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 8px 14px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.acc { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.bad { color: var(--bad); }
.btn.full { width: 100%; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.btns.three { grid-template-columns: 1fr 1fr 1fr; }
.btns .btn { width: 100%; }
.link { border: 0; background: none; color: var(--accent); font-weight: 650; padding: 8px 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.c { flex: none; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 6px 14px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.c[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; font-size: 15px; color: var(--sub); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.field { width: 100%; min-height: 50px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); padding: 10px 12px; font-size: 17px; }
.field:focus { outline: none; border-color: var(--accent); }
textarea.field { min-height: 140px; line-height: 1.45; resize: vertical; }
.lbl { display: block; font-weight: 650; font-size: 15px; margin: 12px 2px 6px; }
.search { position: relative; margin-bottom: 10px; }
.search input { padding-left: 42px; }
.search svg { position: absolute; left: 12px; top: 13px; width: 22px; height: 22px; stroke: var(--sub); fill: none; stroke-width: 2; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 60px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-top: 0; }
.li:last-child { border-bottom: 0; }
.li .t { font-weight: 650; }
.li .s { font-size: 14px; color: var(--sub); }
.li .main { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 4px 0; min-height: 44px; }
.li .main .t, .li .main .s { display: block; overflow: hidden; text-overflow: ellipsis; }
.qtybox { display: flex; align-items: center; gap: 4px; }
.qtybox button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); font-size: 22px; font-weight: 700; line-height: 1; }
.qtybox .q { min-width: 56px; text-align: center; font-weight: 700; font-size: 15px; }
.tag { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: var(--info-soft); color: var(--info); } .tag.mute { background: var(--soft); color: var(--sub); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.dot.have { background: var(--ok); } .dot.sub { background: var(--warn); } .dot.missing, .dot.short { background: var(--bad); } .dot.skip { background: var(--line); }
.rcard { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 10px; width: 100%; text-align: left; box-shadow: var(--shadow); }
.rcard .pic { width: 84px; height: 64px; border-radius: 10px; background: var(--soft) center/cover no-repeat; flex: none; display: flex; align-items: center; justify-content: center; color: var(--sub); }
.rcard .pic svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.rcard .t { font-weight: 700; font-size: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard .s { display: block; font-size: 14px; color: var(--sub); margin-top: 2px; }
.empty { text-align: center; padding: 26px 16px; color: var(--sub); }
.empty > svg { width: 54px; height: 54px; stroke: var(--sub); fill: none; stroke-width: 1.6; margin-bottom: 6px; }
.banner { display: flex; gap: 10px; align-items: center; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 15px; }
.banner.info { background: var(--info-soft); color: var(--info); } .banner.warn { background: var(--warn-soft); color: var(--warn); } .banner.ok { background: var(--ok-soft); color: var(--ok); } .banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner .btn { white-space: nowrap; min-height: 40px; padding: 6px 12px; flex: none; }
.banner .x { margin-left: auto; border: 0; background: transparent; min-width: 40px; min-height: 40px; font-size: 20px; color: inherit; }
.bar { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.ok i { background: var(--ok); }
/* sheets */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--bg); border-radius: 20px 20px 0 0; max-height: 94vh; overflow-y: auto; overscroll-behavior: contain; padding: 0 14px calc(20px + var(--safe-b)); max-width: 760px; margin: 0 auto; box-shadow: 0 -4px 30px rgba(0,0,0,.2); }
#sheet.full { top: 0; max-height: none; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); }
.shead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; background: var(--bg); padding: 10px 0 8px; margin-bottom: 4px; }
.shead h2 { margin: 0; flex: 1; font-size: 19px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { min-height: 44px; border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 0 8px 0 0; display: inline-flex; align-items: center; gap: 2px; }
#toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabh) + 14px + var(--safe-b)); z-index: 60; max-width: 560px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#toast.top { top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; }
#toast span { flex: 1; font-size: 15px; }
#toast button { min-height: 44px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 0 16px; }
/* recipe */
.hero { width: 100%; aspect-ratio: 16/9; border-radius: var(--r); background: var(--soft) center/cover no-repeat; margin-bottom: 10px; position: relative; display: block; border: 0; }
.hero .play { position: absolute; inset: 0; margin: auto; width: 68px; height: 48px; border-radius: 14px; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; }
.hero .play::after { content: ""; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 4px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 24px; font-weight: 700; }
.stepper b { min-width: 40px; text-align: center; font-size: 20px; }
.ing { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ing:last-child { border-bottom: 0; }
.ing .dot { margin-top: 6px; }
.ing .amt { font-weight: 700; }
.ing .why { font-size: 13.5px; }
.ing.head { font-weight: 800; color: var(--sub); text-transform: uppercase; font-size: 13px; letter-spacing: .05em; padding-top: 14px; }
.step { display: flex; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.step .n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step .x { flex: 1; min-width: 0; }
.tbtn { margin: 6px 6px 0 0; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); padding: 4px 12px; font-weight: 700; font-size: 14px; }
.cook { display: flex; flex-direction: column; min-height: calc(100vh - 70px); }
.cook .stepbig { font-size: 26px; line-height: 1.35; font-weight: 600; padding: 12px 4px; flex: 1; }
.cook .nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; position: sticky; bottom: 0; padding: 10px 0 calc(6px + var(--safe-b)); background: var(--bg); }
.timers { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.timer { background: var(--ink); color: var(--bg); border-radius: 12px; padding: 8px 12px; font-weight: 800; font-variant-numeric: tabular-nums; border: 0; min-height: 44px; }
.timer.ring { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
/* plan */
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent) inset; }
.day .dh { display: flex; align-items: center; padding: 8px 12px; background: var(--soft); font-weight: 750; }
.slot { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 6px 12px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.slot .m { width: 78px; flex: none; font-size: 13px; font-weight: 700; color: var(--sub); text-transform: uppercase; }
.slot .v { flex: 1; min-width: 0; font-weight: 650; }
.slot .v.add { color: var(--sub); font-weight: 500; }
/* list */
.gl { display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 58px; border-bottom: 1px solid var(--line); }
.gl:last-child { border-bottom: 0; }
.check { width: 32px; height: 32px; border-radius: 9px; border: 2px solid var(--sub); background: transparent; flex: none; display: flex; align-items: center; justify-content: center; }
.check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.check[aria-checked="true"]::after { content: ""; width: 9px; height: 16px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -2px); }
.gl.done .t { text-decoration: line-through; color: var(--sub); }
/* scanner */
.scan { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: var(--r); overflow: hidden; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan .aim { position: absolute; left: 10%; right: 10%; top: 35%; bottom: 35%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan .aim::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: var(--accent); }
/* intro */
.intro { min-height: calc(100vh - 40px); display: flex; flex-direction: column; padding: 12px 6px; }
.intro .pic { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 220px; }
.intro .pic svg { width: min(260px, 70vw); height: auto; }
.intro h1 { font-size: 28px; text-align: center; }
.intro p { text-align: center; color: var(--sub); font-size: 18px; margin: 0 8px 18px; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0 16px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); width: 24px; border-radius: 9px; }
.spin { width: 22px; height: 22px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }
.gbtn { width: 100%; min-height: 54px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: #1f1f1f; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.gbtn svg { width: 22px; height: 22px; }
.orline { text-align: center; color: var(--sub); font-size: 14px; margin: 12px 0 0; }
.msg { min-height: 1.2em; font-size: 15px; margin: 8px 2px; } .msg.err { color: var(--bad); }
.gcode { font-size: 40px; font-weight: 800; letter-spacing: .1em; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; color: #000; background: #fff; font: 12pt/1.4 Georgia, serif; padding: 0 12mm; }
  #print h1 { font-size: 20pt; } #print li { margin: 2px 0; }
}
@media (max-width: 360px) { body { font-size: 16px; } .big { font-size: 17px; } h1 { font-size: 21px; } .slot .m { width: 64px; } .qtybox button { width: 40px; height: 40px; } }
@media (min-width: 700px) { .btns.four { grid-template-columns: repeat(4, 1fr); } }
