/* ═══ BRASH type — Neue Haas Grotesk (Bold & Light per the brand guide,
   Roman for small UI copy) ═══ */
@font-face {
  font-family: "Neue Haas Grotesk";
  src: url("fonts/NeueHaasDisplayLight.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk";
  src: url("fonts/NeueHaasDisplayRoman.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas Grotesk";
  src: url("fonts/NeueHaasDisplayBold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root { --accent: #F40000; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #050505;
  font-family: "Neue Haas Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #fff;
  overflow: hidden;
}

input {
  outline: none;
  font-family: inherit;
  color: #fff;
}
::placeholder { color: #6f6f6f; }

.mono-note {
  font-size: 10.5px;
  color: #6f6f6f;
  letter-spacing: .05em;
}
.mono-tiny {
  font-size: 9.5px;
  color: #5c5c5c;
  letter-spacing: .08em;
}
.xbtn {
  margin-left: auto;
  cursor: pointer;
  color: #8d8d8d;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
}
.xbtn:hover { color: #fff; }

/* ═══ header ═══ */
.hdr {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 74px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 30px 0;
  z-index: 20;
}
.hdr-logo {
  height: 30px;
  width: auto;
  display: block;
}
.hdr-title { font-weight: 700; font-size: 15px; }
.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hdr-search {
  width: 280px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
}
.hdr-stats {
  font-size: 11.5px;
  color: #8d8d8d;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.pill-btn {
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.pill-btn:hover { background: var(--accent); }
.pill-btn.on { background: var(--accent); }
.pill-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
}
.pill-outline:hover { background: rgba(255,255,255,.12); }
.pill-red { background: var(--accent); }
.pill-red:hover { background: var(--accent); filter: brightness(1.15); }
.signout {
  font-size: 10px;
  color: #6f6f6f;
  letter-spacing: .1em;
  cursor: pointer;
  padding: 6px 2px;
}
.signout:hover { color: #fff; }
#dataSource { cursor: default; }
#dataSource:hover { color: #6f6f6f; }
#dataSource.live { color: var(--accent); }

/* ═══ views ═══ */
.view { position: fixed; inset: 74px 0 0; }

/* ═══ map ═══ */
#mapStage {
  position: absolute;
  left: 0; right: 0;
  top: 76px;
  bottom: 130px;
}
#mapCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#markerLayer { position: absolute; inset: 0; }

.marker {
  position: absolute;
  transform: translate(-50%,-50%);
  cursor: pointer;
  z-index: 5;
}
/* data-driven changes tween; the .animate class is lifted during window
   resizes so repositioning stays instant */
#markerLayer.animate .marker {
  transition:
    left .6s cubic-bezier(.22,1,.36,1),
    top .6s cubic-bezier(.22,1,.36,1),
    opacity .35s ease,
    transform .35s ease;
}
#markerLayer.animate .marker .dot {
  transition:
    width .45s cubic-bezier(.22,1,.36,1),
    height .45s cubic-bezier(.22,1,.36,1);
}
.marker.enter {
  animation: markerPop .55s cubic-bezier(.34,1.56,.64,1) backwards;
}
@keyframes markerPop {
  from { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1); opacity: 1; }
}
.marker.exit {
  opacity: 0 !important;
  transform: translate(-50%,-50%) scale(.3);
  pointer-events: none;
}
.marker .dot {
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(244,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  color: #fff;
}
@keyframes atlasPulse {
  0%   { box-shadow: 0 0 0 0 rgba(244,0,0,.5); }
  70%  { box-shadow: 0 0 0 14px rgba(244,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(244,0,0,0); }
}
.marker:hover .dot { animation: atlasPulse 1.2s ease-out infinite; }
.marker .mlabel {
  position: absolute;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #d6d6d6;
  white-space: nowrap;
  display: none;
  text-shadow: 0 1px 6px rgba(0,0,0,.9), 0 0 12px rgba(0,0,0,.7);
}
/* side chosen per city in placeLabels() so labels clear neighbouring dots */
.marker[data-lpos="b"] .mlabel { top: 100%; left: 50%; transform: translateX(-50%); margin-top: 7px; }
.marker[data-lpos="t"] .mlabel { bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 7px; }
.marker[data-lpos="r"] .mlabel { left: 100%; top: 50%; transform: translateY(-50%); margin-left: 9px; }
.marker[data-lpos="l"] .mlabel { right: 100%; top: 50%; transform: translateY(-50%); margin-right: 9px; }
.marker[data-lpos="br"] .mlabel { left: 100%; top: 100%; margin: -4px 0 0 -4px; }
.marker[data-lpos="bl"] .mlabel { right: 100%; top: 100%; margin: -4px -4px 0 0; }
.marker[data-lpos="tr"] .mlabel { left: 100%; bottom: 100%; margin: 0 0 -4px -4px; }
.marker[data-lpos="tl"] .mlabel { right: 100%; bottom: 100%; margin: 0 -4px -4px 0; }
.marker:hover .mlabel, .marker.labelled .mlabel { display: block; }
.marker:hover { z-index: 15 !important; } /* hovered label rides above neighbours */

.apanel {
  position: absolute;
  left: 26px;
  top: 18px;
  bottom: 88px;
  width: 370px;
  background: rgba(8,8,8,.93);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
}
.apanel[hidden] { display: none; }
.apanel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.apanel-title { font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.apanel-count {
  font-size: 11.5px;
  color: #8d8d8d;
}
.apanel-list { overflow: auto; flex: 1; }
.apanel-row {
  padding: 15px 22px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
}
.apanel-row:hover { background: rgba(255,255,255,.06); }
.apanel-row .nm { font-weight: 700; font-size: 16.5px; letter-spacing: -.2px; }
.apanel-row .mt { font-size: 12.5px; color: #9b9b9b; margin-top: 3px; }

.map-foot {
  position: absolute;
  left: 206px;
  bottom: 26px;
  right: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 20;
}
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.13);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.chip:hover { background: rgba(255,255,255,.28); }
.chip.on { background: var(--accent); }
.chip.on:hover { background: var(--accent); }

/* ═══ index ═══ */
#viewIndex {
  display: flex;
  border-top: 1px solid rgba(255,255,255,.1);
}
#viewIndex[hidden] { display: none; }
.idx-side {
  width: 262px;
  flex: none;
  border-right: 1px solid rgba(255,255,255,.1);
  overflow: auto;
  padding: 22px 0 90px;
}
.idx-filter { padding: 0 24px 18px; }
.idx-filter input {
  width: 100%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
}
.side-label {
  padding: 0 24px 10px;
  font-size: 10.5px;
  color: #6f6f6f;
  letter-spacing: .12em;
}
.side-label-gap { padding-top: 20px; }
.side-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 24px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: #cfcfcf;
}
.side-row:hover { background: rgba(255,255,255,.06); }
.side-row.on { color: var(--accent); }
.side-row .ct {
  font-size: 11px;
  color: #6f6f6f;
}
.idx-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding-bottom: 90px;
}
.idx-showing {
  padding: 14px 30px;
  font-size: 11px;
  color: #6f6f6f;
  letter-spacing: .08em;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.idx-row {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 16px 30px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  cursor: pointer;
}
.idx-row:hover { background: rgba(255,255,255,.05); }
.idx-row .num {
  font-size: 11px;
  color: #6f6f6f;
  flex: none;
  width: 32px;
}
.idx-row .nm {
  font-weight: 800;
  font-size: 31px;
  letter-spacing: -1.2px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.idx-row .cl {
  margin-left: auto;
  font-size: 12.5px;
  color: #9b9b9b;
  flex: none;
  text-align: right;
}
.idx-preview {
  width: 372px;
  flex: none;
  border-left: 1px solid rgba(255,255,255,.1);
  padding: 26px;
  overflow: auto;
}
.pv { display: flex; flex-direction: column; gap: 16px; }
.pv-visual, .detail-visual {
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,.18);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.045) 0 12px, transparent 12px 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #7c7c7c;
  letter-spacing: .08em;
}
.pv-visual { height: 210px; }
.pv-visual.has-image, .detail-visual.has-image {
  border: 1px solid rgba(255,255,255,.12);
  background-size: cover;
  background-position: center;
}
.pv-client { color: var(--accent); font-weight: 800; font-size: 13.5px; }
.pv-name { font-weight: 800; font-size: 36px; letter-spacing: -1.5px; line-height: 1; }
.pv-headline { font-size: 15.5px; color: #a8a8a8; line-height: 1.45; }
.pv-meta {
  font-size: 11px;
  color: #6f6f6f;
  letter-spacing: .06em;
}
.pv-open {
  align-self: flex-start;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ═══ ask ═══ */
.ask-scroll { position: absolute; inset: 0; overflow: auto; }
.ask-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 40px 110px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.ask-title {
  font-weight: 800;
  font-size: 88px;
  letter-spacing: -4px;
  line-height: .95;
  margin: 0;
}
.ask-sub { font-size: 20px; color: #9b9b9b; letter-spacing: -.2px; }
.ask-bar { display: flex; gap: 12px; }
.ask-bar input {
  flex: 1;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 17px 26px;
  font-size: 17px;
}
.ask-go {
  padding: 17px 34px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.ask-try { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.try-label { letter-spacing: .1em; }
.try-chips { display: contents; }
.try-chip {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.try-chip:hover { background: rgba(255,255,255,.24); }
.ask-answer {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 26px;
}
.ask-answer[hidden] { display: none; }
.ask-summary { font-size: 21px; letter-spacing: -.3px; }
.ask-atlas { color: var(--accent); font-weight: 800; }
.ask-drafts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.draft-btn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.draft-primary { border-color: var(--accent); color: var(--accent); }
.ask-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.ask-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ask-card:hover { background: rgba(255,255,255,.11); }
.ask-card .cl { color: var(--accent); font-weight: 800; font-size: 12px; }
.ask-card .nm { font-weight: 800; font-size: 22px; letter-spacing: -.8px; line-height: 1; }
.ask-card .hd { font-size: 12.5px; color: #a8a8a8; line-height: 1.45; }
.ask-card .mt {
  font-size: 10px;
  color: #6f6f6f;
  letter-spacing: .06em;
  margin-top: auto;
}
.ask-more {
  font-size: 11.5px;
  color: #8d8d8d;
}
.ask-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 26px;
}
.ask-tiles[hidden] { display: none; }
.ask-tile {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  padding: 22px;
  cursor: pointer;
}
.ask-tile:hover { background: rgba(255,255,255,.11); }
.ask-tile .nm { font-weight: 800; font-size: 19px; letter-spacing: -.5px; }
.ask-tile .sub { font-size: 12px; color: #9b9b9b; margin-top: 5px; }

/* ═══ view pills ═══ */
.viewpills {
  position: fixed;
  left: 26px;
  bottom: 26px;
  display: flex;
  gap: 8px;
  z-index: 30;
}

/* ═══ cred sheet ═══ */
.detail {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.96);
  z-index: 40;
  overflow: auto;
}
.detail[hidden] { display: none; }
.detail-inner {
  padding: 38px 46px 46px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.detail-top { display: flex; align-items: center; gap: 14px; }
.detail-client { color: var(--accent); font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.detail-geonote {
  font-size: 10.5px;
  color: #6f6f6f;
  border: 1px dashed rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 4px 10px;
}
.detail-close {
  margin-left: auto;
  cursor: pointer;
  color: #9b9b9b;
  font-size: 26px;
  line-height: 1;
}
.detail-close:hover { color: #fff; }
.detail-name { font-weight: 800; font-size: 64px; letter-spacing: -2.5px; line-height: .98; }
.detail-headline { font-size: 24px; color: #b3b3b3; max-width: 900px; line-height: 1.3; letter-spacing: -.3px; }
.detail-tags { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.detail-tag {
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  font-size: 12.5px;
  font-weight: 600;
}
.detail-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.detail-deck {
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.detail-deck:hover { filter: brightness(1.15); }
.detail-draft {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.detail-edit {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.detail-edit:hover { background: rgba(255,255,255,.12); }
.detail-ainote {
  font-size: 10px;
  color: #6f6f6f;
}
.detail-visual { height: 250px; border-radius: 14px; font-size: 12px; }
.detail-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 34px; }
.detail-col-h { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.detail-col-b { font-size: 13.5px; line-height: 1.6; color: #a8a8a8; }
.detail-nonarr {
  padding: 22px;
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 12px;
  font-size: 12px;
  color: #7c7c7c;
  letter-spacing: .06em;
}
.detail-sec-h { font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.scope-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.scope-pill {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 12px;
  color: #cfcfcf;
}
.rel-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.rel-card {
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  cursor: pointer;
  min-width: 180px;
}
.rel-card:hover { background: rgba(255,255,255,.13); }
.rel-card .nm { font-weight: 700; font-size: 15px; }
.rel-card .cl { font-size: 11.5px; color: #9b9b9b; margin-top: 2px; }

/* ═══ cred editor ═══ */
.editor {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.editor[hidden] { display: none; }
.editor-card {
  width: 720px;
  max-width: 100%;
  max-height: 100%;
  background: #0b0b0b;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.editor-title { font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.editor-body {
  overflow: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-grid-loc { grid-template-columns: 2fr 2fr 1fr 1fr; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld input, .fld textarea { width: 100%; }
.fld span {
  font-size: 10.5px;
  color: #8d8d8d;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.fld span em {
  font-style: normal;
  color: #5c5c5c;
  text-transform: none;
  letter-spacing: .04em;
}
.fld input, .fld textarea {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: #fff;
  resize: vertical;
}
.fld input:focus, .fld textarea:focus { border-color: rgba(255,255,255,.35); }
.fld-missing span { color: var(--accent); }
.fld-missing input, .fld-missing textarea { border-color: var(--accent); }
.editor-note { letter-spacing: .06em; }
.deck-row { display: flex; align-items: center; gap: 12px; }
.deck-attach {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.deck-attach:hover { background: rgba(255,255,255,.12); }
.deck-info {
  font-size: 11px;
  color: #8d8d8d;
  letter-spacing: .04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.deck-remove {
  font-size: 10.5px;
  color: #6f6f6f;
  letter-spacing: .08em;
  cursor: pointer;
  flex: none;
}
.deck-remove:hover { color: var(--accent); }
.deck-remove[hidden] { display: none; }
.editor-checks { display: flex; gap: 22px; }
.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #cfcfcf;
  cursor: pointer;
}
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.editor-error {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
.editor-error[hidden] { display: none; }
.editor-foot {
  display: flex;
  align-items: center;
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.editor-delete {
  font-size: 10.5px;
  color: #6f6f6f;
  letter-spacing: .08em;
  cursor: pointer;
}
.editor-delete:hover { color: var(--accent); }
.editor-delete[hidden] { display: none; }
.editor-actions { margin-left: auto; display: flex; gap: 8px; }

/* ═══ login — red curtain over the sign-in form ═══ */
.login {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #050505;
  overflow: hidden;
}
.login[hidden] { display: none; }

/* dotted world backdrop, revealed once the curtain lifts */
.lg-map, .lg-dot { opacity: 0; transition: opacity 1.1s ease .35s; }
.lg-map {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.22) 1px, transparent 1.4px);
  background-size: 15px 15px;
}
.lg-dot { position: absolute; border-radius: 999px; background: var(--accent); }
.login.open .lg-map, .login.open .lg-dot { opacity: .4; }

/* the curtain */
.curtain {
  position: absolute;
  inset: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: none;
  transition: transform .75s cubic-bezier(.7,0,.2,1);
  z-index: 2;
}
.login.open .curtain { transform: translateY(-101%); }
.curtain-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transform: translateY(34px);
}
.curtain-logo {
  width: min(72vw, 640px);
  height: auto;
  display: block;
}
.curtain-chevs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 26px;
}
.curtain-chevs svg:nth-child(1) { animation: lgCasc 1.5s ease-in-out infinite; }
.curtain-chevs svg:nth-child(2) { animation: lgCasc 1.5s ease-in-out .18s infinite; }
.curtain-chevs svg:nth-child(3) { animation: lgCasc 1.5s ease-in-out .36s infinite; }
@keyframes lgCasc {
  0%   { opacity: 0; transform: translateY(-8px); }
  35%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(12px); }
}

/* the sign-in form behind it */
.lg-form {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.login.open .lg-form { display: flex; }
.login-box {
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-box input {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 14px;
  animation: lgRise .5s cubic-bezier(.22,1,.36,1) .38s both;
}
.login-box input + input { animation-delay: .46s; }
.login-btn {
  padding: 14px 20px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  user-select: none;
  animation: lgRise .5s cubic-bezier(.22,1,.36,1) .54s both;
}
.login-btn:hover { filter: brightness(1.15); }
.login-foot { animation: lgRise .5s cubic-bezier(.22,1,.36,1) .62s both; }
@keyframes lgRise {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}
.login-foot { display: flex; justify-content: center; align-items: baseline; }
.forgot { font-size: 12.5px; color: #8d8d8d; cursor: pointer; }
.forgot:hover { color: #fff; }
.login-fields { display: flex; flex-direction: column; gap: 14px; }
.login-fields[hidden] { display: none; }
.login-error {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.login-error.ok { color: #8d8d8d; }
.login-error[hidden] { display: none; }

/* ═══ motion ═══ */

/* interactive transitions */
.pill-btn, .chip, .try-chip, .ask-go, .login-btn, .draft-btn,
.detail-deck, .detail-draft, .detail-edit, .deck-attach, .pv-open,
.hdr-search, .idx-filter input, .ask-bar input, .login-box input,
.fld input, .fld textarea {
  transition: background .22s ease, color .22s ease, border-color .22s ease,
              filter .22s ease, transform .16s ease;
}
.pill-btn:active, .chip:active, .try-chip:active, .ask-go:active,
.login-btn:active, .draft-btn:active, .detail-deck:active, .detail-draft:active,
.detail-edit:active, .deck-attach:active, .pv-open:active { transform: scale(.96); }

.ask-card, .ask-tile, .rel-card {
  transition: background .24s ease, border-color .24s ease, transform .24s ease;
}
.ask-card:hover, .ask-tile:hover, .rel-card:hover { transform: translateY(-3px); }

.apanel-row, .idx-row, .side-row { transition: background .18s ease, color .18s ease; }
.signout, .forgot, .xbtn, .detail-close, .deck-remove, .editor-delete { transition: color .2s ease; }

.hdr-search:focus, .idx-filter input:focus, .ask-bar input:focus, .login-box input:focus {
  border-color: rgba(255,255,255,.38);
  background: rgba(255,255,255,.14);
}

/* map markers — gentle lift on hover, alongside the pulse */
#markerLayer .marker .dot { transition: transform .2s ease; }
#markerLayer.animate .marker .dot {
  transition:
    width .45s cubic-bezier(.22,1,.36,1),
    height .45s cubic-bezier(.22,1,.36,1),
    transform .2s ease;
}
.marker:hover .dot { transform: scale(1.1); }

/* view switching — fade & rise (retriggers when a view is shown) */
.view { animation: viewIn .45s cubic-bezier(.22,1,.36,1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* lists & cards — quick staggered reveal */
.apanel-row, .idx-row, .ask-card, .ask-tile, .rel-card {
  animation: rowIn .28s ease backwards;
}
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(1) { animation-delay: .025s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(2) { animation-delay: .05s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(3) { animation-delay: .075s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(4) { animation-delay: .1s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(5) { animation-delay: .125s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(6) { animation-delay: .15s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(7) { animation-delay: .175s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(8) { animation-delay: .2s; }
:is(.apanel-row, .idx-row, .ask-card, .ask-tile):nth-child(n+9) { animation-delay: .22s; }
@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* overlays — cred sheet, editor, map side panel */
.detail { animation: fadeIn .3s ease; }
.detail-inner { animation: riseIn .45s cubic-bezier(.22,1,.36,1); }
.editor { animation: fadeIn .22s ease; }
.editor-card { animation: riseIn .4s cubic-bezier(.22,1,.36,1); }
.apanel { animation: panelIn .4s cubic-bezier(.22,1,.36,1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* login — fade-out on sign-in (arrival is the curtain + lgRise cascade) */
.login.bye {
  animation: loginBye .45s ease forwards;
  pointer-events: none;
}
@keyframes loginBye { to { opacity: 0; } }

/* app entrance after sign-in (body.app-enter set from app.js) */
.app-enter .hdr { animation: fadeDown .55s cubic-bezier(.22,1,.36,1) .1s backwards; }
.app-enter .view { animation: viewIn .6s cubic-bezier(.22,1,.36,1) .05s backwards; }
.app-enter .viewpills { animation: fadeUp .55s cubic-bezier(.22,1,.36,1) .25s backwards; }
.app-enter .map-foot { animation: fadeUp .55s cubic-bezier(.22,1,.36,1) .32s backwards; }
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* accessibility — honour reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}

/* ═══ narrow screens ═══ */
@media (max-width: 1280px) {
  .hdr-stats { display: none; }
}
@media (max-width: 1000px) {
  .idx-preview { display: none; }
  .ask-grid { grid-template-columns: 1fr 1fr; }
  .ask-tiles { grid-template-columns: 1fr 1fr; }
  .ask-title { font-size: 64px; letter-spacing: -3px; }
  .hdr-search { width: 180px; }
  .detail-name { font-size: 44px; }
}

/* ═══ TEMPORARY — cred rewrite stages ═══
   Delete alongside the STAGE_TAGGING block in app.js and the stage markup in
   index.html — see STAGES.md. */
.stage-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  vertical-align: middle;
  margin-right: 8px;
  background: #6f6f6f;
}
.stage-green  { background: #2ecc71; }
.stage-orange { background: #ff9420; }
.stage-red    { background: #ff3b30; }
/* black reads as a hole on a black background, so it gets a ring instead */
.stage-black  { background: #0b0b0b; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.idx-row .stage-dot { margin-right: -9px; }  /* the row's 20px gap does the spacing */
.side-row .stage-dot { margin-right: 7px; }
.stage-opt .stage-dot { margin-right: 0; }  /* the pill's own 6px gap does the spacing */
/* the STAGE group sits above SECTOR while this is live, so the gap goes with it */
#stageFilter:not([hidden]) + .side-label { padding-top: 20px; }
.stage-tag { display: flex; align-items: center; }
.stage-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  font-size: 12.5px;
  font-weight: 600;
  color: #cfcfcf;
  cursor: pointer;
  white-space: nowrap;
}
.stage-opt:hover { background: rgba(255,255,255,.12); }
.stage-opt input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.stage-opt:has(input:checked) {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.14);
  color: #fff;
}
#stageField[hidden], #stageFilter[hidden] { display: none; }
