:root {
  color-scheme: dark;
  --bg: #060607;
  --panel: #0d0e10;
  --rule: #232529;
  --fg: #f2f1ec;
  --muted: #8b8d93;
  --accent: #2f7dff;
  --accent-dim: #1a3d7a;
  --red: #e5232b;
  --bar-h: 3.75rem;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  /* keep iOS rubber-band overscroll from flashing white past the edges */
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: "Oswald", system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  overscroll-behavior-y: contain;
}

.page {
  width: 100%;
  max-width: 40rem;
  min-height: 100dvh;
  padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand {
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: 0.5rem;
  /* Reserve the logo's height so the menu doesn't jump when it loads. */
  min-height: calc(4.5rem + max(1rem, env(safe-area-inset-top)) + 0.5rem);
  box-sizing: border-box;
}

/* Any logo shape fits whole: no circular crop. */
.logo {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  display: block;
}

.brand-title {
  margin: 0;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  font-family: "Oswald", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--fg);
}

#mobile-menu {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.desktop-qr {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: center;
  padding-block: 2rem;
}

/* [hidden] beats the rules above (higher specificity: ID/class + attribute) —
   without this, the browser's default `[hidden] { display: none }` loses
   to `#mobile-menu`/`.desktop-qr` setting display:flex unconditionally. */
#mobile-menu[hidden],
.desktop-qr[hidden] {
  display: none;
}

.qr-image {
  width: min(20rem, 80vw);
  height: auto;
  border-radius: 0.75rem;
  background: #fff;
  padding: 1rem;
}

.qr-caption {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.paginator {
  width: 100%;
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: rgba(6, 6, 7, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  z-index: 5;
}

.paginator--top {
  top: 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.paginator--bottom {
  bottom: 0;
  margin-top: auto;
  padding-top: 0.4rem;
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
}

.nav-btn {
  appearance: none;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #051022;
}

.nav-btn:active:not(:disabled) {
  background: var(--accent-dim);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.page-indicator {
  min-width: 4.5rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.page-current {
  color: var(--fg);
}

.page-sep {
  color: var(--muted);
  margin: 0 0.35rem;
}

.page-total {
  color: var(--muted);
}

.menu-viewport {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-block: 0.75rem;
  touch-action: pan-y;
}

.menu-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.menu-image.is-loading {
  opacity: 0;
}

@media (min-width: 640px) {
  .logo {
    width: 5.5rem;
    height: 5.5rem;
  }

  .brand {
    min-height: calc(5.5rem + max(1rem, env(safe-area-inset-top)) + 0.5rem);
  }

  .menu-viewport {
    align-items: center;
  }

  .menu-image {
    max-height: 78vh;
    width: auto;
  }
}

/* Elements with their own display (e.g. the flex paginators) must still
   disappear when given the hidden attribute. */
[hidden] {
  display: none !important;
}

.menu-status {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.menu-status p {
  margin: 0;
  max-width: 22rem;
  line-height: 1.5;
}

.retry-btn {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

/* Subscription expired: replaces the menu (and the desktop QR code). */
.suspended {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1.25rem;
  text-align: center;
}

.suspended-title {
  margin: 0;
  font-family: "Oswald", system-ui, sans-serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--red);
}

.suspended-text {
  margin: 0;
  max-width: 22rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- the Simple Catalog
   Display mode "catalog" (app.js): a sticky bar of group names, item cards,
   one item in full in a sheet. */

.catalog {
  width: 100%;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.catalog-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-inline: calc(-1 * max(0.75rem, env(safe-area-inset-left)));
  background: rgba(6, 6, 7, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.catalog-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.6rem max(0.75rem, env(safe-area-inset-left));
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.catalog-tabs::-webkit-scrollbar {
  display: none;
}

.catalog-tab {
  flex: none;
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.03em;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.catalog-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.catalog-filter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.75rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}

.catalog-filter input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 2.5rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--rule);
  transition: background-color 150ms ease;
  flex: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 150ms ease;
}

.catalog-filter input:checked + .switch {
  background: var(--accent);
}

.catalog-filter input:checked + .switch::after {
  transform: translateX(1.1rem);
}

.catalog-filter input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.catalog-group {
  padding-top: 1.25rem;
}

.group-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--panel);
}

.group-name {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.group-items {
  display: flex;
  flex-direction: column;
}

.catalog-item {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  padding: 0.9rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  touch-action: manipulation;
}

.catalog-item:first-child {
  border-top: 0;
}

.catalog-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.4rem;
}

.item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.item-name {
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.item-portion,
.item-description {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.item-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-top: 0.25rem;
}

.item-price {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-labels {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.item-photo {
  flex: none;
  width: 6rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 0.6rem;
  background: var(--panel);
}

.catalog-item.is-sold-out .item-name,
.catalog-item.is-sold-out .item-price,
.catalog-item.is-sold-out .item-labels {
  color: var(--muted);
}

.catalog-item.is-sold-out .item-photo {
  filter: grayscale(1);
  opacity: 0.45;
}

.sold-out-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  margin: 0;
}

.label-icon {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
}

.label-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.label-vegetarian,
.label-vegan {
  color: #52c97a;
}

.label-spicy {
  color: #ff6a4d;
}

.label-gluten_free {
  color: #e8b74a;
}

.label-new {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #051022;
  background: var(--accent);
  border-radius: 0.3rem;
  padding: 0.05rem 0.4rem;
}

.catalog-item.is-sold-out .label-icon,
.catalog-item.is-sold-out .label-new {
  filter: grayscale(1);
  opacity: 0.6;
}

.catalog-note {
  margin: 3rem 0;
  text-align: center;
  color: var(--muted);
}

/* One item in full: a sheet rising from the bottom of the phone. */
.catalog-sheet {
  width: 100%;
  max-width: 40rem;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 1rem 1rem 0 0;
  background: var(--panel);
  color: var(--fg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.catalog-sheet::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.catalog-sheet[open] {
  animation: sheet-up 180ms ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(2rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-sheet[open] { animation: none; }
}

.sheet-close {
  position: sticky;
  top: 0.6rem;
  float: right;
  margin: 0.6rem 0.6rem -3rem 0;
  z-index: 1;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 0;
  background: rgba(6, 6, 7, 0.75);
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.sheet-photo {
  display: block;
  width: 100%;
  max-height: 55dvh;
  object-fit: cover;
  background: var(--bg);
}

.catalog-sheet.is-sold-out .sheet-photo {
  filter: grayscale(1);
  opacity: 0.6;
}

.sheet-body {
  padding: 1rem 1.1rem max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sheet-name {
  margin: 0;
  padding-right: 2.5rem;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.sheet-meta {
  margin: 0;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.sheet-labels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.sheet-labels li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

.sheet-description {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.sheet-photo:not([hidden]) + .sheet-body .sheet-name {
  padding-right: 0;
}
