:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #2b2a26;
  --muted: #7a756a;
  --line: #ddd6c8;
  --accent: #2f6f5e;
  --accent-ink: #fff;
  --gold: #b8862b;
  --err: #b3402f;
  --shadow: 0 4px 18px rgba(40, 35, 25, .16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1d1f; --card: #24272a; --ink: #ece8df; --muted: #9c978c;
    --line: #3a3d40; --accent: #5fb39a; --accent-ink: #10201b; --gold: #e0b45a;
    --shadow: 0 4px 18px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--err); min-height: 1.2em; }
h1 { font-size: 24px; margin: 0 0 8px; }
h3 { margin: 14px 0 6px; font-size: 15px; }
button, input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: #b3402f; color: #fff; border-color: #b3402f; }
button:disabled { opacity: .5; cursor: default; }
a.btn { display: inline-block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; }
a.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
input, textarea, select { width: 100%; margin: 4px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }

.screen { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }

#game, #map { position: fixed; inset: 0; }
#map { z-index: 0; }

#hud { position: fixed; top: 8px; left: 8px; right: 8px; z-index: 500; display: flex; gap: 6px;
  flex-wrap: wrap; pointer-events: none; }
.hud-item { pointer-events: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 64px; }
.hud-item b { font-size: 15px; }
.hud-item span { font-size: 11px; color: var(--muted); }
.gps.ok b { color: var(--accent); }
.gps.bad b { color: var(--err); }

#map-tools { position: fixed; z-index: 500; right: 12px; top: 80px; display: flex; flex-direction: column; gap: 8px; }
#map-tools button { width: 44px; height: 44px; border-radius: 50%; font-size: 19px; padding: 0; box-shadow: var(--shadow); }
#fog { position: absolute; inset: 0; pointer-events: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#rose { position: fixed; z-index: 2; left: 14px; top: 80px; width: 96px; height: 96px; pointer-events: none; display: none; opacity: .85; }

#toasts { position: fixed; z-index: 600; top: 80px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--card); border-left: 4px solid var(--gold); border-radius: 8px; padding: 8px 12px;
  box-shadow: var(--shadow); animation: fade 6s forwards; }
@keyframes fade { 0%{opacity:0; transform: translateY(-6px)} 8%{opacity:1; transform:none} 85%{opacity:1} 100%{opacity:0} }
.toast:nth-last-child(n+4) { display: none; }  /* не больше трёх подсказок разом — карту не закрываем */
/* магнитола (целиком или пол-экрана) и планшет: экран невысокий — подсказки мельче и в правом углу, центр карты (где игрок) свободен */
@media (min-width: 600px) and (max-height: 820px) {
  #toasts { left: auto; right: 64px; transform: none; width: min(46vw, 360px); }
  .toast { font-size: 13px; line-height: 1.3; padding: 6px 10px; }
}

#panel { position: fixed; z-index: 500; right: 8px; bottom: 8px; width: 380px; max-height: 60vh;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; }

#tabs button { border: 0; border-radius: 0; background: none; padding: 10px 10px; white-space: nowrap;
  border-bottom: 2px solid transparent; }
