:root {
  color-scheme: light;
  --bg: #f8efe7;
  --card: #fffaf5;
  --ink: #2c1a12;
  --muted: #695446;
  --brand: #8b4a2f;
  --brand-dark: #4a2a1e;
  --cream: #f3d8b8;
  --gold: #d79a43;
  --success: #25643e;
  --danger: #b33a2f;
  --shadow: 0 18px 60px rgba(71, 37, 20, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(215, 154, 67, 0.28), transparent 30rem),
    linear-gradient(160deg, #fff8ef 0%, var(--bg) 55%, #ead0bb 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 18px;
}

.hero,
.card,
.drink-card {
  border: 1px solid rgba(74, 42, 30, 0.08);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 190px;
  padding: 28px;
  border-radius: 34px;
  overflow: hidden;
}

.event-ads {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.event-ads[hidden] { display: none; }
.event-ads::-webkit-scrollbar { display: none; }

.event-ad {
  position: relative;
  flex: 0 0 min(86vw, 620px);
  min-height: 128px;
  overflow: hidden;
  border: 1px solid rgba(74, 42, 30, 0.12);
  border-radius: 24px;
  background: var(--brand-dark);
  color: #fff;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}

.event-ad img {
  width: 100%;
  height: 170px;
  display: block;
  object-fit: cover;
}

.event-ad.has-photo .event-copy {
  position: absolute;
  inset: auto 0 0;
  padding: 32px 18px 16px;
  background: linear-gradient(transparent, rgba(32, 16, 10, 0.92));
}

.event-ad.text-only .event-copy { padding: 22px; }
.event-copy strong { display: block; font-size: 1.25rem; }
.event-copy p { margin: 4px 0 0; color: #fff; white-space: pre-line; }
.event-discount { display: inline-block; margin-bottom: 7px; padding: 4px 8px; border-radius: 999px; background: #f3dec2; color: var(--brand-dark); font-size: .72rem; font-weight: 900; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 13vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
}

.hero-copy {
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.55;
}

.cup {
  position: relative;
  flex: 0 0 118px;
  width: 118px;
  height: 118px;
  border-radius: 28px 28px 46px 46px;
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  box-shadow: inset 0 -18px 32px rgba(0, 0, 0, 0.18);
}

.cup::before {
  content: "";
  position: absolute;
  top: 30px;
  right: -34px;
  width: 48px;
  height: 54px;
  border: 12px solid var(--brand-dark);
  border-left: 0;
  border-radius: 0 34px 34px 0;
}

.cup span {
  position: absolute;
  inset: 12px 14px auto;
  height: 20px;
  border-radius: 999px;
  background: var(--cream);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.68);
}

.tab {
  border: 0;
  border-radius: 999px;
  padding: 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  color: #fff;
  background: var(--brand-dark);
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.card {
  padding: 22px;
  border-radius: 28px;
}

.member-header,
.section-title,
.drink-top,
.drink-bottom,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--brand-dark);
  background: #f3dec2;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.muted-pill {
  color: var(--muted);
  background: #eee1d7;
}

.points-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0;
}

.points-row > div {
  padding: 18px;
  border-radius: 22px;
  background: #fff;
}

.points-row strong {
  display: block;
  font-size: 2.4rem;
  line-height: 1;
}

.points-row span,
.muted {
  color: var(--muted);
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ead8ca;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--brand));
  transition: width 240ms ease;
}

.reward-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: #fff3e2;
  border: 1px solid #e3c8a8;
}

.reward-action div { display: grid; gap: 3px; }
.reward-action .primary-btn { flex-shrink: 0; }

.barcode-panel {
  margin-top: 20px;
  padding: 16px;
  border: 1px dashed rgba(74, 42, 30, 0.2);
  border-radius: 20px;
  background: #fff;
  text-align: center;
}

.qr-code {
  width: 224px;
  height: auto;
  max-width: 100%;
  margin-bottom: 12px;
  border-radius: 16px;
}

.drink-photo {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 12px;
}

.menu-prices { display: grid; gap: 2px; }
.original-price { color: var(--muted); font-size: .78rem; }
.discount-pill { margin-left: auto; border-radius: 999px; padding: 6px 9px; background: #25643e; color: white; font-size: .72rem; font-weight: 900; }

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.category-button {
  border: 1px solid #d9c4b3;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  padding: 10px 16px;
  min-height: 44px;
}

.category-button.active {
  background: var(--brand-dark);
  color: white;
  border-color: var(--brand-dark);
}

.category-empty { grid-column: 1 / -1; padding: 20px 0; }
.menu-category { display: block; margin-bottom: 8px; }

.order-photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
}

.barcode svg {
  width: min(100%, 360px);
  height: auto;
}

