:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1f2a24;
  --muted: #6b726d;
  --line: #e4ded4;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --ok: #2f7a4a;
  --danger: #b42318;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; user-select: text; }
[hidden] { display: none !important; }

.kiosk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 30vw); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }

/* Menu */
.menu { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { padding: 20px 28px 12px; background: var(--bg); }
.topbar h1 { margin: 0 0 12px; font-size: 30px; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; border: 2px solid var(--ink); background: transparent; border-radius: 999px; padding: 10px 22px; font-weight: 600; font-size: 18px; }
.tab:active { background: var(--ink); color: var(--bg); }
.menu-scroll { flex: 1; overflow-y: auto; padding: 4px 28px 40px; scroll-behavior: smooth; }
.category h2 { font-size: 22px; margin: 24px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-height: 200px; transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}
.item:active { transform: scale(.97); }
.item.bump { animation: bump .3s ease; }
@keyframes bump { 40% { transform: scale(.95); box-shadow: 0 0 0 4px var(--accent); } }
.item .emoji { font-size: 54px; line-height: 1; margin-bottom: 6px; }
.item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; margin-bottom: 4px; }
.item .name { font-weight: 700; font-size: 19px; }
.item .desc { color: var(--muted); font-size: 15px; line-height: 1.3; }
.item .price { margin-top: auto; font-weight: 700; font-size: 19px; color: var(--accent); }
.item.sold-out { opacity: .45; }
.item.sold-out .price { color: var(--muted); }
.tag { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #e6f0e8; color: var(--ok); vertical-align: middle; }

/* Basket */
.basket { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.basket h2 { margin: 0; padding: 24px 24px 12px; font-size: 24px; }
.lines { list-style: none; margin: 0; padding: 0 24px; overflow-y: auto; flex: 1; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 600; font-size: 17px; display: flex; flex-direction: column; }
.line-name small { color: var(--muted); font-weight: 500; font-size: 15px; margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 6px; flex: none; }
.step { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); font-size: 24px; font-weight: 700; line-height: 1; }
.step:active { background: var(--line); }
.qty { min-width: 28px; text-align: center; font-weight: 700; font-size: 19px; }
.empty { color: var(--muted); padding: 0 24px; flex: 1; font-size: 17px; }
.basket-foot { padding: 16px 24px 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.field input { padding: 14px; border: 2px solid var(--line); border-radius: 12px; font-size: 18px; color: var(--ink); background: var(--bg); }
.field input:focus { outline: none; border-color: var(--ink); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; }
.total-row strong { font-size: 28px; }

/* Buttons */
.btn { border: 0; border-radius: 14px; padding: 14px 20px; font-weight: 700; font-size: 18px; }
.btn.big { padding: 20px; font-size: 22px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { background: var(--line); color: var(--muted); }
.btn.primary:active:not(:disabled) { filter: brightness(.9); }
.btn.ghost { background: transparent; border: 2px solid var(--line); }
.error { color: var(--danger); margin: 0; font-weight: 600; }

/* Overlays and single-card pages */
.overlay { position: fixed; inset: 0; background: rgb(31 42 36 / .55); display: grid; place-items: center; z-index: 10; }
body.solo { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
body.sim { background: #20262e; }
.card { background: var(--surface); border-radius: 24px; padding: 40px; width: min(520px, 92vw); box-shadow: 0 20px 60px rgb(0 0 0 / .18); }
.card.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card h2 { margin: 4px 0; font-size: 28px; }
.card p { margin: 0; font-size: 18px; }
.card .btn { margin-top: 12px; min-width: 220px; }
.muted { color: var(--muted); }
.order-number { font-size: 96px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--accent); }
.tick { width: 84px; height: 84px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 48px; display: grid; place-items: center; }
.badge { background: #fff4d6; color: #7a5200; font-weight: 700; font-size: 14px !important; padding: 6px 12px; border-radius: 999px; }
.row { display: flex; gap: 12px; }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Portrait tablets: basket goes under the menu */
@media (orientation: portrait) {
  .kiosk { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .basket { border-left: 0; border-top: 1px solid var(--line); max-height: 45vh; }
}
