:root {
  --bg: #eefcfb;
  --bg-accent: #fff8e7;
  --surface: rgba(255,255,255,0.86);
  --surface-strong: rgba(255,255,255,0.96);
  --text: #0f172a;
  --muted: #4b5563;
  --brand: #0ea5a8;
  --brand-deep: #0f766e;
  --coral: #fb7185;
  --gold: #f59e0b;
  --lime: #84cc16;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 45px rgba(15,23,42,0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

html[data-theme="dark"] {
  --bg: #082627;
  --bg-accent: #113436;
  --surface: rgba(5,20,21,0.74);
  --surface-strong: rgba(5,20,21,0.92);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --brand: #5eead4;
  --brand-deep: #99f6e4;
  --coral: #fb7185;
  --gold: #fbbf24;
  --lime: #bef264;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 20px 45px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(251,113,133,0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(14,165,168,0.20), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: #111827; color: white; padding: 0.8rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; border-radius: 12px; }

.ambient {
  position: fixed; inset: auto; width: 240px; height: 240px; filter: blur(50px); opacity: 0.42; pointer-events: none; z-index: 0;
}
.ambient-one { top: 10%; left: -70px; background: rgba(94,234,212,0.65); }
.ambient-two { right: -70px; bottom: 16%; background: rgba(251,191,36,0.45); }

.app-frame {
  position: relative; z-index: 1; max-width: 470px; margin: 0 auto; min-height: 100vh;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(108px + env(safe-area-inset-bottom));
}

.topbar {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; margin-bottom: 16px;
}
.profile-trigger, .round-button, .nav-item, .primary-button, .secondary-button, .text-button, .chip-button, .reward-action, .ghost-button, .pill-link, .route-link, .mini-pill {
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.profile-trigger:hover, .round-button:hover, .primary-button:hover, .secondary-button:hover, .reward-action:hover, .ghost-button:hover, .pill-link:hover { transform: translateY(-1px); }
.profile-trigger, .round-button {
  background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 18px; width: 48px; height: 48px;
  display: inline-flex; justify-content: center; align-items: center; position: relative;
}
.round-button svg, .nav-item svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 12px; min-width: 0; background: var(--surface-strong); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
.brand-sun { width: 38px; height: 38px; border-radius: 999px; background: linear-gradient(135deg, #fb7185, #f59e0b 60%, #fde047); display: inline-flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.brand-wave { width: 34px; height: 14px; border-radius: 999px 999px 0 0; background: rgba(255,255,255,0.94); margin-bottom: 3px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 0.98rem; line-height: 1.05; }
.brand-copy small { color: var(--brand-deep); font-size: 0.72rem; letter-spacing: 0.18em; font-weight: 800; }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: linear-gradient(135deg, rgba(14,165,168,0.22), rgba(251,191,36,0.22)); display: grid; place-items: center; font-weight: 800; }
.avatar-large { width: 64px; height: 64px; font-size: 1.35rem; }
.status-dot { position: absolute; right: 11px; bottom: 11px; width: 10px; height: 10px; border-radius: 999px; background: var(--lime); border: 2px solid var(--surface-strong); }

#app { display: flex; flex-direction: column; gap: 16px; }
.card, .hero-card, .feature-card, .metric-card, .member-card, .promo-card, .store-card, .reward-card, .menu-card, .timeline-card {
  background: var(--surface); backdrop-filter: blur(20px); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius-lg);
}
.hero-card { overflow: hidden; }
.hero-media { position: relative; aspect-ratio: 4 / 4.1; background: #cbd5e1; }
.hero-media img, .photo-thumb img, .community-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: auto 0 0 0; padding: 22px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, rgba(15,23,42,0.02), rgba(15,23,42,0.78)); color: white;
}
.badge-row, .stack, .button-row, .pill-row, .stats-grid, .feature-grid, .section-head, .page-head, .store-meta, .quick-grid, .menu-tags, .history-list, .rewards-grid, .locations-grid, .gallery-row {
  display: grid; gap: 12px;
}
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge, .mini-pill, .pill-link, .eyebrow-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.45rem 0.78rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
}
.badge { background: rgba(255,255,255,0.18); color: #fff; backdrop-filter: blur(10px); }
.hero-copy h1, .page-head h1, .page-head h2, .sheet-header h2, .reward-modal h2 { margin: 0; line-height: 1.05; }
.hero-copy h1 { font-size: 2rem; }
.hero-copy p { margin: 0; color: rgba(255,255,255,0.92); }
.button-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
.primary-button, .secondary-button, .reward-action, .ghost-button, .pill-link, .route-link {
  border: none; border-radius: 16px; padding: 0.95rem 1rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.primary-button, .reward-action, .route-link {
  background: linear-gradient(135deg, var(--brand), #0891b2); color: white; box-shadow: 0 16px 32px rgba(14,165,168,0.25);
}
.secondary-button, .ghost-button, .pill-link {
  background: rgba(255,255,255,0.16); color: inherit; border: 1px solid rgba(255,255,255,0.24);
}
html[data-theme="light"] .secondary-button, html[data-theme="light"] .ghost-button, html[data-theme="light"] .pill-link, :root .card .ghost-button {
  background: rgba(255,255,255,0.82); border-color: var(--border);
}

.section-card { padding: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 4px 2px 0; }
.eyebrow, .eyebrow-chip {
  color: var(--brand-deep); font-size: 0.72rem; letter-spacing: .18em; font-weight: 800; text-transform: uppercase;
}
.eyebrow-chip { background: rgba(14,165,168,0.12); width: fit-content; }
.page-head p, .section-copy, .support-copy, .store-copy, .fine-print, .reward-copy, .member-copy, .stat-copy, .menu-copy, .muted { color: var(--muted); margin: 0; }

.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 6px; }
.metric-card { padding: 14px; }
.metric-card strong { display: block; font-size: 1.25rem; margin-bottom: 3px; }
.metric-card span { color: var(--muted); font-size: 0.83rem; }
.progress-card { padding: 18px; }
.progress-track { width: 100%; height: 12px; background: rgba(148,163,184,0.2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--brand)); border-radius: inherit; }
.progress-copy { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; color: var(--muted); }
.quick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.feature-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.feature-card { overflow: hidden; }
.photo-thumb { aspect-ratio: 1 / 1; overflow: hidden; }
.feature-body { padding: 14px; display: grid; gap: 6px; }
.feature-body h3, .store-body h3, .reward-content h3, .menu-body h3, .timeline-card h3 { margin: 0; font-size: 1.02rem; }
.feature-body p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { padding: 0.36rem 0.6rem; background: rgba(14,165,168,0.10); border-radius: 999px; font-size: 0.74rem; font-weight: 700; color: var(--brand-deep); }

.member-card { overflow: hidden; }
.member-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px 18px 10px; }
.member-body { padding: 0 18px 18px; display: grid; gap: 16px; }
.member-number { font-size: 1.7rem; font-weight: 900; letter-spacing: 0.08em; }
.member-stripes { height: 14px; border-radius: 999px; background: linear-gradient(90deg, #fb7185 0 16%, #f59e0b 16% 32%, #fde047 32% 48%, #34d399 48% 64%, #38bdf8 64% 80%, #a78bfa 80% 100%); }
.qr-box { display: grid; place-items: center; width: 148px; height: 148px; border-radius: 20px; background: repeating-linear-gradient(90deg, rgba(15,23,42,0.08) 0 8px, transparent 8px 16px), repeating-linear-gradient(0deg, rgba(15,23,42,0.08) 0 8px, transparent 8px 16px), var(--surface-strong); border: 1px solid var(--border); }
.qr-box span { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 18px; background: white; color: var(--brand-deep); font-weight: 900; box-shadow: inset 0 0 0 12px rgba(14,165,168,0.09); }
.staff-demo { padding: 18px; display: grid; gap: 14px; }
.demo-form { display: grid; gap: 12px; }
.inline-field { display: grid; gap: 8px; }
.input, input[type="date"] {
  width: 100%; padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-strong); color: var(--text);
}
.helper-note { font-size: 0.84rem; color: var(--muted); }

.rewards-grid { grid-template-columns: 1fr; }
.reward-card { overflow: hidden; }
.reward-card[data-ready="true"] { outline: 2px solid rgba(14,165,168,0.22); }
.reward-banner { padding: 18px; background: linear-gradient(135deg, rgba(14,165,168,0.13), rgba(251,191,36,0.12)); display: flex; justify-content: space-between; gap: 12px; }
.reward-value { font-size: 1.8rem; font-weight: 900; }
.reward-content { padding: 16px 18px 18px; display: grid; gap: 10px; }
.reward-status { font-size: 0.86rem; color: var(--muted); }
.reward-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.84rem; }
.reward-action[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.store-card { overflow: hidden; }
.store-photo { aspect-ratio: 1.35 / 1; background: #e2e8f0; }
.store-photo img { width: 100%; height: 100%; object-fit: cover; }
.store-body { padding: 18px; display: grid; gap: 12px; }
.store-meta { grid-template-columns: repeat(2, minmax(0,1fr)); }
.store-item { padding: 12px; border-radius: 16px; background: rgba(14,165,168,0.08); display: grid; gap: 4px; }
.store-item small { color: var(--muted); }
.community-photo { aspect-ratio: 1.35 / 1; overflow: hidden; border-radius: 18px; }

.menu-card { overflow: hidden; }
.menu-top { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 14px; }
.menu-top .photo-thumb { aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; }
.menu-body { display: grid; gap: 8px; }
.menu-tags { grid-template-columns: repeat(2, minmax(0,1fr)); }
.menu-pill { font-size: 0.8rem; padding: 0.55rem 0.7rem; background: rgba(148,163,184,0.14); border-radius: 12px; }
.combo-grid { display: grid; gap: 12px; }
.build-grid { display: grid; gap: 10px; }
.build-block { padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.48); border: 1px solid var(--border); }
html[data-theme="dark"] .build-block { background: rgba(255,255,255,0.03); }
.build-block strong { display: block; margin-bottom: 8px; }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 0.44rem 0.68rem; border-radius: 999px; background: rgba(14,165,168,0.1); color: var(--brand-deep); font-size: 0.8rem; font-weight: 700; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.history-item:first-child { border-top: none; }
.history-item strong { display: block; }
.history-item time { color: var(--muted); font-size: 0.84rem; }
.delta-plus { color: var(--brand-deep); font-weight: 800; }
.delta-minus { color: var(--coral); font-weight: 800; }

.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(438px, calc(100vw - 22px)); display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 10px;
  background: rgba(255,255,255,0.88); backdrop-filter: blur(18px); border: 1px solid rgba(255,255,255,0.35); border-radius: 26px; box-shadow: var(--shadow);
}
html[data-theme="dark"] .bottom-nav { background: rgba(5,20,21,0.88); border-color: rgba(255,255,255,0.07); }
.nav-item { padding: 8px 4px; border-radius: 18px; color: var(--muted); display: grid; place-items: center; gap: 4px; font-weight: 700; }
.nav-item small { font-size: 0.72rem; }
.nav-item.active { color: var(--brand-deep); background: rgba(14,165,168,0.12); }
.scan-bubble { width: 48px; height: 48px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), #0891b2); color: white; display: grid; place-items: center; box-shadow: 0 16px 32px rgba(14,165,168,0.24); }
.nav-scan { transform: translateY(-20px); }
.nav-scan small { margin-top: -2px; }

.sheet-dialog, .reward-dialog { border: none; padding: 0; background: transparent; }
.sheet-dialog::backdrop, .reward-dialog::backdrop { background: rgba(15,23,42,0.42); backdrop-filter: blur(6px); }
.sheet-card, .reward-modal {
  width: min(460px, calc(100vw - 24px)); border: 1px solid var(--border); background: var(--surface-strong); color: var(--text); border-radius: 28px; box-shadow: var(--shadow);
}
.sheet-card { padding: 14px 16px 20px; display: grid; gap: 14px; }
.sheet-handle { width: 48px; height: 6px; border-radius: 999px; background: rgba(148,163,184,0.4); margin: 4px auto 0; }
.sheet-header, .profile-preview { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.profile-preview span:last-child { color: var(--muted); display: block; font-size: 0.9rem; margin-top: 4px; }
.close-button { border: none; background: rgba(148,163,184,0.14); border-radius: 999px; width: 38px; height: 38px; font-size: 1.5rem; line-height: 1; color: inherit; }
.field { display: grid; gap: 7px; font-weight: 700; }
.field input { margin-top: 0; }
.consent-row { display: flex; gap: 12px; align-items: start; font-weight: 600; }
.consent-row input { margin-top: 0.2rem; }
.consent-row small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.text-button { border: none; padding: 0; background: transparent; font-weight: 800; }
.danger-text { color: var(--coral); justify-self: start; }
.reward-modal { padding: 22px; display: grid; gap: 12px; text-align: center; }
.modal-close { justify-self: end; }
.reward-burst { width: 70px; height: 70px; border-radius: 999px; background: linear-gradient(135deg, #fde047, #f59e0b); display: grid; place-items: center; font-size: 2rem; margin: -10px auto 4px; }
.redemption-code { padding: 1rem; border-radius: 18px; background: rgba(14,165,168,0.1); font-size: 1.2rem; font-weight: 900; letter-spacing: 0.12em; color: var(--brand-deep); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(30px); bottom: calc(102px + env(safe-area-inset-bottom)); z-index: 40; opacity: 0; pointer-events: none;
  background: rgba(15,23,42,0.92); color: white; padding: 0.88rem 1rem; border-radius: 16px; box-shadow: var(--shadow); transition: all .26s ease;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.noscript { padding: 1rem; margin: 1rem; border-radius: 16px; background: #fee2e2; color: #7f1d1d; }

@media (max-width: 390px) {
  .feature-grid, .quick-grid, .button-row, .store-meta, .menu-tags { grid-template-columns: 1fr; }
  .menu-top { grid-template-columns: 1fr; }
  .hero-copy h1 { font-size: 1.72rem; }
}
