/* Reel Kitchen. Tokens first, light and dark. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBF3E4;
  --surface: #FFFBF2;
  --surface-2: #F4E7CF;
  --ink: #2B1D16;
  --ink-soft: #6B584B;
  --line: #2B1D16;
  --line-soft: #E3D3B6;
  --tomato: #E4472B;
  --tomato-press: #C93A21;
  --on-tomato: #FFF8EE;
  --herb: #3D7A4B;
  --herb-soft: #DCEBD3;
  --butter: #F7CE4B;
  --note: #FFE8A3;
  --shadow: 4px 4px 0 var(--line);
  --shadow-sm: 2px 2px 0 var(--line);
  --r: 22px;
  --r-sm: 14px;
  --gutter: 16px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1512; --surface: #2A221C; --surface-2: #362B23; --ink: #F6EBDD; --ink-soft: #B9A696;
    --line: #6A5545; --line-soft: #43362C; --tomato: #F0583C; --tomato-press: #DB4A2F; --on-tomato: #20110C;
    --herb: #8DC48F; --herb-soft: #26382A; --butter: #F2C744; --note: #4B3F1B;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1512; --surface: #2A221C; --surface-2: #362B23; --ink: #F6EBDD; --ink-soft: #B9A696;
  --line: #6A5545; --line-soft: #43362C; --tomato: #F0583C; --tomato-press: #DB4A2F; --on-tomato: #20110C;
  --herb: #8DC48F; --herb-soft: #26382A; --butter: #F2C744; --note: #4B3F1B;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5;
  min-height: 100dvh; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; -webkit-user-select: none; user-select: none; }
input, select, textarea { font-size: 16px; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 var(--gutter) 96px; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border: 2px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.btn.primary { background: var(--tomato); color: var(--on-tomato); }
.btn.primary:active { background: var(--tomato-press); }
.btn.herb { background: var(--herb); color: var(--bg); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.danger { color: var(--tomato); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.iconbtn {
  width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; text-decoration: none;
}
.iconbtn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.iconbtn.primary { background: var(--tomato); color: var(--on-tomato); }
.iconbtn.plain { border-color: transparent; background: transparent; box-shadow: none; }

/* inputs */
.field, .search input, .login input {
  width: 100%; min-height: 48px; padding: 10px 16px; border: 2px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); outline: none;
}
.field:focus, .search input:focus, .login input:focus { border-color: var(--tomato); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tomato) 25%, transparent); }
textarea.field { min-height: 88px; resize: vertical; line-height: 1.45; }
label.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 18px 0 6px; letter-spacing: .01em; }

