:root {
  --bg: #070d1f;
  --bg-elev: #121a38;
  --panel: rgba(14, 20, 44, 0.9);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef1fb;
  --muted: #94a0c4;
  --accent: #ffcf5c;
  --accent-ink: #1a1200;
  --track: #263258;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --tl-height: 132px;

  /* Χρώματα τύπων γεγονότων */
  --c-war: #ff5a5f;
  --c-revolution: #ff9f43;
  --c-politics: #ffd166;
  --c-exploration: #2ec4b6;
  --c-science: #4cc9f0;
  --c-culture: #f78fb3;
  --c-disaster: #b388ff;
  --c-economy: #8ce99a;
  --c-tragedy: #9aa5b1;
  --c-crop: #b7e061;
  --c-tree: #41b06e;
  --c-spice: #d4a373;
  --c-animal: #f0e0c0;
  --c-religion: #c084fc;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Brand ---------- */
.brand {
  position: fixed;
  top: 16px;
  left: 18px;
  z-index: 5;
  pointer-events: none;
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.01em; }
.brand .sub { margin: 2px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }
.brand .hint { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }
.brand .credit { margin: 3px 0 0; font-size: 10.5px; color: var(--muted); opacity: 0.8; }
.brand .credit a { color: var(--muted); pointer-events: auto; }
kbd {
  font-family: inherit;
  font-size: 10.5px;
  padding: 1px 5px;
  margin: 0 1px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-elev);
}

/* ---------- Map ---------- */
#map-wrap { position: relative; flex: 1; min-height: 0; background: var(--bg); }
#map { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
button, input, label { touch-action: manipulation; }
#map:active { cursor: grabbing; }

