:root {
  --bg: #f6efe6;
  --surface: #fffaf3;
  --surface-2: #f1e7d9;
  --text: #2a211c;
  --muted: #7d6e63;
  --line: #e4d8c8;
  --accent: #b8432a;
  --accent-ink: #fff7f2;
  --accent-soft: #f7dcd3;
  --star: #e2a92e;
  --star-empty: #d9cdbd;
  --heart: #d6455a;
  --good: #3d8a5a;
  --good-soft: #dcefe2;
  --mid: #b07a12;
  --mid-soft: #f7e8c4;
  --bad: #c0392b;
  --bad-soft: #f5d9d4;
  --shadow: 0 8px 24px rgba(60, 40, 20, .10);
  --radius: 18px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1815;
    --surface: #26211d;
    --surface-2: #302923;
    --text: #f2eae0;
    --muted: #a6978a;
    --line: #3b332c;
    --accent: #e0664a;
    --accent-ink: #1c1815;
    --accent-soft: #4a2a22;
    --star: #f0b83c;
    --star-empty: #4a4038;
    --good: #6cbf88; --good-soft: #23402d;
    --mid: #e0b04a; --mid-soft: #45361a;
    --bad: #e26a5a; --bad-soft: #4a2a25;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #1c1815; --surface: #26211d; --surface-2: #302923; --text: #f2eae0; --muted: #a6978a;
  --line: #3b332c; --accent: #e0664a; --accent-ink: #1c1815; --accent-soft: #4a2a22;
  --star: #f0b83c; --star-empty: #4a4038; --shadow: 0 8px 24px rgba(0,0,0,.35);
  --good: #6cbf88; --good-soft: #23402d; --mid: #e0b04a; --mid-soft: #45361a; --bad: #e26a5a; --bad-soft: #4a2a25;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

/* ---- splash / states ---- */
.splash { min-height: 100dvh; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 8px; }
.splash-mark { font-size: 48px; color: var(--star); }
.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---- layout ---- */
.page { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-top: env(safe-area-inset-top); }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 15px; padding: 6px 0; margin: -6px 0 8px; }
.back:hover { color: var(--text); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 20px 0 8px; }

