/* Layout: eine ruhige Spalte, Speisekarte oben, Kasse als zweite Ansicht.
   Farben: Dunkles Holz mit Gold, Rot nur fuer die Bestell-Buttons. Tokens zuerst, alles andere nutzt sie. */
:root {
  color-scheme: dark;
  --bg: #14110F;
  --surface: #1E1915;
  --surface2: #2A231C;
  --line: #3A3128;
  --fg: #F2EADB;
  --muted: #B3A68F;
  --accent: #D4AF5A;
  --accent-bg: #D4AF5A;
  --on-accent: #14110F;
  --red: #C0392B;
  --on-red: #FFFFFF;
  --ok: #9CCB9F;
  --danger: #F08A7E;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45);
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #FBF7F0;
    --surface: #FFFFFF;
    --surface2: #F3ECE0;
    --line: #E2D8C6;
    --fg: #2A221A;
    --muted: #6B5E4C;
    --accent: #8A6A1F;
    --on-accent: #14110F;
    --red: #B3392B;
    --ok: #2F6B3A;
    --danger: #B3261E;
    --shadow: 0 10px 28px rgba(60, 40, 10, .14);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FBF7F0;
  --surface: #FFFFFF;
  --surface2: #F3ECE0;
  --line: #E2D8C6;
  --fg: #2A221A;
  --muted: #6B5E4C;
  --accent: #8A6A1F;
  --on-accent: #14110F;
  --red: #B3392B;
  --ok: #2F6B3A;
  --danger: #B3261E;
  --shadow: 0 10px 28px rgba(60, 40, 10, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 40;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding-block: 20px 120px; }

/* Kopf */
.topbar { display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.hero { padding: 24px 0 20px; display: flex; flex-direction: column; gap: 10px; }
.hero h1 { font-family: "Oswald", var(--font-display); font-weight: 600; font-size: clamp(34px, 9vw, 48px); line-height: 1.05; letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; }
.hero p { color: var(--muted); max-width: 46ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--surface); }
.chip.accent { border-color: var(--accent); color: var(--accent); background: transparent; font-weight: 600; }
.demo-note { margin-top: 8px; padding: 10px 14px; border: 1px dashed var(--accent); border-radius: 12px; font-size: 13px; color: var(--muted); }
button.chip { cursor: pointer; min-height: 32px; }

/* Kategorien */
.tabs {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 0;
  background: var(--bg); border-bottom: 1px solid var(--line);
  scrollbar-width: none; scroll-padding: 0 40px;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs::after { content: ""; flex: none; width: 28px; }
/* Grosse Bildschirme: alle Kategorien sichtbar, in mehreren Zeilen */
@media (min-width: 900px) {
  .tabs { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .tabs::after { display: none; }
}
.tab {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 15px;
}
.tab[aria-selected="true"] { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--on-accent); font-weight: 700; }

/* Produkte */
.cat-title { font-family: var(--font-display); font-weight: 600; font-size: 30px; margin: 28px 0 12px; }
.items { display: flex; flex-direction: column; gap: 12px; }
.card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.card h3 { font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.15; }
.card .info { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.card .thumb { width: 88px; height: 88px; flex: none; object-fit: cover; border-radius: 12px; background: var(--surface2); }
.card .desc { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card .allergen { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.card .allergen.unknown { color: var(--accent); }
.card .side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.price { font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.add {
  min-height: 44px; min-width: 44px; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--red); color: var(--on-red); font-weight: 700; font-size: 15px;
  transition: transform .15s ease;
}
.add:active { transform: scale(.94); }
.add.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Warenkorb-Leiste */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--bg); border-top: 1px solid var(--line);
}
.cartbtn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: 640px; margin: 0 auto; min-height: 56px; padding: 0 20px;
  border: 0; border-radius: 14px; background: var(--accent-bg); color: var(--on-accent);
  font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums;
}
.cartbtn.bump { animation: pop .35s ease; }
.fly { position: fixed; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-bg); z-index: 60; pointer-events: none; }

/* Dialoge */
dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px);
  margin: auto auto 12px; padding: 0; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow); overflow: hidden;
}
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px 18px 8px; }
.dlg-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.1; }
.dlg-body { padding: 4px 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.dlg-foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.close { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 20px; line-height: 1; flex: none; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
legend { padding: 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--surface2); }
.opt input { width: 20px; height: 20px; accent-color: var(--accent-bg); flex: none; }
.opt span.l { flex: 1; min-width: 0; }
.opt span.p { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.btn { min-height: 52px; padding: 0 22px; border: 0; border-radius: 14px; font-weight: 700; font-size: 16px; }
.btn.red { background: var(--red); color: var(--on-red); }
.btn.gold { background: var(--accent-bg); color: var(--on-accent); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.grow { flex: 1; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; }
.qty button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; line-height: 1; }
.qty b { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .nm { font-weight: 700; }
.line .sub { font-size: 13px; color: var(--muted); }
.totals { display: flex; flex-direction: column; gap: 6px; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.totals .sum { color: var(--accent); font-weight: 800; font-size: 18px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* Kasse */
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 0; }
.checkout h1 { font-family: var(--font-display); font-weight: 600; font-size: 38px; margin: 8px 0 20px; }
.sec { display: flex; flex-direction: column; gap: 14px; margin-bottom: 28px; }
.sec h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--on-accent); font-weight: 700; }
.row { display: flex; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field.w2 { flex: 2; }
.field.w3 { flex: 3; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: 100%; min-width: 0; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; min-height: 1em; }
.helpers { display: flex; flex-direction: column; gap: 10px; }
.helper { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-weight: 600; }
.helper.primary { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.helper.live { background: var(--red); border-color: var(--red); color: var(--on-red); }
.helper svg { width: 20px; height: 20px; flex: none; }
.status { font-size: 13px; color: var(--muted); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.box { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }

/* Bestaetigung */
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 40px; }
.done h1 { font-family: var(--font-display); font-weight: 600; font-size: 44px; }
.check { width: 84px; height: 84px; }
.check circle { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw .7s ease forwards; }
.check path { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Hinweis-Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--accent);
  color: var(--fg); font-weight: 700; box-shadow: var(--shadow); transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .row.stack-sm { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.add:disabled { opacity: .45; cursor: not-allowed; }

.trackbar { display: block; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; text-align: center; }
.trackbar[hidden] { display: none; }
.viewonly { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface); color: var(--fg); font-size: 14px; line-height: 1.45; }

/* Karten: Text darf nie unter den Button laufen; auf dem Handy Preis + Button in einer Zeile unter dem Text */
.card .info > div { min-width: 0; overflow-wrap: anywhere; }
.card h3 { overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 560px) {
  .card { grid-template-columns: minmax(0, 1fr); }
  .card h3 { font-size: 21px; }
  .card .side { flex-direction: row; justify-content: space-between; align-items: center; }
}
