:root {
  --bg: #fff7ed; --surface: #ffffff; --text: #1c1917; --muted: #78716c; --line: #e7e5e4;
  --accent: #c2410c; --accent-ink: #ffffff; --danger: #b91c1c; --shadow: 0 10px 30px rgba(28, 25, 23, .12);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1917; --surface: #292524; --text: #f5f5f4; --muted: #a8a29e; --line: #44403c;
          --accent: #fb923c; --accent-ink: #1c1917; --danger: #f87171; --shadow: 0 10px 30px rgba(0, 0, 0, .45); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#app {
  min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
button {
  border: 0; border-radius: 12px; padding: 12px 18px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; min-height: 48px;
}
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button:disabled { opacity: .4; cursor: default; }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); min-height: 48px;
}
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); min-height: 1.4em; font-size: 14px; }

header { display: flex; align-items: center; gap: 10px; padding: 4px 0 12px; }
header h1 { font-size: 20px; margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
header h1 img { width: 28px; height: 28px; }

/* sign in */
.login { margin: auto 0; display: flex; flex-direction: column; gap: 12px; }
.login .logo { width: 88px; height: 88px; align-self: center; }
.login h1 { text-align: center; margin: 4px 0 8px; }

/* the suggestion */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; min-height: 0; }
.card {
  position: relative; background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; will-change: transform;
}
/* the photo takes what the screen leaves after the header, the name and the buttons - the buttons
   must never fall below the fold on a short phone */
.card .photo, .card .nophoto { width: 100%; aspect-ratio: 4 / 5; max-height: calc(100dvh - 300px); min-height: 180px;
  display: block; background: var(--line); }
.card .photo { object-fit: cover; pointer-events: none; }
.card .nophoto { display: grid; place-items: center; font-size: 72px; }
.card .name { padding: 16px 18px 20px; font-size: 24px; font-weight: 700; }
.card.leaving { transition: transform .22s ease-out, opacity .22s ease-out; }
.card.settle { transition: transform .18s ease-out; }
.controls { display: flex; gap: 12px; }
.controls button { flex: 1; font-size: 18px; }
.hint { text-align: center; }
.empty { margin: auto 0; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.empty .big { font-size: 64px; }

/* the dishes screen */
.add { background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.pick { display: flex; gap: 12px; align-items: center; }
.pick .preview { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--line); flex: none; display: grid; place-items: center; font-size: 26px; }
.pick label { flex: 1; }
.pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 8px; }
.list .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; display: grid; place-items: center; font-size: 24px; }
.list .dish { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list button { min-height: 44px; padding: 8px 12px; }
.count { margin-top: 14px; }
