:root {
  --bg:#120d1a;
  --top:#161020;
  --panel:#21182b;
  --panel-deep:#1a1324;
  --line:#49364e;
  --text:#fff5ed;
  --muted:#d7c6d6;
  --dim:#bda9c0;
  --accent:#73eadc;
  --accent-ink:#0c252b;
  --sunset:#ffc294;
  --vice-edge:#8e5a83;
  --control-face:linear-gradient(180deg,#3d2c49,#281c35);
  --control-depth:inset 0 1px #ffe6fd20,inset 0 -3px #0b0813a6;
  --selected-surface:#20414a;
  --selected-edge:#4f9e9e;
  --map-water:#0d2e42;
  --map-route-road:#ff91cb;
  --map-route-bearing:#88edfc;
}

:is(.primary,.login-submit) {
  background:linear-gradient(165deg,#ffd193 0%,#ffad89 38%,#ff7fae 100%);
  color:#2f112a;
  border:1px solid #ffbea3;
  box-shadow:inset 0 1px #fff5db, inset 0 -3px #95275f66,0 2px 0 #681e51;
}
:is(.primary,.login-submit):hover {
  background:linear-gradient(165deg,#ffdfad,#ffbd9b 38%,#ff99bc);
}
:is(.primary,.login-submit):active {
  box-shadow:inset 0 2px 4px #63134165;
}
:is(.secondary,.filter,.filter-trigger,.top-install,.top-help,.login-install,
    .map-controls button,.route-follow,.code-kinds a,.quality-toggle,.install-close,
    .county-menu summary,.route-tools .icon-button,.story-check) {
  background:var(--control-face);
  border-color:#6b4c69;
  box-shadow:var(--control-depth);
}
:is(.secondary,.filter,.filter-trigger,.top-install,.top-help,.login-install,
    .map-controls button,.route-follow,.code-kinds a,.quality-toggle,.install-close):hover {
  border-color:var(--vice-edge);
  color:var(--text);
}
:is(.secondary,.filter,.filter-trigger,.top-install,.top-help,.login-install,
    .map-controls button,.route-follow,.code-kinds a,.quality-toggle,.install-close):active {
  box-shadow:inset 0 2px 4px #080610ad;
}
:is(.nav a[aria-current],.filter[aria-pressed=true],
    .secondary[aria-pressed=true],.route-follow[aria-pressed=true],.code-kinds a[aria-current],
    .quality-toggle[aria-pressed=true],.code-platform button[aria-pressed=true],
    .story-check[aria-pressed=true]) {
  background:var(--selected-surface);
  border-color:var(--selected-edge);
  color:var(--accent);
  box-shadow:inset 0 1px #c4fcfa24,inset 0 -2px #08151e80;
}
.install-modal {
  background:var(--panel);
  color:var(--text);
  border-color:var(--vice-edge);
}
.install-modal::backdrop {background:#0b060fde}
.install-modal strong {color:var(--accent)}

.topbar {
  background:linear-gradient(100deg,#24162d,var(--top) 42%,#23152a);
  border-color:#674059;
  box-shadow:inset 0 -1px #ffad9f26;
}
.brand {
  display:flex;
  min-width:0;
  min-height:44px;
  align-items:center;
  justify-self:start;
}
.brand img {
  display:block;
  width:clamp(153px,16vw,206px);
  max-width:100%;
  height:auto;
}
.nav a:hover {background:#31213c;color:var(--text)}
.top-help {color:var(--text)}

.rail {
  background:var(--bg);
  scrollbar-color:#654a67 transparent;
}
.rail-head {
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  min-height:162px;
  background:
    linear-gradient(180deg,#190e2533 0%,#170e2494 45%,#150f1f 100%),
    url("./assets/branding/vice-city.webp") center 52% / cover;
}
.rail-head h1 {
  color:var(--text);
  text-shadow:0 2px 10px #100711;
  font-size:2.85rem;
  letter-spacing:-.07em;
}
.search {
  border-color:#69506d;
  background:#24182ce8;
  color:var(--muted);
}
.search input::placeholder {color:var(--muted)}
.search:focus-within {border-color:var(--accent)}

.rail-plan {
  color:var(--sunset);
  background:var(--control-face);
  border-color:#79516b;
  box-shadow:var(--control-depth);
}
.rail-plan:hover {border-color:var(--sunset)}
.rail-plan>span:first-child,.accent-icon {background:#4a2b4a;color:var(--sunset)}
.short-row {background:var(--panel);border-color:var(--line)}
.short-row:is(.selected,:hover) {background:#382138;border-color:var(--vice-edge)}

.map-controls>button:first-child {color:var(--accent)}
.map-modes,.map-footer {background:var(--panel-deep);border-color:var(--line)}
.map-footer button {color:var(--accent)}
.map-controls button:hover,.map-controls button:first-child:hover {
  color:var(--accent);
  background:#45314c;
}
.compass,.county-options,.map-panel {
  background:#22182cf5;
  border-color:#735570;
}
#county-list button:hover {background:#3c2846}
.map-panel.compact-route,.route-follow[aria-pressed=true] {border-color:var(--selected-edge)}
.route-strip {color:var(--map-route-road)}
.route-strip.bearing {color:var(--map-route-bearing)}
.map-player i {border-color:#17232b;box-shadow:0 0 0 5px #73eadc60}
.map-player span {background:#1b2432;color:#cefaf3}
.map-frame {background:var(--map-water)}
.atlas-palette {position:absolute;width:0;height:0;pointer-events:none}
.map-atlas.atlas-recolor {filter:url("#atlas-dusk")}
.map-annotations {pointer-events:none}
.compass i {background:linear-gradient(110deg,#ffd4b8 53%,#a678ae 54%)}
.map-scale {background:#1b1326d9;border-color:#e5c8e1;color:var(--text)}
.reticle {border-color:var(--sunset);box-shadow:0 0 0 4px #1a0e25a0}
.reticle::before,.reticle::after {background:var(--sunset)}

.pin {
  --pin-face-size:34px;
  --pin-edge:var(--category,#e7bfde);
  position:absolute;
  inset:0 auto auto 0;
  width:44px;
  height:44px;
  margin:-22px;
  display:grid;
  place-items:center;
  color:var(--pin-edge);
  border:0;
  border-radius:10px;
  padding:0;
  background:none;
  pointer-events:auto;
}
:where(.far) .pin {--pin-face-size:30px}
.pin.place-pin {--pin-face-size:28px}
:where(.far) .pin.place-pin {--pin-face-size:26px}
.pin-face {
  width:var(--pin-face-size);
  height:var(--pin-face-size);
  display:grid;
  place-items:center;
  border:1px solid var(--pin-edge);
  border-radius:8px;
  background:linear-gradient(#3c2a46,#231831);
  box-shadow:inset 0 1px #fff1fb4d,0 0 0 1px #110b1c,0 2px 0 #120b1d,0 3px 5px #0d0814a8;
  pointer-events:none;
}
.pin-face > svg {width:calc(100% - 6px);height:calc(100% - 6px)}
.pin-face > svg:not(.sheet-icon,.thematic-glyph) {width:65%;height:65%}
.pin-face > .thematic-glyph {padding:2px}
.pin :is(b,.pin-label),.pin.found::after {pointer-events:none}
.pin b,.pin.found::after {
  position:absolute;
  top:0;
  right:0;
  display:grid;
  place-items:center;
  min-width:17px;
  height:17px;
  padding:0 3px;
  border:1px solid #e6bde0;
  border-radius:8px;
  background:#33223e;
  color:#fff6ee;
  font-size:.64rem;
  font-weight:800;
  line-height:1;
  box-shadow:0 1px 2px #0f0918;
}
.pin.found::after {
  content:"✓";
  background:var(--accent);
  color:var(--accent-ink);
  border-color:#15333d;
}
.pin:is(:hover,:focus-visible) {z-index:2}
.pin.active {
  --pin-face-size:37px;
  --pin-edge:#ffe0be;
  z-index:3;
}
.pin.active .pin-face {
  background:linear-gradient(#79405f,#3e203f);
  box-shadow:0 0 0 2px #24132b,0 0 0 4px #ffabac9e,0 3px 8px #0e0815c0;
}
.pin-label {
  position:absolute;
  top:5px;
  left:calc(100% + 3px);
  max-width:175px;
  padding:4px 8px;
  border:1px solid #98728e;
  border-radius:6px;
  background:#21162cf5;
  color:var(--text);
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  display:none;
  font-size:.72rem;
  font-weight:800;
}
.pin:is(:hover,:focus-visible,.active) .pin-label {display:block}
.picking .pin {opacity:.42;pointer-events:none}

.route-key {display:grid;gap:5px;list-style:none;padding:0;margin:8px 0}
.route-key li {display:flex;align-items:center;gap:8px}
.route-key i {width:26px;flex:none;border-top:4px solid var(--map-route-road)}
.route-key li + li i {border-top:4px dashed var(--map-route-bearing)}

.reading-view {background:var(--bg)}
.library-hero {
  --cover:url("./assets/branding/leonida-keys.webp");
  --cover-position:right 51%;
  min-height:180px;
  padding:18px 24px;
  background:var(--panel-deep);
  border-color:#6f4664;
}
.library-hero:has(#library-stat[hidden]) {min-height:130px}
.library-hero::before {
  background:
    linear-gradient(90deg,#191023 0%,#1a1024eb 24%,#1b11267a 65%,#190e2538),
    var(--cover) var(--cover-position) / cover no-repeat;
}
body[data-view="roteiros"] #library-hero {
  --cover:url("./assets/branding/estrada-ilustrada.webp");
  --cover-position:right 59%;
}
body[data-view="salvos"] #library-hero,.code-hero {
  --cover:url("./assets/branding/vice-city.webp");
}
.library-hero h1 {
  color:var(--text);
  text-shadow:0 2px 10px #140b1f;
  letter-spacing:-.07em;
}
.library-hero p:not(.eyebrow) {color:#f1e1eb;text-shadow:0 1px 4px #170d20}
.library-stat {
  background:#21172bea;
  border-color:#aa7189;
  box-shadow:var(--control-depth);
  color:var(--sunset);
}
.library-stat span {color:var(--text)}
.item-card,.trip-card,.empty,.now-section,.story-row,.vault-card,.code-entry,
.story-spotlight,.vault-leads {
  background:var(--panel);
  border-color:var(--line);
}
.item-card:hover,.code-entry[open] {border-color:var(--vice-edge)}
.item-media {background:var(--panel-deep);border-color:var(--line)}
.item-media::after {background:linear-gradient(transparent,#140d1bea)}
.item-media .bookmark {background:#23192fed;border-color:#77546d}
.item-media .bookmark.marked {background:var(--selected-surface);border-color:var(--selected-edge)}
:is(.item-card,.trip-card,.now-section,.vault-card,.code-entry) h2 {color:var(--text)}
.code-guide,.code-sequence kbd,.code-digits,.code-status.published,.story-row.complete,
.cue-card,.story-objective {
  background:#1d333b;
  border-color:#4f7e82;
}
.story-objective strong,.vault-leads strong {color:var(--text)}
.story-group h2,.now-section .story-group h3,.item-extra summary {color:var(--sunset)}

.dialog {
  color:var(--text);
  background:var(--panel);
  border-color:var(--vice-edge);
}
.dialog::backdrop {background:#0d0814c9}
.dialog a:not(.primary) {color:var(--accent)}
.atlas-filter-head,.atlas-filter-actions {background:var(--panel-deep);border-color:var(--line)}
.atlas-option>span,.atlas-section,.hunt-goals span {border-color:#664962;background:var(--panel)}
.atlas-option input:checked+span,.hunt-goals input:checked+span {
  border-color:var(--selected-edge);
  background:var(--selected-surface);
}
.atlas-section summary b {background:var(--selected-surface);color:var(--accent)}

@media(max-width:900px) {
  .brand img {width:153px}
}
@media(max-width:720px) {
  .pin:is(.active,:hover):not(:focus-visible) .pin-label {display:none}
  .topbar {padding-inline:10px}
  .brand img {width:clamp(137px,42vw,178px)}
  .mobile-nav {
    background:var(--top);
    border-top-color:#8f5272;
  }
  .mobile-nav a[aria-current] {background:#352037;border-color:#a45d82;color:#ffd5c3}
  .pin:not(.active) .pin-face {box-shadow:inset 0 1px #fff1fb4d,0 2px 0 #120b1d}
  .library-hero {
    min-height:125px;
    padding:12px;
    gap:7px;
  }
  .library-hero:has(#library-stat[hidden]) {min-height:89px}
  .library-hero::before {
    background:
      linear-gradient(90deg,#171020 0%,#171020df 32%,#180e2655 82%),
      var(--cover) var(--cover-position) / cover no-repeat;
  }
  .code-hero .library-stat {min-width:84px}
}
