/* Mobile-first. Светлая тема — контрастная для яркого солнца, тёмная — по системной настройке. */
:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #ececea;
  --text: #111111;
  --muted: #464646;
  --border: #c9c9c6;
  --accent: #0a50b8;
  --accent-text: #ffffff;
  --warn-bg: #fff1c2;
  --warn-text: #5c4300;
  --hotel: #b3261e;
  --today: #0a50b8;
  --ok: #2e8b57;
  --over: #d9822b;
  --danger: #b3261e;
  --on-solid: #ffffff;
  --ok-bg: #d9f2e3;
  --ok-text: #11502c;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #1d1d1f;
    --surface-2: #2a2a2d;
    --text: #f3f3f3;
    --muted: #b9b9b9;
    --border: #3b3b3e;
    --accent: #7eb0ff;
    --accent-text: #0b0b0b;
    --warn-bg: #3b2f00;
    --warn-text: #ffd966;
    --hotel: #ff8a80;
    --today: #7eb0ff;
    --ok-bg: #16402a;
    --ok-text: #b6f0cc;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  }
  .leaflet-tile-pane { filter: brightness(0.75) contrast(1.1); }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
h1 { font-family: var(--font-display); font-size: 1.6rem; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.2rem; margin: 0 0 0.4em; }
h3 { font-size: 1.02rem; margin: 1.1em 0 0.4em; }
p { margin: 0.4em 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* --- Основной контейнер --- */
.view {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 12px;
}
.card.error { border-color: var(--hotel); }
.stub p { font-size: 1.05rem; }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--accent); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 600;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }

/* --- Нижняя навигация --- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.tabbar .tab-icon { font-size: 1.5rem; line-height: 1; filter: grayscale(1); opacity: 0.7; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active .tab-icon { filter: none; opacity: 1; }

/* --- Карта --- */
.map-view {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  display: flex;
  flex-direction: column;
}
.map-top {
  flex: none;
  padding: 8px 12px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 500;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.seg button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="false"] { text-decoration: line-through; opacity: 0.65; }
.chip:disabled { opacity: 0.35; }

#map { flex: 1; min-height: 0; background: var(--surface-2); }

.pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--pin, #555);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  font-size: 20px;
}
.pin-sight  { --pin: #c2410c; }
.pin-cafe   { --pin: #7c3aed; }
.pin-rest   { --pin: #0e7490; }
.pin-toilet { --pin: #1d4ed8; }
.pin-park   { --pin: #15803d; }
.pin-experience { --pin: #be185d; }
.pin-event  { --pin: #a16207; }
.pin-hotel  { --pin: #b3261e; width: 50px; height: 50px; font-size: 26px; border-radius: 12px; }
.pin-unv {
  position: absolute;
  top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #ffc107;
  color: #000;
  font: 700 12px/18px system-ui, sans-serif;
  text-align: center;
  border: 1px solid #000;
}
.leaflet-div-icon.pin-wrap { background: none; border: 0; }
.pin-rain {
  position: absolute;
  bottom: -6px; left: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  font: 12px/20px system-ui, sans-serif;
  text-align: center;
  border: 1px solid #000;
}
.chip-action { color: var(--text); border-style: dashed; }
/* Маршрут впечатления и подсветка кандидатов идеи */
.route-line { stroke: var(--accent); }
.stop-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  border: 2px solid #fff;
  font: 700 13px/22px system-ui, sans-serif;
  text-align: center;
}
.pin-hl {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* --- Шторка --- */
.sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 900;
  max-height: 78vh;
  max-height: 78dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(110%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.sheet.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
@media (min-width: 760px) {
  .sheet { left: 50%; width: 720px; margin-left: -360px; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet.open { transition: none; } }
.sheet-bar {
  flex: none;
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--border); }
.sheet-close {
  position: absolute;
  right: 6px; top: 2px;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 20px;
}

/* Карточка места */
.place-photo { margin: 0 0 10px; }
.place-photo img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; display: block; }
.place-photo figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.place-title { margin: 0; font-size: 1.35rem; }
.place-local { margin: 0 0 6px; color: var(--muted); font-style: italic; }
.place-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.summary { font-weight: 600; }

.effort {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.effort li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.95rem;
}
.effort li.level { grid-column: 1 / -1; font-weight: 700; font-size: 1.05rem; }
.effort .ic { font-size: 1.2rem; }

.route-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 8px; }
.route-btns .btn { font-size: 0.95rem; padding: 10px 8px; text-align: center; }
.game-link { width: 100%; margin-top: 4px; }

/* --- План по дням --- */
.days { display: grid; gap: 10px; }
.day-card {
  display: block;
  color: inherit;
  text-decoration: none;
  margin: 0;
}
.day-card.today { border: 3px solid var(--today); }
.day-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.day-date { font-size: 1.15rem; font-weight: 700; }
.day-city { color: var(--muted); font-weight: 600; }
.day-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.day-sub { margin-top: 6px; color: var(--muted); font-size: 0.92rem; }
.day-nav { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0; }
.day-nav .btn { flex: 1; }
.day-nav .btn[aria-disabled="true"] { visibility: hidden; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item-time { flex: none; min-width: 3.2em; font-weight: 700; }
.item-main { flex: 1; }
.item a.item-place {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-weight: 600;
}

h2.section { margin-top: 18px; }
.item.pause { background: var(--surface-2); }
.item-when { font-weight: 600; margin: 2px 0; }
.event p { margin: 4px 0; }
.event-links a { display: inline-flex; align-items: center; min-height: 44px; }
.warn-card { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.warn-card a { color: inherit; }
.warn-card.strike { border-left: 6px solid currentColor; }
.warn-card .muted { color: inherit; opacity: .85; }
.strike-title { font-weight: 700; font-size: 1.05em; }
.warn-card .src a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.transfer-rec { font-weight: 600; }
.transfer-opts li { margin-bottom: 10px; }

/* --- Советы --- */
.seg-links { margin-bottom: 12px; }
.seg a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; border-radius: 9px; color: var(--text);
  font-weight: 600; text-decoration: none; text-align: center;
}
.seg a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
.filters { margin-bottom: 4px; }
.field { display: grid; gap: 4px; font-weight: 600; }
.field select, .field input {
  min-height: 48px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.chip.pick[aria-pressed="false"] { text-decoration: none; opacity: 1; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.9rem; }
.rec-title { margin: 8px 0 4px; font-size: 1.15rem; }
.eff-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.eff { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 0.88rem; }
.eff.lvl { font-weight: 700; }
.rec-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.day-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-result { min-height: 1.5em; font-weight: 600; }
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  border: 2px solid var(--border); background: transparent; color: var(--text); font-size: 1.1rem; cursor: pointer;
}

/* --- Энергобюджет --- */
.energy { margin: 14px 0 4px; }
.energy-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.energy-bar { display: flex; gap: 4px; }
.seg-e { flex: 1; height: 14px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.seg-e.on { background: var(--ok); border-color: var(--ok); }
.seg-e.over { background: var(--over); border-color: var(--over); }
.energy-note { font-size: 0.88rem; margin: 4px 0 10px; }
.energy-note a { display: inline-block; padding: 10px 0; }
.soft-warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.soft-warn .btn { margin-top: 6px; width: 100%; }

/* Щадящие маршруты в «Советах» */
.route-stops { margin: 6px 0; padding: 0; list-style: none; counter-reset: stop; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.route-stops li { counter-increment: stop; }
.route-stops li::before { content: counter(stop) '. '; font-weight: 700; }
.route-stops li:not(:last-child)::after { content: ' →'; color: var(--muted); }
.route-load { margin: 6px 0 0; font-weight: 600; }

/* «Проверка дня» */
.day-check { margin: 12px 0; }
.check-head { margin: 0 0 8px; font-size: 1.15rem; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); }
.check.ok { background: var(--ok-bg); color: var(--ok-text); }
.check-ic { flex: 0 0 1.6em; font-size: 1.15rem; line-height: 1.4; text-align: center; }
.check-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.check-body p { margin: 6px 0 0; }
.check-body a { color: inherit; font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }
.check-body .muted { color: inherit; opacity: .85; }
.check-body summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.check-body .btn { margin-top: 6px; width: 100%; }
.check.strike { border-left: 6px solid currentColor; }
.check-note { margin: 8px 0 0; font-size: .92rem; }
.plan-switch { margin: 10px 0; }

/* --- Практическое --- */
.prac summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; }
.prac summary::-webkit-details-marker { display: none; }
.prac summary::after { content: '▾'; margin-left: auto; font-size: 1.2rem; color: var(--muted); }
.prac[open] summary::after { content: '▴'; }
.prac summary h2 { margin: 0; }
.prac ul { padding-left: 1.2em; }
.prac li { margin: 6px 0; }
.src { font-size: 0.85rem; }
.src a, .link-list a { display: inline-block; padding: 10px 4px; }
.link-list { list-style: none; padding: 0 !important; margin: 4px 0; }
.link-list li { margin: 0; }
.phrases { list-style: none; padding: 0 !important; display: grid; gap: 6px; }
.phrases li { display: grid; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); margin: 0; }
.ph-local { font-weight: 700; font-size: 1.05rem; }
.numbers { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.numbers li { display: flex; align-items: center; gap: 12px; margin: 0; }
.btn.num { min-width: 96px; flex: none; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 2ch; text-align: center; font-size: 1.3rem; font-weight: 700; }
.btn.wide { width: 100%; margin-top: 8px; }

/* --- Факты «к слову» (facts.js): один на экран --- */
.fun-fact {
  margin: 0 0 12px;
  padding: 12px 14px 4px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.fun-fact:empty { display: none; }
.fun-fact p { margin: 0; line-height: 1.45; }
.fun-fact-icon { font-size: 1.15rem; }
.fun-fact-more {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.sheet-body .fun-fact { margin-top: 16px; }
:root[data-theme="emo"] .fun-fact { border: 2px dashed var(--neon-pink); }

/* --- Игры --- */
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.player { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.player-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; }
.player input {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.players-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.game-card { display: block; color: inherit; text-decoration: none; }
.game-card h3 { margin: 0 0 4px; color: var(--accent); }
.game-card p { margin: 0 0 6px; }
.ach-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.game-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 12px; }
.game-tabs .chip { text-decoration: none; white-space: nowrap; }
.game-tabs .chip[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 0 0 12px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.scene h2 { margin-top: 0; }
.scene p { font-size: 1.05rem; line-height: 1.55; }
.speaker { font-weight: 600; color: var(--muted); }
.line { border-left: 4px solid var(--accent); padding-left: 12px; font-style: italic; }
.turn { margin: 4px 0 8px; font-size: 1.05rem; }
.choices { display: grid; gap: 8px; }
.btn.choice, .quiz-opt { justify-content: flex-start; text-align: left; min-height: 52px; }
.quiz-opt.right { background: var(--ok); border-color: var(--ok); color: var(--on-solid); opacity: 1; }
.quiz-opt.wrong { background: var(--danger); border-color: var(--danger); color: var(--on-solid); opacity: 1; }
.explain { margin: 10px 0 0; }
.quiz-result { font-weight: 700; font-size: 1.1rem; }
.game-end { display: grid; gap: 8px; }
.achievement { text-align: center; font-size: 1.2rem; margin: 8px 0; }
.onsite details summary, .sources summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent); }
.game-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 12px; }
.game-foot .btn { font-size: 0.95rem; padding: 10px 8px; }
.game-foot .btn:only-child { grid-column: 1 / -1; }
.sources .link-list a { word-break: break-all; font-size: 0.85rem; }

/* --- Впечатления в шторке --- */
.more summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent); }
.bul { padding-left: 1.3em; margin: 4px 0 8px; }
.bul li { margin: 4px 0; }
.bul.plain { list-style: none; padding-left: 0; }
.card.idea .rec-actions { grid-template-columns: 1fr; }

/* --- Ручной план дня --- */
.item-ctrls { flex: none; display: grid; gap: 6px; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.item.is-hidden { opacity: 0.6; border-style: dashed; }
.item-place .item-time { min-width: 0; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); }
.item-note { margin: 6px 0; }
.item-edit summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent); }
.item-edit form { display: grid; gap: 10px; margin: 4px 0 8px; }
.item-edit textarea {
  min-height: 64px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
#day-items > .btn.wide { margin-top: 10px; }

/* --- «+ В план» --- */
.add-plan { margin: 12px 0; grid-column: 1 / -1; }
.add-plan > summary { display: flex; list-style: none; cursor: pointer; }
.add-plan > summary::-webkit-details-marker { display: none; }
.add-plan[open] > summary { margin-bottom: 8px; }
.day-pick { display: grid; gap: 2px; text-align: center; }
.pick-warn { font-size: 0.8rem; font-weight: 600; }

/* --- Экспорт и импорт плана --- */
.share-plan { margin-top: 24px; }
.share-btns { display: grid; gap: 8px; }
.share-btns label.btn { cursor: pointer; }
.share-url {
  width: 100%; min-height: 44px; margin-top: 6px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem;
}

/* --- Мини-игра «Фото-задание» --- */
.timer-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.timer { margin: 4px 0; font-size: 2.6rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.timer.done { font-size: 1.6rem; color: var(--hotel); }
.topic { padding: 10px 0; border-top: 1px solid var(--border); }
.topic-name { margin: 0 0 8px; font-size: 1.05rem; }
.topic-players { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.shot, .chip.shot[aria-pressed="false"] { min-height: 44px; text-decoration: none; opacity: 1; }
.chip.shot[aria-pressed="true"] { border-color: var(--accent); }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 6px; }
.pick-row { display: grid; grid-template-columns: auto 1fr 44px; gap: 6px 8px; align-items: center; margin: 8px 0; }
.pick-num { font-weight: 700; width: 1.5ch; text-align: center; }
.pick-row select, .pick-row input {
  min-width: 0; min-height: 44px; padding: 6px 10px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.pick-row select { grid-column: 2 / 4; }
.pick-row input { grid-column: 2; }
.pick-row .icon-btn { grid-column: 3; }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); }

/* --- Мини-игра «Оценки игроков» --- */
.rate-who { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.who, .chip.who[aria-pressed="false"] { min-height: 44px; text-decoration: none; opacity: 1; }
.chip.who[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.rate-status { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.rate-slot h3 { margin: 0 0 8px; }
.score-btns { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.btn.score { padding: 8px 0; font-size: 1.15rem; }
.btn.score[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.verdict { font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
.results { width: 100%; border-collapse: collapse; font-size: 1rem; }
.results th, .results td { padding: 10px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.results tbody th { text-align: left; }
.results tr.win { background: var(--warn-bg); color: var(--warn-text); }
.field.reveal { margin: 8px 0; }

/* --- Переключатель темы --- */
.theme-setting { flex-wrap: wrap; margin-bottom: 12px; }
.theme-setting .seg { flex: 1 1 220px; }

/* ==========================================================================
   Тема «emo» (эмо-MySpace 2010-х). Всегда тёмная, не зависит от системной.
   Контраст (WCAG): текст/фон 16.3:1, muted/surface 10.1, muted/surface-2 8.9,
   accent/surface 6.6, текст кнопки/accent 7.0, today/surface 6.9.
   ========================================================================== */
:root[data-theme="emo"] {
  color-scheme: dark;
  --bg: #0d0612;
  --surface: #1a0f24;
  --surface-2: #2a1838;
  --text: #f7eefc;
  --muted: #cdb8dc;
  --border: #6b3a8c;
  --accent: #ff5fb4;
  --accent-text: #1a0612;
  --warn-bg: #3a2a00;
  --warn-text: #ffd966;
  --hotel: #ff8a80;
  --today: #c77dff;
  --ok: #3ecf8e;
  --over: #ffb03a;
  --danger: #ff6b7a;
  --on-solid: #0d0612;
  --ok-bg: #16402a;
  --ok-text: #b6f0cc;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
  --radius: 6px;
  --neon-pink: #ff5fb4;
  --neon-purple: #b066ff;
  --head-bg: linear-gradient(90deg, #7a1f5c, #5b2a86);
  --head-text: #ffffff;
  --font-display: "Rubik Wet Paint", var(--font-body);
}

/* Шапка «<Имя>'s …» и блинки видны только в эмо. */
.whose, .blinkies { display: none; }

/* --- Эмо: фон — клетка + звёздочки (инлайновый SVG), неподвижный --- */
:root[data-theme="emo"] {
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='%23ff5fb4' opacity='.28'%3E%3Cpath d='M30 18l2.5 7.5 7.5 2.5-7.5 2.5-2.5 7.5-2.5-7.5-7.5-2.5 7.5-2.5z'/%3E%3Cpath d='M130 100l1.8 5.2 5.2 1.8-5.2 1.8-1.8 5.2-1.8-5.2-5.2-1.8 5.2-1.8z'/%3E%3C/g%3E%3Cg fill='%23b066ff' opacity='.3'%3E%3Cpath d='M110 30l1.5 4.5 4.5 1.5-4.5 1.5-1.5 4.5-1.5-4.5-4.5-1.5 4.5-1.5z'/%3E%3Cpath d='M50 130l2 6 6 2-6 2-2 6-2-6-6-2 6-2z'/%3E%3Ccircle cx='160' cy='160' r='1.5'/%3E%3Ccircle cx='85' cy='70' r='1.2'/%3E%3C/g%3E%3C/svg%3E"),
    repeating-conic-gradient(#150a1d 0 25%, #0d0612 0 50%);
  background-size: 180px 180px, 36px 36px;
  background-attachment: fixed;
}
:root[data-theme="emo"] body { background: transparent; }

/* --- Эмо: блоки MySpace — рамка и цветная шапка --- */
:root[data-theme="emo"] .card {
  border: 2px solid var(--border);
  box-shadow: 0 0 0 1px #000, 0 0 14px rgba(176, 102, 255, 0.18);
}
:root[data-theme="emo"] .day-card.today { border: 3px solid var(--today); }
:root[data-theme="emo"] .whose { display: inline; }
:root[data-theme="emo"] .mod-head {
  display: block;
  padding: 8px 12px;
  background: var(--head-bg);
  color: var(--head-text);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 2px solid var(--neon-pink);
  border-radius: 4px;
  text-shadow: 0 0 6px rgba(255, 95, 180, 0.8);
}
:root[data-theme="emo"] .card > .mod-head:first-child {
  margin: -14px -16px 12px;
  border-width: 0 0 2px;
  border-radius: 4px 4px 0 0;
}
:root[data-theme="emo"] .mod-head::after {
  content: '✦ ✧ ✦';
  float: right;
  margin-left: 8px;
  line-height: 1.6;
  font: 0.9rem var(--font-body);
  color: #ffc2e6;
  animation: emo-twinkle 1.8s steps(2, jump-none) infinite;
}

/* --- Эмо: glitter на h1 (светлые тона — контраст с фоном ≥ 12:1) --- */
:root[data-theme="emo"] h1 {
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: #ffe3f3;
  background: linear-gradient(100deg, #ffffff 0%, #ffc2e6 18%, #ffffff 34%, #e0b3ff 52%, #ffffff 68%, #ffc2e6 84%, #ffffff 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 95, 180, 0.55));
  animation: emo-glitter 5s linear infinite;
}
@keyframes emo-glitter { to { background-position: -250% 0; } }
@keyframes emo-twinkle { 50% { opacity: 0.35; } }

/* --- Эмо: блинки-плашки --- */
:root[data-theme="emo"] .blinkies { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.blinkie {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid #000;
  outline: 1px solid var(--neon-pink);
  background: #2a0a24;
  color: #ffc2e6;
  font: 700 0.72rem/1.6 ui-monospace, "Courier New", monospace;
  white-space: nowrap;
  animation: emo-blink 1.6s steps(1) infinite;
}
.blinkie:nth-child(2) { outline-color: var(--neon-purple); background: #1c0a33; color: #e0b3ff; animation-delay: 0.5s; }
.blinkie:nth-child(3) { animation-delay: 1s; }
@keyframes emo-blink { 50% { background: #5b1447; color: #ffffff; } }

/* --- Эмо: навигация, кнопки, фокус --- */
:root[data-theme="emo"] .tabbar { background: #120818; border-top: 2px solid var(--neon-pink); }
:root[data-theme="emo"] .tabbar a.active { text-shadow: 0 0 8px rgba(255, 95, 180, 0.7); }
:root[data-theme="emo"] .btn { box-shadow: 0 0 10px rgba(255, 95, 180, 0.35); }
:root[data-theme="emo"] .btn.secondary { background: var(--surface); }
:root[data-theme="emo"] .seg button[aria-pressed="true"],
:root[data-theme="emo"] .seg a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
:root[data-theme="emo"] .map-top { border-bottom: 2px solid var(--neon-pink); }
:root[data-theme="emo"] .sheet { border-top: 2px solid var(--neon-pink); }
:root[data-theme="emo"] :focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }

/* --- Эмо: курсор-блёстки (создаёт theme.js только на десктопе) --- */
.spark {
  position: fixed;
  z-index: 3000;
  pointer-events: none;
  color: var(--neon-pink);
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 6px currentColor;
  animation: emo-spark 0.8s ease-out forwards;
}
.spark:nth-of-type(2n) { color: var(--neon-purple); }
@keyframes emo-spark {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, 40%) scale(0.3) rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="emo"] h1, .blinkie, :root[data-theme="emo"] .mod-head::after { animation: none; }
  .spark { display: none; }
}

/* --- Mood дня --- */
.mood { margin: 12px 0 -6px; font-weight: 700; }
.mood-label { color: var(--muted); font-weight: 600; }
.mood.mood-card { margin: 6px 0 0; font-size: .95rem; }
:root[data-theme="emo"] .mood {
  display: inline-block;
  padding: 4px 12px;
  border: 1px dashed var(--neon-purple);
  background: var(--surface);
}
:root[data-theme="emo"] .mood-label { font-style: italic; }

/* --- Top 8 --- */
.not-emo { display: inline; }
:root[data-theme="emo"] .not-emo { display: none; }
.top8s { margin-top: 18px; }
.top8-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.top8-slot {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  min-height: 76px;
  padding: 6px 4px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  text-align: center;
}
.top8-slot.empty { place-content: center; color: var(--muted); font-size: 1.4rem; font-weight: 700; border-style: dashed; background: transparent; }
.top8-ic { font-size: 1.5rem; line-height: 1.2; }
.top8-name {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.top8-pick { margin: 10px 0; }
.top8-pick-title { font-weight: 600; margin: 0 0 6px; }
.top8-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.top8-btn, .chip.top8-btn[aria-pressed="false"] { text-decoration: none; opacity: 1; color: var(--text); }
.chip.top8-btn[aria-pressed="true"] { border-color: var(--accent); }
:root[data-theme="emo"] .top8-slot { border-color: var(--neon-purple); }
:root[data-theme="emo"] a.top8-slot:hover { border-color: var(--neon-pink); }

/* Показывать только в эмо */
.emo-only { display: none; }
:root[data-theme="emo"] .emo-only { display: inline; }
:root[data-theme="emo"] p.emo-only { display: block; }

/* --- Currently listening --- */
.listening { margin: 10px 0; }
.listening label { display: block; font-weight: 600; margin-bottom: 4px; }
.listening-row { display: flex; gap: 8px; }
.listening input {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
:root[data-theme="emo"] .listening label { color: var(--neon-pink); font-style: italic; }
:root[data-theme="emo"] .listening input { border-style: dashed; font-style: italic; }

/* --- Стена комментариев (заметки к пунктам) --- */
.wall-comment { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.wall-ava { flex: none; line-height: 1.45; }
.wall-body { flex: 1; min-width: 0; }
.wall-comment .item-note { margin: 0; overflow-wrap: anywhere; }
:root[data-theme="emo"] .wall-ava {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 2px solid var(--neon-purple);
  background: var(--surface-2);
  font-size: 1.3rem;
}
:root[data-theme="emo"] .wall-body {
  position: relative;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}
:root[data-theme="emo"] .wall-who { margin: 0 0 2px; font-size: 0.85rem; font-weight: 700; color: var(--neon-pink); }

/* --- Счётчик (visitor counter) --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.counter { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; }
.counter-row { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; color: var(--muted); }
.counter-digits { display: inline-flex; gap: 2px; font: 700 1.05rem/1 ui-monospace, "Courier New", monospace; font-variant-numeric: tabular-nums; }
.counter-digits span { padding: 3px 4px; border-radius: 3px; background: var(--surface-2); color: var(--text); }
:root[data-theme="emo"] .counter {
  display: inline-flex;
  padding: 6px 10px;
  border: 2px ridge var(--neon-purple);
  background: #000;
}
:root[data-theme="emo"] .counter-digits span { background: #111; color: #7dff9a; border: 1px solid #333; text-shadow: 0 0 4px rgba(125, 255, 154, 0.7); }
:root[data-theme="emo"] .counter-label { font-family: ui-monospace, "Courier New", monospace; font-size: 0.85rem; text-transform: uppercase; }
