@font-face {
  font-family:Onest;
  src:url(../vendor/OnestVariable.woff2) format('woff2'),url(../vendor/OnestVariable.ttf) format('truetype');
  font-weight:100 900;
  font-display:swap
}

* {
  box-sizing:border-box
}
html,body {
  margin:0;
  height:100%;
  overflow:hidden;
  overscroll-behavior:none
}
html {
  color-scheme:dark
}
body {
  font:15px Onest,sans-serif;
  background:#072b34;
  color:#eef6f3;
  --panel:#102830e6;
  --control:#ffffff12;
  --line:#ffffff20;
  --muted:#b1c3c5;
  --accent:#ffd69b;
  --text:#eef6f3
}
html[data-theme=light] {
  color-scheme:light
}
html[data-theme=light] body {
  background:#f6f3e9;
  color:#152c37;
  --panel:#fffef3ed;
  --control:#142e3910;
  --line:#142e3925;
  --muted:#415965;
  --accent:#825016;
  --text:#152c37
}

[hidden] {
  display:none!important
}
#physical-page {
  position:fixed;
  inset:0
}
canvas {
  display:block;
  width:100%;
  height:100%;
  touch-action:none
}
#physical-gpu {
  position:absolute;
  inset:0;
  pointer-events:none
}
button,input,select {
  font:inherit;
  color:inherit;
  min-width:44px;
  min-height:44px;
  border:0;
  border-radius:14px;
  background:var(--control);
  padding:8px 12px
}
button {
  cursor:pointer
}
button:focus-visible,input:focus-visible,select:focus-visible,#year-drum:focus-visible {
  outline:2px solid var(--accent);
  outline-offset:3px
}
nav {
  position:fixed;
  top:max(12px,env(safe-area-inset-top));
  left:14px;
  pointer-events:none
}
#status {
  display:block;
  font-size:12px;
  color:var(--muted);
  background:var(--panel);
  border-radius:8px;
  max-width:90vw;
  padding:3px 8px
}
#status:empty {
  display:none
}

#political-time {
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  width:min(364px,calc(100% - 28px));
  bottom:calc(14px + env(safe-area-inset-bottom));
  touch-action:none
}
.time-heading {
  display:flex;
  align-items:center;
  height:60px;
  padding:0 7px;
  border-radius:30px;
  background:var(--panel);
  border:1px solid var(--line);
  backdrop-filter:blur(24px);
  box-shadow:0 12px 36px #0004
}
#political-play {
  order:-1;
  width:46px;
  height:46px;
  border-radius:50%;
  font-size:20px;
  background:var(--accent);
  color:#162b30;
  padding:0
}
#edit-year {
  flex:1;
  background:transparent;
  min-width:0;
  padding:0;
  text-align:center
}
#political-year {
  font-size:30px;
  font-weight:600;
  letter-spacing:0;
  white-space:nowrap
}
#open-more {
  width:46px;
  height:46px;
  border-radius:50%;
  padding:0;
  font-size:21px
}
#political-input {
  width:160px;
  min-width:0;
  margin:auto;
  font-size:24px
}
#political-status {
  display:none
}
#ui-message {
  font-size:12px;
  margin:3px 0;
  color:var(--muted);
  background:var(--panel)
}
#ui-message:empty {
  display:none
}
/* Список проверенных годов выпуска включён: тихая подпись под шкалой (появляется плавно, не рывком). */
#accepted-note {
  font-size:11px;
  margin:2px 0 0;
  color:var(--muted);
  text-align:center;
  letter-spacing:.02em;
  animation:accepted-note-in .6s cubic-bezier(.2,.7,.2,1) both
}
#accepted-note[hidden] {
  display:none
}
@keyframes accepted-note-in {
  from { opacity:0; transform:translateY(3px) }
  to { opacity:.8; transform:none }
}
@media (prefers-reduced-motion:reduce) {
  #accepted-note { animation:none; opacity:.8 }
}

