:root {
  --ink: #181614;
  --muted: #625f58;
  --paper: #fcfbf7;
  --warm: #f2eadf;
  --cool: #e4eeec;
  --line: #d7cfc3;
  --accent: #2f645d;
  --accent-deep: #1f4642;
  --clay: #b45d43;
  --sage: #586e55;
  --shadow: 0 18px 42px rgba(31, 28, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--cool) 0, var(--paper) 42%, var(--warm) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent-deep);
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(31, 70, 66, 0.22);
}

.brand-title,
.brand-caption {
  display: block;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.brand-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.city-badge {
  flex-shrink: 0;
  padding: 8px 10px;
  border: 1px solid rgba(47, 100, 93, 0.22);
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.76rem;
  font-weight: 800;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-link {
  padding: 8px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--accent-deep);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
}

.topbar-link.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(47, 100, 93, 0.18);
}

.topbar-link:hover {
  background: rgba(255, 255, 255, 0.72);
}

h1,
h2,
h3,
p,
dd {
  overflow-wrap: anywhere;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.15rem, 8vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brief-screen,
.detail-layout {
  display: grid;
  gap: 22px;
}

.brief-copy {
  display: grid;
  align-content: center;
  padding: 12px 0;
}

.brief-copy p {
  max-width: 600px;
  font-size: 1.02rem;
}

.promise-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.promise-list span,
.pill,
.tag {
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.promise-list span {
  padding: 8px 10px;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 100, 93, 0.18);
}

.brief-panel,
.best-card,
.backup-card,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow);
}

.brief-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.section-heading p,
.section-heading h2 {
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-title {
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 800;
}

.input,
.textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.input {
  min-height: 48px;
  padding: 0 12px;
}

.textarea {
  min-height: 116px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.input:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 100, 93, 0.13);
}

.segment-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.segment,
.custom-budget,
.like-tile,
.primary,
.secondary,
.text-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.segment {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.segment.is-selected {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.budget-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.custom-budget {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.custom-budget.is-selected,
.custom-budget:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 100, 93, 0.15);
}

.budget-prefix {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.custom-budget-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-weight: 800;
}

.custom-budget-input::placeholder {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.like-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
}

.like-tile {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 8px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  text-align: left;
  overflow: hidden;
}

.like-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: #eadfd4;
}

.like-tile span {
  align-self: center;
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 800;
  line-height: 1.2;
}

.like-tile.is-selected {
  border-color: var(--accent-deep);
  background: linear-gradient(180deg, rgba(228, 238, 236, 0.98) 0, rgba(255, 255, 255, 0.98) 100%);
  box-shadow:
    0 0 0 4px rgba(47, 100, 93, 0.32),
    0 10px 24px rgba(47, 100, 93, 0.16);
}

.like-tile.is-selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(31, 70, 66, 0.28);
}

.like-tile.is-selected span {
  color: var(--accent-deep);
}

.like-tile.is-selected img {
  outline: 2px solid rgba(47, 100, 93, 0.28);
  outline-offset: -2px;
}

.custom-like {
  align-content: center;
  min-height: 136px;
  padding: 12px;
}

.custom-like span {
  font-size: 0.92rem;
}

.custom-like-input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.custom-like-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 100, 93, 0.13);
}

.primary,
.secondary,
.text-button {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  padding: 0 16px;
  text-decoration: none;
}

.primary {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 10px 22px rgba(47, 100, 93, 0.22);
}

.secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.text-button {
  color: var(--accent-deep);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.primary:hover,
.secondary:hover,
.segment:hover,
.like-tile:hover {
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

.results-screen {
  display: grid;
  gap: 18px;
}

.results-header {
  display: grid;
  gap: 14px;
  align-items: end;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.results-actions .secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.results-header h1 {
  max-width: 760px;
  margin-bottom: 10px;
}

.results-header p {
  margin-bottom: 0;
}

.best-card {
  display: grid;
  overflow: hidden;
}

.best-card > img,
.backup-card img,
.detail-image {
  width: 100%;
  object-fit: cover;
  display: block;
  background: #eadfd4;
}

.best-card > img {
  aspect-ratio: 16 / 10;
}

.best-body,
.backup-body,
.detail-panel {
  display: grid;
  gap: 14px;
}

.best-body,
.backup-body {
  padding: 16px;
}

.best-body h2,
.backup-body h3,
.detail-panel h1 {
  margin-bottom: 0;
}

.card-kicker,
.merchant-line,
.card-meta,
.delivery-line {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.card-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  padding: 6px 9px;
  color: #fff;
  background: var(--clay);
}

.delivery-line {
  margin-bottom: 0;
  color: var(--accent-deep);
  line-height: 1.35;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.detail-list.compact {
  margin-top: 2px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 6px 8px;
  color: #36342f;
  background: #e7eee6;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.action-row .primary,
.action-row .secondary {
  flex: 1 1 160px;
}

.backup-section {
  display: grid;
  gap: 12px;
}

.like-match {
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.backup-body .like-match {
  margin: 0 0 4px;
}

.backup-grid {
  display: grid;
  gap: 12px;
}

.backup-card {
  display: grid;
  overflow: hidden;
}

.backup-card img {
  aspect-ratio: 16 / 9;
}

.backup-body {
  align-content: space-between;
}

.compact-actions {
  justify-content: space-between;
}

.compact-actions .primary {
  flex: 1 1 150px;
}

.back-link {
  justify-self: start;
  padding: 0;
}

.detail-image {
  border-radius: 8px;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow);
}

.detail-panel {
  padding: 18px;
}

.reminder-panel,
.saved-reminders,
.reminders-screen,
.reminder-settings-screen,
.empty-reminders {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow);
}

.reminder-panel,
.reminders-screen,
.reminder-settings-screen,
.empty-reminders {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.reminder-panel--saved {
  background:
    linear-gradient(180deg, rgba(228, 238, 236, 0.95) 0, rgba(255, 253, 249, 0.96) 100%);
}

.reminder-form {
  display: grid;
  gap: 14px;
}

.reminder-copy,
.reminder-note,
.reminder-meta,
.empty-reminders p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.reminder-note {
  font-size: 0.82rem;
}

.reminder-note--error {
  color: #9b3d3d;
}

.reminder-account-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.account-reminders-section {
  display: grid;
  gap: 12px;
}

.account-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.auth-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-panel--disabled code {
  font-size: 0.82em;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-toggle-button {
  justify-self: center;
}

.auth-google-button {
  font-weight: 800;
}

.auth-passkey-notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff8e8;
  border: 1px solid #f0d48a;
  color: #6a4d00;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-passkey-notice--subtle {
  background: #f7f8fa;
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-external-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reminder-frequency-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.saved-reminders {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 4px;
}

.saved-reminders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-reminders-header .eyebrow {
  margin-bottom: 0;
}

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

.reminder-card {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reminder-card h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.reminder-settings-button {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.reminders-screen,
.reminder-settings-screen {
  gap: 18px;
}

.reminder-settings-summary {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reminder-settings-footer {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.reminder-cancel-button {
  color: #8f3a3a;
  border-color: rgba(143, 58, 58, 0.28);
  background: rgba(255, 245, 245, 0.95);
}

.reminder-cancel-button:hover {
  background: rgba(255, 235, 235, 0.98);
}

.loading-screen {
  display: grid;
  place-items: center;
  min-height: 52vh;
}

.loading-card {
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-card h1 {
  margin-bottom: 0;
}

.loading-card p {
  margin-bottom: 0;
}

.loading-likes {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 4px;
}

.loading-likes-label {
  margin: 0;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.loading-likes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loading-likes-list li {
  padding: 8px 10px;
  border: 1px solid rgba(47, 100, 93, 0.18);
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  margin: 8px auto 0;
  border: 3px solid rgba(47, 100, 93, 0.18);
  border-top-color: var(--accent-deep);
  border-radius: 999px;
  animation: sirsee-spin 900ms linear infinite;
}

@keyframes sirsee-spin {
  to {
    transform: rotate(360deg);
  }
}

.error-banner {
  padding: 12px 14px;
  border: 1px solid rgba(180, 93, 67, 0.35);
  border-radius: 8px;
  color: #7a3b28;
  background: rgba(180, 93, 67, 0.1);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 26px;
  }

  .brief-screen {
    grid-template-columns: minmax(240px, 0.52fr) minmax(0, 1fr);
    align-items: start;
  }

  .brief-copy {
    position: sticky;
    top: 24px;
    align-content: start;
    padding-top: 20px;
  }

  .brief-copy h1 {
    font-size: clamp(2.2rem, 5.4vw, 4.1rem);
  }

  .field-grid,
  .backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .results-actions {
    justify-content: flex-end;
  }

  .best-card,
  .detail-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.85fr);
  }

  .best-card > img {
    height: 100%;
    min-height: 420px;
    aspect-ratio: auto;
  }

  .best-body,
  .detail-panel {
    padding: 24px;
  }
}

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

  .topbar {
    align-items: flex-start;
  }

  .city-badge {
    max-width: 130px;
    text-align: center;
  }

  h1 {
    font-size: clamp(2.05rem, 13vw, 3.4rem);
  }

  .brief-panel {
    padding: 16px;
  }

  .results-actions {
    width: 100%;
    display: grid;
  }

  .results-header .secondary,
  .primary,
  .secondary,
  .text-button {
    width: 100%;
  }

  .back-link {
    width: auto;
  }

  .action-row {
    display: grid;
  }

  .reminder-frequency-group {
    grid-template-columns: 1fr;
  }
}
