/* ============================================================
   NOWHERE, RIGHT NOW — Retro Hi-Fi Mobile-Perfect Terminal
   Architecture: Zero Horizontal Overflow, 1st Screen Full Map.
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Chassis & Panels */
  --chassis:        #0b0f0d;
  --chassis-2:      #121815;
  --chassis-3:      #18221d;
  --panel:          #141c19;
  --panel-border:   #232f29;
  --panel-border-2: #34463d;

  /* High Contrast Typography */
  --text-primary:   #f0f4f1;
  --text-secondary: #b5c4bd;
  --text-muted:     #7f9288;
  --text-faint:     #4d5d54;

  /* Phosphor LED Signals */
  --amber:          #ffb000;
  --amber-dim:      rgba(255, 176, 0, 0.15);
  --amber-glow:     0 0 10px rgba(255, 176, 0, 0.45);
  --ruby:           #f43f5e;

  /* Grid Line Hardware Guide */
  --grid-line:      rgba(255, 255, 255, 0.035);

  /* Typography */
  --display: "Syne", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans:    "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    "DM Mono", ui-monospace, monospace;
}

/* ============================================================
   GLOBAL BODY & VIEWPORT CONSTRAINTS
   ============================================================ */
html {
  background: var(--chassis);
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

body {
  background: var(--chassis);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* CHANGED: use stable viewport units — 100svh prevents layout shift when
     mobile Chrome's address bar collapses. Falls back to 100vh on older
     browsers that don't support svh. */
  min-height: 100vh;
  min-height: 100svh;
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;

  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
}

a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 176, 0, 0.45);
  transition: all 0.15s ease;
}
a:hover {
  color: #fff;
  border-bottom-style: solid;
  border-bottom-color: #fff;
}

button, select, input {
  font-family: inherit;
  color: inherit;
}

::selection {
  background: var(--amber);
  color: #0b0f0d;
}

/* ============================================================
   MASTHEAD
   ============================================================ */
