/* Gappetite. Barvy podle Gabčina zadání: kávová, světle béžová, pudrově růžová.
   DOČASNÉ odstíny, než dorazí její 4 ukázky vzhledu; pak se ladí jen tady nahoře. Fialovou nepoužívat. */
:root {
  --bg: #F7F1EA;          /* světle béžová */
  --paper: #FFFCF8;
  --sand: #EDE2D6;
  --pink: #EBCFC9;        /* pudrově růžová (stejná jako v Gappce) */
  --pink-soft: #F5E4E0;
  --pink-deep: #B5726A;
  --coffee: #6B4A35;      /* kávová */
  --coffee-soft: #D9C4B2;
  --ink: #3B2A20;
  --muted: #7A6555;
  --line: #E6D9CC;
  --danger: #A4473C;
  --radius: 18px;
  --f-title: "Fraunces", Georgia, serif;
  --f-body: "Nunito", system-ui, -apple-system, sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--f-body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
#app { outline: none; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); max-width: 720px; margin: 0 auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; font-size: 17px; color: var(--ink); }
h1, h2 { font-family: var(--f-title); font-weight: 500; margin: 0; }
h2 { font-size: 22px; margin: 28px 0 10px; color: var(--coffee); }
[hidden] { display: none !important; }
.ico { width: 22px; height: 22px; flex: none; }
.ico.filled { fill: currentColor; }

/* ---------- hlavička ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: rgba(247, 241, 234, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-title { flex: 1; text-align: center; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-gap { width: 44px; flex: none; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--coffee); flex: none; text-decoration: none; }
.icon-btn:active { background: var(--sand); }

.page { padding: 16px; }

/* ---------- hlavní stránka ---------- */
.home { padding: calc(var(--safe-t) + 12px) 16px 0; }
.home-head { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 40px; font-weight: 500; color: var(--coffee); letter-spacing: -.01em; font-style: italic; }
.search {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 18px; padding: 0 16px; height: 52px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; color: var(--muted);
}
.search:focus-within { border-color: var(--pink-deep); }
.search input { flex: 1; border: 0; background: transparent; outline: none; height: 100%; min-width: 0; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear { width: 36px; height: 36px; margin-right: -8px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.search-clear .ico { width: 18px; height: 18px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  aspect-ratio: 1 / 1; border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; justify-content: flex-end; text-decoration: none; text-align: left;
  transition: transform .12s ease;
}
.tile:active { transform: scale(.97); }
.tone-0 { background: var(--pink); }
.tone-1 { background: var(--sand); }
.tone-2 { background: var(--coffee-soft); }
.tile-name { font-family: var(--f-title); font-size: 18px; line-height: 1.15; display: flex; align-items: center; gap: 4px; }
.tile-count { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tile-add { background: transparent; border: 1.5px dashed var(--coffee-soft); color: var(--coffee); justify-content: center; align-items: center; }
.tile-add .tile-name { font-family: var(--f-body); font-size: 15px; font-weight: 700; }
.tile-add .ico { width: 18px; height: 18px; }
.all-link { display: block; text-align: center; margin: 20px 0 8px; padding: 12px; color: var(--coffee); font-weight: 700; text-decoration: none; }

/* ---------- seznam receptů ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { display: flex; align-items: stretch; background: var(--paper); border-radius: var(--radius); box-shadow: 0 1px 0 var(--line); overflow: hidden; }
.card-link { flex: 1; display: flex; align-items: center; gap: 14px; padding: 10px; text-decoration: none; min-width: 0; position: relative; }
.thumb { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; flex: none; background: var(--sand); }
.ph { display: grid; place-items: center; background: linear-gradient(135deg, var(--pink) 0%, var(--coffee-soft) 100%); }
.ph span { font-family: var(--f-title); font-size: 30px; color: rgba(255, 255, 255, .92); font-style: italic; }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.card-title { font-family: var(--f-title); font-size: 19px; line-height: 1.2; }
.card-meta { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.card-fav { position: absolute; top: 10px; right: 12px; color: var(--pink-deep); }
.card-fav .ico { width: 16px; height: 16px; }
.card-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 74px; border-left: 1px solid var(--line); color: var(--coffee); font-size: 12.5px; font-weight: 700; }
.card-side:active { background: var(--sand); }

.seg { display: inline-flex; background: var(--sand); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg button { padding: 7px 16px; border-radius: 999px; font-size: 14.5px; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--coffee); box-shadow: 0 2px 8px -4px rgba(59, 42, 32, .35); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; margin: 0; }
.empty-sm { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.warn { background: var(--pink-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 15px; margin: 12px 0; }
.link { color: var(--pink-deep); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- recept ---------- */
.hero { position: relative; }
.hero-img { width: 100%; height: min(62vw, 420px); object-fit: cover; display: block; }
.hero-img.ph { display: grid; height: calc(var(--safe-t) + 170px); }
.hero-img.ph span { font-size: 96px; }
.hero-back { position: absolute; top: calc(var(--safe-t) + 10px); left: 12px; background: rgba(255, 252, 248, .9); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .3); }
.recipe-body {
  position: relative; margin-top: -26px; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 22px 20px 8px;
}
.recipe-title { font-size: 32px; line-height: 1.12; color: var(--ink); }
.sample { background: var(--sand); color: var(--muted); font-size: 14px; border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip { font-size: 13.5px; padding: 4px 12px; border-radius: 999px; background: var(--pink-soft); text-decoration: none; color: var(--coffee); font-weight: 700; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 4px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line);
  font-size: 13.5px; font-weight: 700; color: var(--coffee);
}
.act.on { background: var(--pink); border-color: var(--pink); }
.act[data-act="fav"].on { color: var(--pink-deep); }
.act:disabled { opacity: .4; }
.servings { color: var(--muted); margin: 12px 0 0; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: k; }
.steps li { counter-increment: k; position: relative; padding: 2px 0 14px 42px; }
.steps li::before {
  content: counter(k); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--coffee); color: var(--paper);
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.nutri-note { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.nutri dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.nutri dl div { background: var(--paper); border-radius: 12px; padding: 10px 6px; text-align: center; }
.nutri dt { font-size: 12px; color: var(--muted); }
.nutri dd { margin: 2px 0 0; font-weight: 800; font-size: 15px; }
.source { color: var(--muted); font-size: 14px; margin: 26px 0 0; border-top: 1px solid var(--line); padding-top: 14px; }
.source + .source { border: 0; margin-top: 4px; padding-top: 0; }
.source a { color: var(--coffee); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.source .ico { width: 15px; height: 15px; }
.admin { display: flex; gap: 10px; margin: 18px 0 0; }

/* ---------- nákup ---------- */
.add { display: flex; gap: 8px; margin-bottom: 16px; }
.add input { flex: 1; min-width: 0; height: 50px; padding: 0 16px; border-radius: 14px; border: 1.5px dashed var(--coffee-soft); background: var(--paper); outline: none; }
.add input:focus { border-style: solid; border-color: var(--pink-deep); }
.add .btn { width: 50px; padding: 0; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 4px; background: var(--paper); border-radius: 14px; padding: 4px 8px 4px 4px; }
.box { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.box .ico { width: 26px; height: 26px; padding: 4px; border: 2px solid var(--coffee); border-radius: 8px; stroke: transparent; stroke-width: 3; }
.box[aria-pressed="true"] .ico { background: var(--coffee); stroke: var(--paper); }
.item-text { flex: 1; text-align: left; padding: 8px 0; display: flex; flex-direction: column; min-width: 0; }
.item-text small { color: var(--muted); font-size: 12.5px; }
.item.done { background: transparent; }
.item.done .item-text span { text-decoration: line-through; color: var(--muted); }
.done-head { display: flex; align-items: baseline; justify-content: space-between; }
.done-head h2 { font-size: 18px; }

/* ---------- tlačítka a formulář ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  background: var(--coffee); color: var(--paper); font-weight: 800; text-decoration: none;
  position: relative;
}
.btn:active { opacity: .85; }
.btn.ghost { background: transparent; color: var(--coffee); border: 1.5px solid var(--coffee-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: currentColor; }
.btn.wide { display: flex; width: 100%; }
.btn .ico { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.btn-row .btn { flex: 1; }

.settings h2 { font-size: 19px; }
.row-link { display: flex; justify-content: space-between; padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 700; margin-top: 12px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-left: 4px; }
.version { color: var(--muted); font-size: 13px; text-align: center; margin-top: 32px; }

.recipe-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 800; color: var(--coffee); padding: 0; margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--muted); }
.field input[type="text"], .field input[type="url"], .field textarea, .paste textarea, .nutri-grid input, .field-inline input, .sheet-input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); outline: none;
}
.field input:focus, .field textarea:focus, .paste textarea:focus, .sheet-input:focus { border-color: var(--pink-deep); }
textarea { resize: vertical; line-height: 1.45; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 700; font-size: 15px; }
.chip-check input:checked + span { background: var(--pink); border-color: var(--pink); color: var(--coffee); }
.chip-check input:focus-visible + span { outline: 2px solid var(--pink-deep); outline-offset: 2px; }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.photo-prev { width: 84px; height: 84px; border-radius: 14px; background: var(--sand); display: grid; place-items: center; color: var(--muted); overflow: hidden; flex: none; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick { position: relative; cursor: pointer; }
/* Schované políčko pro soubor: ne display:none, to by iPhone při ťuknutí na popisek nemusel otevřít. */
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.btn:has(.vh:focus-visible), .photo-pick:has(.vh:focus-visible) .btn { outline: 2px solid var(--pink-deep); outline-offset: 2px; }
.inline-check { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-top: -8px; }
.nutri-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.nutri-grid label, .field-inline { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.field-inline { margin-top: 8px; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.paste { background: var(--pink-soft); border-radius: 14px; padding: 4px 14px; }
.paste summary { font-weight: 800; color: var(--coffee); padding: 10px 0; cursor: pointer; }
.paste[open] { padding-bottom: 14px; }
.paste .btn { margin-top: 10px; }

/* ---------- spodní lišta ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(var(--safe-b) + 6px);
  background: rgba(255, 252, 248, .96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbtn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.tabbtn[aria-current="page"] { color: var(--coffee); }
.tabbtn[aria-current="page"] .ico { stroke-width: 2.2; }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pink-deep); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- okno zespodu a hláška ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(59, 42, 32, .35); animation: fade .15s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 720px; margin: 0 auto;
  background: var(--paper); border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(var(--safe-b) + 18px);
  animation: up .2s ease;
}
.sheet h2 { margin: 0 0 12px; font-size: 22px; }
.sheet p { margin: 0 0 8px; color: var(--muted); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#toast-root { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: 30; display: flex; justify-content: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 14px; font-size: 15px; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .5); animation: up .2s ease; }
.toast .link { color: var(--pink); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
