/* Mobile first: everything is designed for a ~390px phone, then widened. */

:root {
  --bg: #f7f3ee;
  --surface: #ffffff;
  --surface-2: #efe9e1;
  --text: #1f1a14;
  --muted: #6d6458;
  --line: #e3dcd2;
  --accent: #d2492a;
  --accent-text: #ffffff;
  --accent-soft: #fbe3db;
  --yes: #2f8a57;
  --no: #c23b3b;
  --shadow: 0 1px 2px rgb(31 26 20 / 6%), 0 6px 20px rgb(31 26 20 / 6%);
  --radius: 18px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --surface: #221e19;
    --surface-2: #2c2721;
    --text: #f3ede5;
    --muted: #a99f92;
    --line: #3a342c;
    --accent: #ef6a4a;
    --accent-text: #1a0f0a;
    --accent-soft: #3d2219;
    --yes: #4fbf80;
    --no: #ee6b6b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--accent); }

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 0.25rem; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.fine { color: var(--muted); font-size: 0.875rem; text-align: center; margin-top: 1rem; }
.error { color: var(--no); font-weight: 600; margin: 0; }
.notice { background: var(--accent-soft); padding: 10px 14px; border-radius: 12px; }

/* --- chrome ---------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { font-weight: 700; letter-spacing: -0.01em; }
.city-chip {
  font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600;
}
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* --- controls -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--no); background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.6; }

.stack { display: flex; flex-direction: column; gap: 10px; }
label { font-weight: 600; font-size: 0.95rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.code-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- cards ----------------------------------------------------------------- */

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
}
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px;
}
.tag.wild { color: var(--muted); background: var(--surface-2); }
.section-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
.card.stack > p { margin: 0; }
.card.stack > label { margin-top: 6px; }

.week-title { margin-top: 4px; }
.learned { color: var(--muted); font-size: 0.9rem; margin: -4px 0 14px; }

.pick-meta { display: flex; gap: 6px; margin-bottom: 10px; }
.pick h2 { font-size: 1.3rem; }
.when { font-weight: 700; margin: 6px 0 0; }
.where { color: var(--muted); margin: 0 0 10px; }
.reason { margin: 0 0 14px; }
.pick-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pick-actions .btn.primary { flex: 1 1 120px; }
.rate { display: flex; gap: 6px; }
.rate button {
  min-width: 48px; min-height: 48px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-size: 1.25rem; cursor: pointer; color: var(--text);
}
.rate button.text { font-size: 0.85rem; font-weight: 600; padding: 0 12px; color: var(--muted); }
.rate button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.banner p { margin: 0; }
.banner[hidden] { display: none; }
.empty { text-align: center; padding: 32px 20px; }
.install-hint { color: var(--muted); font-size: 0.9rem; text-align: center; }

.spinner {
  width: 36px; height: 36px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- landing / login ------------------------------------------------------- */

.hero { text-align: center; padding: 12vh 4px 24px; }
.hero h1 { font-size: 2.1rem; }
.hero-icon { border-radius: 18px; margin-bottom: 18px; }
.lede { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }
.steps { padding-left: 1.2rem; color: var(--muted); }
.steps li { margin-bottom: 8px; }
.narrow { padding-top: 8vh; }

/* --- onboarding deck ------------------------------------------------------- */

.onboarding .page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.onboard-head { margin-bottom: 14px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

.deck { position: relative; height: min(50dvh, 400px); margin-bottom: 18px; }
.swipe {
  position: absolute; inset: 0; margin: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.swipe.dragging { transition: none; }
.swipe .tag { align-self: flex-start; }
.swipe h2 { font-size: 1.45rem; margin-top: 6px; }
.swipe .desc { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; margin: 0; }
.stamp {
  position: absolute; top: 18px; padding: 4px 12px; border: 3px solid; border-radius: 10px;
  font-weight: 800; font-size: 1.2rem; text-transform: uppercase; opacity: 0; transform: rotate(-12deg);
}
.stamp.yes { right: 18px; color: var(--yes); }
.stamp.no { left: 18px; color: var(--no); transform: rotate(12deg); }

.swipe-buttons { display: flex; align-items: center; justify-content: center; gap: 22px; }
.swipe-buttons[hidden] { display: none; }
.round {
  width: 64px; height: 64px; border-radius: 50%; border: 0; box-shadow: var(--shadow);
  background: var(--surface); font-size: 1.6rem; font-weight: 700; cursor: pointer;
}
.round.yes { color: var(--yes); }
.round.no { color: var(--no); }
.skip { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; min-height: 48px; cursor: pointer; }
.notes[hidden] { display: none; }

/* --- history --------------------------------------------------------------- */

.history-week { margin-bottom: 18px; }
.history-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.history-list li {
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.history-list li:last-child { border-bottom: 0; }
.h-title { font-weight: 600; }
.h-meta { grid-column: 1; color: var(--muted); font-size: 0.875rem; }
.h-rating { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); font-size: 0.9rem; }

.account { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }

/* --- wider screens --------------------------------------------------------- */

@media (min-width: 720px) {
  .page { padding-top: 32px; }
  .tabbar { left: 50%; right: auto; width: 420px; transform: translateX(-50%); bottom: 16px;
            border: 1px solid var(--line); border-radius: 20px; height: var(--tabbar-h); padding-bottom: 0; }
}

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

/* --- Hey Friday: landing, sharing, taste type ------------------------------ */

.brand { color: var(--text); text-decoration: none; }
.center { text-align: center; }
.btn.big { min-height: 56px; font-size: 1.05rem; border-radius: 16px; }

.hero h1 { font-size: 2.4rem; letter-spacing: -0.03em; }
.hero { padding-top: 9vh; }
.demo { margin: 28px 0 8px; }
.demo .section-label { text-align: center; margin-bottom: 10px; }
.demo-card { transform: rotate(-1.2deg); }
.demo-card .btn { pointer-events: none; }
.steps { list-style: none; padding: 0; margin: 28px 0; display: grid; gap: 14px; color: var(--text); }
.steps li { display: flex; gap: 14px; align-items: flex-start; margin: 0; }
.step-n {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800;
}
.closing { margin-top: 8px; }

.week-title { margin-bottom: 0; }
.week-sub { margin: 0 0 14px; }

.pick-actions .btn { flex: 1 1 0; white-space: nowrap; padding: 0 14px; }
.rate { align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.rate-label { color: var(--muted); font-size: 0.85rem; margin-right: auto; }

.taste-mini { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.taste-emoji { font-size: 2rem; }
.chev { margin-left: auto; font-size: 1.6rem; color: var(--muted); }

.taste-card {
  text-align: center; padding: 36px 24px 22px; margin: 8px 0 20px; border-radius: 28px;
  background: linear-gradient(160deg, var(--accent) 0%, #8f2a7a 100%); color: #fff;
  box-shadow: 0 12px 40px rgb(210 73 42 / 30%);
}
.taste-card h1 { font-size: 2.2rem; margin: 6px 0 10px; }
.taste-card p { margin: 0 auto; max-width: 30ch; font-size: 1.05rem; opacity: 0.95; }
.taste-big-emoji { font-size: 4.5rem; line-height: 1; }
.taste-card .taste-brand { margin-top: 26px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.taste-card + .btn { margin-bottom: 10px; }

.public .page { padding-bottom: 40px; }
.invite-kicker { font-weight: 700; color: var(--accent); margin: 8px 0 4px; }
.invite-title { font-size: 1.6rem; margin-bottom: 16px; }
.cta-card { margin-top: 18px; }
.cta-card h2 { font-size: 1.2rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 10; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
}
.toast[hidden] { display: none; }
