/* ============================================================================
   ATLAS — visual design
   Deep-space navy room, warm amber journal marks, editorial serif voice.
   Glass panels float over the canvas; the globe is always the protagonist.
   ========================================================================== */

:root {
  --bg-0: #04070d;
  --bg-1: #0a1220;
  --ink: #e9eef6;
  --ink-2: #98a6ba;
  --ink-3: #5e6d82;
  --gold: #e9b56a;
  --gold-bright: #f6c47e;
  --coral: #ff7c6a;
  --glass: rgba(12, 17, 28, 0.64);
  --glass-2: rgba(16, 23, 37, 0.78);
  --line: rgba(255, 255, 255, 0.085);
  --line-2: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.5, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute must always win, even over display rules below. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg-0);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- atmosphere ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(38, 58, 105, 0.34) 0%, transparent 55%),
    radial-gradient(110% 90% at 88% 96%, rgba(24, 66, 78, 0.26) 0%, transparent 55%),
    radial-gradient(70% 60% at 50% 50%, var(--bg-1) 0%, var(--bg-0) 100%);
}
.bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(90% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}
.noise {
  position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

#stage { position: fixed; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; cursor: grab; }
#stage:active { cursor: grabbing; }
body.over-marker #stage { cursor: pointer; }

/* ---------- glass primitive ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* ---------- boot choreography ----------
   Uses the standalone `translate` property so it never fights the layout
   `transform`s that center .controls and .empty. */
.ui-in { opacity: 0; translate: 0 10px; transition: opacity 0.9s var(--ease-out), translate 0.9s var(--ease-out); }
body.booted .ui-in { opacity: 1; translate: none; }
body.booted .hdr { transition-delay: 0.45s; }
body.booted .stats { transition-delay: 0.62s; }
body.booted .controls { transition-delay: 0.8s; }
body.booted .empty { transition-delay: 1.05s; }

/* =============================================================== header */
.hdr {
  position: fixed; z-index: 20;
  top: max(20px, env(safe-area-inset-top)); left: 24px;
  display: flex; align-items: flex-start; gap: 6px;
}
.wordmark {
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.42em; color: var(--gold);
  margin-bottom: 5px; user-select: none;
}
.journal-title {
  font-family: var(--serif); font-weight: 330; font-size: 30px; line-height: 1.05;
  letter-spacing: 0.01em; color: var(--ink);
  outline: none; border-radius: 6px; padding: 2px 6px; margin-left: -6px;
  min-width: 60px; max-width: 46vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: text; transition: background 0.25s;
}
.journal-title:hover { background: rgba(255, 255, 255, 0.05); }
.journal-title:focus { background: rgba(255, 255, 255, 0.07); box-shadow: 0 0 0 1.5px rgba(233, 181, 106, 0.5); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: none; color: var(--ink-2); cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; }
.kebab { margin-top: 14px; }

.menu {
  position: absolute; top: 60px; left: 0; min-width: 250px;
  padding: 8px; border-radius: var(--r-md); z-index: 25;
  background: var(--glass-2);
}
.menu button {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: none; border-radius: 8px;
  background: transparent; color: var(--ink); font: 500 13.5px var(--sans);
  cursor: pointer; transition: background 0.15s;
}
.menu button:hover { background: rgba(255, 255, 255, 0.08); }
.menu button.danger { color: #ff9d8f; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 7px 4px; }
.menu-note { padding: 8px 12px 5px; font-size: 11px; color: var(--ink-3); }

/* =============================================================== stats */
.stats { position: fixed; z-index: 20; top: max(20px, env(safe-area-inset-top)); right: 24px; text-align: right; }
.chips {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  font: 400 13px var(--sans); color: var(--ink-2); border: 1px solid var(--line);
  transition: border-color 0.25s, transform 0.2s;
}
.chips:hover { border-color: var(--line-2); transform: translateY(-1px); }
.chip b { font: 600 15px var(--sans); color: var(--ink); margin-right: 2px; font-variant-numeric: tabular-nums; }
.chip-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }

.stats-panel {
  position: absolute; right: 0; top: 54px; width: 320px; max-height: min(66vh, 560px);
  padding: 20px; text-align: left; overflow-y: auto; z-index: 25;
  background: var(--glass-2);
  animation: pop-in 0.35s var(--ease-spring);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }
.sp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 14px; }
.sp-big b { font: 300 34px var(--serif); color: var(--ink); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sp-big i { font-style: normal; font-size: 19px; color: var(--ink-3); }
.sp-big span { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; }
.sp-line { font-size: 12.5px; color: var(--ink-2); margin: 7px 0; }
.sp-line.dim { color: var(--ink-3); font-size: 12px; }
.sp-line b { color: var(--gold); font-weight: 500; }
.sp-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 12px; overflow: hidden; }
.sp-bar-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--coral)); transition: width 0.8s var(--ease-out); }
.sp-countries { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.sp-row { display: flex; align-items: center; gap: 10px; padding: 5.5px 2px; font-size: 13px; }
.sp-row .flag { font-size: 15px; }
.sp-name { flex: 1; color: var(--ink-2); }
.sp-n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sp-empty { font-size: 13px; color: var(--ink-3); padding: 6px 2px; }

/* =============================================================== toasts */
.toasts {
  position: fixed; z-index: 40; top: max(20px, env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px;
  font: 450 13.5px var(--sans); color: var(--ink);
  opacity: 0; transform: translateY(-12px) scale(0.96);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-spring);
  max-width: min(88vw, 480px);
}
.toast.show { opacity: 1; transform: none; }
.toast b { color: var(--gold-bright); font-weight: 600; }
.toast.t-country, .toast.t-continent { border-color: rgba(233, 181, 106, 0.4); box-shadow: var(--shadow), 0 0 24px rgba(233, 181, 106, 0.12); }
.toast.t-warn { border-color: rgba(255, 140, 120, 0.35); }
.t-flag { font-size: 20px; }

/* =============================================================== tooltip */
.tip {
  position: fixed; z-index: 15; top: 0; left: 0;
  padding: 7px 13px; border-radius: 999px;
  font: 500 12.5px var(--sans); color: var(--ink);
  pointer-events: none; white-space: nowrap;
}
.tip .flag { margin-right: 3px; }
.tip i { font-style: normal; color: var(--ink-3); margin-left: 5px; font-variant-numeric: tabular-nums; }

/* =============================================================== detail card */
.detail {
  position: fixed; z-index: 22; left: 24px; bottom: 96px;
  width: 300px; padding: 18px;
  opacity: 0; transform: translateY(14px) scale(0.97);
  transition: opacity 0.25s var(--ease-out), transform 0.3s var(--ease-spring);
}
.detail.show { opacity: 1; transform: none; }
.d-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; }
.d-close svg { width: 14px; height: 14px; }
.d-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; padding-right: 20px; }
.d-flag { font-size: 30px; line-height: 1; }
.d-name { font: 400 21px var(--serif); letter-spacing: 0.01em; }
.d-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.d-year { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.d-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.d-stepper { display: flex; align-items: center; gap: 2px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.d-step {
  width: 26px; height: 26px; border: none; border-radius: 7px;
  background: transparent; color: var(--ink-2); font-size: 15px; cursor: pointer;
  transition: background 0.15s;
}
.d-step:hover { background: rgba(255, 255, 255, 0.09); color: var(--ink); }
.d-year-input {
  width: 56px; text-align: center; border: none; background: transparent;
  color: var(--ink); font: 600 14px var(--sans); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield; outline: none;
}
.d-year-input::-webkit-inner-spin-button { display: none; }
.d-notes {
  width: 100%; min-height: 58px; max-height: 130px; resize: vertical;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; color: var(--ink); font: 400 13px/1.5 var(--sans);
  outline: none; transition: border-color 0.2s;
}
.d-notes:focus { border-color: rgba(233, 181, 106, 0.45); }
.d-notes::placeholder { color: var(--ink-3); }
.d-actions { display: flex; justify-content: space-between; margin-top: 12px; }

.ghost-btn {
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-2);
  color: var(--ink-2); font: 500 12.5px var(--sans);
  transition: all 0.2s;
}
.ghost-btn:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--ink); transform: translateY(-1px); }
.ghost-btn.danger:hover { border-color: rgba(255, 120, 100, 0.5); color: #ff9d8f; }

/* =============================================================== controls */
.controls {
  position: fixed; z-index: 20; bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 7px; border-radius: 999px;
}

.seg { position: relative; display: flex; background: rgba(255, 255, 255, 0.045); border-radius: 999px; padding: 3px; }
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line-2);
  border-radius: 999px; transition: transform 0.45s var(--ease-spring);
}
.seg.map .seg-thumb { transform: translateX(100%); }
.seg-btn {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border: none; border-radius: 999px;
  background: transparent; color: var(--ink-3); font: 500 13px var(--sans);
  cursor: pointer; transition: color 0.3s;
}
.seg-btn.active { color: var(--ink); }
.seg-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; }

