:root {
  --ink: #0B0D0F;
  --surface: #16191F;
  --surface-2: #1D2129;
  --paper: #F3ECDA;
  --beer-amber: #ee940e;
  --regency-amber: #C97C2E;
  --brass: #C7A542;
  --ember: #E2542E;
  --muted: #93897A;
  --muted-on-paper: #8A7F68;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}
button:focus-visible,
img:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.hidden { display: none !important; }

/* ---------- Header ---------- */

.topbar {
  padding: 28px 24px 6px;
}
.brand-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 4vw, 34px);
  color: var(--paper);
}

/* ---------- Table select screen ---------- */

.table-select {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.table-select-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.table-select-title {
  margin: 6px 0 22px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(24px, 4vw, 30px);
  color: var(--paper);
}
/* Floor-plan style: a fixed 6-across grid (fills 5 rows for 30 tables). The
   panel background evokes a room the staff are looking down onto. */
.table-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 16px);
  max-width: 760px;
  padding: clamp(12px, 2vw, 22px);
  background:
    linear-gradient(180deg, rgba(29, 33, 41, 0.5) 0%, rgba(22, 25, 31, 0.5) 100%);
  border: 1px solid rgba(199, 165, 66, 0.18);
  border-radius: 22px;
}
.table-btn {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(199, 165, 66, 0.3);
  background: var(--surface);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(16px, 3.4vw, 24px);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  overflow: hidden;
}
.table-btn-no {
  line-height: 1.05;
}
/* The group label is a finding aid, not the identity of the table — kept
   quiet so the number still reads at a glance from across the room. */
.table-btn-group {
  font-family: var(--font-mono);
  font-size: clamp(7px, 1.35vw, 10px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-btn:active .table-btn-group {
  color: rgba(11, 13, 15, 0.7);
}
.table-btn:hover {
  border-color: var(--brass);
}
.table-btn:active {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--ink);
  transform: scale(0.97);
}
.table-walkin {
  margin-top: 22px;
  align-self: flex-start;
}

/* ---------- Table indicator (on menu) ---------- */

.table-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.table-indicator-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.table-indicator-label strong {
  color: var(--brass);
}
.btn-linky {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px 2px;
}

/* ---------- Menu screen ---------- */

.screen {
  padding: 12px 20px 24px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 90px);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  gap: 18px;
  flex: 1;
  padding-bottom: 96px;
}

.menu-card {
  --tone: var(--brass);
  background: var(--surface);
  border: 1px solid rgba(199, 165, 66, 0.25);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.menu-card[data-tone="beer"] { --tone: var(--beer-amber); }
.menu-card[data-tone="regency"] { --tone: var(--regency-amber); }

.menu-card-photo-tile {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  padding: 18px 20px 4px;
  min-height: 216px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
}
.menu-card-photo-tile::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 40%;
  width: 210px;
  height: 210px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--tone) 60%, transparent) 0%, transparent 70%);
  filter: blur(4px);
  opacity: 0.6;
}
.menu-card-photo-tile::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 46%;
  height: 20px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6) 0%, transparent 75%);
}
.menu-card-photo {
  position: relative;
  z-index: 1;
  max-height: 216px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.55));
}

.menu-card-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(199, 165, 66, 0.22);
}
.menu-card-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.menu-card-name {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--paper);
}
.menu-card-price {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--tone);
  white-space: nowrap;
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qty-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(199, 165, 66, 0.4);
  background: var(--surface-2);
  color: var(--paper);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.qty-btn:active { background: var(--tone); border-color: var(--tone); color: var(--ink); }
.qty-value {
  font-family: var(--font-mono);
  font-size: 20px;
  min-width: 32px;
  text-align: center;
}

.basket-bar {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid rgba(199, 165, 66, 0.25);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.basket-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.basket-amount {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--paper);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 15px 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.35; }
.btn-primary { background: var(--ember); color: var(--paper); }
.btn-secondary { background: var(--surface-2); color: var(--paper); border: 1px solid rgba(199, 165, 66, 0.35); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-small { padding: 11px 16px; font-size: 14px; }

/* ---------- Coupon (order page) ---------- */

.order-footer {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.coupon-entry {
  display: flex;
  gap: 10px;
}
.coupon-input {
  flex: 1;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(199, 165, 66, 0.3);
  background: var(--surface);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 16px;
}
.coupon-input::placeholder {
  color: var(--muted);
  letter-spacing: normal;
  text-transform: none;
}
.coupon-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--chang-green) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--chang-green) 45%, transparent);
  border-radius: 12px;
  padding: 12px 16px;
}
.coupon-applied-text {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--paper);
}
.basket-discount-note {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--chang-green);
}

/* The order footer replaces the standalone sticky on .basket-bar. */
.order-footer .basket-bar {
  position: static;
  margin-top: 0;
}

/* ---------- Checkout / ticket screen ---------- */

#checkout-screen { align-items: center; justify-content: center; }

.ticket {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  border: 1px solid rgba(199, 165, 66, 0.6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 34px 30px;
  text-align: center;
}
.ticket-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-on-paper);
}
.ticket-amount {
  margin: 8px 0 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  color: var(--ink);
}
.qr-frame {
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(11, 13, 15, 0.12);
  padding: 14px;
  display: inline-block;
}
.qr-image {
  width: 220px;
  height: 220px;
  display: block;
}
/* The real PromptPay QR is a tall bank-issued image (bank header, QR, payee
   name), not a bare square — let it keep its own aspect ratio. */
.qr-frame.static .qr-image {
  /* Widest that still fits the ticket's inner width — the bank-issued image
     spends a lot of height on its header/footer, so the QR itself only gets
     ~60% of this, and it has to stay comfortably scannable across the table. */
  width: 300px;
  max-width: 100%;
  height: auto;
}
/* A static QR has no amount encoded, so the amount the customer must type is
   the single most important thing on this screen after the QR itself. */
.static-qr-hint {
  margin: -8px 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted-on-paper);
}
.static-qr-hint strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ember);
}
.countdown-row {
  margin: 18px 0 0;
  color: var(--muted-on-paper);
  font-size: 14px;
}
.countdown-mono {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}
.countdown-mono.urgent {
  color: var(--ember);
}
.ticket-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}
.ticket .btn-secondary { background: var(--ink); color: var(--paper); border: none; }
.ticket .btn-ghost { color: var(--muted-on-paper); }

.result-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.result-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 6px;
}
.result-icon.success { background: color-mix(in srgb, var(--beer-amber) 18%, transparent); color: var(--beer-amber); }
.result-icon.neutral { background: rgba(11, 13, 15, 0.08); color: var(--muted-on-paper); }
.result-state h2 {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}
.result-state .btn { margin-top: 14px; }

/* ---------- Slip fallback ---------- */

.slip-hint {
  margin: 22px 0 8px;
  font-size: 13px;
  color: var(--muted-on-paper);
}
/* A link-style button that reads on the light ticket. */
.ticket .btn-linky {
  border: none;
  background: transparent;
  color: var(--ember);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px 2px;
}
.slip-camera-wrap,
.slip-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.slip-video {
  width: 100%;
  max-height: 340px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
}
.slip-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  border: 1px solid rgba(11, 13, 15, 0.15);
}
.slip-preview-wrap .ticket-actions {
  width: 100%;
}
