/* Worldview Timeline web preview. CSP is style-src 'self' — no inline style attributes. */
:root {
  --bg: #0b1a30; --panel: #12253f; --line: #1e3a5c; --ink: #e8f1fb;
  --dim: #8fb0d0; --accent: #7dd3fc; --hot: #facc15; --warn: #fb923c;
  --sat-t: env(safe-area-inset-top, 0px);
  --sat-r: env(safe-area-inset-right, 0px);
  --sat-b: env(safe-area-inset-bottom, 0px);
  --sat-l: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: flex; flex-direction: column; min-height: 100%; min-height: 100dvh;
  overflow-x: clip;
}
.topbar {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  padding-left: max(18px, var(--sat-l));
  padding-right: max(18px, var(--sat-r));
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand img { width: 28px; height: 28px; }
.brand h1 { font-size: 16px; letter-spacing: .12em; margin: 0; color: var(--accent); }
.tag {
  font-size: 10px; letter-spacing: .14em; color: var(--hot);
  border: 1px solid var(--hot); border-radius: 99px; padding: 1px 8px;
  vertical-align: middle;
}
.ghost {
  background: #0e1f36; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.help {
  margin: 0; padding: 12px 18px; background: #0e1f36; color: var(--dim);
  border-bottom: 1px solid var(--line); font-size: 13px; max-width: 92ch;
  padding-left: max(18px, var(--sat-l));
  padding-right: max(18px, var(--sat-r));
}
.help[hidden] { display: none !important; }
.help strong { color: var(--ink); }
.controls {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  padding-left: max(18px, var(--sat-l));
  padding-right: max(18px, var(--sat-r));
  position: relative; z-index: 2;
}
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { color: var(--dim); font-size: 11px; letter-spacing: .08em; }
input, select, button {
  background: #0e1f36; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; font: inherit; font-size: 13px;
}
input[type="range"] { width: min(260px, 100%); padding: 0; accent-color: var(--accent); }
button { cursor: pointer; border-color: var(--accent); color: var(--accent); }
button:hover { background: #16304f; }
.clock { color: var(--hot); font-size: 15px; letter-spacing: .06em; }
.status { color: var(--dim); font-size: 12px; }
#stage {
  position: relative; z-index: 1; flex: 1; min-height: 0; overflow: hidden;
  background: #0a2438 url("poster.jpg") center / cover no-repeat; cursor: grab;
}
#stage::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px; margin: -8px 0 0 -8px;
  border: 2px solid var(--hot); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(11, 26, 48, .65);
  pointer-events: none; z-index: 2;
}
@media (min-height: 700px) {
  #stage { min-height: 420px; }
}
@media (max-width: 880px) {
  #stage { min-height: min(56svh, calc(100svh - 14rem)); }
}
#stage.drag { cursor: grabbing; }
#basemap, #tiles { position: absolute; inset: 0; }
#basemap { z-index: 0; }
#tiles { z-index: 1; }
#basemap img,
#tiles img {
  position: absolute; width: 256px; height: 256px;
  image-rendering: auto; user-select: none; pointer-events: none;
}
.legend {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(11, 26, 48, .86); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; color: var(--dim); font-size: 11px;
}
.legend b { color: var(--ink); }
.places { display: flex; gap: 6px; flex-wrap: wrap; }
.search-field { flex: 1 1 16rem; min-width: min(100%, 16rem); }
.search-box { position: relative; }
#q { width: 100%; }
.search-msg { margin: 2px 0 0; color: var(--dim); font-size: 11px; min-height: 0; }
#results {
  position: absolute; z-index: 4; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 0; list-style: none;
  background: #0e1f36; border: 1px solid var(--line); border-radius: 6px;
  max-height: 240px; overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
#results[hidden] { display: none !important; }
#results li { margin: 0; }
#results button {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line); background: transparent; color: var(--ink);
}
#results li[aria-selected="true"] button,
#results button:hover { background: #16304f; }
#results .hit-label { display: block; color: var(--ink); }
#results .hit-detail { display: block; color: var(--dim); font-size: 11px; }
.film { display: flex; flex-direction: column; gap: 4px; min-width: min(100%, 14rem); flex: 1 1 14rem; }
.filmline { margin: 0; color: var(--dim); font-size: 12px; max-width: 40rem; }
#filmBar { width: min(100%, 280px); height: 8px; accent-color: var(--accent); }
#filmBar[hidden], #filmFile[hidden], #filmCancel[hidden] { display: none !important; }
#filmFile { color: var(--accent); font-size: 13px; }
.credit {
  color: var(--dim); font-size: 11px; padding: 10px 18px;
  border-top: 1px solid var(--line);
  padding-left: max(18px, var(--sat-l));
  padding-right: max(18px, var(--sat-r));
  padding-bottom: max(10px, var(--sat-b));
}

@media (max-height: 540px) and (orientation: landscape) {
  body { overflow: hidden; }
  .topbar { padding: 4px 12px; gap: 10px;
    padding-left: max(12px, var(--sat-l)); padding-right: max(12px, var(--sat-r)); }
  .brand h1 { font-size: 14px; }
  .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .status, .search-msg { display: none; }
  #results { max-height: 28vh; }
  .controls { padding: 4px 12px; gap: 8px; align-items: center;
    padding-left: max(12px, var(--sat-l)); padding-right: max(12px, var(--sat-r)); }
  .credit { display: none; }
  #stage { flex: 1; min-height: 0; }
  .legend { font-size: 9px; line-height: 1.25; padding: 4px 6px; left: 8px; bottom: 8px; }
  input[type="range"] { width: min(200px, 32vw); }
}

@media (pointer: coarse) {
  button, .ghost { min-height: 40px; }
  input[type="range"] { min-height: 32px; }
}