.ctl-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

.ctl-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.ctl-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.ctl-btn:active { transform: scale(0.9); }
.ctl-btn.on { color: var(--gold); }
.ctl-btn:disabled { opacity: 0.35; cursor: default; }
.ctl-btn:disabled:hover { background: transparent; color: var(--ink-3); }
.ctl-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; }
.ctl-btn .i-sun-day, .ctl-btn .i-sun-night { fill: currentColor; stroke: none; }

.ctl-btn[data-tip]:hover::after, .ctl-btn[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  padding: 6px 11px; border-radius: 8px; white-space: nowrap;
  background: var(--glass-2); border: 1px solid var(--line);
  font: 500 11.5px var(--sans); color: var(--ink-2);
  pointer-events: none;
}

.add-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 14px; margin-left: 2px;
  border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #f0bd77, #dfa254);
  color: #241605; font: 600 13.5px var(--sans);
  box-shadow: 0 4px 18px rgba(233, 181, 106, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s;
}
.add-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(233, 181, 106, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.add-btn:active { transform: scale(0.96); }
.add-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.add-btn kbd {
  font: 500 10.5px var(--sans); background: rgba(0, 0, 0, 0.14);
  padding: 2.5px 6px; border-radius: 5px; letter-spacing: 0.04em;
}
.add-btn.big { padding: 14px 26px; font-size: 15px; }

/* =============================================================== search */
.search-veil {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3, 5, 10, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.22s;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(14vh, 70px) 18px 20px;
}
.search-veil.show { opacity: 1; }
.search {
  width: min(560px, 100%); border-radius: var(--r-lg); overflow: hidden;
  background: var(--glass-2);
  transform: translateY(-10px) scale(0.98); transition: transform 0.28s var(--ease-spring);
}
.search-veil.show .search { transform: none; }
.search-row { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.search-ico { width: 19px; height: 19px; stroke: var(--ink-3); fill: none; flex: none; }
#search-input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--ink); font: 400 17px var(--sans); caret-color: var(--gold);
}
#search-input::placeholder { color: var(--ink-3); }
.search-row kbd {
  font: 500 10.5px var(--sans); color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 6px;
}
.search-results { max-height: min(51vh, 430px); overflow-y: auto; padding: 8px; }
.search-item {
  display: grid; grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto;
  column-gap: 12px; align-items: center; width: 100%;
  padding: 10px 12px; border: none; border-radius: 12px;
  background: transparent; text-align: left; cursor: pointer;
  transition: background 0.12s;
}
.search-item .flag { grid-row: span 2; font-size: 21px; }
.s-name { font: 500 14.5px var(--sans); color: var(--ink); }
.s-meta { grid-column: 2; font-size: 12px; color: var(--ink-3); }
.s-badge {
  grid-row: span 2; font: 500 11px var(--sans); color: var(--ink-3);
  opacity: 0; transition: opacity 0.15s;
}
.search-item.active { background: rgba(255, 255, 255, 0.07); }
.search-item.active .s-badge { opacity: 1; color: var(--gold); }
.search-item.visited .s-badge { opacity: 1; color: var(--gold); }
.search-item.visited .s-name::after { content: " ·"; color: var(--gold); }
.search-hint, .search-empty { padding: 22px 20px; font-size: 13px; color: var(--ink-3); text-align: center; }
.search-empty span { font-size: 12px; opacity: 0.8; }

/* =============================================================== timeline */
.timeline {
  position: fixed; z-index: 21; bottom: 92px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  width: min(620px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; border-radius: 999px;
  opacity: 0; transition: opacity 0.3s var(--ease-out), transform 0.35s var(--ease-spring);
}
.timeline.show { opacity: 1; transform: translateX(-50%); }
.tl-track { position: relative; flex: 1; height: 26px; cursor: pointer; touch-action: none; }
.tl-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 3px;
  border-radius: 2px; background: rgba(255, 255, 255, 0.1);
}
.tl-fill {
  position: absolute; left: 0; top: 12px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--coral));
}
.tl-handle {
  position: absolute; top: 13.5px; width: 15px; height: 15px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--gold-bright); box-shadow: 0 0 0 4px rgba(233, 181, 106, 0.2), 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.tl-ticks { position: absolute; inset: 0; }
