:root {
  --paper: #fffaf6;
  --paper-strong: #ffffff;
  --ink: #2d211d;
  --ink-soft: #77655d;
  --line: rgba(103, 70, 55, 0.12);
  --coral: #f05b49;
  --coral-dark: #d84436;
  --coral-soft: #ffebe5;
  --gold: #f6a94a;
  --mint: #5f9d83;
  --shadow: 0 20px 50px rgba(83, 48, 34, 0.10);
  --nav-height: 76px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #f4ede8;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #f4ede8;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 211, 184, 0.45), transparent 28rem),
    linear-gradient(160deg, #f8f1eb, #efe7e1);
}

button,
input { font: inherit; }

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

.app-shell {
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px calc(var(--nav-height) + 34px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 92% -4%, rgba(255, 211, 180, 0.42), transparent 16rem),
    var(--paper);
  box-shadow: 0 0 60px rgba(72, 43, 31, 0.08);
  overflow: hidden;
}

.page { display: none; animation: page-in 240ms ease-out; }
.page.is-active { display: block; }

.hero { padding: 16px 4px 18px; }
.hero h1 {
  max-width: 360px;
  margin: 8px 0 7px;
  font-size: clamp(30px, 9vw, 38px);
  line-height: 1.14;
  letter-spacing: -0.045em;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

.eyebrow,
.section-kicker {
  color: var(--coral-dark);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.search-box {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 25px rgba(89, 56, 41, 0.06);
  backdrop-filter: blur(16px);
}
.search-box:focus-within {
  border-color: rgba(240, 91, 73, 0.42);
  box-shadow: 0 0 0 4px rgba(240, 91, 73, 0.08);
}
.search-box svg {
  width: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
}
.search-box input::placeholder { color: #aa9b95; }
.clear-search {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: #f2ebe7;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.clear-search.is-visible { opacity: 1; pointer-events: auto; }

.chip-strip {
  display: flex;
  gap: 9px;
  margin: 15px -18px 2px;
  padding: 0 18px 9px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chip-strip::-webkit-scrollbar { display: none; }

.filter-chip,
.random-tag {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #695851;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: transform 140ms ease, color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.filter-chip:active,
.random-tag:active { transform: scale(0.96); }
.filter-chip.is-active,
.random-tag.is-active {
  border-color: var(--coral);
  color: white;
  background: linear-gradient(135deg, var(--coral), #ef745f);
  box-shadow: 0 8px 18px rgba(240, 91, 73, 0.22);
}

.content-section { margin-top: 25px; }
.all-section { margin-top: 32px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.section-heading h2,
.filter-card-heading h2 {
  margin: 3px 0 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}
.count-pill {
  flex: 0 0 auto;
  margin-bottom: 2px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--coral-dark);
  background: var(--coral-soft);
  font-size: 12px;
  font-weight: 700;
}

.featured-list {
  display: grid;
  grid-auto-columns: 78%;
  grid-auto-flow: column;
  gap: 12px;
  margin: 0 -18px;
  padding: 0 18px 7px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.featured-list::-webkit-scrollbar { display: none; }
.featured-card {
  position: relative;
  min-height: 174px;
  padding: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: white;
  text-align: left;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}
.featured-card::before,
.dish-visual::before,
.sheet-visual::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), transparent 45%);
  content: "";
}
.tone-0 { background: linear-gradient(145deg, #d84b3e, #8e2927); }
.tone-1 { background: linear-gradient(145deg, #e7823f, #ac462e); }
.tone-2 { background: linear-gradient(145deg, #789c79, #345f50); }
.tone-3 { background: linear-gradient(145deg, #b85a6c, #79354b); }
.tone-4 { background: linear-gradient(145deg, #a67a52, #684a38); }
.tone-5 { background: linear-gradient(145deg, #d7a33d, #9b6427); }
.featured-emoji {
  position: absolute;
  top: 19px;
  right: 20px;
  font-size: 54px;
  filter: drop-shadow(0 9px 14px rgba(53, 24, 13, 0.22));
  transform: rotate(4deg);
}
.featured-card-content { position: relative; z-index: 1; padding-top: 66px; }
.featured-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 23px;
  letter-spacing: -0.025em;
}
.featured-card span {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.category-block { margin-top: 26px; }
.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}
.category-heading h3 { margin: 0; font-size: 18px; }
.category-heading span { color: #a18f87; font-size: 12px; }
.dish-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.dish-card {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 21px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  text-align: left;
  box-shadow: 0 9px 24px rgba(83, 50, 36, 0.055);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.dish-card:active { transform: scale(0.98); box-shadow: 0 5px 14px rgba(83, 50, 36, 0.07); }
.dish-visual {
  position: relative;
  display: grid;
  height: 84px;
  place-items: center;
  overflow: hidden;
  color: white;
  font-size: 39px;
}
.dish-visual span { position: relative; z-index: 1; filter: drop-shadow(0 7px 10px rgba(56, 28, 17, 0.22)); }
.dish-card-body { padding: 13px 13px 14px; }
.dish-card strong {
  display: block;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-tags { display: flex; min-width: 0; gap: 5px; overflow: hidden; }
.mini-tag {
  min-width: 0;
  overflow: hidden;
  padding: 5px 7px;
  border-radius: 7px;
  color: #8a6154;
  background: #fff0ea;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 50px 18px 30px;
  color: var(--ink-soft);
  text-align: center;
}
.empty-icon { font-size: 46px; }
.empty-state h3 { margin: 12px 0 6px; color: var(--ink); }
.empty-state p { margin: 0 0 20px; font-size: 14px; }

.random-hero { padding-bottom: 15px; }
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f3ebe6;
}
.mode-button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.mode-button.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 6px 16px rgba(76, 47, 34, 0.08);
}

.random-filter-card {
  margin-top: 16px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
}
.filter-card-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.filter-card-heading h2 { font-size: 18px; }
.text-button {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  color: var(--coral-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.random-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.random-tag { min-height: 36px; padding: 0 12px; font-size: 12px; }
.pool-summary { margin: 13px 0 0; color: #9a887f; font-size: 12px; }

.result-card {
  position: relative;
  display: flex;
  min-height: 320px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  margin-top: 16px;
  padding: 30px 23px;
  overflow: hidden;
  border-radius: 30px;
  color: white;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 205, 126, 0.45), transparent 26%),
    radial-gradient(circle at 14% 86%, rgba(249, 95, 79, 0.36), transparent 28%),
    linear-gradient(145deg, #5c302a, #2e2220 68%);
  text-align: center;
  box-shadow: 0 24px 54px rgba(62, 37, 30, 0.24);
}
.result-card.is-spinning .result-emoji { animation: spin-pop 130ms ease-in-out infinite alternate; }
.result-card.is-revealed { animation: reveal-card 420ms cubic-bezier(.2,.8,.2,1); }
.result-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
}
.orbit-one { width: 290px; height: 290px; }
.orbit-two { width: 220px; height: 220px; border-style: dashed; transform: rotate(30deg); }
.result-emoji {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 14px;
  font-size: 68px;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.25));
}
.result-overline {
  position: relative;
  z-index: 1;
  color: #ffc7b5;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
}
.result-card h2 {
  position: relative;
  z-index: 1;
  margin: 7px 0 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}
.result-card p {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.55;
}
.result-tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 16px;
}
.result-tag,
.sheet-tag {
  padding: 6px 9px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(12px);
}

.random-actions { display: grid; gap: 10px; margin-top: 14px; }
.primary-button,
.secondary-button {
  min-height: 56px;
  border-radius: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--coral), #ef765d);
  box-shadow: 0 12px 26px rgba(240, 91, 73, 0.26);
}
.primary-button:active { transform: translateY(1px) scale(0.995); }
.secondary-button {
  border: 1px solid rgba(240, 91, 73, 0.24);
  color: var(--coral-dark);
  background: white;
}
.button-spark { margin-right: 7px; }
.accept-button { width: 100%; }

.future-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 19px;
  padding: 15px;
  border: 1px dashed rgba(152, 113, 95, 0.24);
  border-radius: 20px;
  color: var(--ink-soft);
  background: rgba(246, 237, 231, 0.54);
}
.future-icon { font-size: 25px; }
.future-slot div:nth-child(2) { min-width: 0; flex: 1; }
.future-slot strong { display: block; color: #64524a; font-size: 13px; }
.future-slot span { display: block; margin-top: 3px; font-size: 11px; }
.future-badge {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-radius: 7px;
  color: #9b7a6c;
  background: rgba(255, 255, 255, 0.7);
  font-size: 10px !important;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}
.nav-inner {
  display: grid;
  width: min(100%, 430px);
  min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: 1fr 1fr;
  margin: 0 auto;
  padding: 8px 28px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(104, 72, 58, 0.10);
  background: rgba(255, 250, 246, 0.90);
  box-shadow: 0 -15px 35px rgba(74, 43, 30, 0.08);
  backdrop-filter: blur(24px) saturate(150%);
  pointer-events: auto;
}
.nav-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 4px;
  border: 0;
  color: #a39189;
  background: transparent;
  flex-direction: column;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.nav-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-button.is-active { color: var(--coral); }

.sheet-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgba(37, 26, 23, 0.38);
  backdrop-filter: blur(4px);
}
.dish-sheet {
  position: fixed;
  z-index: 61;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 430px);
  max-height: 88svh;
  margin: 0 auto;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 30px 30px 0 0;
  background: var(--paper-strong);
  box-shadow: 0 -24px 70px rgba(50, 29, 22, 0.24);
  animation: sheet-up 260ms cubic-bezier(.2,.8,.2,1);
}
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 12px; border-radius: 999px; background: #e3d8d2; }
.sheet-close {
  position: absolute;
  z-index: 2;
  top: 25px;
  right: 28px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(40, 28, 24, 0.28);
  font-size: 24px;
  backdrop-filter: blur(12px);
}
.sheet-visual {
  position: relative;
  display: grid;
  height: 170px;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  color: white;
  font-size: 75px;
}
.sheet-visual span { position: relative; z-index: 1; filter: drop-shadow(0 12px 18px rgba(50, 26, 17, 0.22)); }
.sheet-category { display: block; margin-top: 18px; color: var(--coral-dark); font-size: 11px; font-weight: 750; letter-spacing: 0.12em; }
.dish-sheet h2 { margin: 6px 0 8px; font-size: 29px; letter-spacing: -0.04em; }
.dish-sheet > p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.sheet-tag { color: #875d4f; background: #fff0ea; }
.dish-sheet .primary-button { width: 100%; }

.invite-ready { border-color: rgba(232, 112, 83, 0.2); background: linear-gradient(135deg, #fff4ef, #fffaf6); }
.invite-ready .future-badge { color: #238251; background: #e7f8ee; }
.invite-sheet { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.invite-sheet .sheet-close { color: var(--ink-soft); background: #f4ece7; }
.invite-dish { margin-bottom: 18px !important; color: var(--ink) !important; font-weight: 700; }
.invite-time-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.invite-time-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink-soft);
  background: #fff;
  font-weight: 700;
}
.invite-time-button.is-active { border-color: var(--coral); color: var(--coral-dark); background: #fff0ea; }
.field-label { display: grid; gap: 7px; margin: 14px 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.invite-input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 500;
}
.invite-input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(232, 112, 83, 0.12); }
.message-preview { margin: 16px 0; padding: 14px; border-radius: 16px; background: #f8f3ef; }
.message-preview span { color: var(--ink-soft); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.message-preview p { margin: 7px 0 0; color: var(--ink); font-size: 14px; line-height: 1.6; white-space: pre-line; }
.invite-status { min-height: 20px; margin-top: 10px !important; text-align: center; }
.invite-status.is-error { color: #b33a31; }

.toast {
  position: fixed;
  z-index: 100;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 38px);
  padding: 12px 18px;
  border-radius: 999px;
  color: white;
  background: rgba(45, 33, 29, 0.93);
  box-shadow: 0 12px 30px rgba(45, 33, 29, 0.2);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in 200ms ease-out;
}

[hidden] { display: none !important; }
body.sheet-open { overflow: hidden; }

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin-pop { from { transform: rotate(-4deg) scale(0.88); } to { transform: rotate(4deg) scale(1.05); } }
@keyframes reveal-card { 0% { transform: scale(0.96); } 60% { transform: scale(1.015); } 100% { transform: scale(1); } }

@media (min-width: 700px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100svh - 44px); border-radius: 34px; }
  .nav-inner { bottom: 22px; border: 1px solid var(--line); border-radius: 0 0 34px 34px; }
  .bottom-nav { bottom: 22px; }
}

@media (max-width: 360px) {
  .app-shell { padding-right: 14px; padding-left: 14px; }
  .chip-strip, .featured-list { margin-right: -14px; margin-left: -14px; padding-right: 14px; padding-left: 14px; }
  .dish-grid { gap: 8px; }
  .dish-card-body { padding: 11px; }
  .featured-list { grid-auto-columns: 84%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
