/* World News Garden — spin the world, read the news. */

:root {
  --bg: #04070c;
  --ink: #f2f5f8;
  --dim: #7d8b99;
  --dimmer: #4a5763;
  --accent: #4dfd8b;              /* available cities */
  --selected: #ffc247;            /* the city you have open */
  --you: #ff3b30;                 /* your own location */
  --accent-soft: rgba(77, 253, 139, 0.15);
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(8, 12, 18, 0.82);
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --panel-w: 400px;
  --sheet-h: 0px; /* mobile bottom-sheet height; set when the sheet is open */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior: none; }

/* ---------- globe canvas ---------- */

#globe {
  position: fixed;
  inset: 0;
  /* A canvas is a replaced element: inset:0 alone will NOT stretch it, so it
     would fall back to its intrinsic (drawing-buffer) size and hang off the
     bottom-right on any display where devicePixelRatio isn't 1. These two
     declarations are what actually make it fill the viewport. */
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
#globe.dragging { cursor: grabbing; }

/* Soft glow behind the planet, and a vignette to sink the edges. */
.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  /* Kept light so the starfield stays visible through it. */
  background:
    radial-gradient(circle at 50% 52%, rgba(58, 108, 150, 0.1), transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 72%, rgba(0, 0, 0, 0.45) 100%);
}

/* ---------- centre reticle ---------- */

.reticle {
  position: fixed;
  top: calc(50% - var(--reticle-shift-y, 0px));
  left: calc(50% - var(--reticle-shift, 0px));
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  pointer-events: none;
  transition: width 0.3s, height 0.3s, margin 0.3s, border-color 0.3s, opacity 0.3s;
  z-index: 5;
}
.reticle::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.reticle.locked {
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  /* Amber, matching the selected marker on the globe. */
  border-color: var(--selected);
  box-shadow: 0 0 26px rgba(255, 194, 71, 0.3);
}

/* ---------- chrome ---------- */

.wordmark {
  position: fixed;
  top: 26px;
  left: 30px;
  z-index: 10;
  line-height: 1.15;
}
.wordmark h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.wordmark h1 a {
  color: inherit;
  text-decoration: none;
}
.wordmark span {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
}

.tools {
  position: fixed;
  top: 26px;
  right: 30px;
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: right 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
body.panel-open .tools { right: calc(var(--panel-w) + 30px); }

.search-wrap { position: relative; }

#search {
  width: 178px;
  padding: 9px 13px;
  border-radius: 999px;
  /* Bright enough to actually see the field against the globe. */
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  outline: none;
  transition: width 0.28s, border-color 0.2s, background 0.2s;
}
#search:focus {
  width: 232px;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}
#search::placeholder { color: rgba(255, 255, 255, 0.58); }

.results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 262px;
  max-height: 316px;
  overflow-y: auto;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  display: none;
}
.results.show { display: block; }
.results button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
}
.results button:hover, .results button.active { background: var(--accent-soft); }
.results button small {
  display: block;
  color: var(--dim);
  font-size: 11px;
  margin-top: 2px;
}
/* A green pip marks the places that have a newsroom of their own. */
.results button.has-news::after {
  content: '';
  position: absolute;
  top: 14px;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px var(--accent);
}
.results button { position: relative; }

/* ---------- right-hand control stack ---------- */

