/* Світла тема. Референс — мінімалістичні fintech-інтерфейси: світло-сірий фон, картки на тон темніші,
   білі панелі, чорні «пігулки» для активного стану, м'які градієнти салатний → сірий → малиновий.
   Шрифт Geologica: 100 (тонкий, великі числа й другі рядки) і 700 (акценти); 300 — лише дрібний текст, бо 100 на 11–13 px не читається. */
:root {
  --bg: #f0f0f2;
  --card: #e7e7ea;
  --card2: #ececef;
  --white: #fff;
  --line: #dededf;
  --line2: #cdcdd2;
  --ink: #0c0c0e;
  --ink2: #55555c;
  --ink3: #95959c;
  --west: #46dd72;      /* салатний — демократії */
  --west-ink: #14963f;
  --auto: #d6245f;      /* малиновий — автократії */
  --auto-ink: #ad1149;
  --neut: #a3a2a7;      /* сірий — нейтральні гравці */
  --neut-ink: #6c6b71;
  --grad: linear-gradient(90deg, #7af596 0%, #c9c9cd 50%, #e8467f 100%);
  --f: 'Geologica', system-ui, sans-serif;
  --r: 16px;
  --panel-w: 390px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 300 14px/1.45 var(--f);
  font-variant-numeric: tabular-nums;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: auto auto 1fr auto; grid-template-areas: "top top" "dims dims" "stage panel" "tl tl";
  overflow: hidden;
}
a { color: inherit; }
b, strong { font-weight: 700; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- top ---------- */
.top { grid-area: top; display: flex; align-items: center; gap: 24px; padding: 16px 24px 10px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); }
.brand-mark::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--ink); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text b { font-size: 20px; letter-spacing: .02em; }
.brand-text span { font-weight: 300; font-size: 12px; color: var(--ink3); margin-top: 3px; }
.views { display: flex; gap: 6px; margin-left: 18px; }
.views a, .method-link { text-decoration: none; padding: 8px 16px; border-radius: 999px; color: var(--ink2); font-weight: 300; background: var(--card2); }
.views a:hover, .method-link:hover { color: var(--ink); background: var(--card); }
.views a.on { color: var(--white); background: var(--ink); font-weight: 700; }
.method-link { background: var(--white); border: 1px solid var(--line); }

/* ---------- dims ---------- */
.dims { grid-area: dims; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 24px 12px; }
.dims button { padding: 6px 13px; border-radius: 999px; font-size: 12px; color: var(--ink2); background: var(--white); border: 1px solid var(--line); }
.dims button:hover { color: var(--ink); border-color: var(--line2); }
.dims button.on { color: var(--white); background: var(--ink); border-color: var(--ink); font-weight: 700; }
.legend { margin-left: auto; display: flex; gap: 6px; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 8px; background: var(--card2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ---------- stage ---------- */
.stage { grid-area: stage; position: relative; min-height: 0; overflow: hidden; user-select: none; -webkit-user-select: none; margin: 0 0 0 24px; border-radius: var(--r); background: var(--card2); }
.view { position: absolute; inset: 0; display: none; }
.view.on { display: block; }
.view > svg { width: 100%; height: 100%; display: block; position: relative; }
#view-singularity::before { /* великий блідий водяний знак, як назва бренду в референсі */
  content: 'WW3'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%);
  font: 100 min(25vw, 50vh)/1 var(--f); color: #e2e2e6; letter-spacing: -.04em; pointer-events: none; white-space: nowrap;
}
.map-hint { position: absolute; left: 18px; bottom: 14px; font-size: 11px; color: var(--ink3); max-width: 440px; pointer-events: none; }
.map-ctrl { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; z-index: 2; padding: 4px; border-radius: 999px; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.map-ctrl button { padding: 6px 12px; border-radius: 999px; font-size: 12px; color: var(--ink2); }
.map-ctrl button:hover { color: var(--ink); background: var(--card2); }
.map-ctrl button.on { color: var(--white); background: var(--ink); font-weight: 700; }
.map-ctrl .reset { margin-left: 4px; }
#view-map svg { cursor: grab; touch-action: none; }
#view-map svg:active { cursor: grabbing; }

.tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--white); border-radius: 12px; padding: 11px 13px; font-size: 12px; min-width: 200px; opacity: 0; transition: opacity .12s; box-shadow: 0 10px 30px rgba(20,20,30,.12), 0 1px 2px rgba(0,0,0,.06); }
.tooltip.on { opacity: 1; }
.tooltip b { display: block; font-size: 14px; margin-bottom: 7px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink2); font-size: 12px; }
.tooltip .row span:last-child { color: var(--ink); font-weight: 700; }

