:root {
  --ink: #23304a;
  --paper: #fffaf0;
  --tomato: #e8553a;
  --sun: #f2c230;
  --sea: #74cfc4;
  --muted: #5d6b84;
  --line: 2px solid var(--ink);
  --hard: 0 3px 0 var(--ink);
  --head: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sea);
  color: var(--ink);
  font: 500 15px/1.35 var(--body);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#city {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#city:active { cursor: grabbing; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; }

.top {
  position: fixed;
  top: calc(12px + var(--safe-t));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
.brand, .counter {
  background: var(--paper);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--hard);
  padding: 8px 12px;
}
.brand strong { display: block; font: 800 16px/1.15 var(--head); }
.brand span { font-size: 12px; color: var(--muted); font-weight: 600; }
.counter { text-align: right; }
.counter span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.counter b { font: 800 22px/1.05 var(--head); font-variant-numeric: tabular-nums; }

.tools {
  position: fixed;
  top: calc(78px + var(--safe-t));
  left: 12px;
  right: 12px;
  max-width: 420px;
}
.search {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border: var(--line);
  border-radius: 999px;
  box-shadow: var(--hard);
  padding: 3px 3px 3px 14px;
}
.search span { font-weight: 700; color: var(--muted); }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 16px;
  padding: 7px 2px;
  outline: none;
}
.search:focus-within { outline: 3px solid var(--tomato); outline-offset: 1px; }
.search button {
  border: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}
.results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  background: var(--paper);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--hard);
}
.results button {
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px;
  border-radius: 9px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.results button:hover { background: #f3e9d3; }
.results small { color: var(--muted); font-weight: 500; }
.results .none { padding: 10px; color: var(--muted); }
.ticker {
  display: inline-block;
  margin-top: 8px;
  max-width: 100%;
  background: rgba(35, 48, 74, .86);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo {
  position: fixed;
  left: 12px;
  top: calc(164px + var(--safe-t));
  background: var(--sun);
  border: var(--line);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 700;
}

.bottom {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + var(--safe-b));
  max-width: 520px;
  margin: 0 auto;
}
.goal {
  background: var(--paper);
  border: var(--line);
  border-radius: 12px;
  box-shadow: var(--hard);
  padding: 7px 11px 9px;
  margin-bottom: 9px;
}
.goal-text { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.goal-text b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 7px; border-radius: 5px; background: #eadfc6; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--tomato); transition: width .5s; }

.actions { display: flex; gap: 8px; }
.btn {
  border: var(--line);
  border-radius: 13px;
  box-shadow: var(--hard);
  padding: 13px 12px;
  font-weight: 700;
  background: var(--paper);
  white-space: nowrap;
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.main { flex: 1; background: var(--tomato); color: #fff; font-family: var(--head); font-size: 14px; font-weight: 800; }
.btn.wide { width: 100%; margin-top: 4px; }
.btn[disabled] { opacity: .55; cursor: default; }

.scrim { position: fixed; inset: 0; background: rgba(35, 48, 74, .4); }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 520px;
  max-height: 92dvh;
  margin: 0 auto;
  overflow-y: auto;
  background: var(--paper);
  border: var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .bar i { transition: none; } }

.sheet h2 { font: 800 19px/1.2 var(--head); margin: 0 34px 12px 0; overflow-wrap: anywhere; }
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  background: #f3e9d3;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.follow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.follow p { margin: 0; font-weight: 600; }
.chip { border: var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--sun); }

.seg { border: 0; padding: 0; margin: 0 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend { font-weight: 600; font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 5px; }
.seg label { flex: 1; min-width: 120px; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; border: var(--line); border-radius: 11px; padding: 9px; font-weight: 700; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--tomato); outline-offset: 2px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.at { display: flex; align-items: center; border: var(--line); border-radius: 11px; padding: 0 11px; background: #fff; }
.at i { font-style: normal; font-weight: 700; color: var(--muted); }
.at input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; padding: 11px 3px; outline: none; }
.at:focus-within { outline: 3px solid var(--tomato); outline-offset: 1px; }
.err { display: block; color: #bb2f18; font-weight: 600; margin-top: 5px; }

.kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kind {
  border: var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 3px 2px 5px;
  font-size: 11.5px;
  font-weight: 600;
}
.kind canvas { display: block; width: 58px; height: 79px; margin: 0 auto; }
.kind[aria-checked="true"] { background: var(--sun); box-shadow: inset 0 0 0 2px var(--ink); }

.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: var(--line); padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }

.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.house-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.house-head canvas { width: 88px; height: 120px; flex: none; }
.house-head h2 { margin: 0 0 3px; }
.eyebrow { margin: 0 0 3px; font-size: 12px; font-weight: 700; color: var(--tomato); }
.meta { margin: 0; color: var(--muted); font-size: 13.5px; }
.sheet.small .actions .btn.ghost { flex: none; }

.board { list-style: none; margin: 12px 0 0; padding: 0; }
.board li { margin-bottom: 7px; }
.board button { display: flex; width: 100%; gap: 9px; align-items: center; border: var(--line); border-radius: 11px; background: #fff; padding: 9px 11px; font-weight: 700; text-align: left; }
.board i { font-style: normal; font: 800 15px var(--head); width: 20px; }
.board span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.board b { font-variant-numeric: tabular-nums; }
.board li:first-child button { background: var(--sun); }
.board .none { color: var(--muted); font-weight: 500; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(130px + var(--safe-t));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  text-align: center;
  z-index: 5;
}

/* Режим съёмки: только город, счётчик и крупный текст. */
body.filming .tools,
body.filming .bottom,
body.filming .demo,
body.filming .brand { display: none; }
body.filming .top { justify-content: flex-end; }
.film { position: fixed; inset: 0; pointer-events: none; text-align: center; padding: 18vh 18px 0; }
.film-title {
  display: inline-block;
  background: var(--paper);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--hard);
  padding: 10px 14px;
  font: 800 clamp(17px, 5vw, 26px)/1.15 var(--head);
}
.film-big {
  margin-top: 16px;
  font: 800 clamp(46px, 15vw, 92px)/1 var(--head);
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 720px) {
  .sheet { bottom: 24px; border-bottom: var(--line); border-radius: 20px; max-height: calc(100dvh - 48px); box-shadow: 0 5px 0 var(--ink); }
  .kinds { grid-template-columns: repeat(7, 1fr); }
  .kind canvas { width: 52px; height: 71px; }
}