#year-drum {
  position:relative;
  height:40px;
  margin-top:7px;
  border-radius:20px;
  overflow:hidden;
  touch-action:none;
  user-select:none;
  cursor:grab;
  background:radial-gradient(60% 160% at 50% 100%,#ffce824d,transparent 70%),linear-gradient(180deg,#051318e6,#091e24d6);
  border:1px solid #ffffff17;
  box-shadow:inset 0 2px 8px #0009,0 14px 34px -14px #0009;
  backdrop-filter:blur(18px)
}
#year-drum[data-mode=drag] {
  cursor:grabbing
}
#year-drum::before {
  content:'';
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
  background:linear-gradient(90deg,#030d11f5,transparent 32%,transparent 68%,#030d11f5)
}
#year-drum::after {
  content:'';
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(180deg,#ffffff20,transparent 45%)
}
.drum-scale {
  position:absolute;
  inset:0;
  perspective:500px;
  pointer-events:none
}
.drum-tick {
  position:absolute;
  top:8px;
  left:0;
  width:1px;
  height:8px;
  background:#efd2a6;
  color:#efd2a6;
  white-space:nowrap;
  font:9px Onest,sans-serif;
  padding-top:12px;
  text-indent:-10px;
  will-change:transform
}
.drum-tick.major {
  top:4px;
  height:14px;
  padding-top:17px
}
.drum-pointer {
  position:absolute;
  top:0;
  left:calc(50% - 3px);
  width:6px;
  height:17px;
  background:#ed695e;
  clip-path:polygon(0 0,100% 0,70% 75%,50% 100%,30% 75%);
  transform-origin:50% 0;
  filter:drop-shadow(0 0 3px #ed695e)
}

#atlas-menu {
  position:fixed;
  z-index:5;
  left:50%;
  transform:translateX(-50%);
  bottom:calc(129px + env(safe-area-inset-bottom));
  width:min(364px,calc(100% - 28px));
  max-height:calc(100dvh - 170px);
  overflow:auto;
  overscroll-behavior:contain;
  touch-action:pan-y;
  border-radius:28px;
  background:var(--panel);
  border:1px solid var(--line);
  backdrop-filter:blur(24px);
  padding:12px;
  box-shadow:0 12px 40px #0004
}
.menu-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px
}
h1 {
  font-size:18px;
  margin:0
}
#close-menu,#close-selection {
  border-radius:50%;
  font-size:24px;
  padding:0;
  width:44px;
  flex-shrink:0
}
#menu-home>button {
  display:block;
  width:100%;
  height:50px;
  text-align:left;
  background:transparent;
  border-radius:20px;
  font-weight:500
}
.speed-row,.seg {
  display:flex;
  align-items:center;
  gap:4px
}
.speed-row {
  justify-content:space-between;
  margin:8px 0
}
.seg {
  border-radius:18px;
  background:var(--control);
  padding:3px
}
.seg button {
  min-width:34px;
  padding:3px;
  background:transparent
}
.seg button[aria-pressed=true] {
  background:var(--accent);
  color:#162b30
}
.seg small {
  font-size:10px;
  padding:0 4px
}
.field {
  display:grid;
  gap:6px;
  margin:12px 0
}
.row {
  display:flex;
  gap:8px;
  align-items:center
}
.row input {
  min-width:0;
  flex:1
}
p {
  line-height:1.4;
  color:var(--muted);
  font-size:12px
}
#country-results {
  display:grid;
  gap:6px
}
#country-results button {
  text-align:left
}
.layer-row {
  padding:12px;
  border-bottom:1px solid var(--line);
  color:inherit;
  background:var(--control);
  margin:0
}
.upcoming {
  color:var(--muted);
  background:transparent
}
#layer-groups h2,.video-settings h2 {
  font-size:14px;
  color:var(--muted)
}
.switch-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  min-height:56px
}
input[role=switch] {
  appearance:none;
  width:52px;
  height:44px;
  padding:0;
  border-radius:22px;
  background:var(--line);
  position:relative;
  flex-shrink:0
}
input[role=switch]::after {
  content:'';
  position:absolute;
  width:28px;
  height:28px;
  border-radius:50%;
  background:var(--panel);
  left:4px;
  top:8px
}
input[role=switch]:checked {
  background:var(--accent)
}
input[role=switch]:checked::after {
  left:20px
}
#share-link {
  width:100%;
  margin-top:8px
}
summary {
  min-height:44px;
  padding:12px 0;
  cursor:pointer
}

