/* Restaurant Ratings — SPA styles. Mobile-first.
   Fully custom palette, independent of Telegram's theme colors. Light vs. dark is
   chosen by [data-theme] when set (JS pins it from tg.colorScheme inside the Mini
   App — authoritative there), and otherwise follows the OS via prefers-color-scheme
   in a plain browser. The dark block is duplicated so either trigger applies it. */

:root {
  /* Light palette */
  --bg:#f1efe8; --surface:#ffffff; --text:#20241d; --muted:#6a6e64;
  --line:rgba(0,0,0,.10); --accent:#356b4e; --accentText:#ffffff; --link:#356b4e;
  --hi:#3E8E5F; --mid:#C77F22; --lo:#C4553D;
}
/* Dark — auto in a plain browser, unless JS has pinned light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#15170f; --surface:#20241b; --text:#ecebe0; --muted:#a7a99d;
    --line:rgba(255,255,255,.12); --accent:#6bbf8c; --accentText:#10231a; --link:#6bbf8c;
  }
}
/* Dark — explicit, when JS pins it (authoritative inside Telegram). */
:root[data-theme="dark"] {
  --bg:#15170f; --surface:#20241b; --text:#ecebe0; --muted:#a7a99d;
  --line:rgba(255,255,255,.12); --accent:#6bbf8c; --accentText:#10231a; --link:#6bbf8c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

a { color: var(--link); text-decoration: none; }
b { font-weight: 650; }

/* Header */
.hdr { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top)) 16px 8px; }
.hdr .htext { flex: 1; min-width: 0; }
.hdr .ttl { font-size: 20px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr .sub { font-size: 12px; color: var(--muted); }
.iconbtn {
  flex: none; width: 34px; height: 34px; margin-left: -8px; border: none; background: transparent;
  color: var(--accent); font-size: 30px; line-height: 1; cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.iconbtn:active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accentText);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none;
}

/* Tabs */
.tabs { display: flex; gap: 6px; padding: 4px 12px 8px; }
.tab {
  font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 14px; border-radius: 999px;
  cursor: pointer; user-select: none; border: none; background: transparent;
}
.tab.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

/* Body list */
.body { padding: 4px 12px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }

.banner {
  background: color-mix(in srgb, var(--mid) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--mid) 40%, transparent);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
}
.banner .b-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid); flex: none; }

.rowcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 12px; display: flex; gap: 11px; align-items: center; cursor: pointer;
}
.rowcard:active { transform: scale(.995); }
.rank { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); width: 16px; text-align: center; font-weight: 700; flex: none; }
.rc-main { flex: 1; min-width: 0; }
.rc-main .nm { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-main .mt { font-size: 12px; color: var(--muted); margin-top: 1px; }

.score {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px; padding: 6px 10px; border-radius: 10px;
  color: #fff; min-width: 46px; text-align: center; line-height: 1; flex: none;
}
.score small { display: block; font-size: 8px; font-weight: 700; opacity: .85; margin-top: 2px; letter-spacing: .05em; }
.sc-hi { background: var(--hi); } .sc-mid { background: var(--mid); } .sc-lo { background: var(--lo); }
.sc-none { background: color-mix(in srgb, var(--muted) 55%, var(--surface)); color: var(--surface); }

.pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 15%, var(--surface)); color: var(--muted); flex: none; }

/* Forms */
.lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 8px 2px 2px; }
.input, .field {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 12px; font-size: 15px; color: var(--text); font-family: inherit;
}
.input:focus, .field:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.row2 { display: flex; gap: 8px; }

.ac { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin-top: -2px; }
.ac-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ac-item:last-child { border-bottom: none; }
.ac-item:active, .ac-item.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ac-item .nm { font-weight: 600; font-size: 14px; }
.ac-item .ad { font-size: 12px; color: var(--muted); }

.chosen { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 11px; padding: 10px 12px; font-size: 13px; }
.chosen .nm { font-weight: 700; }
.chosen .ad { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Buttons */
.btn { display: block; width: 100%; border: none; border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 650; cursor: pointer; background: var(--accent); color: var(--accentText); font-family: inherit; }
.btn:active { opacity: .9; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.danger { background: transparent; color: var(--lo); border: 1.5px solid color-mix(in srgb, var(--lo) 50%, transparent); }
.btn + .btn { margin-top: 8px; }
.actions { margin-top: 14px; }

/* Criteria (card averages + rate sliders) */
.crit { margin: 10px 0; }
.crit .cr-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.crit .cr-top b { font-weight: 650; }
.crit .cr-top .v { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; }
.track { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 20%, transparent); margin-top: 5px; overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

input[type=range] { width: 100%; margin: 8px 0 2px; accent-color: var(--accent); }

.totbox { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 13px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; margin: 14px 0; }
.totbox .tl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.totbox .lg { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 800; color: var(--accent); line-height: 1; }

/* Reveal */
.person { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: none; }
.person .av { width: 26px; height: 26px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; }
.person .pn { flex: 1; font-weight: 600; font-size: 14px; }
.person .pc { font-size: 12px; color: var(--muted); }
.person .ps { font-variant-numeric: tabular-nums; font-weight: 800; }

/* Card info */
.card-info { padding: 2px 2px 6px; }
.card-info .addr { color: var(--muted); font-size: 13px; }
.maplink { font-weight: 600; font-size: 13px; display: inline-flex; gap: 5px; margin-top: 4px; }
.divlbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 2px 4px; }
.visit { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.visit:last-child { border-bottom: none; }
.visit .vd { color: var(--muted); font-size: 12px; }

/* Misc */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.loader { text-align: center; color: var(--muted); padding: 60px 20px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 13px; max-width: 90%; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--mid) 20%, transparent); color: var(--mid); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