/* ---- cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
a.card, a.node, a.btn, .tabbar a { text-decoration: none; color: inherit; }
.card.tap { transition: transform .12s ease, box-shadow .12s ease; text-align: left; width: 100%; display: block; }
.card.tap:active { transform: scale(.985); }
.card.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card.accent .muted { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }

/* ---- chips ---- */
.chip {
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { padding: 7px 13px; font-size: 13.5px; flex: 0 0 auto; }

/* ---- vegetarisch ---- */
.chip.veg.good { background: var(--good-soft); color: var(--good); }
.chip.veg.mid  { background: var(--mid-soft);  color: var(--mid); }
.chip.veg.poor { background: var(--bad-soft);  color: var(--bad); }
.chip.veg-toggle.on { background: var(--good); color: #fff; }
.veg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg button { padding: 9px 4px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background .12s ease, color .12s ease; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button.on.good { color: var(--good); }
.seg button.on.mid  { color: var(--mid); }
.seg button.on.poor { color: var(--bad); }

/* ---- tags ---- */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.tag { padding: 7px 12px; font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); }
.chip.tag.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.tiny { padding: 2px 8px; font-size: 11.5px; }
.tag-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.tag-row > .small { flex: 0 0 auto; padding-top: 3px; }

/* ---- stars ---- */
.stars { position: relative; display: inline-block; color: var(--star-empty); font-size: 15px; letter-spacing: 1px; line-height: 1; white-space: nowrap; }
.stars .fg { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--star); }
.stars.lg { font-size: 22px; }
.rating-big { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1; }
.rating-inline { font-weight: 700; font-variant-numeric: tabular-nums; }

.aspect-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.aspect-row:last-child { border-bottom: 0; }
.aspect-row .val { font-weight: 700; min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- star input ---- */
.star-input { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.star-input:last-child { border-bottom: 0; }
.star-input .btns { display: flex; gap: 2px; }
.star-input > span:first-child { flex: 1; font-size: 15px; }
.star-input .btns button { font-size: 27px; line-height: 1; color: var(--star-empty); padding: 2px; transition: transform .1s ease, color .1s ease; }
.star-input .btns button.on { color: var(--star); }
.star-input .btns button:active { transform: scale(1.2); }
.star-input .num { width: 20px; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- avatars ---- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-content: center; font-weight: 700; font-size: 14px;
  color: #fff; background: var(--muted);
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

/* ---- venue list card ---- */
.venue-card { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; }
.venue-card .name { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.15; }
.venue-card .score { text-align: right; }
.venue-card .score .n { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1; }
.venue-card .foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topper-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; max-width: 100%; }
.topper-pill .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- review ---- */
.review { padding: 14px 16px; }
.review .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review .head .who { font-weight: 700; }
.review .head .when { color: var(--muted); font-size: 12.5px; }
.review .text { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review .photo { margin: 10px 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.review .photo img { width: 100%; max-height: 360px; object-fit: cover; }
.mini-scores { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--muted); }
.mini-scores b { color: var(--text); }

.topper {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--accent-soft);
}
.topper .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.topper .what { font-weight: 700; color: var(--text); }
.heart {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; color: var(--muted); flex: 0 0 auto;
  transition: transform .1s ease;
}
.heart:active { transform: scale(1.15); }
.heart.on { color: var(--heart); border-color: color-mix(in srgb, var(--heart) 40%, transparent); background: color-mix(in srgb, var(--heart) 10%, var(--surface)); }
.heart .ic { font-size: 16px; }

.topper-card .what { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; }

/* ---- forms ---- */
label.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  outline: none; font-size: 16px; font-weight: 400;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 96px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--surface-2); color: var(--text);
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { color: var(--bad); background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--bad); font-size: 14px; }
.ok { color: var(--good); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }

.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-grid button {
  padding: 12px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: grid; gap: 4px; justify-items: center; font-size: 13px; font-weight: 600; color: var(--muted);
}
.cat-grid button .e { font-size: 22px; }
.cat-grid button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.venue-results { display: grid; gap: 6px; margin-top: 6px; }
.venue-results button {
  text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.venue-results button.new { border-style: dashed; color: var(--accent); font-weight: 600; }
.selected-venue { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); }
.selected-venue .x { margin-left: auto; color: var(--accent); font-weight: 700; padding: 4px 8px; }

.photo-pick { position: relative; border: 1px dashed var(--line); border-radius: 12px; min-height: 72px; display: grid; place-content: center; text-align: center; color: var(--muted); overflow: hidden; background: var(--surface); }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-pick img { width: 100%; max-height: 260px; object-fit: cover; }
.photo-pick .remove { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 700; }

/* ---- auth ---- */
.auth { min-height: 100dvh; display: grid; align-content: center; padding: 32px 24px 48px; gap: 20px; }
.auth .brand { text-align: center; display: grid; gap: 6px; margin-bottom: 8px; }
.auth .brand .mark { font-size: 44px; color: var(--star); line-height: 1; }
.auth .brand h1 { font-size: 34px; }
.auth form { display: grid; gap: 12px; }
.auth .switch { text-align: center; color: var(--muted); font-size: 14px; }
.auth .switch button { color: var(--accent); font-weight: 700; }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- invites ---- */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .18em;
  font-size: 22px; padding: 6px 12px; border-radius: 10px; background: var(--surface-2);
}
.tree { display: grid; gap: 6px; }
.tree .node { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.tree .node .via { color: var(--muted); font-size: 12.5px; }
.tree .indent { position: relative; margin-left: 22px; }
.tree .indent::before { content: ''; position: absolute; left: -14px; top: -8px; bottom: 50%; width: 12px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-radius: 0 0 0 8px; }

/* ---- tab bar ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.tabbar .inner {
  pointer-events: auto;
  width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 22px; padding: 6px 6px;
  box-shadow: var(--shadow);
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px; padding: 8px 4px 6px; text-decoration: none;
  color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 14px;
}
.tabbar a .ic { font-size: 21px; line-height: 1; }
.tabbar a.on { color: var(--accent); }
.tabbar a.add { color: var(--accent-ink); }
.tabbar a.add .ic {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-content: center;
  background: var(--accent); font-size: 30px; margin-top: -22px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- setup screen ---- */
.setup ol { padding-left: 20px; display: grid; gap: 8px; margin: 8px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
