@font-face { font-family: "Onest"; src: url(fonts/onest-cyr.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url(fonts/onest-lat.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #f4f2ee;
  --paper2: #ebe8e1;
  --card: #ffffff;
  --ink: #141414;
  --ink2: #2a2a2a;
  --muted: #6d6a64;
  --rule: #dcd8cf;
  --red: #e4222b;
  --red-d: #c21820;
  --green: #1f9e45;
  --gold: #f2b705;
  --r: 18px;
  --font: "Onest", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 52'%3E%3Cpath d='M20 50S37 31.4 37 19A17 17 0 0 0 3 19c0 12.4 17 31 17 31z' fill='%23e4222b' stroke='white' stroke-width='3'/%3E%3Ccircle cx='20' cy='19' r='6.5' fill='white'/%3E%3C/svg%3E");
  --pin-true: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 52'%3E%3Cpath d='M20 50S37 31.4 37 19A17 17 0 0 0 3 19c0 12.4 17 31 17 31z' fill='%23141414' stroke='white' stroke-width='3'/%3E%3Cpath d='M13.5 19.5l4.5 4.5 8.5-9' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }
.arr { display: inline-block; transition: transform .15s; }
.btn:hover .arr { transform: translateX(3px); }

/* ---------- Кнопки ---------- */
.btn { border: 0; border-radius: 999px; padding: 14px 24px; font-weight: 700; font-size: 16px; letter-spacing: -.005em; transition: transform .08s, background .15s, box-shadow .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.97); }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 8px 22px -8px rgba(228,34,43,.7); }
.btn.red:hover { background: var(--red-d); }
.btn.red:disabled { background: #cfcac0; color: #7d786f; box-shadow: none; cursor: default; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #333; }
.btn.line { background: transparent; border: 2px solid var(--ink); padding: 12px 22px; }
.btn.line:hover { background: var(--ink); color: #fff; }
.btn.ghost-dark { background: rgba(255,255,255,.1); color: #fff; }
.btn.ghost-dark:hover { background: rgba(255,255,255,.18); }
.btn.wide { width: 100%; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.round-btn:hover { background: var(--red); }

/* ---------- Главная ---------- */
#home { overflow-y: auto; }
.topbar { max-width: 1240px; margin: 0 auto; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.logo em { font-style: normal; font-weight: 500; color: var(--muted); }
.logo-pin { width: 26px; height: 34px; background: var(--pin) center/contain no-repeat; }
.name-pill { display: flex; align-items: center; background: var(--card); border: 1.5px solid var(--rule); border-radius: 999px; padding: 4px 4px 4px 16px; gap: 10px; }
.name-pill span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.name-pill input { border: 0; background: var(--paper); border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 15px; width: 180px; outline: none; color: var(--ink); }
.name-pill input:focus { box-shadow: inset 0 0 0 2px var(--red); }

.home-grid { max-width: 1240px; margin: 0 auto; padding: 10px 28px 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: start; }
.eyebrow { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--red); }
.home-left h1 { font-size: clamp(64px, 9vw, 132px); line-height: .88; letter-spacing: -.055em; margin: 10px 0 18px; font-weight: 800; }
.lead { font-size: 18px; line-height: 1.5; color: var(--ink2); margin: 0 0 26px; max-width: 520px; }

.panel { background: var(--card); border-radius: var(--r); padding: 22px 24px; margin-bottom: 16px; box-shadow: 0 1px 0 var(--rule), 0 10px 30px -18px rgba(0,0,0,.25); }
.panel p { color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.panel-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.panel-title { font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.panel.sign { background: var(--ink); color: #fff; }
.panel.sign p { color: #b9b5ad; }
.sign-head { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #d6d2ca; margin-bottom: 12px; }
.sign-head b { margin-left: auto; background: #fff; color: var(--ink); border-radius: 8px; padding: 3px 9px; letter-spacing: .02em; }
.line-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 5px var(--c), inset 0 0 0 9px #fff; }
.panel.challenge { box-shadow: inset 0 0 0 2px var(--red), 0 10px 30px -18px rgba(0,0,0,.25); }
.panel.challenge .panel-tag { color: var(--red); }
.panel.down { background: #fde3e4; box-shadow: inset 0 0 0 2px var(--red); }
.panel.down p { color: var(--ink2); }
.btn:disabled { opacity: .45; cursor: default; }
.daily-done { margin-top: 14px; background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px 14px; font-size: 15px; color: #e6e2da; }
.daily-done b { color: #fff; font-size: 20px; }

.opt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips button { display: inline-flex; align-items: center; gap: 7px; background: var(--paper); border: 0; border-radius: 999px; padding: 7px 13px 7px 8px; font-size: 14px; font-weight: 600; color: var(--ink2); transition: background .12s, color .12s; }
.chips button i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; }
.chips button:hover { background: var(--paper2); }
.chips button.on { background: var(--ink); color: #fff; }
.chips button.on i { box-shadow: 0 0 0 2px #fff; }
.seg { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.home-right { position: sticky; top: 20px; }
.scheme { background: var(--card); border-radius: 28px; padding: 22px; box-shadow: 0 1px 0 var(--rule), 0 20px 50px -30px rgba(0,0,0,.35); }
#zoneMap { width: 100%; height: auto; display: block; aspect-ratio: 1; }
#zoneMap path { fill: var(--c); stroke: #fff; stroke-width: .9; stroke-linejoin: round; cursor: pointer; transition: opacity .15s, fill .15s; opacity: .9; }
#zoneMap path:hover { opacity: 1; }
#zoneMap.sel path { fill: #dedad2; opacity: 1; }
#zoneMap.sel path.on { fill: var(--c); }
#zoneMap .okr-label { font-size: 13px; font-weight: 800; fill: #fff; pointer-events: none; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.25); stroke-width: 2px; letter-spacing: .02em; }
#zoneMap.sel .okr-label { fill: #9a958c; stroke: none; }
#zoneMap.sel .okr-label.on { fill: #fff; stroke: rgba(0,0,0,.25); }
.scheme-caption { text-align: center; font-weight: 700; margin-top: 10px; color: var(--ink2); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.facts div { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: 0 1px 0 var(--rule); }
.facts b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.facts span { color: var(--muted); font-size: 13px; }
.foot { max-width: 1240px; margin: 0 auto; padding: 18px 28px 30px; color: #9a958c; font-size: 13px; }

/* ---------- Игра ---------- */
#game { background: #111; }
#pano { position: absolute; inset: 0; }
#pano [class*="panorama-gotoymaps"], #pano a[href*="yandex.ru/maps"], #pano a[href*="yandex.com/maps"] { display: none !important; }
/* на картах — без «Открыть в Яндекс Картах» и «Создать свою карту» (логотип и условия остаются) */
[class*="-gotoymaps"], [class*="-gototech"], [class*="-gototaxi"], [class*="-taxi-"] { display: none !important; }
.pano-loading { position: absolute; inset: 0; z-index: 5; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; font-weight: 700; color: var(--muted); transition: opacity .35s; }
.pano-loading.off { opacity: 0; pointer-events: none; }
.loader-line { display: flex; align-items: center; gap: 22px; position: relative; }
.loader-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; background: var(--red); border-radius: 3px; }
.loader-line i { position: relative; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 4px var(--red); animation: stop 1.2s infinite; }
.loader-line i:nth-child(2) { animation-delay: .2s; } .loader-line i:nth-child(3) { animation-delay: .4s; }
@keyframes stop { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.45); } }

.game-top { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 10; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.game-top > * { pointer-events: auto; }
.line-progress { margin: 0 auto; background: rgba(255,255,255,.96); border-radius: 999px; padding: 9px 20px; display: flex; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.lp-st { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 4px #cfcac0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: transparent; flex: none; transition: all .2s; }
.lp-seg { width: 44px; height: 5px; background: #cfcac0; flex: none; }
.lp-seg.done { background: var(--red); }
.lp-st.done { box-shadow: inset 0 0 0 4px var(--red); }
.lp-st.cur { width: 34px; height: 34px; background: var(--red); box-shadow: 0 0 0 4px rgba(228,34,43,.2); color: #fff; font-size: 14px; }
.score-pill { background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 18px; display: flex; flex-direction: column; align-items: center; min-width: 86px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.score-pill small { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: #a9a59d; font-weight: 700; }
.score-pill b { font-size: 18px; font-variant-numeric: tabular-nums; }
.score-pill.timer.low { background: var(--red); animation: pulse .6s ease-in-out infinite alternate; }
.score-pill.timer.low small { color: #ffd2d4; }
@keyframes pulse { to { transform: scale(1.06); } }
#exitBtn { box-shadow: 0 6px 24px rgba(0,0,0,.25); }

.guess-box { position: absolute; right: 16px; bottom: 16px; z-index: 10; width: 380px; background: var(--card); border-radius: 20px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.45); transition: width .22s ease; display: flex; flex-direction: column; gap: 8px; }
.guess-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 0 8px; }
.gh-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.gh-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--paper); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.gh-btn:hover { background: var(--paper2); }
.guess-box.pinned #mapPinBtn { background: var(--ink); color: #fff; }
.map-close { display: none; }
.pin-mini { width: 14px; height: 18px; background: var(--pin) center/contain no-repeat; display: inline-block; flex: none; }
.guess-map-wrap { position: relative; height: 250px; border-radius: 14px; overflow: hidden; transition: height .22s ease; background: var(--paper); }
#gmap { position: absolute; inset: 0; }
.guess-box:hover, .guess-box.pinned { width: min(720px, 56vw); }
.guess-box:hover .guess-map-wrap, .guess-box.pinned .guess-map-wrap { height: min(520px, 62vh); }
.guess-btn { width: 100%; }
.map-open { display: none; position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10; padding: 16px 28px; font-size: 17px; white-space: nowrap; }
.pin-mini.white { filter: brightness(0) invert(1); }

/* Пины на картах */
.mg-pin { position: absolute; left: -20px; top: -52px; width: 40px; height: 52px; background: var(--pin) center/contain no-repeat; filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); animation: drop .32s cubic-bezier(.3,1.6,.5,1); cursor: grab; }
.mg-pin.truth { background-image: var(--pin-true); }
.mg-pin.num { background-image: none; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; background: var(--red); border: 3px solid #fff; color: #fff; font: 800 13px var(--font); display: flex; align-items: center; justify-content: center; animation: none; }
.mg-pin.num.truth { background: var(--ink); }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Результат раунда ---------- */
#result { background: var(--paper); }
#rmap { position: absolute; inset: 0; }
.result-card { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(540px, calc(100% - 24px)); background: var(--card); border-radius: 24px; padding: 20px 22px 22px; z-index: 10; box-shadow: 0 24px 60px -10px rgba(0,0,0,.4); animation: rise .35s cubic-bezier(.2,.9,.3,1.1); }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
.rc-top { display: flex; align-items: center; gap: 14px; }
.station-no { width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 5px rgba(228,34,43,.15); flex: none; }
.rc-where { flex: 1; min-width: 0; }
.rc-district { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.rc-sub { color: var(--muted); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.okrug-badge { background: var(--c, var(--ink)); color: #fff; font-weight: 800; font-size: 13px; padding: 6px 11px; border-radius: 8px; flex: none; }
.rc-mid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.rc-mid > div { background: var(--paper); border-radius: 14px; padding: 10px 14px; }
.rc-mid small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.rc-mid b { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rc-score b { color: var(--red); }
.bar { height: 8px; border-radius: 99px; background: var(--paper2); margin: 14px 0 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); border-radius: 99px; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.badge { font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 999px; background: #e3f4e8; color: var(--green); }
.badge.warn { background: #fdf3d3; color: #9a7300; }
.badge.bad { background: #fde3e4; color: var(--red-d); }

/* ---------- Итог ---------- */
#final { overflow-y: auto; }
.final-wrap { display: grid; grid-template-columns: 1fr 440px; height: 100%; }
.final-map-wrap { position: relative; min-height: 320px; }
#fmap { position: absolute; inset: 0; }
.final-side { background: var(--paper); padding: 30px 28px; overflow-y: auto; }
.final-total { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 2px; }
.final-total b { font-size: 68px; font-weight: 800; letter-spacing: -.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.final-total span { color: var(--muted); font-size: 18px; font-weight: 600; }
.final-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--red); }
.route { list-style: none; margin: 22px 0 8px; padding: 0 0 0 4px; position: relative; }
.route::before { content: ""; position: absolute; left: 14px; top: 16px; bottom: 16px; width: 6px; border-radius: 3px; background: var(--red); }
.route li { position: relative; display: grid; grid-template-columns: 26px 1fr auto; gap: 14px; align-items: center; padding: 9px 0; }
.route .st { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 5px var(--c, var(--red)); position: relative; z-index: 1; }
.route .nm { font-weight: 700; line-height: 1.2; }
.route .nm small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.route .pt { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 17px; }
.final-place { color: var(--muted); min-height: 22px; margin-top: 4px; }
.final-place b { color: var(--ink); }
.board { margin-top: 26px; background: var(--card); border-radius: var(--r); padding: 16px 16px 10px; }
.board-head { font-weight: 800; margin-bottom: 8px; }
.board-head span { color: var(--muted); font-weight: 500; font-size: 13px; }
.board-list { list-style: none; margin: 0; padding: 0; counter-reset: b; }
.board-list li { counter-increment: b; display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 9px 8px; border-radius: 10px; font-size: 15px; }
.board-list li + li { border-top: 1px solid var(--paper2); }
.board-list li::before { content: counter(b); font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-list li:nth-child(1)::before { color: var(--red); }
.board-list li.me { background: #fde3e4; border-top-color: transparent; }
.board-list li b { font-variant-numeric: tabular-nums; }
.board-list small { letter-spacing: -1px; margin-left: 4px; }
.board-empty { color: var(--muted); padding: 8px 4px 12px; }

.modal { position: fixed; inset: 0; background: rgba(20,20,20,.45); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { position: relative; width: min(480px, 100%); max-height: 82vh; overflow-y: auto; background: var(--card); border-radius: 24px; padding: 24px; }
.modal-card h2 { margin: 6px 0 14px; font-size: 26px; letter-spacing: -.02em; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; }

.toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -90px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; z-index: 200; transition: transform .25s; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- Мобильные ---------- */
@media (max-width: 900px) {
  .topbar { padding: 16px; }
  .name-pill span { display: none; }
  .name-pill { padding: 4px; }
  .name-pill input { width: 130px; }
  .home-grid { grid-template-columns: 1fr; gap: 20px; padding: 0 16px 10px; }
  .home-right { position: static; }
  .facts { display: none; }
  .seg button { padding: 8px 11px; font-size: 13px; }
  .scheme { padding: 14px; border-radius: 22px; }
  .home-left h1 { font-size: 76px; }
  .foot { padding: 10px 16px 30px; }
  .game-top { top: 10px; left: 10px; right: 10px; gap: 6px; }
  .line-progress { padding: 7px 12px; }
  .lp-seg { width: 14px; }
  .lp-st { width: 16px; height: 16px; box-shadow: inset 0 0 0 3px #cfcac0; }
  .lp-st.done { box-shadow: inset 0 0 0 3px var(--red); }
  .lp-st.cur { width: 26px; height: 26px; font-size: 12px; }
  .score-pill { min-width: 0; padding: 5px 12px; }
  .score-pill b { font-size: 15px; }
  .round-btn { width: 38px; height: 38px; }
  .map-open { display: inline-flex; }
  .guess-box { display: none; inset: 0; width: auto !important; border-radius: 0; padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); z-index: 20; }
  .guess-box.open { display: flex; }
  .guess-box .guess-map-wrap { flex: 1; height: auto !important; }
  #mapPinBtn { display: none; }
  .map-close { display: inline-flex; width: 38px; height: 38px; }
  .guess-btn { padding: 17px; font-size: 17px; }
  .result-card { bottom: calc(10px + env(safe-area-inset-bottom)); padding: 16px; border-radius: 20px; }
  .rc-district { font-size: 19px; }
  .rc-mid b { font-size: 24px; }
  .final-wrap { grid-template-columns: 1fr; grid-template-rows: 44vh auto; height: auto; }
  .final-side { padding: 22px 16px 40px; }
  .final-total b { font-size: 54px; }
}
