/* ============================================================================
 * app.css — one stylesheet for all three pages.
 *
 * Rules of the house:
 *  - No web fonts. A web font is a CDN request. System stack only.
 *  - Big type, high contrast: this has to read on a phone at arm's length and
 *    on an iPad propped next to a stove.
 *  - Style :active, never :hover — :hover sticks on touch devices.
 *  - touch-action: manipulation on everything tappable, or iOS double-tap
 *    zooms the board instead of advancing the order.
 * ========================================================================== */

:root {
  --bg:        #1b1226;
  --bg-2:      #271a35;
  --card:      #fff9f0;
  --ink:       #241a2e;
  --ink-soft:  #6b5a78;
  --cream:     #fff9f0;
  --yellow:    #ffd166;
  --pink:      #ef476f;
  --green:     #06d6a0;
  --blue:      #4cc9f0;
  --line:      rgba(255, 249, 240, 0.18);
  --radius:    18px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
          'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: contain;
}

body {
  min-height: 100dvh;
}
@supports (-webkit-touch-callout: none) {
  body { min-height: -webkit-fill-available; }
}

button, input, .chip, .card, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

h1, h2, h3 { margin: 0; line-height: 1.1; }

/* --- shared page shell ---------------------------------------------------- */

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 18px;
}
.topbar h1 { font-size: 30px; letter-spacing: -0.5px; }
.topbar .sub { color: rgba(255, 249, 240, 0.62); font-size: 15px; margin-top: 6px; }
/* the guest page gives its vertical space to the crepe instead */
.topbar.compact { padding-bottom: 10px; }
.topbar.compact h1 { font-size: 24px; }
.topbar.compact .sub { font-size: 14px; margin-top: 4px; }

.section { margin: 0 0 26px; }
.section > h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--yellow);
  margin-bottom: 12px;
  font-weight: 800;
}
.section .hint {
  font-size: 14px;
  color: rgba(255, 249, 240, 0.5);
  margin: -6px 0 12px;
}

/* --- chips ---------------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--line);
  background: var(--bg-2);
  color: var(--cream);
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 600;
  min-height: 52px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
}
.chip .em { margin-right: 7px; }
.chip:active { transform: scale(0.95); }
.chip[aria-pressed='true'] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}

/* ==========================================================================
 * THE LIVE CREPE — guest page hero. Sticks to the top so you can watch your
 * crepe fill up while you scroll the ingredient list.
 * ======================================================================== */

.stage {
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--bg);
  padding: 6px 0 14px;
  margin-bottom: 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
/* The iOS keyboard makes stuck elements jump, so we un-stick while the note
   field is focused. */
.stage.unstick { position: static; }

.crepe {
  position: relative;
  width: min(70vw, 270px);
  padding-bottom: min(43.4vw, 167px);   /* ~1.6:1 ellipse, no aspect-ratio needed */
  margin: 0 auto;
  border-radius: 50%;
  background-image:
    radial-gradient(circle at 23% 29%, rgba(158, 94, 28, 0.28) 0 5px, transparent 6px),
    radial-gradient(circle at 75% 25%, rgba(158, 94, 28, 0.20) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 79%, rgba(158, 94, 28, 0.24) 0 6px, transparent 7px),
    radial-gradient(circle at 29% 73%, rgba(158, 94, 28, 0.16) 0 4px, transparent 5px),
    radial-gradient(ellipse at 38% 32%, #f8d795 0%, #ecb965 52%, #d3903f 100%);
  box-shadow:
    inset 0 -6px 14px rgba(140, 80, 20, 0.28),
    inset 0 4px 10px rgba(255, 240, 200, 0.5),
    0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.crepe.has-stuff { transform: scale(1.02); }

.crepe .ing {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 27px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(90, 50, 10, 0.45));
  pointer-events: none;
}
.crepe .ing.just-added { animation: plop 0.38s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes plop {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(-40deg); }
  60%  { transform: translate(-50%, -50%) scale(1.3) rotate(8deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.crepe-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16%;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #96601f;
}

.crepe-list {
  margin: 12px auto 0;
  max-width: 90%;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  min-height: 21px;
}
.crepe-list.muted { color: rgba(255, 249, 240, 0.45); font-weight: 500; }

/* --- inputs (as few as possible — the iOS AutoFill bar is unsuppressable) -- */

.field {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--bg-2);
  color: var(--cream);
  border-radius: 14px;
  padding: 16px;
  font-size: 17px;          /* < 16px makes iOS zoom the whole page on focus */
  min-height: 54px;
}
.field::placeholder { color: rgba(255, 249, 240, 0.38); }
.field:focus { outline: none; border-color: var(--yellow); }

/* --- primary action ------------------------------------------------------- */

.go {
  display: block;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: var(--radius);
  background: var(--green);
  color: #06251c;
  font-size: 23px;
  font-weight: 900;
  padding: 22px;
  min-height: 68px;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.12s ease;
}
.go:active { transform: scale(0.98); }
.go[disabled] { opacity: 0.35; cursor: default; }

.ghost {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 2px solid var(--line);
  color: var(--cream);
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
}
.ghost:active { transform: scale(0.96); }

.hidden { display: none !important; }

.err {
  background: var(--pink);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ==========================================================================
 * Guest live-status screen
 * ======================================================================== */

.status-screen {
  text-align: center;
  padding-top: 8vh;
}
.status-emoji { font-size: 76px; line-height: 1; }
.status-head {
  font-size: 34px;
  font-weight: 900;
  margin: 18px 0 8px;
  letter-spacing: -0.5px;
}
.status-sub { font-size: 17px; color: rgba(255, 249, 240, 0.62); }
.status-confirm {
  font-size: 16px;
  color: var(--yellow);
  font-weight: 600;
  margin-top: 20px;
}
.recap {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 26px 0;
  text-align: left;
  font-size: 16px;
  line-height: 1.55;
}
.recap .who { font-weight: 800; font-size: 19px; margin-bottom: 4px; }
.recap .note { color: var(--yellow); margin-top: 8px; font-style: italic; }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.09); }
}

