/* ============================================================
   timeline.css — shared styles for all century/decade timelines
   ============================================================ */

/* ── Reset & base ─────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; display: flex; flex-direction: column; scrollbar-gutter: stable; }
body { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f4f0;
  color: #1a1a18;
  padding: 20px 24px 32px;
}

/* ── Header ───────────────────────────────────────────────── */
header { margin-top: 14px; margin-bottom: 6px; text-align: center; }
h1 { font-size: 18px; font-weight: 600; color: #1a1a18; margin: 0 0 4px 0; letter-spacing: -0.3px; }
.subtitle { font-size: 12px; color: #6b6a64; text-align: center; margin: 0 0 6px 0; }

/* Breadcrumbs */
.breadcrumbs { font-size: 12px; color: #9b9a94; margin: 0 0 6px 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.bc-link { color: #5a7ab5; text-decoration: none; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: #c0bfb8; margin: 0 3px; font-size: 11px; }
.bc-current { color: #1a1a18; font-weight: 500; }

/* ── Legend / category filter buttons ────────────────────── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}
.leg-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: opacity .15s, border-color .15s;
}
.leg-btn.off { opacity: 0.35; }
.leg-btn:hover { border-color: currentColor; }
.ld { width: 9px; height: 9px; min-width: 9px; min-height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ── Canvas wrapper & canvas ──────────────────────────────── */
#canvasWrap {
  width: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}
canvas { display: block; width: 100%; cursor: default; }

/* ── Footer instructions ──────────────────────────────────── */
.instructions { display: none; }

/* ── Toggle all button ───────────────────────────────────── */
.leg-btn.toggle-all {
  color: #4a4a46;
  border-color: rgba(0,0,0,0.15);
  background: rgba(0,0,0,0.04);
  font-weight: 500;
}
.leg-btn.toggle-all:hover { border-color: rgba(0,0,0,0.3); background: rgba(0,0,0,0.08); }

/* ── Legend button category colours ──────────────────────── */
/* Category colours — text colour on button, background on dot */
.leg-btn.cat-person  { color: #534AB7 !important; }
.leg-btn.cat-event   { color: #0F6E56 !important; }
.leg-btn.cat-conflicts     { color: #922B21 !important; }
.leg-btn.cat-crisis  { color: #993C1D !important; }
.leg-btn.cat-science { color: #185FA5 !important; }
.leg-btn.cat-culture   { color: #7A3B8F !important; }
.leg-btn.cat-companies { color: #40916C !important; }
.leg-btn.cat-countries { color: #B45309 !important; }

.leg-btn.cat-person  .ld { background-color: #534AB7 !important; }
.leg-btn.cat-event   .ld { background-color: #0F6E56 !important; }
.leg-btn.cat-conflicts     .ld { background-color: #922B21 !important; }
.leg-btn.cat-crisis  .ld { background-color: #993C1D !important; }
.leg-btn.cat-science .ld { background-color: #185FA5 !important; }
.leg-btn.cat-culture   .ld { background-color: #7A3B8F !important; }
.leg-btn.cat-companies .ld { background-color: #40916C !important; }
.leg-btn.cat-countries .ld { background-color: #B45309 !important; }

/* ── Colour tokens — category colours ────────────────────── */
:root {
  /* Person */
  --cat-person-bg:     #EEEDFE;
  --cat-person-border: #AFA9EC;
  --cat-person-year:   #7F77DD;
  --cat-person-title:  #3C3489;
  --cat-person-sub:    #534AB7;

  /* Event / war */
  --cat-event-bg:      #E1F5EE;
  --cat-event-border:  #5DCAA5;
  --cat-event-year:    #1D9E75;
  --cat-event-title:   #085041;
  --cat-event-sub:     #0F6E56;

  /* Disaster / crisis */
  --cat-crisis-bg:     #FAECE7;
  --cat-crisis-border: #F0997B;
  --cat-crisis-year:   #D85A30;
  --cat-crisis-title:  #712B13;
  --cat-crisis-sub:    #993C1D;

  /* Science */
  --cat-science-bg:     #E6F1FB;
  --cat-science-border: #85B7EB;
  --cat-science-year:   #378ADD;
  --cat-science-title:  #0C447C;
  --cat-science-sub:    #185FA5;

  /* Culture */
  --cat-culture-bg:     #F5EDFB;
  --cat-culture-border: #C9A0DC;
  --cat-culture-year:   #9B5BB5;
  --cat-culture-title:  #5C1F7A;
  --cat-culture-sub:    #7A3B8F;
}

/* ── Subcategory expand arrow ─────────────────────────────── */
.leg-btn .expand-arrow {
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 3px;
  border-radius: 3px;
  transition: background .15s;
  user-select: none;
}
.leg-btn .expand-arrow:hover { background: rgba(0,0,0,0.1); opacity: 1; }
.leg-btn .expand-arrow.open  { opacity: 1; }

/* ── Subcategory row ─────────────────────────────────────── */
#subLegend {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.07);
  width: 100%;
}
#subLegend.visible { display: flex; }

.sub-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 3px 9px 3px 6px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: opacity .15s, border-color .15s;
  background: #fff;
}
.sub-btn:hover   { border-color: currentColor; }
.sub-btn.off     { opacity: 0.35; }
.sub-btn.all-sub {
  color: #4a4a46;
  border-color: rgba(0,0,0,0.15);
  background: rgba(0,0,0,0.04);
  font-weight: 500;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 52px;
  box-sizing: border-box;
  background: #faf9f6;
  border-bottom: 1px solid #e8e6df;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

/* Logo */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-logo-icon {
  font-size: 22px;
  color: #5a6a4a;
  line-height: 1;
}
.topbar-logo-text {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: 700;
  color: #2a2a22;
  letter-spacing: -0.5px;
}
.topbar-logo:hover .topbar-logo-text { color: #5a6a4a; }
.topbar-logo:hover .topbar-logo-icon { transform: rotate(15deg); transition: transform 0.2s; }
.topbar-version {
  font-size: 10px;
  font-family: monospace;
  color: #aaa99a;
  background: #eeecea;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 2px;
  align-self: flex-end;
  margin-bottom: 3px;
  letter-spacing: 0.3px;
}

/* Search */
.topbar-search {
  max-width: 400px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.5;
}
.topbar-search-input {
  width: 100%;
  padding: 7px 14px 7px 32px;
  border: 1px solid #dddbd3;
  border-radius: 20px;
  background: #f3f2ee;
  font-size: 13px;
  color: #2a2a22;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.topbar-search-input::placeholder { color: #aaa99a; }
.topbar-search-input:focus {
  border-color: #8a9a7a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(90,106,74,0.1);
}

/* Actions */

.topbar-user-wrap,
.topbar-login {
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b6a5a;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.topbar-btn:hover {
  background: #eeece5;
  color: #2a2a22;
}

/* Push content below fixed topbar */
body { padding-top: 52px; }
body.page { padding-top: 52px; }

/* ── Search dropdown ──────────────────────────────────────── */
.topbar-search { position: relative; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dddbd3;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 300;
  overflow: hidden;
  max-height: 360px;
  overflow-y: auto;
}
.search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.search-result:hover, .search-result:focus, .search-result.kbd-focus { background: #f5f3ee; outline: none; }
.sr-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.sr-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sr-label { font-size: 13px; color: #1a1a18; font-weight: 500; }
.sr-label mark { background: #fff0b3; color: inherit; border-radius: 2px; padding: 0 1px; }
.sr-sub { font-size: 11px; color: #9b9a94; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Custom timeline picker ───────────────────────────────── */
.topbar-picker { position: relative; flex-shrink: 0; }
.topbar-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #dddbd3;
  border-radius: 20px;
  background: #f3f2ee;
  color: #4a4a42;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.topbar-picker-btn:hover { border-color: #8a9a7a; background: #eeecea; }
.picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #dddbd3;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 14px;
  z-index: 300;
  min-width: 200px;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.picker-row label {
  font-size: 12px;
  color: #6b6a5a;
  width: 32px;
  flex-shrink: 0;
}
.picker-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.picker-input {
  flex: 1;
  padding: 6px 26px 6px 10px;
  border: 1px solid #dddbd3;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #1a1a18;
  background: #faf9f6;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.picker-input:focus { border-color: #8a9a7a; background: #fff; }
.picker-clear {
  position: absolute;
  right: 5px;
  background: none;
  border: none;
  color: #9b9a90;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: none;
}
.picker-clear:hover { color: #1a1a18; background: #eeecea; }
.picker-clear.visible { display: block; }
.picker-go {
  width: 100%;
  padding: 7px;
  background: #5a6a4a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 2px;
}
.picker-go:hover { background: #4a5a3a; }

/* ── Basket counter on login button ─────────────────────── */
.basket-counter {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  pointer-events: none;
  animation: counterPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes counterPop {
  0%   { transform: scale(0.5); }
  100% { transform: scale(1); }
}

/* ── Guest favourite counter (distinct from basket: amber, bottom-right) ── */
.fav-counter {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: #d68910;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  pointer-events: none;
  animation: counterPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fav-fly { background: #b9770e !important; }

/* ── Flying item animation ──────────────────────────────── */
.basket-fly {
  position: fixed;
  background: #5a6a4a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  opacity: 1;
  transition: none;
}

/* ── User dropdown ───────────────────────────────────────── */
.topbar-user-wrap {
  position: relative;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #3a3a32;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 8px;
  font-family: inherit;
  height: 100%;
}
.topbar-user:hover { color: #1a1a18; }
.user-new-badge {
  background: #c0392b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0ddd6;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 220px;
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1a1a18;
  text-decoration: none;
  transition: background 0.1s;
  cursor: pointer;
}
.ud-item:hover { background: #f8f6f0; }
.ud-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.ud-count {
  margin-left: auto;
  font-size: 11px;
  color: #9b9a90;
  font-weight: 500;
}
.ud-divider {
  height: 1px;
  background: #eeecea;
  margin: 4px 0;
}
.ud-logout { color: #9b9a90; }
.ud-logout:hover { color: #c0392b; background: #fdf2f2; }

/* ── Hamburger menu ──────────────────────────────────────── */
.topbar-hamburger-wrap {
  position: relative;
  flex-shrink: 0;
}
.topbar-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 6px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.topbar-hamburger:hover {
  background: #f0ede8;
  border-color: #e0ddd6;
}
.topbar-hamburger span {
  display: block;
  height: 2px;
  background: #4a4a40;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.12s;
  transform-origin: center;
}
/* Animate to X when open */
.topbar-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.topbar-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.hamburger-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e0ddd6;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}
.hd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1a1a18;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.hd-item:hover { background: #f8f6f0; }
.hd-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.hd-divider { height: 1px; background: #eeecea; margin: 4px 0; }

/* Toggle switch */
.hd-switch { justify-content: space-between; }
.hd-toggle {
  width: 34px;
  height: 18px;
  background: #d0cec8;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}
.hd-toggle.on { background: #5a6a4a; }
.hd-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.hd-toggle.on .hd-toggle-knob { transform: translateX(16px); }

/* ── Photo toggle button ─────────────────────────────────── */
.topbar-photo-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.topbar-photo-btn:hover {
  background: #f0ede8;
  border-color: #e0ddd6;
}

/* ── HTML Axis ───────────────────────────────────────────── */
#axisWrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: #f5f4f0;
  overflow: visible;
  user-select: none;
  pointer-events: none;
}

/* One continuous bar */
.ax-bar {
  position: absolute;
  background: rgba(80,60,10,0.07);
  border: 1px solid rgba(120,100,20,0.3);
  border-radius: 6px 6px 0 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* Decade sections inside bar */
.ax-dec {
  position: absolute;
  top: 0; bottom: 0;
  border-right: 1px solid rgba(0,0,0,0.20);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 2px 4px 3px;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.12s;
}


.ax-dec:last-child  { border-right: none; }
.ax-dec:hover, .ax-dec.hov { background: rgba(0,0,0,0.08); }

.ax-hint {
  font: 400 9px sans-serif;
  color: rgba(0,0,0,0.45);
  line-height: 1.2;
  visibility: hidden;
}
.ax-dec:hover .ax-hint, .ax-dec.hov .ax-hint { visibility: visible; }

.ax-year {
  font: 700 11px sans-serif;
  color: #5a5a52;
  padding-top: 2px;
  white-space: nowrap;
}
.ax-year.ax-major {
  color: #5a5a52;
}
.ax-dec:hover .ax-year, .ax-dec.hov .ax-year { color: #1a1a18; }

/* End year label inside last decade */
.ax-endyear {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font: 700 11px sans-serif;
  color: #5a5a52;
  white-space: nowrap;
  pointer-events: none;
}

/* Nav triangles */
.ax-nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(0,0,0,0.3);
  font-size: 14px;
  transition: color 0.12s;
}
.ax-nav:hover { color: rgba(0,0,0,0.7); }
.ax-nav-left  { left: 0; }
.ax-nav-right { right: 0; }

/* Millennium zoom triangle */
.ax-zoom {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(0,0,0,0.25);
  font-size: 14px;
  transition: color 0.12s;
}
.ax-zoom:hover { color: rgba(0,0,0,0.6); }

/* ── Axis sublabel (day abbreviation) ───────────────────── */
.ax-sublabel {
  font: 400 8px sans-serif;
  color: rgba(0,0,0,0.35);
  line-height: 1;
  white-space: nowrap;
}
.ax-weekend {
  background: rgba(0,0,0,0.05) !important;
}
.ax-weekend:hover, .ax-weekend.hov {
  background: rgba(0,0,0,0.12) !important;
}

/* ── Non-canvas pages (auth, contact, timelines) ────────── */
body.page { overflow-y: scroll; height: auto; }

/* ── Density slider ──────────────────────────────────────── */
.topbar-density {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.topbar-density-icon {
  font-size: 13px;
  color: #9b9a90;
  line-height: 1;
}
#densitySlider {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: #d0cdc4;
  outline: none;
  cursor: pointer;
}
#densitySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #5a6a4a;
  cursor: pointer;
}
#densitySlider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #5a6a4a;
  cursor: pointer;
  border: none;
}

/* ── Range drag handles ──────────────────────────────────── */
.range-handle {
  position: absolute;
  top: 4px;
  bottom: 0;
  width: 10px;
  margin-left: -5px;
  background: #5a6a4a;
  border-radius: 4px;
  cursor: ew-resize;
  z-index: 20;
  opacity: 0.75;
  transition: opacity 0.12s;
}
.range-handle:hover { opacity: 1; }
.range-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 60%;
  background: rgba(255,255,255,0.6);
  border-radius: 1px;
}
.range-overlay {
  position: absolute;
  top: 4px;
  bottom: 0;
  background: rgba(0,0,0,0.12);
  pointer-events: none;
  z-index: 15;
}
.range-reset {
  position: absolute;
  top: 4px;
  right: 38px;
  font-size: 14px;
  color: #5a6a4a;
  cursor: pointer;
  z-index: 25;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.12s;
}
.range-reset:hover { opacity: 1; }

/* ── Period save button ──────────────────────────────────── */
.range-save {
  position: absolute;
  top: 26px;
  right: 38px;
  font-size: 14px;
  cursor: pointer;
  z-index: 25;
  opacity: 0.6;
  transition: opacity 0.12s;
}
.range-save:hover { opacity: 1; }

/* ── Drag handle year tooltip ────────────────────────────── */
.handle-year-tip {
  position: absolute;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  background: #5a6a4a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 30;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.handle-year-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #5a6a4a;
}

/* ── Period toast ────────────────────────────────────────── */
.period-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #5a6a4a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
}
.period-toast a { color: #c8d4b0; text-decoration: none; }
.period-toast-close { cursor: pointer; opacity: 0.6; margin-left: 8px; }
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ── Periods in All Timelines ────────────────────────────── */
.tl-tag.periods {
  cursor: pointer;
  background: #f0f4e8;
  color: #5a6a4a;
  border: 1px solid #c8d4b0;
}
.tl-tag.periods:hover { background: #e0e8d0; }
.tl-periods {
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eeecea;
}
.tl-period-link {
  font-size: 12px;
  color: #5a6a4a;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0f4e8;
  display: block;
}
.tl-period-link:hover { background: #e0e8d0; }
