:root {
  --bg: #120e0c;
  --bg-elev: #1b1512;
  --card: #251c18;
  --card-2: #2e241f;
  --ink: #f7f0e7;
  --muted: #b7a496;
  --dim: #8c7a6d;
  --line: rgba(247, 240, 231, 0.11);
  --gold: #e8b86d;
  --gold-2: #f4d7a3;
  --tomato: #e85d4c;
  --tomato-2: #ff7a68;
  --leaf: #8dce8f;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --accent: var(--gold);
  --glow: rgba(232, 184, 109, 0.28);
}

body[data-period="breakfast"] {
  --accent: #f0b27a;
  --glow: rgba(240, 178, 122, 0.32);
}
body[data-period="lunch"] {
  --accent: #e8c15a;
  --glow: rgba(232, 193, 90, 0.28);
}
body[data-period="afternoon"] {
  --accent: #e8a35c;
  --glow: rgba(232, 163, 92, 0.3);
}
body[data-period="dinner"] {
  --accent: #e07a62;
  --glow: rgba(224, 122, 98, 0.28);
}
body[data-period="late"] {
  --accent: #c9a6e8;
  --glow: rgba(201, 166, 232, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 500px at 10% -10%, var(--glow), transparent 55%),
    radial-gradient(800px 400px at 110% 8%, rgba(232, 93, 76, 0.16), transparent 50%),
    radial-gradient(700px 500px at 50% 120%, rgba(20, 10, 8, 0.8), transparent 50%),
    var(--bg);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(14px + var(--safe-top)) 16px calc(28px + var(--safe-bot));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.back-btn, .lang-btn, .icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(247, 240, 231, 0.06);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lang-btn { width: auto; padding: 0 12px; font-size: 13px; }
.back-btn:active, .lang-btn:active, .icon-btn:active { transform: scale(0.97); }
.brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.brand-text span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 6.4vw, 2.15rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 6px 0 10px;
}
.hero p.lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

.period-card {
  background: linear-gradient(180deg, rgba(247,240,231,0.06), rgba(247,240,231,0.03));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.period-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.period-head .now {
  font-weight: 650;
  font-size: 0.95rem;
}
.period-head .clock {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.periods {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.periods button {
  min-height: 52px;
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 2px;
  line-height: 1.15;
  text-align: center;
}
.periods button .ico { font-size: 16px; }
.periods button.active {
  background: color-mix(in srgb, var(--accent) 18%, #1a1411);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--ink);
}

.search {
  position: relative;
  margin: 0 0 14px;
}
.search input {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 44px 0 44px;
  outline: none;
  font-size: 16px; /* avoids iOS zoom */
}
.search input::placeholder { color: var(--dim); }
.search input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search .mag, .search .clear {
  position: absolute;
  top: 0;
  height: 52px;
  width: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.search .mag { left: 0; pointer-events: none; }
.search .clear { right: 0; }

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 18px;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(247, 240, 231, 0.06);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.filters button.active {
  background: var(--ink);
  color: #1a120f;
  border-color: var(--ink);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 2px 10px;
}
.section-title h2 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.section-title span { color: var(--dim); font-size: 12px; }

.grid {
  display: grid;
  gap: 12px;
}
.title-card, .dish-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.title-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}
.title-card:active, .dish-card:active { transform: translateY(1px); }
.poster {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: var(--art, linear-gradient(145deg, #4a2c22, #1f1512));
  border: 1px solid rgba(255,255,255,0.08);
}
.meta .kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.meta h3 {
  margin: 2px 0 4px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.meta p, .dish-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.prices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chip {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(247, 240, 231, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}
.chip.gold { color: var(--gold-2); border-color: rgba(232,184,109,0.25); }
.chip.leaf { color: var(--leaf); border-color: rgba(141,206,143,0.25); }

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.title-hero {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}
.title-hero .poster { width: 92px; height: 92px; font-size: 42px; border-radius: 22px; }
.title-hero h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 4px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.blurb {
  color: var(--muted);
  margin: 12px 0 18px;
  font-size: 0.95rem;
}

.dish-card { padding: 16px; }
.dish-card .top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.dish-emoji {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: rgba(247, 240, 231, 0.06);
  flex: 0 0 auto;
}
.dish-card h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.seen {
  font-size: 12px;
  color: var(--dim);
  margin-top: 8px;
}

.dish-page .emoji-xl {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 42px;
  background: var(--art, linear-gradient(145deg, #4a2c22, #1f1512));
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}
.dish-page h1 {
  font-family: var(--display);
  font-size: 1.85rem;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.from-title {
  color: var(--muted);
  margin: 0 0 14px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.stat b { display: block; font-size: 1.02rem; }
.stat span { color: var(--dim); font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-family: var(--display);
}
.panel ol, .panel ul { margin: 0; padding-left: 1.15rem; }
.panel li { margin: 0 0 8px; color: var(--ink); }
.panel li:last-child { margin: 0; }
.panel .subtle { color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }

.actions { display: grid; gap: 8px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 14px;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(247, 240, 231, 0.06);
  padding: 0 14px;
}
.btn.primary {
  background: var(--ink);
  color: #1a120f;
  border-color: var(--ink);
}
.btn.tomato {
  background: var(--tomato);
  color: #fff;
  border-color: transparent;
}
.drink {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.drink .mark {
  background: color-mix(in srgb, var(--leaf) 18%, transparent);
  color: var(--leaf);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 8px;
  flex: 0 0 auto;
}

.legal {
  margin: 22px 2px 8px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.5;
}

@media (min-width: 720px) {
  #app { width: min(100%, 840px); }
  .home-grid, .dish-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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