.member-code {
  margin: 8px 0 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.small {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.drink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.order-item {
  display: grid;
  gap: 8px;
  min-height: 118px;
  border: 1px solid rgba(74, 42, 30, 0.12);
  border-radius: 18px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.order-item.active {
  border-color: rgba(139, 74, 47, 0.45);
  background: #fff3e2;
}

.order-item span {
  font-size: 1.45rem;
}

.order-item strong {
  display: block;
}

.order-item small {
  color: var(--muted);
  font-weight: 800;
}

.order-adjustment-note { color: var(--brand) !important; }
.service-field { max-width: 280px; margin-bottom: 0; }
.configured-lines { display: grid; gap: 8px; }
.configured-order-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}
.configured-order-line small { display: block; margin-top: 2px; }
.qty-controls.compact { grid-template-columns: 32px 24px 32px; margin: 0; gap: 3px; }
.qty-controls.compact button { width: 32px; height: 32px; }
.menu-options { min-height: 0 !important; margin-top: -8px; font-size: 0.84rem; }
.adjust-item-btn {
  min-height: 36px;
  border: 1px solid var(--brand);
  border-radius: 12px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 800;
}

.order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
}

.order-summary strong {
  display: block;
  margin-top: 4px;
}

.reward-preview {
  margin-bottom: 14px;
  padding: 16px;
  border: 2px solid var(--success);
  border-radius: 18px;
  color: #17482c;
  background: #e6f5ec;
}

.reward-preview strong { display: block; margin-bottom: 4px; }
.reward-preview .reward-balance { margin: 8px 0 0; }
.reward-preview button { margin-top: 12px; }
.reward-confirm { background: var(--success); }

.qty-controls {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.qty-controls button {
  width: 42px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--brand-dark);
  font-size: 1.25rem;
  font-weight: 900;
}

.qty-controls b {
  text-align: center;
  font-size: 1.1rem;
}

.drink-card {
  padding: 18px;
  border-radius: 24px;
}

.drink-emoji {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  font-size: 1.8rem;
}

.drink-card p {
  min-height: 48px;
  color: var(--muted);
  line-height: 1.45;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  border-radius: 14px;
  padding: 0 14px;
  font-weight: 850;
}

.primary-btn {
  border: 0;
  color: #fff;
  background: var(--brand-dark);
}

.ghost-btn {
  border: 1px solid rgba(74, 42, 30, 0.14);
  color: var(--brand-dark);
  background: #fff7ed;
}

.activity-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
}

.activity-list strong {
  color: var(--ink);
}

.field {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: var(--brand-dark);
  font-weight: 850;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(74, 42, 30, 0.14);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.scanner {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  border-radius: 24px;
  background: #20150f;
}

.scanner video {
  display: block;
  width: 100%;
  min-height: 240px;
  object-fit: cover;
}

#scanSuccess,
#rewardDialog,
#orderAdjustmentDialog,
#orderOptionsDialog {
  width: min(90vw, 420px);
  border: 0;
  border-radius: 24px;
  padding: 28px;
  color: var(--ink);
  background: var(--card);
}

#scanSuccess::backdrop,
#rewardDialog::backdrop,
#orderAdjustmentDialog::backdrop,
#orderOptionsDialog::backdrop {
  background: rgba(32, 21, 15, 0.6);
}

#orderAdjustmentDialog,
#orderOptionsDialog { text-align: left; }
#orderAdjustmentDialog .field,
#orderOptionsDialog .field { margin: 14px 0; }
.option-total { padding: 12px; border-radius: 14px; color: var(--brand-dark); background: #f7e8d6; font-weight: 900; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.dialog-actions .primary-btn { grid-column: 1 / -1; }

#rewardDialog { text-align: center; }
#rewardDialog .qr-code { display: block; margin: 18px auto 8px; }
#rewardDialog .ghost-btn { width: 100%; }
.reward-countdown { color: var(--brand-dark); font-weight: 850; }
.reward-catalog { display: grid; gap: 10px; margin: 18px 0; max-height: 52vh; overflow: auto; text-align: left; }
.reward-option { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid #ddc8b4; border-radius: 14px; color: var(--ink); background: #fff7ed; text-align: left; }
.reward-option img, .reward-option-emoji { width: 52px; height: 52px; border-radius: 11px; object-fit: cover; display: grid; place-items: center; background: #f3dec2; font-size: 1.5rem; }
.reward-option span { display: grid; gap: 2px; }
.reward-option b { white-space: nowrap; color: var(--brand-dark); }
.reward-option:disabled { background: #f0ece7; }

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.scanner-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.admin-actions,
.manual-entry {
  margin-top: 14px;
}

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.manual-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.manual-entry .field { margin: 0; }

.admin-actions > button,
.manual-entry > button {
  width: 100%;
}

.assistance-card h3 { margin-bottom: 4px; }
.assistance-lookup { align-items: end; }
.member-result {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid rgba(74, 42, 30, 0.12);
  border-radius: 18px;
  background: #fff;
}
.member-result strong { display: block; font-size: 1.12rem; }
.member-result span { color: var(--muted); }
.assistance-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(74, 42, 30, 0.12);
}
.assistance-section .field { margin: 12px 0; }
.assistance-section > button { width: 100%; }
.adjustment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.notice {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 16px;
  color: var(--brand-dark);
  background: #f7e8d6;
}

.notice:empty { display: none; }

.notice.success {
  color: var(--success);
  background: #e6f5ec;
}

.notice.error {
  color: var(--danger);
  background: #fde9e6;
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .hero {
    align-items: flex-start;
    padding: 22px;
  }

  .cup {
    flex-basis: 82px;
    width: 82px;
    height: 82px;
    border-radius: 22px 22px 34px 34px;
  }

  .cup::before {
    right: -24px;
    width: 34px;
    height: 38px;
    border-width: 9px;
  }

  .reward-action { align-items: stretch; flex-direction: column; }
  .manual-entry,
  .adjustment-grid { grid-template-columns: 1fr; }
}