.stack {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: right 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
body.panel-open .stack { right: calc(var(--panel-w) + 22px); }

.stack-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(24, 29, 38, 0.82);
  backdrop-filter: blur(14px);
  color: #e8edf3;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s;
}
.stack-btn svg { width: 21px; height: 21px; display: block; }
.stack-btn:hover {
  background: rgba(40, 48, 60, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.stack-btn:active { transform: scale(0.94); }

/* Zoom buttons read as one control, split by a hairline. */
.stack-group {
  display: flex;
  flex-direction: column;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 29, 38, 0.82);
  backdrop-filter: blur(14px);
}
.stack-group .stack-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  height: 48px;
}
.stack-group .stack-btn + .stack-btn {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.stack-btn:disabled { opacity: 0.32; cursor: default; }
.stack-btn:disabled:hover { background: transparent; color: #e8edf3; }

/* Lock swaps between the two glyphs; green while engaged. */
.stack-btn .icon-locked { display: none; }
#lock[aria-pressed='true'] {
  color: var(--accent);
  border-color: rgba(77, 253, 139, 0.45);
  background: rgba(77, 253, 139, 0.12);
}
#lock[aria-pressed='true'] .icon-locked { display: block; }
#lock[aria-pressed='true'] .icon-unlocked { display: none; }

#locate.busy { color: var(--accent); animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: 0.45; } }

/* ---------- bottom readout ---------- */

.readout {
  position: fixed;
  left: 30px;
  bottom: 28px;
  z-index: 10;
  max-width: 460px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
}
.readout.show { opacity: 1; transform: none; pointer-events: auto; }

.readout .place {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.05;
}
/* The city the headlines actually come from, when the place is a suburb. */
.readout .parent {
  font-weight: 400;
  color: var(--dim);
  letter-spacing: -0.01em;
}

.country .flag {
  margin-right: 7px;
  font-size: 13px;
  letter-spacing: 0;
  vertical-align: -1px;
}
.country .flag:empty { display: none; }
.readout .country {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}
.source-chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--sans);
}
.source-chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.24); }
.source-chip.is-city { border-style: dashed; }
.source-chip.is-city.active { border-style: solid; }
.source-chip.active {
  background: var(--selected);
  border-color: var(--selected);
  color: #1a1408;
  font-weight: 600;
}

/* ---------- headlines panel ---------- */

.panel {
  position: fixed;
  top: 0;
  right: 0;
  /* Never let the panel exceed the viewport, or its text overflows off-screen
     instead of wrapping. */
  width: min(var(--panel-w), 100vw);
  max-width: 100vw;
  height: 100%;
  background: var(--panel);
  backdrop-filter: blur(22px);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 20;
  display: flex;
  flex-direction: column;
}
body.panel-open .panel { transform: none; }

.panel-head {
  padding: 24px 26px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel-head .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.panel-head h2 {
  margin: 9px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-head .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--dim);
}
.panel-close {
  position: absolute;
  top: 21px;
  right: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.panel-close:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }

.stories {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.stories::-webkit-scrollbar { width: 8px; }
.stories::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.story {
  display: block;
  padding: 17px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: inherit;
  transition: background 0.18s;
}
.story:hover { background: rgba(255, 255, 255, 0.045); }
.story:hover .story-title { color: var(--accent); }

.story-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -0.006em;
  transition: color 0.18s;
  overflow-wrap: anywhere;
}
.story-snippet {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}
.story-time {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.story-thumb {
  float: right;
  width: 68px;
  height: 68px;
  margin: 2px 0 8px 13px;
  border-radius: 7px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.panel-foot {
  padding: 13px 26px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--dimmer);
  flex-shrink: 0;
}
.panel-foot a { color: var(--dim); }

.state {
  padding: 46px 26px;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
  line-height: 1.6;
}
.spinner {
  width: 22px;
  height: 22px;
  margin: 0 auto 15px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- loading veil ---------- */

.veil {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #03060a;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.veil.gone { opacity: 0; visibility: hidden; }

/* Starfield, drifting slowly so the screen is never dead. */
.veil-stars {
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(1px 1px at 52% 85%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 48% 76%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 13% 57%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 13% 72%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 30% 82%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 1px at 30% 7%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 2px at 20% 71%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 15% 76%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 72% 93%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 65% 89%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 2px at 76% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 25% 91%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 69% 65%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 1px at 79% 11%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 1px at 98% 45%, rgba(255,255,255,.7), transparent),
    radial-gradient(2px 2px at 7% 87%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 90% 46%, rgba(255,255,255,.35), transparent),
    radial-gradient(2px 1px at 13% 36%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 95% 91%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 1px at 93% 51%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 2px at 47% 23%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 1px at 29% 38%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 2px at 52% 65%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 2px at 53% 72%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 2px at 72% 37%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 2px at 31% 21%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 31% 86%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 2px at 77% 25%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 20% 55%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 90% 67%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 2px at 52% 53%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 2px at 83% 53%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 28% 58%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 78% 8%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 70% 14%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 28% 80%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 46% 79%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 1px at 16% 64%, rgba(255,255,255,.35), transparent),
    radial-gradient(2px 2px at 41% 12%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 96% 35%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 28% 69%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 69% 40%, rgba(255,255,255,.9), transparent),
    radial-gradient(1px 1px at 23% 47%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 80% 26%, rgba(255,255,255,.7), transparent),
    radial-gradient(2px 1px at 27% 68%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 5% 37%, rgba(255,255,255,.35), transparent);
  animation: veil-drift 62s linear infinite;
  opacity: 0.55;
}
@keyframes veil-drift { to { transform: translate3d(-4%, 3%, 0); } }

/* Slow colour wash behind the globe. */
.veil-aurora {
  position: absolute;
  width: 120vmax;
  height: 120vmax;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 40%, rgba(37, 179, 101, 0.17), transparent 42%),
    radial-gradient(circle at 62% 58%, rgba(46, 109, 158, 0.17), transparent 46%);
  filter: blur(30px);
  animation: veil-aurora 18s ease-in-out infinite alternate;
}
@keyframes veil-aurora {
  from { transform: translate3d(-4%, -2%, 0) scale(1); }
  to   { transform: translate3d(4%, 2%, 0) scale(1.12); }
}

.veil-inner {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 0 24px;
}

/* --- wireframe globe, built from rings rotated in 3D --- */

.veil-sphere {
  position: relative;
  width: 132px;
  height: 132px;
  margin-bottom: 30px;
  perspective: 620px;
}
.vs-glow {
  position: absolute;
  inset: -34%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 253, 139, 0.3), transparent 62%);
  animation: vs-pulse 3.4s ease-in-out infinite;
}
.vs-body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: vs-spin 11s linear infinite;
}
.vs-body i {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(77, 253, 139, 0.34);
  border-radius: 50%;
}
/* Meridians: one circle, turned about the vertical axis. */
.vs-mer:nth-child(1) { transform: rotateY(0deg); }
.vs-mer:nth-child(2) { transform: rotateY(30deg); }
.vs-mer:nth-child(3) { transform: rotateY(60deg); }
.vs-mer:nth-child(4) { transform: rotateY(90deg); }
.vs-mer:nth-child(5) { transform: rotateY(120deg); }
.vs-mer:nth-child(6) { transform: rotateY(150deg); }
/* Parallels: flat rings lifted and shrunk to sit on the sphere. */
.vs-lat { border-color: rgba(77, 253, 139, 0.2); }
.vs-lat-n { transform: rotateX(90deg) translateZ(40px) scale(0.79); }
.vs-lat-e { transform: rotateX(90deg); }
.vs-lat-s { transform: rotateX(90deg) translateZ(-40px) scale(0.79); }