#selection-card {
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:calc(129px + env(safe-area-inset-bottom));
  width:min(364px,calc(100% - 28px));
  display:flex;
  align-items:flex-start;
  gap:8px;
  padding:13px 12px 13px 17px;
  border-radius:28px;
  background:var(--panel);
  backdrop-filter:blur(24px);
  border:1px solid var(--line)
}
#political-selection {
  position:static!important;
  display:block!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:0!important;
  color:inherit!important;
  font:inherit!important;
  max-width:none!important;
  min-width:0;
  flex:1
}
#political-selection[hidden] {
  display:none!important
}
#political-selection strong {
  font-size:17px
}
#political-selection>div {
  margin-top:6px
}
.zoom {
  position:fixed;
  right:20px;
  bottom:20px;
  display:grid;
  gap:5px
}
.zoom button {
  width:44px;
  padding:0;
  font-size:24px;
  background:var(--panel)
}
#cine-controls {
  display:none
}

.cine-mode #physical-page::after {
  content:'';
  position:absolute;
  inset:54% 0 0;
  pointer-events:none;
  background:linear-gradient(180deg,transparent,#03131880 60%,#031318d1);
  z-index:0
}
.cine-mode #political-time {
  left:0;
  right:0;
  transform:none;
  width:auto;
  bottom:env(safe-area-inset-bottom);
  z-index:1
}
.cine-mode .time-heading {
  position:absolute;
  left:14px;
  bottom:86px;
  height:auto;
  padding:0;
  background:none;
  border:0;
  box-shadow:none;
  backdrop-filter:none
}
.cine-mode #political-year {
  font-size:min(27vw,24vh);
  font-weight:700;
  letter-spacing:0;
  color:#eef6f3;
  opacity:.32;
  white-space:normal;
  line-height:.85
}
.cine-mode #edit-year {
  max-width:80vw;
  text-align:left
}
.cine-mode #political-play,.cine-mode #open-more {
  display:none
}
.cine-mode #year-drum {
  height:86px;
  margin:0;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
  backdrop-filter:none
}
.cine-mode #year-drum::before {
  background:linear-gradient(90deg,#031318aa,transparent 32%,transparent 68%,#031318aa)
}
.cine-mode #year-drum::after {
  display:none
}
.cine-mode .drum-tick {
  top:28px;
  height:16px;
  padding-top:22px;
  filter:drop-shadow(0 0 4px #ffd69688)
}
.cine-mode .drum-tick.major {
  top:18px;
  height:26px;
  padding-top:32px
}
.cine-mode .drum-pointer {
  height:44px;
  width:2px;
  left:calc(50% - 1px);
  clip-path:none
}
.cine-mode #selection-card {
  left:22px;
  transform:none;
  bottom:calc(130px + min(33vw,24vh) + env(safe-area-inset-bottom));
  width:auto;
  max-width:80vw;
  border:0;
  border-radius:0;
  background:none;
  backdrop-filter:none;
  padding:0 0 0 26px;
  z-index:1
}
.cine-mode #selection-card::before {
  content:'';
  position:absolute;
  left:0;
  top:12px;
  width:18px;
  height:2px;
  background:#ed695e
}
.cine-mode #political-selection {
  font-size:13px!important;
  text-transform:uppercase;
  letter-spacing:.08em
}
.cine-mode #political-selection>div {
  display:none
}
.cine-mode #close-selection {
  background:none
}
.cine-mode #cine-controls {
  position:fixed;
  right:5px;
  bottom:calc(100px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:3px;
  z-index:2;
  opacity:0;
  pointer-events:none;
  transition:opacity .4s
}
.cine-mode.controls-awake #cine-controls,.cine-mode #cine-controls:has(:focus-visible) {
  opacity:1;
  pointer-events:auto
}
#cine-controls button {
  background:transparent;
  text-shadow:0 1px 6px #031217;
  font-size:18px;
  max-width:85px
}
#cine-speed,#exit-cine {
  font-size:12px!important
}
.cine-mode .zoom {
  opacity:0;
  pointer-events:none;
  z-index:2;
  bottom:450px;
  right:12px
}
.cine-mode.controls-awake .zoom {
  opacity:1;
  pointer-events:auto
}
.cine-mode #atlas-menu {
  bottom:100px
}
.cine-mode #ui-message {
  position:absolute;
  bottom:0;
  left:12px
}
html[data-theme=light] .cine-mode {
  color:var(--text)
}
html[data-theme=light].cine-mode #political-year {
  color:#152c37;
  opacity:.4
}
html[data-theme=light].cine-mode #physical-page::after {
  background:linear-gradient(180deg,transparent,#f6f3e9cc)
}