/* ==========================================================================
 * Kitchen board — the iPad. Everything here is deliberately oversized.
 * ======================================================================== */

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
@supports (-webkit-touch-callout: none) {
  .gate { min-height: -webkit-fill-available; }
}
.gate h1 { font-size: 44px; }
.gate p { color: rgba(255, 249, 240, 0.6); font-size: 17px; max-width: 420px; margin: 0; }
.gate .start {
  font-size: 26px;
  padding: 26px 46px;
  min-height: 84px;
  width: auto;
  min-width: 300px;
}

.board {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 10px 12px 0;
}
@supports (-webkit-touch-callout: none) {
  .board { height: -webkit-fill-available; }
}

.board-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 4px 12px;
  flex: 0 0 auto;
}
.board-top .title { font-size: 24px; font-weight: 900; }
.board-top .spacer { flex: 1; }
.counter {
  background: var(--yellow);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 21px;
  font-weight: 900;
  white-space: nowrap;
}
.dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--green);
  transition: background 0.3s ease;
}
.dot.stale { background: var(--pink); }

.cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(255, 249, 240, 0.04);
  border-radius: var(--radius);
  padding: 10px;
}
.col > h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 900;
  padding: 4px 4px 10px;
  flex: 0 0 auto;
}
.col-new    > h2 { color: var(--pink); }
.col-cooking> h2 { color: var(--yellow); }
.col-ready  > h2 { color: var(--green); }

.col-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 6px;
}
.col-empty {
  color: rgba(255, 249, 240, 0.25);
  font-size: 15px;
  text-align: center;
  padding: 24px 8px;
}

.card {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  flex: 0 0 auto;
}
.card.fresh { animation: pop 0.45s ease; }
@keyframes pop {
  0%   { transform: scale(0.85); box-shadow: 0 0 0 0 var(--pink); }
  60%  { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(239, 71, 111, 0); }
  100% { transform: scale(1); }
}

.card .guest {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.card .base-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 999px;
  padding: 4px 12px;
  margin: 8px 0 6px;
}
.card .base-tag.sweet  { background: #ffe0e8; color: #a01235; }
.card .base-tag.savory { background: #e3f3d8; color: #3d6118; }
.card .items { font-size: 19px; line-height: 1.45; font-weight: 600; }
.card .items .none { color: var(--ink-soft); font-weight: 500; font-style: italic; }
.card .note {
  margin-top: 9px;
  background: #fff2c9;
  border-left: 5px solid var(--yellow);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 17px;
  font-weight: 700;
  color: #6a4d00;
}
/* Live timers. tabular-nums keeps the digits from jittering the layout as
   they tick — they update every second. */
.card .times {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.card .times .t { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.card .times .t.now { font-size: 19px; font-weight: 900; }
.card .times .t.now.cooking { color: #9a6000; }
.card .times .t.now.ready   { color: #06805f; }

.card-actions { display: flex; gap: 9px; margin-top: 12px; }
.advance {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 14px;
  font-size: 21px;
  font-weight: 900;
  min-height: 64px;
  padding: 12px;
  cursor: pointer;
  color: #12220f;
  transition: transform 0.06s ease;
}
.advance:active { transform: scale(0.97); }
.advance.to-cooking { background: var(--yellow); color: #5a3f00; }
.advance.to-ready   { background: var(--green);  color: #06251c; }
.advance.to-served  { background: var(--blue);   color: #062a38; }
.undo {
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid rgba(36, 26, 46, 0.18);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 14px;
  min-width: 64px;
  min-height: 64px;
  font-size: 24px;
  cursor: pointer;
}
.undo:active { transform: scale(0.94); }

.served-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  font-size: 15px;
  color: rgba(255, 249, 240, 0.5);
  overflow: hidden;
}
.served-strip .names {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  padding: 15px 26px;
  border-radius: 999px;
  z-index: 60;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.milestone {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 12vw, 130px);
  font-weight: 900;
  color: var(--yellow);
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 55;
  animation: milestone 2.4s ease forwards;
}
@keyframes milestone {
  0%   { opacity: 0; transform: scale(0.5); }
  15%  { opacity: 1; transform: scale(1.06); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

/* iPad portrait / smaller screens: stack the columns instead of squeezing */
@media (max-width: 700px) {
  .cols { grid-template-columns: 1fr; overflow-y: auto; }
  .col { min-height: 140px; }
  .col-body { overflow: visible; }
}

/* ==========================================================================
 * QR page
 * ======================================================================== */

.qr-page { text-align: center; }
.qr-box {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  display: inline-block;
  margin: 8px auto 0;
  max-width: 100%;
}
.qr-box svg { display: block; width: min(72vw, 420px); height: auto; }
.qr-url {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 14px;
  word-break: break-all;
  max-width: 420px;
}
.qr-caption { font-size: 30px; font-weight: 900; margin-bottom: 4px; }
.qr-caption-sub { font-size: 18px; color: rgba(255, 249, 240, 0.6); margin-bottom: 20px; }
.qr-controls { margin-top: 26px; text-align: left; }

@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .qr-box { border-radius: 0; padding: 0; box-shadow: none; }
  .qr-box svg { width: 148mm; }
  .qr-caption { color: #000; font-size: 32pt; }
  .qr-caption-sub { color: #333; font-size: 15pt; }
  .qr-url { color: #000; font-size: 15pt; margin: 8mm auto 0; max-width: none; }
}
