:root {
  --cheddar: #F7931E;
  --cheese: #FFD23F;
  --cream: #FFF8E7;
  --crust: #4A2C0A;
  --paprika: #D4421A;
  --muted: #7A5A36;
  --herb: #2F6B2A;
  --danger: #A8201A;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px 48px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Fredoka", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--crust);
  /* Scattered elbow macaroni */
  background: var(--cheddar) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140' fill='none' stroke='%23FFAA3D' stroke-width='9' stroke-linecap='round'%3E%3Cpath d='M18 40a16 16 0 0 1 30-6'/%3E%3Cpath d='M92 22a16 16 0 0 0 26 14'/%3E%3Cpath d='M50 104a16 16 0 0 1 8-28'/%3E%3Cpath d='M104 112a16 16 0 0 1 24-18'/%3E%3C/svg%3E");
  overflow-x: hidden;
}

[hidden] { display: none !important; }

/* ---------- card ---------- */

.card {
  width: 100%;
  max-width: 440px;
  background: var(--cream);
  border: 3px solid var(--crust);
  border-radius: 28px;
  box-shadow: 0 8px 0 var(--crust);
  overflow: hidden;
}

.card.wide { max-width: 880px; }

.hero {
  position: relative;
  padding: 20px 20px 10px;
  text-align: center;
  background: var(--cheese);
}

.bowl {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 auto 4px;
}

.steam path { animation: steam 2.8s ease-in-out infinite; }
.steam path:nth-child(2) { animation-delay: -0.9s; }
.steam path:nth-child(3) { animation-delay: -1.8s; }

@keyframes steam {
  0%, 100% { opacity: 0.35; transform: translateY(4px); }
  50% { opacity: 1; transform: translateY(-3px); }
}

h1 {
  margin: 0;
  font-size: clamp(28px, 8.4vw, 38px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.details {
  margin: 8px 0 0;
  font-weight: 500;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.drip {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: -1px;
}

.body { padding: 10px 22px 26px; }

/* ---------- form bits ---------- */

.lead {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 500;
  text-align: center;
  text-wrap: balance;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"],
input[type="time"],
textarea {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 18px;
  color: var(--crust);
  background: #fff;
  border: 3px solid var(--crust);
  border-radius: 14px;
  appearance: none;
  -webkit-appearance: none;
}

input[type="time"] { min-height: 56px; }

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 4px solid var(--cheddar);
  outline-offset: 2px;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px 18px;
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  color: #fff;
  background: var(--paprika);
  border: 3px solid var(--crust);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--crust);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--crust); }
.btn:disabled { opacity: 0.6; cursor: default; }

.link {
  display: block;
  margin: 20px auto 0;
  padding: 6px 8px;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

.lang {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 44px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--crust);
  background: var(--cream);
  border: 2px solid var(--crust);
  border-radius: 999px;
  cursor: pointer;
}

.error, .ok {
  margin: 10px 0 0;
  font-weight: 500;
}
.error { color: var(--danger); }
.ok { color: var(--herb); }

/* ---------- suspense ---------- */

.loading {
  padding: 28px 0 16px;
  text-align: center;
  font-size: 19px;
  font-weight: 500;
}

.spinner {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border: 12px solid var(--cheese);
  border-color: var(--cheese) var(--cheese) transparent transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result ---------- */

.hi {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}

.ticket {
  margin: 14px 0 0;
  padding: 18px 16px 20px;
  text-align: center;
  background: #fff;
  border: 3px dashed var(--paprika);
  border-radius: 18px;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.8) rotate(-3deg); }
  to { opacity: 1; transform: none; }
}

.ticket-label {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ticket-bring {
  margin: 0;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--paprika);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.hush {
  margin: 10px 0 0;
  font-size: 15px;
  text-align: center;
  color: var(--muted);
}

.arrival {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 3px dotted #E9D5A8;
}

.row { display: flex; gap: 10px; align-items: stretch; }
.row input { flex: 1 1 0; min-width: 0; }
.row .btn { flex: 0 0 auto; width: auto; margin-top: 0; }

/* ---------- macaroni confetti ---------- */

.confetti {
  position: fixed;
  top: -30px;
  left: var(--x);
  width: 22px;
  height: 22px;
  border: 7px solid var(--c);
  border-color: var(--c) var(--c) transparent transparent;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  animation: fall var(--d) linear var(--delay) both;
}

@keyframes fall {
  from { transform: translateY(0) rotate(var(--r)); opacity: 1; }
  to { transform: translateY(110vh) rotate(calc(var(--r) + 540deg)); opacity: 0.9; }
}

/* ---------- admin ---------- */

.admin h2 {
  margin: 28px 0 10px;
  font-size: 21px;
  font-weight: 600;
}
.admin h2:first-child { margin-top: 6px; }

.admin .hint {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
}

.admin textarea {
  min-height: 220px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

.admin .btn { width: auto; display: inline-block; font-size: 17px; padding: 10px 18px; }
.admin .btn.quiet { color: var(--crust); background: var(--cheese); }

.admin .fields { display: grid; gap: 12px; }
@media (min-width: 640px) { .admin .fields { grid-template-columns: 1fr 1fr; } }

.admin ul.errors { margin: 10px 0 0; padding-left: 20px; color: var(--danger); }

.share {
  display: block;
  padding: 10px 14px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  background: #fff;
  border: 2px dashed var(--crust);
  border-radius: 12px;
  overflow-wrap: anywhere;
  user-select: all;
}

.table-wrap { overflow-x: auto; border: 3px solid var(--crust); border-radius: 14px; background: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; }
th { font-weight: 600; background: var(--cheese); white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid #EBDDBB; }
td.time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
td.none { color: #A8906B; font-weight: 400; }
td.empty { text-align: center; color: var(--muted); padding: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 4px 12px; background: #fff; border: 2px solid var(--crust); border-radius: 999px; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