/* закріплена картка з хрестиком */
.pop { position: absolute; z-index: 6; display: none; min-width: 230px; max-width: 270px; padding: 13px 14px 10px; border-radius: 14px; background: var(--white); font-size: 12px; box-shadow: 0 14px 40px rgba(20,20,30,.16), 0 1px 2px rgba(0,0,0,.06); }
.pop.on { display: block; }
.pop b { display: block; font-size: 15px; margin: 0 26px 8px 0; }
.pop .row, .tooltip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink2); font-size: 12px; line-height: 1.6; }
.pop .row span:last-child { color: var(--ink); font-weight: 700; }
.pop .row span:first-child, .tooltip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; }
i.dot { width: 8px; height: 8px; border-radius: 3px; background: var(--c); display: inline-block; }
.vec { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink2); }
.pop-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; font-size: 22px; font-weight: 100; line-height: 1; color: var(--ink2); }
.pop-x:hover { background: var(--card2); color: var(--ink); }
.pop-more { margin-top: 8px; padding: 6px 11px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 11px; font-weight: 700; }
.panel.flash { box-shadow: 0 0 0 3px var(--west); transition: box-shadow .2s; }
.panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-top .back { margin: 0; }
.panel-x { width: 32px; height: 32px; border-radius: 50%; font-size: 22px; font-weight: 100; color: var(--ink2); background: var(--card2); }
.panel-x:hover { color: var(--ink); background: var(--card); }
.vec-box b { color: var(--ink); }