.tl-tick { position: absolute; top: 10px; width: 1px; height: 7px; background: rgba(255, 255, 255, 0.18); }
.tl-tick[data-year]::after {
  content: attr(data-year);
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font: 500 9px var(--sans); color: var(--ink-3); letter-spacing: 0.03em;
}
.tl-year { font: 600 15px var(--sans); color: var(--gold); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }

#year-backdrop {
  position: fixed; z-index: 2; right: 5vw; top: 50%; transform: translateY(-50%);
  text-align: right; pointer-events: none;
  opacity: 0; transition: opacity 0.6s var(--ease-out);
}
#year-backdrop.show { opacity: 1; }
#year-num {
  display: block; font: 300 clamp(120px, 22vw, 300px)/0.9 var(--serif);
  color: transparent;
  background: linear-gradient(180deg, rgba(233, 181, 106, 0.16), rgba(233, 181, 106, 0.02));
  -webkit-background-clip: text; background-clip: text;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
#year-sub { display: block; font: 400 italic 15px var(--serif); color: rgba(233, 181, 106, 0.4); margin-top: 10px; margin-right: 8px; }

/* =============================================================== empty state */
.empty {
  position: fixed; z-index: 18; left: 50%; top: 50%;
  transform: translate(-50%, -46%); text-align: center; pointer-events: none;
  width: min(92vw, 640px);
}
.empty > * { pointer-events: auto; }
.empty-kicker {
  font: 500 11px var(--sans); letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 18px;
}
.empty h2 {
  font: 300 clamp(34px, 6vw, 58px)/1.12 var(--serif); color: var(--ink);
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.7);
}
.empty h2 em { font-style: italic; color: var(--gold-bright); }
.empty-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 34px; }
.empty .ghost-btn { border-color: transparent; }
.empty .ghost-btn:hover { border-color: var(--line-2); }