/* A bright band sweeping down the globe, like a scan. */
.vs-scan {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(
    to bottom,
    transparent 42%,
    rgba(77, 253, 139, 0.5) 50%,
    transparent 58%
  );
  mask: radial-gradient(circle, #000 66%, transparent 67%);
  -webkit-mask: radial-gradient(circle, #000 66%, transparent 67%);
  animation: vs-scan 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes vs-spin { to { transform: rotateY(360deg); } }
@keyframes vs-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.96); }
  50%      { opacity: 1; transform: scale(1.06); }
}
@keyframes vs-scan {
  0%   { transform: translateY(-58%); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(58%); opacity: 0; }
}

/* --- wordmark --- */

.veil-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink);
}
.veil-tagline {
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

/* --- counters, climbing with real progress --- */

.veil-stats {
  display: flex;
  gap: 30px;
  margin: 30px 0 26px;
}
.veil-stats div { display: grid; gap: 5px; }
.veil-stats b {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.veil-stats span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

/* --- progress --- */

.veil-bar {
  width: 240px;
  max-width: 64vw;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.11);
  overflow: hidden;
}
.veil-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #1e9a56, var(--accent));
  box-shadow: 0 0 12px rgba(77, 253, 139, 0.6);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.veil-status {
  margin: 14px 0 0;
  min-height: 13px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* Boot failed: stop everything moving and say so plainly. */
.veil.failed .vs-body,
.veil.failed .vs-scan,
.veil.failed .vs-glow { animation: none; }
.veil.failed .vs-body i { border-color: rgba(255, 107, 94, 0.35); }
.veil.failed .vs-glow { background: radial-gradient(circle, rgba(255, 107, 94, 0.22), transparent 62%); }
.veil.failed .veil-status { color: #ff8a7e; }
.veil.failed .veil-bar span { background: #ff6b5e; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .veil-stars, .veil-aurora, .vs-body, .vs-scan, .vs-glow { animation: none; }
  .vs-scan { opacity: 0.3; }
}

@media (max-width: 480px) {
  .veil-sphere { width: 108px; height: 108px; }
  .vs-lat-n { transform: rotateX(90deg) translateZ(33px) scale(0.79); }
  .vs-lat-s { transform: rotateX(90deg) translateZ(-33px) scale(0.79); }
  .veil-stats { gap: 20px; margin: 24px 0 22px; }
  .veil-stats b { font-size: 16px; }
  .veil-title { font-size: 13px; letter-spacing: 0.22em; }
}

.hint {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--dimmer);
  pointer-events: none;
  transition: opacity 0.5s;
}
.hint.gone { opacity: 0; }

/* Made-in line, centred along the bottom edge. */
.made {
  position: fixed;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.made .sep { color: rgba(255, 255, 255, 0.25); margin: 0 3px; }
.made .flag { margin-left: 2px; }

.credit {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 4;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.24);
}
.credit a { color: inherit; }
body.panel-open .credit { display: none; }

/* Shown only when scripting is off — real content, not a placeholder. */
.noscript {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  padding: 90px 24px 60px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  line-height: 1.6;
}
.noscript h2 { font-size: 26px; letter-spacing: -0.02em; }
.noscript p { color: var(--dim); }
.noscript strong { color: var(--ink); }
.noscript ul { padding-left: 18px; }
.noscript li { margin-bottom: 6px; }
.noscript a { color: var(--accent); }

/* ---------- narrow screens ---------- */

@media (max-width: 780px) {
  .wordmark { top: 14px; left: 16px; }
  .wordmark h1 { font-size: 13px; letter-spacing: 0.2em; }
  .wordmark span { font-size: 9px; }

  .tools { top: 12px; right: 16px; gap: 6px; }
  body.panel-open .tools { right: 16px; }
  #search { width: 122px; padding: 10px 13px; }
  #search:focus { width: 156px; }
  .results { width: min(300px, calc(100vw - 32px)); }
  .hint { display: none; }
  .made { font-size: 9px; letter-spacing: 0.06em; }
  /* Reads over the sheet rather than being hidden behind it. */
  body.panel-open .made { z-index: 30; }
  body.panel-open .panel-foot { padding-bottom: 30px; }
  body.panel-open .credit { display: none; }

  /* Stack tucks to the right, above the sheet, and stays thumb-sized. */
  .stack {
    right: 12px;
    top: auto;
    /* Sits above the sheet, but never high enough to reach the header —
       the clamp is what stops it covering the search field. */
    bottom: min(calc(var(--sheet-h) + 16px), calc(100dvh - 290px));
    transform: none;
    gap: 8px;
  }
  body.panel-open .stack { right: 12px; }
  .stack-btn { width: 44px; height: 44px; border-radius: 12px; }
  .stack-group .stack-btn { height: 44px; }

  /* The readout sits above the sheet rather than behind it. */
  .readout {
    left: 16px;
    /* Leave the right edge clear for the control stack. */
    right: 70px;
    bottom: calc(var(--sheet-h) + 16px);
    max-width: none;
    transition: opacity 0.4s, transform 0.4s, bottom 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .readout .place { font-size: 27px; }
  .sources {
    margin-top: 11px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  .sources::-webkit-scrollbar { display: none; }
  .source-chip { flex: 0 0 auto; padding: 8px 14px; }

  /* ---- headlines become a bottom sheet ---- */
  .panel {
    --sheet-h: 56vh;
    --sheet-h: 56dvh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--sheet-h);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.5);
  }
  body.panel-open .panel { transform: none; }

  /* Grab handle, so it reads as a sheet you can dismiss. */
  .panel::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.22);
  }

  .panel-head { padding: 22px 18px 13px; }
  .panel-head h2 { font-size: 19px; }
  .story { padding: 15px 18px; }
  .panel-foot { padding: 12px 18px; }
  .panel-close {
    top: 18px;
    right: 14px;
    width: 34px;
    height: 34px;
  }
  .story-thumb { width: 60px; height: 60px; }
}

@media (max-width: 780px) {
  body.panel-open {
    --sheet-h: 56vh;
    --sheet-h: 56dvh;
  }
}

/* Fine-tune for short phones so the sheet doesn't swallow the globe. */
@media (max-width: 780px) and (max-height: 700px) {
  .panel {
    --sheet-h: 62vh;
    --sheet-h: 62dvh;
  }
  body.panel-open {
    --sheet-h: 62vh;
    --sheet-h: 62dvh;
  }
  .readout .place { font-size: 22px; }
}