#tabs button.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
#tab-body { overflow-y: auto; padding: 10px 14px 14px; }
@media (max-width: 640px) {
  #panel { left: 8px; right: 8px; width: auto; max-height: 45vh; }
  #map-tools { top: auto; bottom: calc(45vh + 18px); }
}

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.time { color: var(--muted); font-size: 12px; margin-right: 6px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0; }
.bar i { display: block; height: 100%; background: var(--accent); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.bot { color: var(--muted); }

/* ---------- игровые маркеры ---------- */
.gm { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.gm .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #f2b632 60%, #c47f12); border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.35), 0 0 0 2px rgba(196,127,18,.4); transition: transform .2s; }
.gm.unknown .ico { background: radial-gradient(circle at 35% 30%, #f3f5f8, #9aa7b6 65%, #66768a); animation: bob 1.6s ease-in-out 3; }
.gm .lbl { margin-top: 3px; padding: 1px 7px; border-radius: 8px; background: rgba(255,255,255,.92); color: #23303d;
  font-size: 11px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.gm.camp .ico { border-radius: 10px; background: linear-gradient(#9be27a, #4c9a3a); }
.gm.life .ico { width: 32px; height: 32px; font-size: 17px; background: radial-gradient(circle at 35% 30%, #e6f0ff, #7aa7e0); }
.gm.city .ico { width: auto; height: auto; border-radius: 10px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: #23303d;
  background: linear-gradient(#ffffff, #dfe7ef); white-space: nowrap; }
@keyframes bob { 50% { transform: translateY(-5px); } }
#map.far .gm .lbl { display: none; }
#map.far .gm:not(.city) .ico { transform: scale(.65); }
#map.veryfar .gm.place, #map.veryfar .gm.camp, #map.veryfar .gm.life { display: none; }

.player { position: relative; width: 56px; height: 56px; }
.player .ring { position: absolute; inset: 0; border-radius: 50%; background: rgba(42,125,225,.35); animation: pulse 2s ease-out 4; opacity: 0; }
.player .ava { position: absolute; inset: 8px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #8fc2ff, #2a7de1); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.maplibregl-popup-content { color: #23303d; border-radius: 10px; }

/* ночь */
body[data-map="night"] .gm .ico { box-shadow: 0 0 18px 4px rgba(255,196,80,.75); }
body[data-map="night"] .gm.unknown .ico { box-shadow: 0 0 14px 3px rgba(140,180,255,.55); }
body[data-map="night"] .gm .lbl { background: rgba(20,28,40,.88); color: #ffe3a3; }
body[data-map="night"] #vignette { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 50%, rgba(0,5,20,.6) 100%); }
/* атлас */
body[data-map="atlas"] .gm .ico { background: radial-gradient(circle at 35% 30%, #d9534f, #8e1f1b); border-color: #f3e3bf; }
body[data-map="atlas"] .gm.unknown .ico { background: radial-gradient(circle at 35% 30%, #b9a27a, #6e5a3a); }
body[data-map="atlas"] .gm .lbl { background: none; box-shadow: none; color: #4a3520; font: italic 600 13px Georgia, serif; text-shadow: 0 0 3px #f3e3bf; }
body[data-map="atlas"] #map canvas.maplibregl-canvas { filter: sepia(.45) saturate(.8) contrast(1.05); }
body[data-map="atlas"] #rose { display: block; }
body[data-map="atlas"] #vignette {
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(80,50,20,.45) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/><feColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .15 0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- чат ---------- */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; }
.chat-channels button { font-size: 13px; padding: 6px 8px; }
#chat-list { height: min(34vh, 320px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
@media (max-width: 640px) { #chat-list { height: 22vh; } }
.cm { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; max-width: 92%; align-self: flex-start; }
.cm.mine { align-self: flex-end; border-color: var(--accent); }
.cm.system { align-self: center; background: none; border-style: dashed; font-size: 12px; color: var(--muted); }
.cm.hidden-msg { opacity: .55; border-color: var(--err); }
.cm-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.cm-head .time { margin-left: auto; }
.cm-text { white-space: pre-wrap; word-break: break-word; }
.cm-quote { font-size: 12px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 6px; margin: 2px 0; }
.cm-flag { font-size: 11px; color: var(--err); }
.cm-acts { display: flex; gap: 4px; justify-content: flex-end; }
.cm-acts button { padding: 0 6px; font-size: 12px; border-radius: 6px; }
.tag.mod { color: var(--accent); border-color: var(--accent); }
.chat-input input { flex: 5; }

/* ---------- гараж ---------- */
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.veh { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; padding: 8px 4px; }
.veh .vi { font-size: 24px; }
.veh.on { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-weight: 600; }
.veh .bar { width: 80%; }

/* ---------- мини-игры ---------- */
#game-overlay { position: fixed; inset: 0; z-index: 2000; background: #000; touch-action: none; user-select: none; }
#game-overlay canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.go-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; font-size: 18px; padding: 0; }
.go-ui { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: 14px 16px 24px; }
.go-ui > * { pointer-events: auto; }
.go-top { background: rgba(255,255,255,.88); color: #23303d; border-radius: 12px; padding: 6px 14px; text-align: center;
  display: flex; flex-direction: column; max-width: calc(100% - 60px); }
.go-top span { font-size: 12px; color: #5c6670; }
.go-bars { width: min(420px, 100%); background: rgba(0,0,0,.45); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.go-bars label { display: block; margin: 4px 0; }
.bar.big { display: block; height: 14px; border-radius: 7px; background: rgba(255,255,255,.25); }
.bar.big i { transition: width .08s linear; }
.go-msg { margin-top: auto; margin-bottom: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 8px 14px; border-radius: 12px;
  text-align: center; max-width: 520px; font-size: 15px; }
.go-gear { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.go-gear button { font-size: 13px; padding: 6px 10px; background: rgba(255,255,255,.85); color: #23303d; }
.go-gear button.on { background: var(--accent); color: #fff; }
.go-btn { width: min(320px, 90%); padding: 18px; font-size: 20px; font-weight: 700; border-radius: 16px; border: 0;
  background: #f2b632; color: #2b2a26; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.go-btn:active { transform: scale(.97); }
.atlas { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.atlas-item { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; }
.atlas-item span { font-size: 24px; }
.atlas-item small { font-size: 11px; }
.atlas-item.no { opacity: .45; }

.gm.fishspot .ico { width: 34px; height: 34px; font-size: 18px; background: radial-gradient(circle at 35% 30%, #d9f1ff, #3d9ad6); }
#map.veryfar .gm.fishspot { display: none; }
.card-in { border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }

.go-msg.hidden { display: none; }
/* рыбалка: приборы по углам экрана */
.fx-title { padding: 4px 12px; }
.fx-hud { position: absolute; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); display: flex; flex-direction: column; gap: 6px; }
.fx-tl { top: 64px; left: 12px; align-items: flex-start; }
.fx-tr { top: 64px; right: 14px; align-items: flex-end; font-size: 13px; }
.fx-tr b { font-size: 22px; }
.fx-bl { bottom: 26px; left: 12px; align-items: center; font-size: 11px; }
.fx-br { bottom: 26px; right: 12px; align-items: flex-end; font-size: 11px; }
.fx-br span { font-size: 20px; font-weight: 700; }
.fx-gear { display: flex; flex-direction: column; align-items: center; width: 74px; padding: 6px 4px; border-radius: 12px;
  background: rgba(20,30,40,.55); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.fx-gear span { font-size: 26px; }
.fx-gear small { font-size: 10px; line-height: 1.15; }
.fx-shoot { font-size: 12px; padding: 6px 8px; background: rgba(255,255,255,.88); color: #23303d; border-radius: 10px; }
.fx-ring { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#f2b632 calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.fx-ring b { width: 42px; height: 42px; border-radius: 50%; background: rgba(20,30,40,.8); display: grid; place-items: center; font-size: 20px; }
.fx-btn { width: min(320px, calc(100% - 180px)); }
#game-overlay #fx-bars { margin-top: 112px; }  /* ниже приборов в углах */
@media (max-width: 600px) {
  .fx-bl, .fx-br { bottom: 104px; }
  #game-overlay #fx-bars { width: calc(100% - 20px); }
}
#game-overlay .go-msg { font-size: 14px; max-width: min(520px, calc(100% - 20px)); }
.dh-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; background: rgba(0,0,0,.72); color: #fff; text-align: center; padding: 16px; pointer-events: auto; }
.dh-end.hidden { display: none; }
.dh-end h2 { margin: 0; font-family: monospace; }
.dh-score { font: bold 34px monospace; color: #ffe066; margin: 4px 0; }
.dh-end .row { width: min(320px, 100%); }

/* ---------- кемпинг-магнат ---------- */
.camp-head { display: flex; align-items: center; gap: 4px; }
button.link { border: 0; background: none; padding: 2px 4px; }
.stars { color: var(--gold); letter-spacing: 1px; }
.cash { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.fac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 6px 0; }
.fac { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px dashed var(--line); border-radius: 10px;
  padding: 6px 2px; text-align: center; }
.fac.on { border-style: solid; border-color: var(--accent); }
.fac .fi { font-size: 22px; }
.fac small { font-size: 11px; line-height: 1.2; }
.fac button { padding: 2px 6px; font-size: 12px; margin-top: 2px; }

/* ---------- реальные кемпинги ---------- */
.gm.realcamp .ico { position: relative; background: radial-gradient(circle at 35% 30%, #e6ffe0, #3c9a4a); }
.ok-badge { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: #2f8f3a;
  color: #fff; font-size: 10px; line-height: 16px; text-align: center; border: 2px solid #fff; }
.rc-item { cursor: pointer; }
.rc-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.stars.big { font-size: 20px; }
.rc-sub { display: grid; grid-template-columns: 110px 1fr 28px; gap: 6px; align-items: center; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.amen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; font-size: 13px; margin: 4px 0; }
.amen input { width: auto; margin: 0 4px 0 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 4px; margin: 6px 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.btn-file { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; cursor: pointer; flex: 1; }
.ok { color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- дача-ферма ---------- */
.garden { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; margin: 6px 0; }
.plot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 86px; border-radius: 10px;
  background: linear-gradient(#a8784a, #7d5430); color: #fff; border: 2px solid #6a4526; }
.plot.gh { background: linear-gradient(rgba(210,240,255,.9), rgba(150,200,220,.9)), linear-gradient(#a8784a, #7d5430);
  color: #23303d; border-color: #8fc3dc; }
.plot.sel { outline: 3px solid var(--gold); }
.plot .pi { font-size: 26px; line-height: 1.1; }
.plot .pi.ripe { animation: bob 1.4s ease-in-out infinite; }
.plot small { font-size: 11px; line-height: 1.2; }
.plot .bar { width: 80%; background: rgba(255,255,255,.35); }
.plot .muted { color: inherit; opacity: .8; }
.plot.st-созрело { border-color: var(--gold); box-shadow: 0 0 10px rgba(242,182,50,.7); }
.warn { color: #ffd2c8; }
.plot.gh .warn { color: var(--err); }
.crops { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-top: 6px; }
.crops button { display: flex; flex-direction: column; align-items: center; font-size: 13px; padding: 6px 4px; }
.crops small { font-size: 11px; color: var(--muted); }

/* ---------- доска и маршруты ---------- */
.subtabs button { font-size: 13px; padding: 6px 8px; }
.card-in.rec { border-color: #d64b3a; }
.card-in.rec > b::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #d64b3a;
  margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.report p { margin: 6px 0; }
.plan { white-space: pre-wrap; }
.warn-t { color: var(--err); }
.cp { width: 26px; height: 26px; border-radius: 50%; background: #e2552b; color: #fff; font: bold 12px system-ui; display: grid;
  place-items: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.cp.done { background: #2f8f3a; }

.privacy { border-left: 3px solid var(--accent); padding: 4px 8px; margin: 6px 0; }

/* ================= новый интерфейс: нижнее меню, шторка, плитки ================= */
#hud { gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#hud::-webkit-scrollbar { display: none; }
.hud-item { flex-direction: row; align-items: center; gap: 5px; padding: 6px 10px; min-width: 0; border-radius: 20px; white-space: nowrap; }
.hud-item b { font-size: 15px; }
.hud-item span { font-size: 12px; }
.hud-item .hi { font-size: 15px; }
.gps .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--err); display: inline-block; }
.gps.ok .dot { background: #34a853; }
.gps b { font-size: 12px; }

#nav { position: fixed; z-index: 700; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(40,35,25,.12);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
#nav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 12px; padding: 6px 2px; border-radius: 12px; position: relative; color: var(--muted); }
#nav button span { font-size: 24px; line-height: 1.1; filter: grayscale(.4); }
#nav button.on { color: var(--accent); font-weight: 700; background: color-mix(in srgb, var(--accent) 10%, transparent); }
#nav button.on span { filter: none; }
#nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); }

#panel { left: auto; right: 12px; bottom: 76px; width: 440px; max-height: calc(100vh - 150px); font-size: 16px; }
#panel.hidden { display: none; }
#sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
#sheet-head b { flex: 1; font-size: 18px; }
#sheet-head button { width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
#tab-body { padding: 12px 16px 18px; }
#tab-body h3 { font-size: 17px; margin: 18px 0 8px; }
#tab-body .small { font-size: 13px; }
#tab-body .list li { padding: 10px 0; }
#tab-body button { min-height: 40px; }
.hint { color: var(--muted); margin: 0 0 12px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px 8px; min-height: 120px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--bg); text-align: center; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile .ti { font-size: 40px; line-height: 1; }
.tile b { font-size: 16px; }
.tile small { font-size: 12px; color: var(--muted); }

.me-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--bg); }
.me-card b { font-size: 18px; }
.me-money { display: flex; gap: 16px; margin-top: 6px; }

#map-tools { top: auto; bottom: 90px; }
body.sheet-open #map-tools { display: none; }
.maplibregl-ctrl-bottom-left { bottom: 70px; }
.maplibregl-ctrl-bottom-right { bottom: 66px; }
#toasts { top: 64px; }

@media (max-width: 640px) {
  #panel { left: 0; right: 0; width: auto; bottom: 64px; max-height: 68vh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  #map-tools { bottom: 112px; } /* выше значка ⓘ OpenFreeMap — не наезжают */
}

@media (max-width: 640px) { #h-gps-sub, #h-clock { display: none; } }

.shop-money { margin: 0 0 12px; font-size: 16px; }
.big-ico { font-size: 22px; }
#nav button { font-size: 11px; }
#nav button span { font-size: 22px; }

/* ---------- приложение на телефоне ---------- */
#hud { top: calc(8px + env(safe-area-inset-top)); }
.hud-item { flex-shrink: 0; }
/* ВРЕМЕННО: 🌡️ нагрев телефона (map.js drawBattery) */
.hud-item.temp { font-size: 13px; padding: 6px 9px; }
.hud-item.temp.warm { background: #f6d58a; }
.hud-item.temp.hot { background: #e8836f; color: #fff; }
.hud-item.rec { color: #d64b3a; font-size: 15px; padding: 6px 9px; animation: recblink 1.6s ease-in-out infinite; }
@keyframes recblink { 50% { opacity: .35; } }
.install { margin: 12px 0; }

/* мелкий масштаб: неоткрытые места — маленькие точки, без подписей */
#map.far .gm.unknown .ico { transform: scale(.45); animation: none; opacity: .8; }
#map.far .gm.unknown .lbl { display: none; }

/* именной транспорт в гараже */
.named-car { display: flex; gap: 12px; align-items: center; padding: 12px; margin: 4px 0 8px; border-radius: 14px;
  border: 2px solid #c9a227; background: linear-gradient(135deg, rgba(201,162,39,.16), rgba(201,162,39,.04)); }
.named-car img { width: 96px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.named-car .nc-ico { font-size: 44px; line-height: 1; flex: none; }

/* 🗺️ маршрут: «подойдёт ли вам», дневник, ролик, метки */
a.btn, label.btn { display: inline-block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600; cursor: pointer; }
label.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.fitcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.fit-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fit-c { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 16px; background: rgba(47,111,94,.08); font-size: 14px; }
.fit-c i { font-style: normal; }
button.play { width: 100%; font-size: 17px; padding: 12px; margin: 4px 0 8px; }
.d-day { margin: 14px 0 6px; color: var(--accent); }
.d-day::first-letter { text-transform: uppercase; }
.d-stop { display: flex; gap: 10px; padding: 8px 0; border-left: 3px solid var(--line); margin-left: 6px; padding-left: 10px; }
.d-stop.night { border-left-color: #6a5acd; }
.d-time { min-width: 52px; font-weight: 700; display: flex; flex-direction: column; }
.d-time small { font-weight: 400; color: var(--muted); font-size: 12px; }
.d-body { flex: 1; min-width: 0; }
.d-body p { margin: 4px 0; }
.d-note { width: 100%; box-sizing: border-box; margin-top: 4px; }
.ph { position: relative; display: block; }
.ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.ph-del { position: absolute; top: 2px; right: 2px; padding: 0 6px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: 0; }
.ph-add { display: grid; place-items: center; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 8px; font-size: 22px; cursor: pointer; }
.chk { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; }
.chk input { width: auto; margin: 0; }
.mark-btn { margin: 8px 0 4px; }
.marks .list li { padding: 6px 0; }
.traveler { font-size: 30px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.traveler span { display: inline-block; transition: transform .25s linear; }
#playbar { position: fixed; z-index: 800; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); display: grid;
  grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
#pb-text { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pb-line { grid-column: 1 / -1; grid-row: 2; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
#pb-line i { display: block; height: 100%; width: 0; background: #e2552b; }
.pb-pop img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.filters button { padding: 6px 10px; font-size: 14px; border-radius: 16px; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; }
#shop-q { width: 100%; box-sizing: border-box; margin: 6px 0; }
/* верхняя панель на узком телефоне: всё должно влезть, GPS при хорошем сигнале — просто точка */
.gps b:empty { display: none; }
.gps .dot { width: 11px; height: 11px; }
@media (max-width: 420px) {
  #hud { gap: 4px; left: 6px; right: 6px; }
  .hud-item { padding: 5px 8px; gap: 4px; }
  .hud-item b, .hud-item .hi { font-size: 14px; }
}
.gm .lvl, .city .lvl { color: #c08a1e; font-size: .85em; }
.gm.city.lvl-only .ico { padding: 1px 6px; font-size: 12px; color: #a8741a; font-weight: 700; }
/* ответы и упоминания вас в чате */
.toast.clickable { cursor: pointer; border-left-color: #2f6f5e; pointer-events: auto; animation: fade 15s forwards; }
.badge.mention { background: #2f6f5e; font-weight: 700; }
.cm.to-me { border-left: 3px solid #2f6f5e; background: rgba(47,111,94,.08); }

/* удочки в магазине */
.gear-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.gear-card { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.gear-card.own { border-color: var(--accent); }
.gear-card.named { border: 2px solid #b8860b; background: color-mix(in srgb, #f2d27a 14%, var(--card)); }
.list li.named-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list li.named-row button { flex: none; }
.list li.named-li { border: 2px solid #b8860b; border-radius: 12px; padding: 8px 10px; margin: 6px 0; background: color-mix(in srgb, #f2d27a 14%, var(--card)); }
.gear-photo { width: 100%; height: 86px; object-fit: contain; border-radius: 8px; background: color-mix(in srgb, var(--line) 35%, transparent); }
img.gear-photo { height: 86px; object-fit: contain; padding: 0 8px; box-sizing: border-box; }  /* фото удочки — длинное и тонкое */
.gstat { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.gstat span { width: 62px; color: var(--muted, #6b7280); }
.gstat i { flex: 1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.gstat b { display: block; height: 100%; background: #f2b632; }
.gear-card button, .gear-card .tag { margin-top: 4px; align-self: flex-start; }

/* ================= 🧭 навигатор ================= */
.nav-go { margin-top: 6px; padding: 7px 12px; border: 0; border-radius: 10px; background: #1f7ae0; color: #fff; font: 600 14px system-ui, sans-serif; cursor: pointer; }
body.navigating #hud, body.navigating #nav, body.navigating #map-tools, body.navigating:not(.sheet-open) #panel, body.navigating.sheet-open #navui,
body.navigating .player, body.navigating .maplibregl-ctrl-bottom-left { display: none !important; }
body.navigating #toasts { top: auto; bottom: 150px; }
#navui { position: fixed; inset: 0; z-index: 800; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); }
#navui > div { pointer-events: auto; }
.nv-top { background: #1d5c3f; color: #fff; border-radius: 18px; padding: 12px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.nv-main { display: flex; align-items: center; gap: 14px; }
.nv-main b { font-size: 20px; line-height: 1.2; }
.nv-dist { font-size: 34px; font-weight: 800; line-height: 1; margin-bottom: 2px; }
.nv-sub { font-size: 15px; opacity: .85; margin-top: 2px; }
.nv-next { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.25); font-size: 15px; opacity: .9; }
.nav-ico { width: 64px; height: 64px; flex-shrink: 0; color: #fff; }
.nav-ico-txt { font-size: 46px; width: 64px; text-align: center; flex-shrink: 0; }
.nv-bottom { background: var(--card); color: var(--ink); border-radius: 18px; padding: 10px 12px; box-shadow: 0 -2px 20px rgba(0,0,0,.25); }
.nv-sum { font-size: 17px; margin-bottom: 8px; }
.nv-sum b { font-size: 20px; color: #1d8a4f; }
.nv-btns { display: flex; gap: 6px; align-items: center; }
.nv-btns > * { flex: 1 1 0; min-width: 0 !important; }  /* все кнопки делят ширину поровну — «Выйти» не обрезается */
.nv-btns button, .nv-btns a { min-width: 44px; height: 48px; border-radius: 14px; font-size: 22px; padding: 0 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); display: grid; place-items: center; text-decoration: none; }
.nv-btns .primary { flex-grow: 2; font-size: 16px; font-weight: 700; background: #1f7ae0; color: #fff; border: 0; white-space: nowrap; padding: 0 6px; }
.nv-btns .nv-rec { color: #d64b3a; }
.nav-rec { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.nav-rec .row { flex-wrap: wrap; gap: 6px; }
#h-rec { cursor: pointer; }
.nv-btns .nv-stop { font-size: 24px; font-weight: 700; background: #c0392b; color: #fff; border: 0; }
.nav-arrow { z-index: 5; width: 44px; height: 44px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.nav-arrow svg { width: 100%; height: 100%; fill: #1f7ae0; stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
body.navigating .maplibregl-ctrl-bottom-right { bottom: 140px; }  /* подпись карты — над панелью */
@media (orientation: landscape) and (max-height: 500px) { /* телефон боком на держателе: подсказки — колонкой слева, */
  #navui { right: auto; width: min(380px, 44vw); }        /* дорога — справа (камера сдвинута, map/nav.js navCamera) */
  .nv-top { padding: 10px 12px; }
  .nv-dist { font-size: 30px; }
  .nv-main b { font-size: 18px; }
  .nav-ico, .nav-ico-txt { width: 52px; height: 52px; font-size: 38px; }
  .nv-sum { font-size: 15px; margin-bottom: 6px; }
  .nv-btns button, .nv-btns a { height: 44px; }
  body.navigating .maplibregl-ctrl-bottom-right { bottom: 0; }
  body.navigating #toasts { left: auto; right: 8px; bottom: 8px; transform: none; width: min(360px, 50vw); }
}

/* 🎬 трейлер (me/trailer.js) */
#trailer { position: fixed; inset: 0; z-index: 4000; background: #f4eddb; color: #2b2a26; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); box-sizing: border-box; }
#trailer .tr-intro { text-align: center; max-width: 360px; width: 100%; }
#trailer .tr-intro button { display: block; width: 100%; margin: 8px 0; padding: 12px; font-size: 17px; }
#trailer .tr-logo { font-size: 72px; animation: tr-sway 3s ease-in-out infinite; }
@keyframes tr-sway { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(10deg); } }
#trailer .tr-player { width: 100%; max-width: 520px; height: 100%; display: flex; flex-direction: column; align-items: center; }
#trailer .tr-top { width: 100%; display: flex; align-items: center; gap: 8px; }
#trailer .tr-dots { flex: 1; display: flex; gap: 4px; }
#trailer .tr-dots i { flex: 1; height: 4px; border-radius: 2px; background: #ddd6c8; }
#trailer .tr-dots i.done { background: #2f6f5e; }
#trailer .tr-dots i.on { background: linear-gradient(90deg, #2f6f5e 50%, #ddd6c8 50%); background-size: 200% 100%; animation: tr-fill 6s linear forwards; }
@keyframes tr-fill { from { background-position: 100% 0; } to { background-position: 0 0; } }
#trailer .tr-mute { background: none; border: 0; font-size: 22px; padding: 4px 8px; }
#trailer .tr-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; margin-top: 8px; }
#trailer .tr-stage svg { width: 100%; max-height: 100%; aspect-ratio: 1; border-radius: 18px; box-shadow: 0 8px 28px rgba(60, 50, 30, .18); }
#trailer .tr-cap { min-height: 4.2em; margin: 12px 4px 4px; text-align: center; font-size: 18px; line-height: 1.35; font-weight: 600; }
#trailer .tr-cap.in { animation: tr-in .6s ease-out; }
@keyframes tr-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#trailer .tr-bottom { width: 100%; display: flex; justify-content: center; }
#trailer .tr-skip { background: none; border: 0; color: #6b5d45; font-size: 16px; padding: 10px 16px; }
#trailer .tr-end { display: flex; gap: 8px; width: 100%; }
#trailer .tr-end button { flex: 1; padding: 12px; font-size: 16px; }
#trailer .tr-end.hidden { display: none; }

/* 🏛️ Коллекция городов (world/world.js) */
.cc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cc { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-width: 0; }
.cc b { font-size: 13px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.cc small { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.cc.got { border-color: var(--gold); }
.cc-img { width: 100%; max-width: 96px; aspect-ratio: 1; object-fit: contain; }
.cc-shadow { filter: brightness(0) opacity(.22); }
.cc-none { display: flex; align-items: center; justify-content: center; font-size: 40px; border-radius: 50%;
  border: 2px dashed var(--gold); background: rgba(200, 170, 110, .15); box-sizing: border-box; }
.cc-card .cc-none { width: 160px; margin: 0 auto; font-size: 72px; }
.cc-reg { margin: 6px 0; }
.cc-reg > summary { cursor: pointer; padding: 8px 2px; list-style-position: inside; }
.cc-reg[open] > summary { margin-bottom: 4px; }
#cc-modal { position: fixed; inset: 0; z-index: 2500; background: rgba(30, 28, 24, .6);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.cc-card { width: 100%; max-width: 400px; max-height: 100%; overflow: auto; text-align: center; }
.cc-card .cc-img { max-width: 220px; }
.cc-card h2 { margin: 4px 0; }
.cc-card p { text-align: left; }
.cc-card .row { justify-content: center; }
/* ---------- чат и клавиатура на телефоне ---------- */
@media (max-width: 640px) {
  #chat-list { height: 40vh; }
  body.kbd #nav { display: none; }
  body.kbd #panel { bottom: 0; max-height: 100%; }
  body.kbd .chat-rules { display: none; }
  body.kbd #chat-list { height: max(100px, calc(100dvh - 200px)); }  /* видимая над клавиатурой часть */
}
.chat-input { position: sticky; bottom: 0; background: var(--card); padding-top: 6px; }

/* 🏆 рейтинг: своя строка подсвечена */
table.top tr.me-row td { background: color-mix(in srgb, var(--gold) 18%, transparent); font-weight: 600; }
table.top td:nth-child(n+3), table.top th:nth-child(n+3) { text-align: center; }

/* 🧭 «Куда едем?» — поиск адреса для навигатора */
#where { position: fixed; inset: 0; z-index: 900; background: rgba(20,25,30,.35); display: flex; justify-content: center; align-items: flex-start; padding: 70px 12px 12px; }
#where.hidden { display: none; }
.wh-card { width: min(560px, 100%); max-height: calc(100vh - 90px); overflow: auto; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.wh-head { justify-content: space-between; align-items: center; font-size: 18px; }
.wh-close { border: 0; background: none; font-size: 20px; padding: 4px 8px; box-shadow: none; }
.wh-form { gap: 8px; margin: 10px 0 8px; }
.wh-form input { flex: 1; font-size: 18px; padding: 10px 12px; min-width: 0; }
.wh-form button { font-size: 16px; padding: 10px 16px; }
.wh-prof, .wh-chips { gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.wh-prof button, .wh-chips button { border-radius: 20px; padding: 8px 14px; font-size: 15px; }
.wh-prof button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.wh-cap { margin: 8px 2px 4px; }
.wh-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n k" "s k"; width: 100%; text-align: left; gap: 0 10px;
  padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; border-radius: 0; box-shadow: none; font-size: 16px; }
.wh-row b { grid-area: n; } .wh-row .small { grid-area: s; }
.wh-row .wh-km { grid-area: k; align-self: center; opacity: .65; font-size: 14px; }
body.navigating #btn-where { display: none; }

/* 🚦 участки пути маршрута: смена транспорта (games/board.js) */
.sw-now { justify-content: space-between; align-items: center; gap: 8px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin: 8px 0 4px; }
.sw-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; }
.sw-grid button span { font-size: 26px; line-height: 1; }
.sw-grid button small { font-size: 12px; line-height: 1.15; text-align: center; }
.legs { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.legs ol { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: leg; }
.legs li { position: relative; padding: 6px 0 6px 40px; border-left: 4px solid var(--c); margin-left: 12px; counter-increment: leg; }
.legs li .leg-i { position: absolute; left: -16px; top: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--card);
  border: 2px solid var(--c); display: grid; place-items: center; font-size: 16px; }
.legs li b { margin-right: 6px; }
.legs-ed select { width: 100%; margin-top: 4px; }
.leg-sw { background: var(--card); border: 2px solid #1d5c3f; border-radius: 14px; padding: 1px 5px; font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,.3); white-space: nowrap; }

/* 🛠️ Мастерская маршрутов (games/workshop.js) */
.ws-head { margin-bottom: 6px; }
.ws-tabs { flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.ws-tabs button { flex: 1 1 auto; }
.ws-open { width: 100%; margin: 6px 0; }
.rc-item:has(.rt-del) .ws-open { width: calc(100% - 52px); }
.rt-del { width: 44px; margin: 6px 0 6px 4px; padding: 6px 0; }
.ws-feed li.ws-hidden { opacity: .6; }
.ws-row { gap: 6px; margin-top: 4px; }
.ws-row button { padding: 4px 10px; }
.ws-draft { border: 2px solid #1f7ae0; }
.ws-pop { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.ws-pop button { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font: 600 14px system-ui, sans-serif; cursor: pointer; }
.gallery .ph.cover, .ws-covers .ph.cover { outline: 3px solid #e2a32b; outline-offset: 1px; }
.ws-covers button.ph { padding: 0; border: 0; background: none; cursor: pointer; }
/* ролик: заставка, дни, итог (games/board.js playRoute) */
#pb-card { position: fixed; z-index: 900; left: 50%; top: 18%; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  transition: opacity .5s, transform .5s; background: rgba(20, 28, 24, .82); color: #fff; border-radius: 18px; padding: 14px 18px;
  display: flex; gap: 14px; align-items: center; max-width: min(92vw, 520px); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
#pb-card.show { opacity: 1; transform: translate(-50%, 0); }
#pb-card img { width: 120px; height: 90px; object-fit: cover; border-radius: 12px; flex: none; }
#pb-card b { font-size: 20px; display: block; }
#pb-card.day b { font-size: 26px; }
#pb-card .pb-legs { margin-top: 6px; font-size: 20px; letter-spacing: 1px; }
#pb-card.end { pointer-events: auto; }
.ws-stop { border: 2px solid #b8860b; }
.ws-stop select, .ws-stop input[type=number] { width: 100%; }
.st-amen { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 6px 0; }
.merge { border: 2px solid #1f7ae0; }
.merge-chk { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; font-weight: 600; }
.merge-chk input { width: 22px; height: 22px; }

/* 🖼️ просмотр фото во весь экран (core/app.js Photos) */
#photo-view { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(10, 12, 14, .94); }
#photo-view.on { display: flex; align-items: center; justify-content: center; }
#photo-view img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
#photo-view button { position: absolute; background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 50%;
  width: 48px; height: 48px; font-size: 26px; line-height: 1; padding: 0; }
#photo-view .pv-x { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
#photo-view .pv-prev { left: 8px; top: 50%; transform: translateY(-50%); }
#photo-view .pv-next { right: 8px; top: 50%; transform: translateY(-50%); }
#photo-view .pv-n { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center;
  color: #ddd; font-size: 15px; }
.gallery .ph img { cursor: zoom-in; }

#photo-view .pv-cap { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 14px; right: 72px; color: #fff;
  font-size: 15px; line-height: 1.35; text-shadow: 0 1px 3px #000; max-height: 30vh; overflow: hidden; }
/* метки купленного маршрута на карте и плашка «маршрут на карте ✕» (games/board.js) */
.rt-mark { background: #fff; border: 2px solid #8a5a2b; border-radius: 50%; width: 32px; height: 32px; display: flex;
  align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
#route-chip { position: fixed; z-index: 450; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 4px 4px 12px; box-shadow: var(--shadow); font-size: 14px; cursor: pointer; }
#route-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#route-chip .rc-x { width: 32px; height: 32px; border-radius: 50%; padding: 0; flex: none; }
#route-chip[hidden] { display: none; }
body.sheet-open #route-chip { display: none; }
.sw-grid button.on { border-color: var(--accent, #c9772b); box-shadow: 0 0 0 2px var(--accent, #c9772b) inset; }

/* 🛒 витрина маршрутов: обложки лентой */
.sv-h { margin: 14px 0 6px; font-size: 15px; }
.sv-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.sv-card { flex: 0 0 min(220px, 70vw); scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 0 0 8px; border-radius: 14px; overflow: hidden; background: var(--card, #fff); border: 1px solid var(--line); }
.sv-card b, .sv-card small { padding: 0 10px; }
.sv-card b { font-size: 14px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sv-card small { color: var(--muted, #777); font-size: 12px; }
.sv-img { position: relative; display: block; height: 120px; background: var(--line); }
.sv-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-img i { display: grid; place-items: center; height: 100%; font-size: 40px; font-style: normal; }
.sv-price, .sv-own { position: absolute; bottom: 6px; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: rgba(0,0,0,.6); color: #fff; }
.sv-price { right: 6px; }
.sv-own { left: 6px; }