.masthead {
  background: rgba(11, 15, 13, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  width: 100%;
  max-width: 100vw;
}

.masthead__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.masthead__brand-link {
  color: inherit;
  text-decoration: none;
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.masthead__brand {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.masthead__brand-link::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: var(--amber-glow);
}

.masthead__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.masthead__tagline {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.masthead__sep { color: var(--panel-border-2); }

.masthead__lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chassis-2);
  border: 1px solid var(--panel-border);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.masthead__lang-item {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
  padding: 1px 4px;
  border-radius: 2px;
}
.masthead__lang-item:hover { color: var(--text-primary); }
.masthead__lang-item.is-active {
  color: #0b0f0d;
  background: var(--amber);
  font-weight: 700;
}
.masthead__lang-divider { color: var(--panel-border-2); }

/* ============================================================
   MAIN REPORT (CONSTRAINED TO 100% WIDTH)
   ============================================================ */
.report {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow-x: hidden;
}

.report__hero { display: none; }

/* Lookup & Search Console */
.lookup {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
}

.lookup__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.lookup__label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.lookup__input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  width: 100%;
  min-width: 0;
}
.lookup__input::placeholder {
  color: var(--text-faint);
  font-style: italic;
  font-size: 16px;
}

.lookup__go {
  background: var(--amber);
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0b0f0d;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 4px;
  min-height: 34px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.lookup__go:not(:disabled):hover {
  background: #ffc43a;
  transform: translateY(-1px);
}
.lookup__go:disabled {
  background: var(--chassis-3);
  color: var(--text-faint);
  cursor: not-allowed;
}

.lookup__curated-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.lookup__dropdowns {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.lookup__select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--chassis-2);
  border: 1px solid var(--panel-border-2);
  border-radius: 4px;
  padding: 4px 24px 4px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffb000' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 7px 4px;
  max-width: 100%;
}
.lookup__select:hover, .lookup__select:focus { border-color: var(--amber); }
.lookup__select:disabled { opacity: 0.4; cursor: not-allowed; }

.lookup__select--landmark { max-width: 220px; }

.lookup__surprise-btn {
  background: rgba(255, 176, 0, 0.12);
  border: 1px solid rgba(255, 176, 0, 0.45);
  border-radius: 4px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 10px;
  height: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.lookup__surprise-btn:hover {
  background: var(--amber);
  color: #0b0f0d;
}

.lookup__hint {
  display: flex;
  gap: 6px 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.lookup__hint-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

#curated-chips-container {
  display: flex;
  gap: 6px 8px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.lookup__hint-btn {
  background: transparent;
  border: none;
  font-family: var(--display);
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 1px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease;
  white-space: nowrap;
}
.lookup__hint-btn:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.recent { display: none !important; }

/* ============================================================
   DISPATCH (VIEWPORT GRID - ZERO OVERFLOW)
   ============================================================ */
.dispatch {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

/* ============ PLATE (VIEWFINDER FRAME) ============ */
.plate {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.plate__frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  background: #080c0a;
  border: 1px solid var(--panel-border-2);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  padding: 0;

  background-image:
    radial-gradient(circle at center, rgba(255, 176, 0, 0.04) 0%, transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

#viz-canvas,
.city-map,
.city-map canvas {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  inset: 0;
  display: block;
}
#viz-canvas[hidden], .city-map[hidden] { display: none !important; }

.city-map .maplibregl-ctrl-attrib,
.city-map .maplibregl-ctrl-bottom-left,
.city-map .maplibregl-ctrl-bottom-right {
  display: none !important;
}

.plate__expand-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 25;
  background: rgba(18, 24, 21, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.plate__expand-btn:hover {
  background: var(--amber);
  color: #0b0f0d;
}

.plate__frame.is-fullscreen,
.plate__frame:fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  border: none !important;
  border-radius: 0 !important;
}

.plate__caption {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  max-width: calc(100% - 60px);
  background: rgba(14, 19, 16, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  pointer-events: auto;
}
.plate__caption[hidden] { display: none; }

.plate__place {
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.15;
  font-weight: 700;
}

.plate__coords {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plate__link {
  color: var(--text-primary);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.35);
}
.plate__link:hover {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.plate__landmark-row {
  margin: 4px 0 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.plate__landmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-primary);
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.plate__landmark-btn:hover {
  background: var(--amber);
  color: #0b0f0d;
}

.plate__cycle-btn {
  background: rgba(255, 176, 0, 0.16);
  border: 1px solid rgba(255, 176, 0, 0.45);
  color: var(--amber);
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.plate__cycle-btn:hover { background: var(--amber); color: #0b0f0d; }

.plate__subcoords {
  display: block;
  font-size: 9.5px;
  color: var(--text-muted);
}

.plate__loading {
  position: absolute;
  inset: 0;
  z-index: 15;
  background: var(--chassis-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.plate__loading[hidden] { display: none; }

.plate__loading-line {
  width: 36px;
  height: 2px;
  background: var(--amber);
  box-shadow: var(--amber-glow);
  animation: scanline 1.2s ease-in-out infinite;
}
@keyframes scanline {
  0%, 100% { transform: translateX(-12px); opacity: 0.4; }
  50%      { transform: translateX(12px);  opacity: 1; }
}

.plate__loading-text {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}

.plate__figcaption {
  display: flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 2px 0;
}
.plate__figcaption-num { color: var(--amber); font-weight: 700; }
.plate__figcaption-text a { color: var(--text-secondary); }

/* ============ DATA & TELEMETRY PANELS ============ */
.dispatch__col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
}

.block {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.block__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.block__label {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 700;
}

.block__meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.stats { display: flex; flex-direction: column; width: 100%; }

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
  width: 100%;
}
.stat:last-child { border-bottom: none; }

.stat__label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.stat__value {
  font-family: var(--display);
  font-size: 16px;
  color: #f0f4f1 !important;
  font-weight: 700;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.stats--sound .stat__value {
  font-size: 14px;
  color: #f0f4f1 !important;
}

.stat--tradition { align-items: flex-start; }

.stat--tradition .stat__value {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber) !important;
  text-align: right;
  white-space: normal;
  max-width: 65%;
  line-height: 1.35;
}

.block--cta { padding: 10px 14px; }
.controls { display: flex; gap: 10px; width: 100%; }

/* Battery Saver Pulse Animation for Active Buttons */
@keyframes pulse-ruby {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.ctrl {
  flex: 1;
  background: var(--chassis-2);
  border: 1px solid var(--panel-border-2);
  border-radius: 4px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  cursor: pointer;
  min-height: 38px;
  transition: all 0.15s ease;
}
.ctrl:not(:disabled):hover {
  background: var(--amber);
  border-color: var(--amber);
  color: #0b0f0d;
}
.ctrl:disabled { opacity: 0.4; cursor: not-allowed; }

.ctrl.is-active {
  background: var(--ruby);
  border-color: var(--ruby);
  color: #fff;
  animation: pulse-ruby 2s infinite;
}

/* ============================================================
   BOTTOM DOCK (COLOPHON)
   ============================================================ */
.colophon {
  background: rgba(11, 15, 13, 0.96);
  border-top: 1px solid var(--panel-border-2);
  flex-shrink: 0;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  width: 100%;
}

.colophon__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
}

.colophon__left, .colophon__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.colophon__right { justify-content: flex-end; }
.colophon__sep { color: var(--panel-border-2); }

.colophon__link {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  text-transform: uppercase;
}
.colophon__link:hover { color: var(--amber); }

.colophon__slider-box {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  height: 28px;
}

.colophon__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 5px;
  background: var(--chassis-3);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.colophon__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #0b0f0d;
  box-shadow: var(--amber-glow);
  cursor: pointer;
}
.colophon__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #0b0f0d;
  box-shadow: var(--amber-glow);
  cursor: pointer;
}

.colophon__status {
  color: var(--text-secondary);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50ch;
  display: inline-block;
}

#mute-icon { color: var(--amber); }

/* About Modal */
.sheetmodal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.sheetmodal[hidden] { display: none; }

.sheetmodal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 10, 0.85);
  backdrop-filter: blur(6px);
}

.sheetmodal__panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border-2);
  border-radius: 8px;
  padding: 28px 24px;
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  color: var(--text-primary);
}

.sheetmodal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}
.sheetmodal__close:hover { color: var(--amber); }

.sheetmodal__title {
  font-family: var(--display);
  font-size: 26px;
  color: var(--amber);
  margin-bottom: 12px;
}

.sheetmodal__text {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sheetmodal__key {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 14px;
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  font-size: 12.5px;
}
.sheetmodal__key dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--amber);
}
.sheetmodal__key dd { color: var(--text-primary); }

.sheetmodal__colophon {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 14px;
}

/* ============================================================
   MOBILE: ZERO HORIZONTAL SCROLL & 1st SCREEN VIEWPORT
   ============================================================ */
@media (max-width: 820px) {
  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  body {
    padding-bottom: max(85px, calc(70px + env(safe-area-inset-bottom)));
    overflow-y: auto !important;
  }

  .report {
    padding: 10px 12px 24px;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }

  .dispatch {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
    width: 100%;
    max-width: 100%;
  }

  /* CHANGED: svh instead of dvh — stable when the mobile URL bar collapses. */
  .plate {
    min-height: calc(100vh - 260px);
    min-height: calc(100svh - 260px);
    height: calc(100vh - 260px);
    height: calc(100svh - 260px);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }

  .plate__frame {
    flex: 1 1 auto;
    width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    min-height: 320px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
  }

  .city-map,
  .city-map canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: block !important;
  }

  .dispatch__col {
    padding-top: 8px;
    width: 100%;
    max-width: 100%;
  }

  .lookup__curated-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .lookup__dropdowns {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .lookup__select {
    flex: 1;
    min-width: 130px;
    max-width: 100%;
  }

  .lookup__hint {
    flex-wrap: wrap;
    gap: 6px 10px;
    width: 100%;
  }

  #curated-chips-container {
    flex-wrap: wrap;
    gap: 6px 8px;
    width: 100%;
  }

  .colophon__inner {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 16px;
    text-align: center;
  }

  .colophon__left {
    justify-content: space-between;
    width: 100%;
  }

  .colophon__slider { width: 120px; }
  .colophon__center { display: none; }
  .colophon__right { justify-content: center; gap: 14px; }
}

@media (max-width: 520px) {
  .masthead__inner { padding: 10px 12px; }
  .masthead__tagline { display: none; }
  .masthead__brand { font-size: 16px; }

  .lookup { padding: 10px 12px; }
  .lookup__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .lookup__input { font-size: 18px; }
  .lookup__label { display: none; }

  .lookup__dropdowns {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .lookup__select { width: 100%; max-width: 100%; }

  /* CHANGED: svh instead of dvh — stable on mobile. */
  .plate {
    min-height: calc(100vh - 290px);
    min-height: calc(100svh - 290px);
    height: calc(100vh - 290px);
    height: calc(100svh - 290px);
  }

  .plate__frame {
    min-height: 280px;
  }

  .plate__caption {
    top: 8px;
    left: 8px;
    max-width: calc(100% - 50px);
    padding: 6px 10px;
  }
  .plate__place { font-size: 16px; }
  .plate__coords { font-size: 9.5px; }

  .block { padding: 12px 14px; }
  .stat { padding: 6px 0; }
  .stat__label { font-size: 12px; }
  .stat__value { font-size: 14px; }

  .colophon__slider { width: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   START OVERLAY (Solves Autoplay Policy)
   ============================================================ */
.plate__start-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(11, 15, 13, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.plate__start-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.plate__start-btn {
  background: var(--amber);
  color: #0b0f0d;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 176, 0, 0.4);
  animation: startPulse 2s infinite;
  text-transform: uppercase;
}

@keyframes startPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(255, 176, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0); }
}

/* ============================================================
   MOBILE OVERFLOW FIXES (Fixes Lima Cathedral Bug)
   ============================================================ */
.plate__place {
  text-transform: capitalize; /* Forces 'peru' to 'Peru' */
}

@media (max-width: 520px) {
  /* Prevent Search Input from breaking grid width */
  .lookup__input {
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Prevent long Landmark names from stretching the HUD card */
  .plate__place {
    font-size: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
  }

  .plate__landmark-btn {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
  }

  .plate__cycle-btn {
    flex-shrink: 0; /* Keeps the 'Next' button from squishing */
  }
}

/* ============ START OVERLAY & BULLET LIST ============ */
.plate__start-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(11, 15, 13, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  transition: opacity 0.3s ease;
}
.plate__start-overlay[hidden] {
  display: none !important;
}

.plate__start-btn {
  background: var(--amber);
  color: #0b0f0d;
  border: none;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 12px 28px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 176, 0, 0.45);
  animation: pulse-amber 2.2s infinite;
  transition: transform 0.15s ease;
}
.plate__start-btn:hover {
  transform: scale(1.04);
}

@keyframes pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(255, 176, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0); }
}

.plate__start-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  padding: 0;
  margin: 0;
  text-align: left;
}
.plate__start-bullets li {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.plate__start-bullets li span {
  color: var(--amber);
  font-size: 12px;
  flex-shrink: 0;
}

/* ============ START OVERLAY (FIXED VERTICAL STACK) ============ */
.plate__start-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: rgba(11, 15, 13, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex !important;
  flex-direction: column !important; /* Forces button above bullets */
  align-items: center !important;
  justify-content: center !important;
  gap: 22px !important;
  padding: 24px !important;
  text-align: center;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.plate__start-overlay[hidden],
.plate__start-overlay.is-hidden {
  display: none !important;
}

.plate__start-btn {
  background: var(--amber);
  color: #0b0f0d;
  border: none;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 14px 34px;
  border-radius: 999px; /* Smooth pill shape */
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 176, 0, 0.45);
  animation: pulse-amber 2.2s infinite;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.plate__start-btn:hover {
  transform: scale(1.04);
  background: #ffc43a;
}

@keyframes pulse-amber {
  0%   { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0.65); }
  70%  { box-shadow: 0 0 0 16px rgba(255, 176, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 0, 0); }
}

.plate__start-bullets {
  list-style: none !important; /* Removes default browser black dots */
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  max-width: 360px;
  padding: 0 !important;
  margin: 0 !important;
  text-align: left;
}

.plate__start-bullets li {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 28, 25, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 6px;
}

.plate__start-bullets li span {
  font-size: 13px;
  flex-shrink: 0;
  color: var(--amber);
}

/* ============================================================
   ONBOARDING — First-visit walkthrough
   ============================================================ */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.onboarding.is-open {
  opacity: 1;
  pointer-events: auto;
}

.onboarding__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 10, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.onboarding__panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border-2);
  border-radius: 10px;
  padding: 32px 28px 26px;
  max-width: 460px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(8px);
  transition: transform 0.3s ease;
}
.onboarding.is-open .onboarding__panel {
  transform: translateY(0);
}

.onboarding__logo {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: var(--amber-glow);
  margin-bottom: 16px;
}

.onboarding__title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.onboarding__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.onboarding__steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
  padding: 0;
}

.onboarding__steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.onboarding__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--chassis-3);
  border: 1px solid var(--panel-border-2);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.onboarding__steps b {
  display: block;
  font-family: var(--display);
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.onboarding__steps span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.onboarding__cta {
  width: 100%;
  background: var(--amber);
  color: #0b0f0d;
  border: none;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.onboarding__cta:hover {
  background: #ffc43a;
  transform: translateY(-1px);
}

.onboarding__hint {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.06em;
}

/* ============================================================
   PLATE CAPTION — Three-line hierarchy
   (Country / City / Landmark)
   ============================================================ */

.plate__place {
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
  padding-right: 20px; /* room for the ↗ icon */
}

.plate__country {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.plate__city {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
}

.plate__landmark {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 2px;
}

.plate__ext-icon {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .plate__city { font-size: 16px; }
  .plate__landmark { font-size: 11px; }
  .plate__country { font-size: 8px; }
}