/* пошук */
.search { position: relative; margin-left: auto; width: 260px; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2395959c' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px 50%; font: 300 14px var(--f); color: var(--ink); outline: none; -webkit-appearance: none; appearance: none; }
.search input:focus { border-color: var(--ink3); box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.search-list { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; margin: 0; padding: 6px; list-style: none; border-radius: 14px; background: var(--white); box-shadow: 0 14px 40px rgba(20,20,30,.16); max-height: 360px; overflow: auto; }
.search-list.on { display: block; }
.search-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.search-list li.act, .search-list li:hover { background: var(--card2); }
.search-list li i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.search-list li small { margin-left: auto; color: var(--ink3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-list li.none { color: var(--ink3); cursor: default; }
.method-link { margin-left: 0; }

/* svg layers */
.ring { fill: none; stroke: #c9c9cf; stroke-dasharray: 1 5; stroke-linecap: round; }
.ring-label { fill: var(--ink3); font: 300 10px var(--f); letter-spacing: .08em; text-transform: uppercase; }
.sector-label { font: 700 13px var(--f); letter-spacing: .02em; }
.node circle.body { stroke: var(--white); stroke-width: 1.5px; cursor: pointer; transition: opacity .25s; }
.node text { fill: var(--ink2); font: 300 10.5px var(--f); pointer-events: none; paint-order: stroke; stroke: var(--card2); stroke-width: 3.5px; stroke-linejoin: round; }
.node.big text { fill: var(--ink); font-weight: 700; font-size: 11px; }
.node.sel circle.body { stroke: var(--ink); stroke-width: 2.5px; }
.node.dim { opacity: .14; }
.node.in-club circle.body { stroke: var(--ink); stroke-width: 2px; }
.tie { fill: none; stroke-linecap: round; transition: opacity .25s; }
.tie.neg { stroke-dasharray: 3 4; }
.spin { animation: spin 60s linear infinite; transform-origin: center; transform-box: fill-box; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 2.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0%,100% { opacity: .85; transform: scale(1); } 50% { opacity: .3; transform: scale(1.16); } }
.core-text { fill: var(--ink); font: 700 13px var(--f); letter-spacing: .14em; text-anchor: middle; }
.core-sub { fill: var(--ink2); font: 300 11px var(--f); text-anchor: middle; }

.country { stroke: var(--white); stroke-width: .6px; cursor: pointer; vector-effect: non-scaling-stroke; }
.country:hover { stroke: var(--ink); stroke-width: 1.2px; }
.country.sel { stroke: var(--ink); stroke-width: 2px; }
.country.dim { opacity: .18; }
.graticule { fill: none; stroke: rgba(0,0,0,.05); vector-effect: non-scaling-stroke; }
.sphere { fill: #f7f7f8; stroke: var(--line2); vector-effect: non-scaling-stroke; }
.dist-ring { fill: none; stroke: var(--ink); stroke-opacity: .28; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; }
.dist-label { fill: var(--ink2); font: 300 10px var(--f); paint-order: stroke; stroke: #f7f7f8; stroke-width: 3px; }
.geo-tie { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }

/* окупація / фронт (DeepStateMap) */
.occupied { stroke: none; }
.gray-zone { stroke: none; }
.front-halo { fill: none; stroke: #fff; stroke-width: 7px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.front-line { fill: none; stroke: #6d0a2e; stroke-width: 3px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.front-legend { position: absolute; left: 14px; bottom: 46px; z-index: 2; max-width: 300px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.92); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-size: 12px; color: var(--ink2); }
.front-legend:empty { display: none; }
.fl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fl-row b { margin-left: auto; color: var(--ink); white-space: nowrap; }
.sw { flex: none; width: 18px; height: 12px; border-radius: 3px; }
.sw.occ { background: repeating-linear-gradient(45deg, #ad1149 0 2px, #f3d6df 2px 5px); }
.sw.gray { background: repeating-linear-gradient(-45deg, #6c6b71 0 1px, #eeeef0 1px 4px); }
.sw.line { height: 0; border-top: 2.5px solid #6d0a2e; border-radius: 0; }
.fl-note { font-size: 11px; color: var(--auto-ink); margin: 4px 0; }
.fl-src { font-size: 10.5px; color: var(--ink3); margin-top: 4px; }
.fl-src a { color: var(--ink2); }

/* ---------- clubs ---------- */
.clubs-wrap { position: absolute; inset: 0; overflow: auto; padding: 24px; }
.clubs-intro { max-width: 780px; color: var(--ink2); margin: 0 0 20px; }
.clubs-intro h2 { font: 700 30px/1.1 var(--f); color: var(--ink); margin: 0 0 10px; }
.clubs-intro h2 span { font-weight: 100; color: var(--ink2); }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.club { background: var(--white); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.club::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 70px; background: linear-gradient(180deg, var(--pc) 0%, transparent 100%); opacity: .16; pointer-events: none; }
.club > * { position: relative; }
.club h3 { margin: 0; font-size: 16px; font-weight: 700; }
.club .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--ink3); }
.club .meta b { color: var(--ink); }
.bar { height: 6px; background: var(--card2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--pc, var(--ink2)); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; background: var(--card2); font-size: 11px; color: var(--ink2); cursor: pointer; }
.chip:hover { color: var(--ink); background: var(--card); }
.chip i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.club .show { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: 999px; color: var(--white); background: var(--ink); }
.club .show:hover { opacity: .85; }

/* ---------- panel ---------- */
.panel { grid-area: panel; overflow-y: auto; margin: 0 24px 0 12px; padding: 22px 20px 30px; background: var(--white); border-radius: var(--r); }
.panel h2 { font: 700 26px/1.1 var(--f); margin: 0 0 6px; letter-spacing: -.01em; }
.panel h2 span { display: block; font-weight: 100; color: var(--ink2); }
.panel h3 { font-size: 11px; font-weight: 300; text-transform: uppercase; letter-spacing: .1em; color: var(--ink3); margin: 26px 0 10px; }
.panel .sub { color: var(--ink3); font-size: 12px; }
.panel .back { font-size: 12px; color: var(--ink2); margin-bottom: 14px; padding: 5px 11px; border-radius: 999px; background: var(--card2); }
.panel .back:hover { color: var(--ink); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--card2); border-radius: 12px; padding: 11px 12px 12px; position: relative; overflow: hidden; }
.kpi.pole { background: linear-gradient(180deg, var(--card2) 55%, var(--soft) 100%); }
.kpi span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink3); }
.kpi span i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.kpi b { display: block; font-weight: 100; font-size: 30px; line-height: 1.15; letter-spacing: -.02em; margin-top: 2px; }
.kpi small { font-size: 11px; color: var(--ink2); }
.tri-wrap { display: flex; justify-content: center; margin: 6px 0 4px; }
.tri text { font: 300 10px var(--f); fill: var(--ink3); }
.stack { display: grid; grid-template-columns: 96px 1fr 38px; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); margin-bottom: 7px; }
.stack .s { display: flex; height: 10px; gap: 2px; }
.stack .s i { display: block; height: 100%; border-radius: 3px; }
.stack .inv { text-align: right; color: var(--ink); font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list li small { display: block; color: var(--ink3); font-size: 11px; margin-top: 2px; }
.ev { cursor: pointer; }
.ev:hover { color: var(--west-ink); }
.ev time { font-size: 11px; color: var(--ink3); margin-right: 6px; }
.ev.future { opacity: .35; }
.tag { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 6px; background: var(--card2); color: var(--ink2); margin-right: 4px; }
.note-box { font-size: 12px; color: var(--ink2); background: var(--card2); border-radius: 12px; padding: 10px 12px; margin-top: 14px; }
.vote-no { color: var(--auto-ink); } .vote-yes { color: var(--west-ink); } .vote-abstain, .vote-absent { color: var(--neut-ink); }

/* ---------- timeline ---------- */
.timeline { grid-area: tl; display: flex; align-items: center; gap: 18px; margin: 12px 24px 16px; padding: 12px 18px; border-radius: var(--r); background: var(--white); }
.play { width: 40px; height: 40px; border-radius: 50%; font-size: 13px; flex: none; color: var(--white); background: var(--ink); }
.play:hover { opacity: .85; }
.tl-track { position: relative; flex: 1; padding-top: 16px; }
.tl-events { position: absolute; left: 0; right: 0; top: 0; height: 14px; }
.tl-events button { position: absolute; top: 0; width: 3px; height: 12px; margin-left: -1px; border-radius: 2px; background: var(--ink3); padding: 0; }
.tl-events button.military { background: var(--ink); }
.tl-events button.economic { background: var(--neut-ink); }
.tl-events button.political { background: var(--ink3); }
.tl-events button:not(.past) { opacity: .25; }
.tl-events button:hover { transform: scaleY(1.4); }
.timeline input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; margin: 4px 0; height: 6px; border-radius: 3px; background: var(--card); outline: none; }
.timeline input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid var(--white); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer; }
.timeline input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--white); cursor: pointer; }
.tl-years { position: relative; height: 14px; font-size: 10px; color: var(--ink3); margin-top: 2px; }
.tl-years span { position: absolute; transform: translateX(-50%); }
.tl-date { flex: none; min-width: 170px; text-align: right; }
.tl-date b { display: block; font-size: 16px; }
.tl-date span { font-size: 12px; color: var(--ink2); }

/* ---------- about ---------- */
dialog { background: var(--white); color: var(--ink); border: 0; border-radius: 20px; max-width: 760px; width: calc(100% - 32px); max-height: calc(100% - 48px); padding: 30px 32px; box-shadow: 0 30px 80px rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(240,240,242,.75); backdrop-filter: blur(6px); }
dialog .close { position: absolute; right: 16px; top: 12px; font-size: 26px; font-weight: 100; color: var(--ink3); }
.about-body h2 { font: 700 30px/1.1 var(--f); margin: 0 0 14px; }
.about-body h3 { font-size: 15px; font-weight: 700; margin: 24px 0 6px; }
.about-body p, .about-body li { color: var(--ink2); }
.about-body code { font-size: 12px; background: var(--card2); padding: 1px 5px; border-radius: 4px; }

/* ---------- дотик і дрібниці для всіх розмірів ---------- */
.views .short { display: none; }
.node circle.hit { fill: transparent; cursor: pointer; }
button, a, .chip { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sel-card { display: none; }

/* ---------- mobile / tablet / телефон у ландшафті ---------- */
@media (max-width: 900px), (max-height: 560px) {
  html, body { height: auto; }
  body {
    display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  /* шапка: бренд + «Метод» в один рядок, під ними — сегментований перемикач видів на всю ширину */
  .top { flex-wrap: wrap; gap: 10px; padding: 12px 14px 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-mark::after { inset: 6px; }
  .brand-text b { font-size: 18px; }
  .method-link { padding: 7px 14px; font-size: 13px; }
  .search { order: 4; width: 100%; margin: 0; }
  .search input { padding: 11px 14px 11px 38px; font-size: 16px; }
  .brand { margin-right: auto; }
  .views { order: 3; width: 100%; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 999px; background: var(--card2); }
  .views a { padding: 9px 6px; font-size: 13px; text-align: center; white-space: nowrap; background: none; }
  .views a.on { background: var(--ink); }
  .views .full { display: none; } .views .short { display: inline; }
  /* виміри: горизонтальна стрічка без смуги прокрутки, з м'яким згасанням справа */
  .dims { padding: 4px 14px 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .dims::-webkit-scrollbar { display: none; }
  .dims button { white-space: nowrap; padding: 8px 14px; font-size: 13px; flex: none; }
  .dims button:last-of-type { margin-right: 40px; }
  .legend { display: none; }
  body[data-view=clubs] .dims { display: none; }
  /* сцена: квадратна під коло сингулярності, не вища за екран */
  .stage { margin: 0 10px; height: min(calc(100vw - 20px + 70px), 74vh); min-height: 340px; }
  body[data-view=map] .stage { height: min(calc(100vw + 40px), 74vh); }
  #view-singularity::before { font-size: min(50vw, 40vh); }
  /* клуби на мобільному — звичайний потік сторінки, без вкладеної прокрутки */
  body[data-view=clubs] .stage { height: auto; min-height: 0; overflow: visible; background: none; }
  body[data-view=clubs] #view-clubs { position: static; }
  body[data-view=clubs] .clubs-wrap { position: static; overflow: visible; padding: 4px 4px 8px; }
  .club-grid { grid-template-columns: 1fr; }
  .clubs-intro h2 { font-size: 24px; }
  .map-hint { display: none; }
  .map-ctrl { top: 8px; left: 8px; right: 8px; justify-content: space-between; }
  .map-ctrl button { font-size: 12px; padding: 8px 10px; flex: 1; }
  .map-ctrl .reset { flex: none; }
  .front-legend { left: 8px; right: 8px; bottom: 8px; max-width: none; padding: 8px 10px; font-size: 11px; }
  .front-legend .fl-row { margin-bottom: 2px; }
  body[data-sel] .front-legend { display: none; }
  /* картка вибраної країни поверх сцени */
  .sel-card.on { display: flex; align-items: center; gap: 8px; position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 4; padding: 10px 8px 10px 14px; border-radius: 14px; background: var(--white); box-shadow: 0 8px 24px rgba(20,20,30,.14); }
  .sc-main { flex: 1; min-width: 0; }
  .sc-main b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sc-row { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12px; color: var(--ink2); }
  .pc { display: inline-flex; align-items: center; gap: 5px; }
  .pc i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
  .pc.inv { color: var(--ink); font-weight: 700; }
  .sc-more { flex: none; padding: 9px 12px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 12px; font-weight: 700; }
  .sc-close { flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; font-weight: 100; color: var(--ink2); }
  body[data-view=map] .sel-card.on { bottom: 8px; }
  /* таймлайн: закріплений знизу екрана — дату можна крутити, читаючи панель; великий повзунок під палець */
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .timeline { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 10; margin: 0; padding: 8px 12px; gap: 10px; box-shadow: 0 8px 30px rgba(20,20,30,.16), 0 1px 2px rgba(0,0,0,.06); }
  .stage { margin-bottom: 10px; }
  body[data-view=clubs] .timeline { display: none; }
  body[data-view=clubs] { padding-bottom: env(safe-area-inset-bottom); }
  .play { width: 44px; height: 44px; }
  .tl-track { padding-top: 14px; }
  .timeline input[type=range] { height: 8px; margin: 8px 0; }
  .timeline input[type=range]::-webkit-slider-thumb { width: 28px; height: 28px; }
  .timeline input[type=range]::-moz-range-thumb { width: 22px; height: 22px; }
  .tl-date { min-width: 0; }
  .tl-date b { font-size: 13px; white-space: nowrap; }
  .tl-date span { font-size: 11px; white-space: nowrap; }
  .tl-years span.first { display: none; }
  /* панель — під таймлайном, на всю ширину */
  .top { order: 1; } .dims { order: 2; } .stage { order: 3; flex: none; } .timeline { order: 4; } .panel { order: 5; }
  .panel { margin: 0 10px 16px; padding: 20px 16px 26px; overflow: visible; scroll-margin-top: 10px; }
  .panel h2 { font-size: 24px; }
  .kpi b { font-size: 26px; }
  .list li { padding: 11px 0; }
  .chip { padding: 6px 10px; font-size: 12px; }
  .stack { grid-template-columns: 88px 1fr 38px; }
  .tri-wrap svg { max-width: 100%; height: auto; }
  /* «Метод» — аркуш знизу на весь екран */
  dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 26px 18px calc(24px + env(safe-area-inset-bottom)); }
  .about-body h2 { font-size: 24px; }
}
@media (max-width: 380px) {
  .tl-date b { font-size: 12px; }
  .map-ctrl .rtxt { display: none; }
  .map-ctrl .reset { padding: 8px 12px; font-size: 15px; }
  .tl-years span:nth-child(odd):not(.first) { display: none; }
  .dims button { padding: 7px 12px; }
  .sc-more { padding: 9px 10px; }
}
/* телефон у ландшафті: шапка в один рядок, сцена на всю висоту, таймлайн у потоці одразу під нею */
@media (max-height: 560px) and (min-width: 561px) {
  .top { flex-wrap: nowrap; padding: 8px 14px 4px; }
  .search { order: 0; width: 200px; flex: none; }
  .search input { padding: 7px 12px 7px 34px; font-size: 14px; }
  .brand-text span { display: none; }
  .views { order: 0; width: auto; flex: 1; max-width: 420px; margin-left: 8px; }
  .views a { padding: 7px 6px; }
  .dims { padding: 4px 14px 6px; }
  .dims button { padding: 6px 12px; }
  .stage, body[data-view=map] .stage { height: calc(100vh - 104px); min-height: 250px; }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .timeline { position: static; margin: 0 10px 10px; box-shadow: none; }
  .sel-card.on { left: auto; width: 360px; }
}
