:root {
  --bg: #1C1A16;
  --bg-2: #24211C;
  --card: #2A2620;
  --line: #3A352C;
  --text: #F3EAD8;
  --muted: #B5AA95;
  --gold: #D4A24C;
  --gold-2: #E8BE6E;
  --olive: #8DA25A;
  --red: #D9644A;
  --radius: 16px;
  --serif: "Frank Ruhl Libre", "David", serif;
  --sans: "Assistant", "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg);
  transition: opacity .5s ease, visibility .5s;
}
.splash.done { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center;
  font: 900 46px/1 var(--serif); color: var(--bg);
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold));
  box-shadow: 0 0 0 6px rgba(212,162,76,.15);
}
.splash-name { font: 700 22px var(--serif); color: var(--gold-2); }

/* ---------- Banners ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; font-size: 15px; }
.banner-offline { background: #5A2A1E; color: #FFD9CC; justify-content: center; }
.banner-install { background: var(--bg-2); border-bottom: 1px solid var(--line); }
.install-icon { font-size: 22px; }
.install-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.install-text small { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 999px; cursor: pointer;
  padding: 10px 20px; font-weight: 700; color: var(--text); background: transparent;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-gold { background: var(--gold); color: #1C1A16; }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { border-color: #6B3326; color: #F2A693; }
.btn-danger:hover { background: #3A1E17; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--gold); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(28,26,22,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 22px var(--serif); color: var(--gold-2); }
.spark { color: var(--gold); font-size: 16px; }

/* ---------- Hero ---------- */
main { max-width: 760px; margin: 0 auto; }
.hero { position: relative; overflow: hidden; }
.hero-media { display: flex; justify-content: center; padding: 16px 16px 0; }
.hero-media img {
  width: auto; height: auto; max-width: 100%;
  max-height: min(320px, 42vh);          /* картинка не занимает весь экран */
  object-fit: contain; border-radius: 16px;
}
.hero-body { position: relative; padding: 36px 20px 28px; text-align: center; }
.hero-media:has(img:not([hidden])) + .hero-body { padding-top: 20px; }
@media (max-width: 520px) {
  .hero-media img { max-height: 240px; }
}
.hero-tag {
  display: inline-block; margin: 0 0 10px; padding: 4px 14px; border-radius: 999px;
  border: 1px solid rgba(212,162,76,.5); color: var(--gold-2); font-size: 14px; letter-spacing: .02em;
}
.hero-title { margin: 0; font: 900 clamp(38px, 10vw, 60px)/1.05 var(--serif); }
.hero-title em { font-style: italic; color: var(--gold); }
.hero-date {
  margin-top: 14px; display: inline-flex; gap: 10px; align-items: center;
  font-weight: 700; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px 16px;
}
.hero-date .dot { color: var(--gold); }
.hero-tagline { margin: 14px 0 0; color: var(--muted); }

/* ---------- Menu ---------- */
.menu { padding: 0 16px; }
.section { margin: 26px 0 8px; }
.section-title {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px; font: 700 26px var(--serif); color: var(--gold-2);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to left, var(--line), transparent); }
.items { display: grid; gap: 12px; }
.item {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.item.no-img { grid-template-columns: 1fr; padding: 14px 16px; }
.item-img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--bg-2); }
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item-name { margin: 0; font: 700 19px/1.3 var(--serif); }
.item-price { font-weight: 700; color: var(--gold); white-space: nowrap; }
.item-desc { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.vegan { color: var(--olive); border-color: rgba(141,162,90,.5); }
.badge.spicy { color: var(--red); border-color: rgba(217,100,74,.5); }
.badge.gf { color: var(--gold-2); border-color: rgba(212,162,76,.5); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 28px 20px 40px; color: var(--muted); font-size: 14px; }
.footer p { margin: 4px 0; }
.legend span { color: var(--line); margin: 0 6px; }
.updated { font-size: 12px; opacity: .7; }

/* ---------- Dialog ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 20px; padding: 0;
  background: var(--bg-2); color: var(--text); width: min(360px, calc(100% - 32px));
}
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.login { padding: 24px; display: grid; gap: 14px; }
.login h2 { margin: 0; font: 700 24px var(--serif); color: var(--gold-2); }
.row { display: flex; gap: 10px; }
.error { color: #F2A693; margin: 0; font-size: 14px; }

/* ---------- Admin panel ---------- */
.admin {
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: min(480px, 100%); display: flex; flex-direction: column;
  background: var(--bg-2); border-inline-start: 1px solid var(--line);
  box-shadow: 10px 0 40px rgba(0,0,0,.5);
}
.admin-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--line);
}
.admin-head h2 { margin: 0; font: 700 22px var(--serif); color: var(--gold-2); }
.admin-actions { display: flex; align-items: center; gap: 8px; }
.status { font-size: 13px; color: var(--muted); }
.status.dirty { color: var(--gold-2); }
.admin-body { flex: 1; overflow-y: auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.admin-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.panel > h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 60px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 400; font-size: 14px; }
.checks input { accent-color: var(--gold); width: 16px; height: 16px; }

.img-field { display: flex; align-items: center; gap: 10px; }
.img-thumb {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none;
  background: var(--bg) center/cover; border: 1px dashed var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 22px;
}
.img-field .file-btn { position: relative; overflow: hidden; }
.img-field input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.ed-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 12px; background: var(--bg); }
.ed-section-head { display: flex; gap: 8px; align-items: end; }
.ed-section-head label { flex: 1; }
.ed-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--card); }
.ed-item-bar { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ed-item-bar b { font-size: 14px; color: var(--gold-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-tools { display: flex; gap: 4px; flex: none; }
.ed-tools .icon-btn { width: 30px; height: 30px; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 200; background: var(--text); color: var(--bg); font-weight: 700;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}

@media (min-width: 900px) {
  body.admin-open main { margin-left: 500px; margin-right: auto; }
}
@media (max-width: 420px) {
  .item-img { width: 80px; height: 80px; }
  .grid2 { grid-template-columns: 1fr; }
}
.btn { white-space: nowrap; }
@media (max-width: 520px) {
  .admin-head h2 { font-size: 19px; white-space: nowrap; }
  .status { font-size: 11px; max-width: 80px; line-height: 1.2; }
}

/* ---------- Day tabs ---------- */
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin: 20px auto 4px; max-width: 520px;
  padding: 5px; border-radius: 16px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 52px; padding: 6px 2px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--muted);
  transition: background .2s, color .2s;
}
.tab:hover { color: var(--text); background: rgba(212,162,76,.08); }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.tab-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.tab-date { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] { background: var(--gold); color: #1C1A16; }
.tab[aria-selected="true"] .tab-date { opacity: .75; }
.tabs-admin { margin: 0; max-width: none; background: var(--bg); }
.tabs-admin .tab { min-height: 44px; }
.tabs-admin .tab-name { font-size: 14px; }

.hint { margin: 0; font-size: 13px; color: var(--muted); }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row select {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
input[type=date] {
  width: 100%; padding: 8px 12px; border-radius: 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
@media (max-width: 380px) {
  .tabs { gap: 3px; padding: 4px; }
  .tab-name { font-size: 14px; }
}
