* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, sans-serif; color: #e8e8ec; background: #070a0d; }
.gold { color: #f4e36b; font-style: normal; }
.c-work { color: #a78bfa; font-style: normal; } .c-care { color: #ff8a6b; font-style: normal; }

/* ---------- header: full at top, mini once exploring ---------- */
#top { position: absolute; top: 0; left: 0; right: 0; z-index: 6; }
.head-full { padding: 16px 20px 10px; background: linear-gradient(#070a0d, #070a0dcc 70%, #070a0d00); }
.head-full h1 { margin: 0; font-size: 23px; letter-spacing: -0.01em; max-width: 820px; }
.head-full .thesis { margin: 6px 0 0; color: #9aa0ad; max-width: 760px; }
#skip-map { margin-top: 8px; padding: 4px 12px; border: 1px solid #2a313d; background: #0e131a;
  color: #6fd3e6; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.head-mini { display: none; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #070a0dee; border-bottom: 1px solid #1c222c; font-weight: 600; color: #c7ccd6; }
#replay { border: 0; background: none; color: #6fd3e6; font: inherit; cursor: pointer; }
body[data-phase="explore"] .head-full { display: none; }
body[data-phase="explore"] .head-mini { display: flex; }

/* ---------- stage / canvas ---------- */
#stage { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- story copy ---------- */
#story { position: absolute; z-index: 5; }
/* desktop: copy sits in a right rail over the map */
@media (min-width: 641px) {
  #story { top: 120px; right: 26px; width: 360px; }
  body[data-phase="explore"] #story { display: none; }
}
.story-step[hidden] { display: none; }
.step-kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9aa0ad; }
.story-step h2 { margin: 6px 0 8px; font-size: 26px; line-height: 1.18; color: #fff; }
.story-step p { margin: 0 0 8px; color: #c7ccd6; }
.story-step .caveat { font-size: 12px; color: #7d828d; }
#story-nav { display: flex; gap: 8px; margin-top: 12px; }
#story-nav button { padding: 6px 14px; border: 1px solid #2a313d; background: #0e131a;
  color: #c7ccd6; border-radius: 999px; cursor: pointer; font: inherit; }
#story-nav button:disabled { opacity: .4; cursor: default; }

/* ---------- controls (explore) ---------- */
#controls { position: absolute; top: 44px; left: 16px; z-index: 6; display: none;
  align-items: center; gap: 14px; flex-wrap: wrap; }
body[data-phase="explore"] #controls { display: flex; }
#modes { display: flex; gap: 6px; }
#modes button { padding: 6px 15px; border: 1px solid #2a313d; background: #0e131a;
  color: #c7ccd6; border-radius: 999px; cursor: pointer; transition: all .15s; }
#modes button.active { background: #f4e36b; color: #1a1400; border-color: #f4e36b; font-weight: 600; }
#net-toggle { color: #9aa0ad; font-size: 13px; display: inline-flex; gap: 6px; cursor: pointer; }
#method-toggle { padding: 0; border: 0; background: none; color: #6fd3e6; font: inherit;
  cursor: pointer; text-decoration: underline; }

/* ---------- stand-here panel ---------- */
#panel { position: absolute; top: 90px; right: 16px; width: 300px; z-index: 7;
  background: #11151c; border: 1px solid #232a36; border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); }
#panel[hidden] { display: none; }
#lead { margin: 0 0 6px; font-size: 16px; color: #fff; }
#detail { margin: 0 0 8px; color: #ff8a6b; }
#close-panel { position: absolute; top: 8px; right: 10px; border: 0; background: none;
  color: #9aa0ad; font-size: 22px; line-height: 1; cursor: pointer; }
#functions { list-style: none; margin: 8px 0 0; padding: 0; }
#functions li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #1c222c; }
#functions li.miss { color: #ff8a6b; } #functions li.just-over { color: #d8c75a; }

/* ---------- legends / network key ---------- */
#legend, #bind-legend, #net-key { position: absolute; z-index: 4; background: rgba(14,19,26,.82);
  border: 1px solid #232a36; border-radius: 8px; padding: 9px 11px; font-size: 12px; backdrop-filter: blur(4px); }
#legend { left: 16px; bottom: 16px; } #legend[hidden] { display: none; }
.legend-title { font-weight: 600; margin-bottom: 5px; color: #e8e8ec; }
#legend-bar { width: 180px; height: 12px; border-radius: 3px;
  background: linear-gradient(90deg,#0c1116,#123038,#1f5e57,#3f8e63,#8fc659,#f4e36b); }
.legend-ends { display: flex; justify-content: space-between; margin-top: 3px; color: #9aa0ad; }
#bind-legend { left: 16px; bottom: 16px; display: flex; gap: 12px; }
#bind-legend[hidden] { display: none; }
#bind-legend span { display: inline-flex; align-items: center; gap: 5px; color: #c7ccd6; }
#bind-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
#net-key { right: 16px; bottom: 16px; display: flex; gap: 14px; color: #c7ccd6; }
#net-key[hidden] { display: none; }
#net-key span { display: inline-flex; align-items: center; gap: 6px; }
#net-key span[hidden] { display: none; }
#net-key i { width: 16px; height: 0; border-top: 2.5px solid; display: inline-block; }
.k-rail { color: #6fd3e6; } .k-tram { color: #e69a6f; } .k-bus { color: #ff8a3d; }

/* ---------- method overlay ---------- */
#method { display: none; }
#method[open] { display: block; position: absolute; top: 88px; left: 16px; right: 16px;
  max-width: 660px; z-index: 8; color: #c7ccd6; font-size: 13px; background: #11151c;
  border: 1px solid #232a36; border-radius: 10px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
#method ul { margin: 4px 0 0; padding-left: 18px; } #method li { margin: 3px 0; } #method strong { color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

footer { position: absolute; bottom: 0; width: 100%; font-size: 11px; color: #6b7180; padding: 6px 20px; z-index: 3; }

/* ---------- MOBILE: map fills screen, copy/explore in a bottom sheet ---------- */
@media (max-width: 640px) {
  .head-full { padding: 12px 14px 16px; }
  .head-full h1 { font-size: 19px; } .head-full .thesis { font-size: 12px; }
  /* story copy becomes a bottom sheet */
  #story { left: 0; right: 0; bottom: 0; top: auto; width: auto;
    background: #11151cf2; border-top: 1px solid #232a36; border-radius: 16px 16px 0 0;
    padding: 12px 16px 18px; backdrop-filter: blur(6px); }
  body[data-phase="explore"] #story { display: none; }
  .story-step h2 { font-size: 18px; }
  /* explore controls become a slim bar under the mini header */
  #controls { top: 40px; left: 0; right: 0; padding: 8px 12px; justify-content: center;
    background: #070a0dcc; }
  #modes { width: 100%; } #modes button { flex: 1; padding: 6px 0; }
  #net-toggle, #method-toggle { font-size: 12px; }
  /* panel becomes the bottom sheet too */
  #panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; border-radius: 16px 16px 0 0; }
  /* keep legends from colliding with the footer: lift above it, hide net-key on phones */
  #legend, #bind-legend { bottom: 26px; } #net-key { display: none; }
  footer { font-size: 10px; }
}