.sphere { fill: url(#ocean-grad); }
.graticule { fill: none; stroke: rgba(255, 255, 255, 0.05); stroke-width: 0.6; }
.country {
  stroke: rgba(8, 12, 30, 0.85);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  transition: filter 150ms ease;
}
.country:hover { filter: brightness(1.25); }
.hcountry {
  stroke: rgba(8, 12, 30, 0.85);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  transition: filter 150ms ease;
}
.hcountry.p1 { stroke-opacity: 0.45; }
g.hist-year { opacity: 0; transition: opacity 700ms ease; }
g.hist-year.in { opacity: 1; }
g.hist-year.out { opacity: 0; }
.hcountry.wild { fill: #27335a; stroke: rgba(8, 12, 30, 0.35); }
.hcountry:hover { filter: brightness(1.25); }

/* Events on the map */
.ev { pointer-events: none; }
.ev .arrow {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  marker-end: url(#arrowhead);
  opacity: 1;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.3, 0, 0.2, 1);
}
.ev .arrow-glow {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.28;
  filter: url(#glow);
  transition: stroke-dashoffset 1.4s cubic-bezier(0.3, 0, 0.2, 1);
}
.ev .anchor { stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ev .pulse {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}
.ev .body { pointer-events: all; cursor: pointer; }
.ev .icon-bg { stroke: #fff; stroke-width: 1.5; }
.ev .icon { font-size: 13px; text-anchor: middle; dominant-baseline: central; user-select: none; }
.ev .label rect { fill: rgba(10, 14, 32, 0.88); stroke: rgba(255,255,255,0.14); }
.ev .label .leader { stroke: rgba(255,255,255,0.45); stroke-width: 1; }
.ev .label .lbl-title { font-size: 11.5px; font-weight: 700; fill: #fff; }
.ev .label .lbl-desc { font-size: 9.5px; fill: #cdd4ea; }
.ev .label .lbl-year { font-size: 9.5px; font-weight: 700; }
.ev.old .label { display: none; }
.ev.old .body { opacity: 0.85; }
.ev.old .arrow, .ev.old .arrow-glow { opacity: 0.35; }

/* type colours (for SVG + panel) */
.t-war { --c: var(--c-war); }
.t-revolution { --c: var(--c-revolution); }
.t-politics { --c: var(--c-politics); }
.t-exploration { --c: var(--c-exploration); }
.t-science { --c: var(--c-science); }
.t-culture { --c: var(--c-culture); }
.t-disaster { --c: var(--c-disaster); }
.t-economy { --c: var(--c-economy); }
.t-tragedy { --c: var(--c-tragedy); }
.t-crop { --c: var(--c-crop); }
.t-tree { --c: var(--c-tree); }
.t-spice { --c: var(--c-spice); }
.t-animal { --c: var(--c-animal); }
.t-religion { --c: var(--c-religion); }
.ev .arrow, .ev .arrow-glow, .ev .pulse { stroke: var(--c); }
.ev .anchor, .ev .icon-bg { fill: var(--c); }
.ev .label .lbl-year { fill: var(--c); }

/* ---------- Controls ---------- */
.map-controls {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 4;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.icon-btn:hover { background: var(--bg-elev); border-color: rgba(255,255,255,0.2); }
.icon-btn.small { width: 34px; height: 34px; font-size: 22px; box-shadow: none; }
.hist-loading {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: none;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.hist-loading.show { display: inline-block; }
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; padding: 4px 8px; cursor: pointer; }
.lang button + button { border-left: 1px solid var(--border); }
.lang button:hover { color: var(--text); }
.lang button.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Sidebar (φίλτρα) ---------- */
.sidebar {
  position: absolute;
  left: 16px;
  top: 72px;
  bottom: 14px;
  width: 250px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  z-index: 4;
  transition: transform 250ms ease, opacity 250ms ease;
}
.sidebar.collapsed { transform: translateX(calc(-100% - 16px)); opacity: 0; pointer-events: none; }
.sb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.sb-title { flex: 1; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.sb-body { overflow-y: auto; padding: 6px 0 10px; display: flex; flex-direction: column; }
.sb-credit { margin: auto 12px 0; padding-top: 10px; font-size: 10px; color: var(--muted); opacity: 0.75; }
.sb-credit a { color: var(--muted); }
.sb-sec { padding: 8px 12px 6px; }
.sb-sec + .sb-sec { border-top: 1px solid var(--border); }
.sb-sec-title {
  display: flex;
  align-items: center;
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sb-actions { margin-left: auto; display: inline-flex; gap: 8px; text-transform: none; letter-spacing: 0; }
.sb-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; padding: 0; }
.sb-link:hover { text-decoration: underline; }

.sb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.sb-row input { position: absolute; opacity: 0; width: 0; height: 0; }
/* διακόπτης ON/OFF */
.sb-switch .sw {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--border);
  transition: background 180ms ease;
}
.sb-switch .sw::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 180ms ease, background 180ms ease;
}
.sb-switch input:checked + .sw { background: var(--accent); border-color: transparent; }
.sb-switch input:checked + .sw::after { transform: translateX(14px); background: var(--accent-ink); }
.sb-switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }

/* αναζήτηση */
.search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.search:focus { border-color: var(--accent); background: rgba(255, 207, 92, 0.08); }
.search::placeholder { color: var(--muted); }
.search-meta { margin: 6px 2px 0; font-size: 10.5px; color: var(--muted); }
.search-meta:empty { display: none; }
.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 10px;
}
.search-results:empty { display: none; }
/* όσο γράφεις, τα αποτελέσματα παίρνουν όλο το ύψος και κρύβουν τα φίλτρα */
.sidebar.searching .sb-sec:not(.sb-search), .sidebar.searching .sb-credit { display: none; }
.sidebar.searching .sb-body { flex: 1; min-height: 0; }
.sidebar.searching .sb-search { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sidebar.searching .search-results { flex: 1; max-height: none; }
.search-results li {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.search-results li:hover, .search-results li.active { background: rgba(255,255,255,0.07); }
.search-results li .bar { border-radius: 2px; background: var(--c); box-shadow: 0 0 6px var(--c); }
.search-results li .meta { font-size: 10px; font-weight: 700; color: var(--c); letter-spacing: 0.03em; }
.search-results li .ttl { font-size: 12px; font-weight: 600; margin-top: 1px; line-height: 1.3; }

/* κατηγορίες & υπο-φίλτρα */
.filters .cat { margin: 2px 0 6px; }
.cat-head { display: flex; align-items: center; gap: 6px; }
.cat-head .sb-row { flex: 1; font-size: 13px; }
.cat-fold {
  flex: none;
  width: 26px; height: 26px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: transform 180ms ease;
}
.cat-fold:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.cat.folded .cat-fold { transform: rotate(-90deg); }
.cat.folded .subs { display: none; }
.subs { margin: 2px 0 0 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.subs .sb-row { padding: 4px 2px; font-size: 12px; font-weight: 500; }
.sb-row .count { margin-left: auto; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* checkbox */
.cb {
  position: relative;
  flex: none;
  width: 16px; height: 16px;
  border-radius: 5px;
  border: 1.5px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
  transition: background 150ms ease, border-color 150ms ease;
}
.sb-row input:checked + .cb { background: var(--accent); border-color: var(--accent); }
.sb-row input:checked + .cb::after {
  content: "";
  position: absolute;
  left: 4.5px; top: 1px;
  width: 4px; height: 8px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sb-row input:indeterminate + .cb { background: rgba(255, 207, 92, 0.35); border-color: var(--accent); }
.sb-row input:indeterminate + .cb::after {
  content: "";
  position: absolute;
  left: 3px; top: 6px;
  width: 8px; height: 2px;
  background: var(--accent);
}
.sb-row input:focus-visible + .cb { outline: 2px solid var(--accent); outline-offset: 2px; }
.sb-row .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.sb-row.off .txt, .sb-row.off .dot { opacity: 0.45; }

.sidebar-open-btn {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 4;
  display: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.sidebar-open-btn.show { display: inline-flex; align-items: center; gap: 6px; }
.search-open-btn { display: none; } /* μόνο σε κινητό */

/* ---------- Panel ---------- */
.panel {
  position: absolute;
  right: 16px;
  top: 72px;
  bottom: 14px;
  width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  z-index: 4;
  transition: transform 250ms ease, opacity 250ms ease;
}
.panel.collapsed { transform: translateX(calc(100% + 16px)); opacity: 0; }
.panel.collapsed .panel-toggle { display: none; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.panel-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}
.panel-toggle {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.panel-open-btn {
  position: absolute;
  right: 16px;
  top: 72px;
  z-index: 4;
  display: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.panel-open-btn.show { display: inline-flex; align-items: center; gap: 6px; }
.panel-open-btn .cnt { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.panel-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}
.panel-list li {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 10px;
  padding: 8px 8px 8px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms;
}
.panel-list li:hover { background: rgba(255,255,255,0.05); }
.panel-list li .bar { border-radius: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.panel-list li .meta { font-size: 10.5px; font-weight: 700; color: var(--c); letter-spacing: 0.03em; }
.panel-list li .ttl { font-size: 13px; font-weight: 600; margin-top: 1px; }
.panel-list li .dsc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.panel-list li.new { background: rgba(255, 207, 92, 0.08); }
.panel-empty { padding: 20px 12px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: absolute;
  pointer-events: none;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(10, 14, 32, 0.95);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 100ms;
  max-width: 280px;
  z-index: 6;
  box-shadow: var(--shadow);
}
.tooltip.show { opacity: 1; }
.tooltip .tt-meta { font-size: 10.5px; font-weight: 700; color: var(--c); letter-spacing: 0.03em; }
.tooltip .tt-title { font-weight: 700; margin-top: 1px; }
.tooltip .tt-desc { color: var(--muted); margin-top: 3px; font-size: 11.5px; }

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.loading.hidden { display: none; }

/* ---------- Timeline bar ---------- */
.timeline {
  height: var(--tl-height);
  flex: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.tl-left { display: flex; align-items: center; gap: 8px; }
.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(255, 207, 92, 0.35);
  transition: transform 100ms, filter 150ms;
}
.play-btn:hover { filter: brightness(1.08); }
.play-btn:active { transform: scale(0.96); }
.play-btn .ico-pause { display: none; }
.play-btn.playing .ico-play { display: none; }
.play-btn.playing .ico-pause { display: block; }

.tl-center { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.year-display { display: flex; align-items: baseline; gap: 10px; }
.year { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.month { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.era { font-size: 12px; color: var(--accent); font-weight: 600; margin-left: 4px; }

.track-wrap { position: relative; padding: 10px 0 14px; }
.ticks { position: absolute; left: 0; right: 0; top: 0; height: 10px; }
.tick { position: absolute; top: 0; width: 1px; height: 6px; background: rgba(255,255,255,0.16); transform: translateX(-0.5px); }
.tick.major { height: 10px; background: rgba(255,255,255,0.4); }
.tick-label {
  position: absolute;
  top: 100%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  margin-top: 16px;
  white-space: nowrap;
}
.event-marks { position: absolute; left: 0; right: 0; top: 11px; height: 4px; pointer-events: none; }
.event-mark { position: absolute; top: 0; width: 2px; height: 4px; border-radius: 1px; background: var(--c); opacity: 0.55; transform: translateX(-1px); }

.track {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  display: block;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--pct, 0%), var(--track) var(--pct, 0%), var(--track) 100%);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.track::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: grab;
}
.track::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: grab;
}
.track:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

.range-labels { display: none; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

.tl-right { display: flex; align-items: center; gap: 10px; }
.speed-label { font-size: 12px; color: var(--muted); }
.speed { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-elev); }
.speed button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.speed button:last-child { border-right: none; }
.speed button:hover { color: var(--text); }
.speed button.active { background: var(--accent); color: var(--accent-ink); }
.speed-input {
  width: 64px;
  border: none;
  border-left: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.speed-input:focus { background: rgba(255, 207, 92, 0.12); }
.speed-input.custom { color: var(--accent-ink); background: var(--accent); }

.toggle {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--muted);
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.toggle[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .panel { width: 260px; }
  .sidebar { width: 230px; }
}
@media (max-width: 820px) {
  :root { --tl-height: auto; }
  body { height: 100dvh; }
  .brand { top: 10px; left: 12px; }
  .brand h1 { font-size: 17px; }
  .brand .sub { display: none; }
  .hist-loading { top: auto; bottom: 8px; font-size: 10px; }

  /* κουμπιά πάνω δεξιά: φίλτρα + «συμβαίνει τώρα» */
  .sidebar-open-btn, .panel-open-btn {
    top: 10px; bottom: auto; left: auto;
    height: 36px; padding: 0 10px;
    border-radius: 999px; font-size: 12px;
    box-shadow: var(--shadow);
  }
  .panel-open-btn .full { display: none; }
  .panel-open-btn { right: 12px; padding: 0 8px; }
  /* κουμπί φίλτρων κάτω αριστερά, με κείμενο */
  .sidebar-open-btn { top: auto; bottom: 12px; left: 12px; right: auto; padding: 0 14px 0 12px; }
  .search-open-btn {
    position: absolute; right: 12px; bottom: 12px; z-index: 4;
    height: 36px; padding: 0 14px 0 12px; gap: 6px; align-items: center;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); font: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  }
  .search-open-btn.show { display: inline-flex; }
  .hist-loading { bottom: 56px; }

  /* sidebar και πάνελ ως φύλλα από κάτω */
  .sidebar, .panel {
    left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 70%;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .sidebar.collapsed, .panel.collapsed { transform: translateY(110%); opacity: 0; }
  /* λαβή συρσίματος στην κορυφή του φύλλου */
  .sidebar::before, .panel::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px;
    border-radius: 2px; background: rgba(255,255,255,0.28);
  }
  .sb-head, .panel-head { padding-top: 16px; }
  .sb-body, .panel-list { -webkit-overflow-scrolling: touch; }
  .search-results { max-height: 150px; }
  .sb-row, .subs .sb-row { padding: 8px 2px; }

  /* timeline: play + έτος + ταχύτητα σε μία σειρά, μπάρα από κάτω */
  .timeline {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "left year speed" "track track track";
    gap: 6px 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .tl-left { grid-area: left; gap: 4px; }
  .tl-center { display: contents; }
  .year-display { grid-area: year; min-width: 0; }
  .track-wrap { grid-area: track; padding: 8px 0 4px; }
  .tl-right { grid-area: speed; gap: 6px; }
  .play-btn { width: 44px; height: 44px; }
  .play-btn svg { width: 20px; height: 20px; }
  .icon-btn.small { width: 30px; height: 30px; font-size: 18px; }
  .year { font-size: 24px; }
  .month { font-size: 12px; min-width: 28px; }
  .era { display: none; }
  .tick-label { display: none; }
  .range-labels { display: flex; }
  .speed-label { display: none; }
  .speed button { padding: 7px 7px; font-size: 11.5px; }
  .speed-input { width: 46px; padding: 7px 4px; font-size: 11.5px; }
  .track::-webkit-slider-thumb { width: 22px; height: 22px; }
  .tooltip { max-width: 220px; }
}
@media (max-width: 480px) {
  .icon-btn.small { display: none; }
  .speed button { padding: 7px 6px; font-size: 11px; }
  .speed-input { width: 42px; }
  .year { font-size: 22px; }
  .sidebar, .panel { max-height: 78%; }
}