/* =============================================================== misc */
.nogl {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 30px; text-align: center; color: var(--ink-2); font-size: 15px; line-height: 1.6;
}
.flag { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid rgba(233, 181, 106, 0.6); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* =============================================================== mobile */
@media (max-width: 720px) {
  .hdr { left: 16px; right: 60px; }
  .journal-title { font-size: 23px; max-width: 62vw; }
  .stats { top: auto; bottom: 92px; right: 12px; left: 12px; text-align: center; }
  .chips { gap: 9px; padding: 9px 14px; font-size: 11.5px; }
  .chip b { font-size: 13.5px; }
  .stats-panel { right: 0; left: 0; top: auto; bottom: 50px; width: auto; max-height: 54vh; }
  .controls { bottom: max(14px, env(safe-area-inset-bottom)); width: calc(100vw - 20px); justify-content: center; padding: 6px; gap: 3px; }
  .seg-btn { padding: 8px 11px; }
  .seg-btn span { display: none; }
  .add-btn span { display: none; }
  .add-btn kbd { display: none; }
  .add-btn { padding: 11px; }
  .ctl-btn { width: 38px; height: 38px; }
  .detail { left: 10px; right: 10px; bottom: 84px; width: auto; }
  .timeline { bottom: 84px; padding: 10px 14px; gap: 10px; }
  .search-veil { padding: max(8vh, 40px) 10px 12px; }
  #search-input { font-size: 16px; }
  #year-backdrop { right: 50%; transform: translate(50%, -50%); top: 34%; text-align: center; }
  #year-sub { margin-right: 0; }
  .empty { transform: translate(-50%, -52%); }
  .toasts { top: max(14px, env(safe-area-inset-top)); width: 100%; padding: 0 12px; }
  .ctl-btn[data-tip]:hover::after { display: none; }
}

/* =============================================================== reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ui-in, .toast, .search, .search-veil, .detail, .timeline, .seg-thumb { transition-duration: 0.01s !important; }
  @keyframes pop-in { from { opacity: 1; } }
}