@media(min-width:800px) {
  #political-time,#atlas-menu,#selection-card {
  width:420px
}
.cine-mode #political-time {
  width:auto
}
.cine-mode #selection-card {
  width:auto
}
.cine-mode #political-year {
  font-size:min(24vw,24vh)
}

}
@media(max-width:799px) {
  .zoom {
  display:none
}

}
@media(prefers-reduced-motion:reduce) {
  * {
  transition:none!important;
  scroll-behavior:auto
}

}
@media(prefers-reduced-transparency:reduce) {
  #atlas-menu,#selection-card,.time-heading {
  backdrop-filter:none
}

}


.year-era {
  font-size:.42em;
  margin-left:5px
}
.cine-mode .year-era {
  display:block;
  font-size:15px;
  letter-spacing:.16em;
  text-transform:uppercase;
  margin:20px 0 0;
  color:var(--muted)
}
.cine-mode #edit-year {
  padding-bottom:8px
}
.menu-open #selection-card {
  visibility:hidden
}
#political-selection {
  max-height:25dvh!important;
  overflow:auto;
  touch-action:pan-y
}
.cine-mode #political-selection {
  max-height:60px!important
}
.i {
  width:22px;
  height:22px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.6;
  stroke-linecap:round;
  stroke-linejoin:round;
  vertical-align:middle
}
#menu-home>button .i {
  margin-right:12px;
  color:var(--muted)
}

.cine-mode .year-era:empty::after { content:'н. э.'; }
.cine-mode #political-selection strong { display:inline; font-size:13px; }
.cine-mode #political-selection .selection-era { display:inline; margin-left:12px; font-size:11px; color:var(--muted); }
#cine-frame {
  position:fixed;
  pointer-events:none;
  z-index:1;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:min(94vw,calc(90dvh * 16 / 9));
  aspect-ratio:16/9;
  border:1px solid var(--line);
}
#cine-frame[data-format="9:16"] {
  width:min(94vw,calc(90dvh * 9 / 16));
  aspect-ratio:9/16;
}
.cine-mode #political-selection .selection-era { white-space:nowrap; }
@media(max-width:799px) {
  .cine-mode #political-selection strong { display:block; }
  .cine-mode #political-selection .selection-era { display:block; margin-left:0; margin-top:6px; }
}