/* header */
.top { display: flex; align-items: center; gap: 12px; padding: 18px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; }
.brand .mark { width: 42px; height: 42px; border-radius: 14px; background: var(--tomato); color: var(--on-tomato); display: grid; place-items: center; border: 2px solid var(--line); box-shadow: var(--shadow-sm); transform: rotate(-4deg); }
.brand b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.addpanel { border: 2px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 14px; margin: 4px 0 14px; display: grid; gap: 10px; }
.addpanel p { font-size: 14px; color: var(--ink-soft); }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.search { position: relative; margin: 6px 0 12px; }
.search .icon { position: absolute; left: 14px; top: 13px; color: var(--ink-soft); pointer-events: none; }
.search input { padding-left: 44px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); text-decoration: none; overflow: hidden; transition: transform .12s, box-shadow .12s; min-width: 0;
}
.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.card:nth-child(3n+1) { transform: rotate(-.5deg); }
.card:nth-child(3n+2) { transform: rotate(.4deg); }
.card:active { transform: translate(3px, 3px); }
.card .cover { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); border-bottom: 2px solid var(--line); overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .cover .noimg { width: 100%; height: 100%; display: grid; place-items: center; font-size: 56px; }
.badge { position: absolute; left: 10px; bottom: 10px; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: grid; place-items: center; font-size: 22px; }
.card .meta { padding: 10px 12px 12px; display: grid; gap: 6px; }
.card h3 { font-size: 15px; line-height: 1.25; font-weight: 800; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.pill.herb { background: var(--herb-soft); color: var(--herb); }
.pill .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.card.pending { border-style: dashed; box-shadow: none; background: var(--surface-2); }
.card.pending .cover { display: grid; place-items: center; border-bottom: 2px dashed var(--line); }
.bar { position: relative; height: 8px; width: 70%; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 -40%; width: 40%; border-radius: 99px; background: var(--tomato); animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { to { left: 100%; } }
.card.pending .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { border: 2px dashed var(--line); border-radius: var(--r); padding: 28px 20px; display: grid; gap: 8px; background: var(--surface-2); }
.empty h2 { font-size: 20px; font-weight: 800; }
.empty p { color: var(--ink-soft); }

/* login */
.login { max-width: 420px; margin: 0 auto; padding: 18vh var(--gutter) 40px; display: grid; gap: 14px; }
.login h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.login p { color: var(--ink-soft); }
.err { color: var(--tomato); font-weight: 700; font-size: 14px; min-height: 20px; }

/* recipe page */
.hero { position: relative; margin: 0 calc(var(--gutter) * -1); border-bottom: 2px solid var(--line); background: var(--surface-2); aspect-ratio: 16 / 11; overflow: hidden; max-height: 52vh; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .noimg { height: 100%; display: grid; place-items: center; font-size: 96px; }
.hero .back { position: absolute; left: var(--gutter); top: 14px; }
.hero .emoji { position: absolute; right: 14px; bottom: -2px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; background: var(--surface); border: 2px solid var(--line); transform: translateY(50%) rotate(6deg); box-shadow: var(--shadow-sm); z-index: 2; }
.titleblock { padding: 24px 0 8px; display: grid; gap: 10px; }
.titleblock h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 800; line-height: 1.1; letter-spacing: -.025em; overflow-wrap: anywhere; padding-right: 56px; }
.titleblock .sum { color: var(--ink-soft); font-size: 17px; }
.note { position: relative; background: var(--note); border: 2px solid var(--line); border-radius: 6px 6px 18px 6px; padding: 14px 16px; margin: 12px 0; transform: rotate(-.6deg); box-shadow: var(--shadow-sm); }
.note b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; opacity: .75; }
.note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.actionrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.cols { display: grid; gap: 8px; }
@media (min-width: 860px) { .cols { grid-template-columns: 360px 1fr; gap: 40px; align-items: start; } .cols .ing { position: sticky; top: 16px; } }
h2.sec { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }

.scaler { display: inline-flex; align-items: center; gap: 4px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; }
.scaler button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.scaler button:active { background: var(--butter); }
.scaler output { min-width: 96px; text-align: center; font-weight: 800; }
.ings { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; }
.ing-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 4px; border-bottom: 1.5px dashed var(--line-soft); cursor: pointer; }
.ing-row input { position: absolute; opacity: 0; pointer-events: none; }
.box { width: 28px; height: 28px; flex: none; border: 2px solid var(--line); border-radius: 9px; background: var(--surface); display: grid; place-items: center; transition: background .15s, transform .15s; }
.box .icon { width: 18px; height: 18px; stroke-width: 3.2; stroke: var(--on-tomato); stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .22s ease .05s; }
.ing-row input:checked + .box { background: var(--herb); transform: scale(1.06); }
.ing-row input:checked + .box .icon { stroke: var(--bg); stroke-dashoffset: 0; }
.ing-row input:focus-visible + .box { outline: 3px solid var(--tomato); outline-offset: 2px; }
.txt { background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0 2px; transition: background-size .28s ease, color .2s, opacity .2s; }
.ing-row input:checked ~ .txt { background-size: 100% 2px; color: var(--ink-soft); opacity: .75; }
.ing-row .q { font-weight: 800; }
.ing-row .n { color: var(--ink-soft); font-size: 14px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; counter-reset: s; }
.step { display: grid; grid-template-columns: 38px 1fr; gap: 12px; }
.step .num { width: 38px; height: 38px; border-radius: 50%; background: var(--butter); color: #2B1D16; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; }
.step p { font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; }
.step img { margin-top: 10px; border-radius: var(--r-sm); border: 2px solid var(--line); width: 100%; max-width: 420px; background: var(--surface-2); }
.step .body { display: grid; gap: 4px; justify-items: start; min-width: 0; }

.timer { display: inline-flex; align-items: stretch; margin-top: 8px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.timer button { border: 0; background: transparent; min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer button + button { border-left: 2px solid var(--line); padding: 0 12px; }
.timer.running { background: var(--herb); color: var(--bg); }
.timer.done { background: var(--tomato); color: var(--on-tomato); animation: wiggle .6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.timer.big button { min-height: 64px; font-size: 24px; padding: 0 28px; }

.source { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.cookedbox { border: 2px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 16px; display: grid; gap: 12px; margin-top: 12px; }
.namechips { display: flex; flex-wrap: wrap; gap: 8px; }
.stamp { justify-self: start; border: 3px double var(--herb); color: var(--herb); border-radius: 14px; padding: 10px 16px; font-weight: 800; transform: rotate(-3deg); animation: thump .45s cubic-bezier(.2, 1.4, .4, 1) both; background: var(--surface); }
.stamp small { display: block; font-weight: 600; opacity: .85; }
@keyframes thump { from { transform: rotate(-10deg) scale(1.7); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
.logline { color: var(--ink-soft); font-size: 14px; }
.confirm { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.confirm span { font-weight: 700; }
details.tr { margin-top: 20px; color: var(--ink-soft); font-size: 14px; }
details.tr p { white-space: pre-wrap; margin-top: 8px; overflow-wrap: anywhere; }

/* edit */
.edit-ing { display: grid; grid-template-columns: 72px 84px 1fr; gap: 8px; padding: 12px; border: 2px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface); margin-bottom: 10px; }
.edit-ing .note-in { grid-column: 1 / 3; }
.edit-ing .tools { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.edit-step { display: grid; gap: 8px; padding: 12px; border: 2px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface); margin-bottom: 10px; }
.edit-step .opts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.edit-step .opts .field { width: 110px; }
.mini { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line-soft); background: var(--surface-2); display: grid; place-items: center; }
.stickybar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 10px; z-index: 5; }
.stickybar .btn { flex: 1; }

/* cook mode */
.cook { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; grid-template-rows: auto 1fr auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); touch-action: pan-y; }
.cook header { padding: 12px var(--gutter) 6px; display: grid; gap: 10px; }
.cook .head { display: flex; align-items: center; gap: 12px; }
.cook .head .t { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook .head .c { font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 4px; }
.seg i { flex: 1; height: 6px; border-radius: 9px; background: var(--line-soft); }
.seg i.on { background: var(--tomato); }
.cook .screen { overflow-y: auto; padding: 12px var(--gutter); display: grid; align-content: center; justify-items: start; gap: 18px; max-width: 760px; width: 100%; margin: 0 auto; animation: in .25s ease-out; }
@keyframes in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.cook .screen.back { animation-name: inback; }
@keyframes inback { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.cook .big { font-size: clamp(28px, 7vw + 6px, 46px); font-weight: 800; line-height: 1.18; letter-spacing: -.02em; overflow-wrap: anywhere; }
.cook .kicker { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--tomato); }
.cook .shot { max-height: 30vh; width: auto; border-radius: var(--r); border: 2px solid var(--line); box-shadow: var(--shadow-sm); }
.cook footer { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; padding: 10px var(--gutter) 16px; }
.cook footer .btn { min-height: 64px; font-size: 18px; }
.cook .ings { width: 100%; }
.cook .ing-row { font-size: 20px; min-height: 58px; }

/* timer bar */
#timerbar { position: fixed; z-index: 40; left: 0; right: 0; top: env(safe-area-inset-top); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 8px; pointer-events: none; }
#timerbar:empty { display: none; }
#timerbar button { pointer-events: auto; border: 2px solid var(--line); border-radius: 999px; background: var(--herb); color: var(--bg); font-weight: 800; padding: 6px 14px; min-height: 40px; box-shadow: var(--shadow-sm); font-variant-numeric: tabular-nums; }
#timerbar button.done { background: var(--tomato); color: var(--on-tomato); }
body.cooking #timerbar { top: calc(env(safe-area-inset-top) + 64px); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 60; max-width: 90vw; }
.offline { background: var(--butter); color: #2B1D16; font-weight: 700; text-align: center; padding: 6px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:nth-child(n) { transform: none; }
}

.icon.big { width: 56px; height: 56px; color: var(--ink-soft); }

/* fixes after visual review 2026-11-17 */
.err:empty { display: none; }
@media (max-width: 420px) { .brand b { font-size: 19px; } }
.step img { aspect-ratio: 4 / 3; height: auto; object-fit: cover; object-position: center 40%; }