/* Drum refinement: labels have their own box, independent of tick height. */
.drum-tick {
  width:1.5px;
  padding:0;
  text-indent:0;
  color:#f7ebcf;
  font:600 11.5px Onest,sans-serif;
}
.drum-tick.major { padding:0; }
.drum-label {
  position:absolute;
  top:17px;
  left:50%;
  transform:translateX(-50%);
}
#year-drum .drum-scale::after {
  content:'';
  position:absolute;
  left:calc(50% - .75px);
  top:0;
  bottom:0;
  width:1.5px;
  background:#ed695e;
  box-shadow:0 0 4px #ed695e66;
}
.cine-mode .time-heading { pointer-events:none; }
.cine-mode #political-input { pointer-events:auto; }
.cine-mode #year-drum .drum-tick {
  top:auto;
  bottom:0;
  height:5px;
  padding:0;
  color:#fff3d8;
  font:500 12px Onest,sans-serif;
}
.cine-mode #year-drum .drum-tick.major { height:22px; padding:0; }
.cine-mode .drum-label { top:auto; bottom:27px; }
.cine-mode #year-drum .drum-scale::after { top:auto; height:35px; }
.cine-mode .drum-pointer { top:auto; bottom:26px; height:12px; width:6px; left:calc(50% - 3px); clip-path:polygon(0 0,100% 0,50% 100%); }
html[data-theme=light] #political-play { color:#fff3d8; }
html[data-theme=light] #year-drum {
  background:radial-gradient(60% 160% at 50% 100%,#ffce8266,transparent 70%),linear-gradient(180deg,#eee2ca,#f7eddb);
}
html[data-theme=light] #year-drum::before {
  background:linear-gradient(90deg,#eee2caf5,transparent 32%,transparent 68%,#eee2caf5);
}
html[data-theme=light] .drum-tick { background:#5b4020; color:#402b15; }
html[data-theme=light].cine-mode #year-drum { background:none; }
html[data-theme=light].cine-mode #year-drum::before {
  background:linear-gradient(90deg,#f6f3e9aa,transparent 32%,transparent 68%,#f6f3e9aa);
}
html[data-theme=light].cine-mode #year-drum .drum-tick { color:#402b15; filter:none; }

#political-selection { pointer-events:auto!important; overscroll-behavior:contain; }

/* One ruler: tick length and label visibility follow screen spacing. */
#year-drum .drum-tick,#year-drum .drum-tick.major,.cine-mode #year-drum .drum-tick,.cine-mode #year-drum .drum-tick.major {
  height:var(--tick-height,8px); padding-top:0; top:auto; bottom:18px;
}
.drum-step { position:absolute; top:1px; left:calc(50% + 10px); font:9px Onest,sans-serif; color:var(--muted); pointer-events:none; }
/* Stable year typography in both modes, including idle and playback. Four cells
   reserve the timeline's maximum digit count, so the era stays anchored. */
.year-digits { display:inline-block; width:2.8em; text-align:right; font-variant-numeric:tabular-nums; font-kerning:none; letter-spacing:0; }
.year-digits>span { margin-left:0; }
.cine-mode .year-digits { display:block; text-align:left; }
.cine-mode .year-era { color:inherit; font-size:.105em; font-weight:600; letter-spacing:.06em; line-height:1; margin:.5em 0 0 .08em; }

#year-drum .drum-label { top:calc(var(--tick-height,8px) + 2px); }
.cine-mode #year-drum .drum-tick { bottom:0; }
/* One baseline for every mark: a mark must not hop up when its level becomes the captioned one. */
.cine-mode #year-drum .drum-tick.major { bottom:0; }
.cine-mode #year-drum .drum-label { top:auto; bottom:27px; }

/* Experimental two-tier ruler: upper centuries and lower years share a fixed pointer. */
#year-drum[data-variant=b] { height:62px; }
.cine-mode #year-drum[data-variant=b] { height:72px; }
#year-drum[data-variant=b] .drum-coarse .drum-tick { bottom:36px; }
#year-drum[data-variant=b] .drum-coarse .drum-label { top:auto; bottom:9px; font-size:10px; }
#year-drum[data-variant=b] .drum-step { left:8px; top:1px; }
#year-drum .drum-coarse::after { display:none; }
.cine-mode #year-drum[data-variant=b] .drum-tick { bottom:18px; }
.cine-mode #year-drum[data-variant=b] .drum-coarse .drum-tick { bottom:36px; }
.cine-mode #year-drum[data-variant=b] .drum-label { top:calc(var(--tick-height,8px) + 2px); bottom:auto; }
.cine-mode #year-drum[data-variant=b] .drum-coarse .drum-label { top:auto; bottom:9px; }
