/* =====================================================================================================
   Prompt Atlas: the glue between the city (index.html, src/main.js) and the screens (css/screens.css).
   Layers, bottom to top:  canvas(0)  labels(1)  veil(2)  ui = title + HUD(3)  screens(6)  flash(9)  boot(20)  sound toggles(60)
   Tokens come from index.html :root (the same values as screens.css --pa-*).  Mint = interactive, amber = saved / "yours" only, pink-red = errors only.
   ===================================================================================================== */

canvas#gl { z-index: 0; }
#labels { z-index: 1; }
#ui { z-index: 3; }

/* ---------------------------------------------------------------- the veil: the city stays alive but blurred behind Gallery / Insights / Stamps / the console */
#veil {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  transition: opacity .9s var(--pa-ease-out);
  background:
    radial-gradient(120% 90% at 50% 38%, color-mix(in srgb, var(--ink-0) 4%, transparent) 0%, color-mix(in srgb, var(--ink-0) 42%, transparent) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--ink-0) 42%, transparent) 0%, color-mix(in srgb, var(--ink-0) 4%, transparent) 28%, color-mix(in srgb, var(--ink-0) 34%, transparent) 100%);
  -webkit-backdrop-filter: blur(10px) saturate(1.05); backdrop-filter: blur(10px) saturate(1.05);   /* the veil is depth of field only: it blurs the city, it never boosts its colour */
}
body[data-route="gallery"] #veil, body[data-route="insights"] #veil, body[data-route="saved"] #veil, body[data-route="credits"] #veil { opacity: 1; }
/* the console: a lighter veil so the tower the camera flew to stays readable behind the panels */
body[data-route="prompt"] #veil {
  opacity: 1;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ink-0) 55%, transparent) 0%, color-mix(in srgb, var(--ink-0) 18%, transparent) 34%, color-mix(in srgb, var(--ink-0) 18%, transparent) 62%, color-mix(in srgb, var(--ink-0) 60%, transparent) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--ink-0) 50%, transparent) 0%, color-mix(in srgb, var(--ink-0) 4%, transparent) 26%, color-mix(in srgb, var(--ink-0) 42%, transparent) 100%);
  -webkit-backdrop-filter: blur(6px) saturate(1.05); backdrop-filter: blur(6px) saturate(1.05);
}
/* a broadcast in flight: the screens step away and the city is sharp again */
body.bc-cine #veil { opacity: 0 !important; }

/* ---------------------------------------------------------------- screens host */
#screens { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#screens .pa-app { position: absolute; inset: 0; }
body[data-route="atlas"] #screens .pa-app[data-layer="city"] .pa-bar,
body[data-route="atlas"] #screens .pa-app[data-layer="city"] .pa-nav { display: none; }
body.bc-cine #screens { opacity: 0; transition: opacity .45s var(--pa-ease-out); pointer-events: none !important; }
#screens { transition: opacity .35s var(--pa-ease-out); }
body.dir-playing #screens { visibility: hidden; }

/* title, HUD, hover card and world labels only exist on the Atlas route */
body[data-route]:not([data-route="atlas"]) #title,
body[data-route]:not([data-route="atlas"]) #hud,
body[data-route]:not([data-route="atlas"]) #lead,
body[data-route]:not([data-route="atlas"]) #tip,
body[data-route]:not([data-route="atlas"]) #labels { opacity: 0 !important; visibility: hidden; pointer-events: none !important; transition: opacity .3s var(--pa-ease-out), visibility 0s var(--pa-ease-out) .3s; }
body[data-route]:not([data-route="atlas"]) #title * { pointer-events: none !important; }

/* a quick scan-line wipe masks the swap between two screens (main.js plays it on every route change) */
#flash { position: fixed; inset: 0; z-index: 9; pointer-events: none; opacity: 0; background: radial-gradient(90% 70% at 50% 50%, color-mix(in srgb, var(--signal) 10%, transparent), color-mix(in srgb, var(--ink-0) 55%, transparent)); }
#flash i { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--signal) 30%, var(--hot) 50%, var(--signal) 70%, transparent); box-shadow: 0 0 22px 2px color-mix(in srgb, var(--signal) 55%, transparent); opacity: 0; }

/* ---------------------------------------------------------------- HUD navigation, tour button, sound toggle */
.hud-nav { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); display: flex; gap: 0; z-index: 2; pointer-events: auto;
  border: 1px solid var(--line2); background: color-mix(in srgb, var(--ink-1) 78%, transparent);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
.hud-nav button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--text2);
  font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; position: relative; }
.hud-nav button:last-child { border-right: 0; }
.hud-nav button i { width: 6px; height: 6px; background: transparent; border: 1px solid var(--text3); transform: rotate(45deg); transition: background .2s var(--pa-ease-out), border-color .2s var(--pa-ease-out), box-shadow .2s var(--pa-ease-out); }
.hud-nav button:hover { color: var(--text); }
.hud-nav button.on { color: var(--hot); background: color-mix(in srgb, var(--signal) 8%, transparent); }
.hud-nav button.on i { background: var(--signal); border-color: var(--signal); }
.hud-nav button.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--signal); }
.hud-nav button:focus-visible { outline: 2px solid var(--hot); outline-offset: -3px; }
.hud-nav b { font: 500 12px var(--mono); color: var(--ghost); letter-spacing: .04em; }
.hud-nav b:empty { display: none; }

.hud-tr { gap: 8px; }
.tourbtn { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px; border: 1px solid color-mix(in srgb, var(--signal) 50%, transparent); background: color-mix(in srgb, var(--ink-1) 78%, transparent); color: var(--text);
  font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; pointer-events: auto; }
.tourbtn i { width: 0; height: 0; border-left: 8px solid var(--signal); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.tourbtn:hover { background: color-mix(in srgb, var(--signal) 12%, transparent); color: var(--hot); }
.tourbtn:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }
.sound-mount { display: inline-flex; align-items: center; pointer-events: auto; }
.title-top .sound-mount { margin-left: 4px; }
.hud-tr .pa-sound__btn, .title-top .pa-sound__btn { height: 36px; }
.sub button .soon { font: 500 12px var(--mono); color: var(--text3); border: 1px solid var(--line2); padding: 2px 5px; margin-left: 10px; letter-spacing: .08em; }

/* the "Esc  Back" pill: visible whenever the camera is below the top level of the atlas (item 5 of the reference list) */
.escpill { position: absolute; right: 36px; top: 148px; z-index: 2; display: inline-flex; align-items: center; gap: 9px; height: 30px; padding: 0 12px 0 8px; border: 1px solid var(--line2); background: color-mix(in srgb, var(--ink-1) 78%, transparent);
  color: var(--text2); font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; pointer-events: auto; opacity: 0; transform: translateY(-6px); transition: opacity .25s var(--pa-ease-out), transform .25s var(--pa-ease-out); visibility: hidden; }
.escpill.on { opacity: 1; transform: none; visibility: visible; }
.escpill:hover { color: var(--text); border-color: color-mix(in srgb, var(--signal) 60%, transparent); }
.escpill:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }
body.clean .escpill { opacity: 0; pointer-events: none; }

/* the shot label ("02 / STREET") and the broadcast / tour captions */
#shotlabel { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 2; font: 500 12px/1 var(--mono); letter-spacing: .24em; color: var(--hot); text-transform: uppercase;
  padding: 9px 16px; background: color-mix(in srgb, var(--ink-0) 72%, transparent); border: 1px solid var(--line2); opacity: 0; transition: opacity .35s var(--pa-ease-out); pointer-events: none; white-space: nowrap; }
#shotlabel.on { opacity: 1; }
#shotlabel b { color: var(--signal); font-weight: 500; margin-right: 10px; }

#airtag { position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 10px); z-index: 7; display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 14px; background: color-mix(in srgb, var(--ink-0) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--ghost) 75%, transparent); color: var(--text); font: 500 12px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity .4s var(--pa-ease-out), transform .4s var(--pa-ease-out); position: fixed; }
#airtag.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
body.bc-reveal #hud .chrome, body.bc-reveal #shotlabel { opacity: 0 !important; pointer-events: none !important; }
body.bc-reveal #hud::before, body.bc-reveal #hud::after { opacity: 0; }
#airtag i { width: 9px; height: 9px; border-radius: 50%; background: var(--ghost); animation: airblink 1.1s steps(2, jump-none) infinite; }
#airtag button { margin-left: 6px; height: 26px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--ghost) 55%, transparent); background: transparent; color: var(--ghost); font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
#airtag button:hover { background: color-mix(in srgb, var(--ghost) 12%, transparent); }
@keyframes airblink { 0% { opacity: 1 } 100% { opacity: .25 } }

/* the context-lost / safe-mode notice */
#lostnote { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; padding: 22px 28px; max-width: min(460px, 90vw); background: color-mix(in srgb, var(--ink-0) 94%, transparent); border: 1px solid var(--line2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alert) 55%, transparent); font: 400 14px/1.5 var(--ui); color: var(--text); display: none; }
#lostnote.on { display: block; }
#lostnote h3 { margin: 0 0 8px; font: 600 22px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--alert); }
#lostnote a { color: var(--signal); }

/* ---------------------------------------------------------------- hover card: thumbnail with the holographic scan, field report */
#tip { width: 360px; }
#tip .tth { position: relative; margin: 0 0 12px; aspect-ratio: 16 / 8.2; overflow: hidden; background: var(--ink-1); border: 1px solid var(--line2); }
#tip .tth img { position: absolute; inset: -11% 0; width: 100%; height: 122%; object-fit: cover; opacity: 0; filter: saturate(.78) contrast(1.12) brightness(.92); transition: opacity .35s var(--pa-ease-out); }
#tip .tth[data-state="ok"] img { opacity: 1; }
#tip .tth::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, color-mix(in srgb, var(--signal) 14%, transparent), color-mix(in srgb, var(--ink-0) 10%, transparent) 40%, color-mix(in srgb, var(--ink-0) 55%, transparent)); mix-blend-mode: normal; pointer-events: none; }
#tip .tth-scan { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(0deg, color-mix(in srgb, var(--ink-0) 20%, transparent) 0 3px, transparent 3px 6px), linear-gradient(180deg, transparent 0 42%, color-mix(in srgb, var(--signal) 22%, transparent) 50%, transparent 58% 100%); background-size: 100% 100%, 100% 260%; background-position: 0 0, 0 -160%; animation: tthscan 3.4s linear infinite; }
@keyframes tthscan { to { background-position: 0 0, 0 160%; } }
#tip .tth-tag, #tip .tth-dur { position: absolute; z-index: 3; bottom: 6px; font: 500 12px/1 var(--mono); letter-spacing: .12em; color: var(--hot); background: color-mix(in srgb, var(--ink-0) 78%, transparent); padding: 3px 6px; }
#tip .tth-tag { left: 6px; color: var(--signal); }
#tip .tth-dur { right: 6px; }
#tip .tth-none { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; font: 500 12px var(--mono); letter-spacing: .3em; color: var(--text3); }
#tip .tth[data-state="fail"] .tth-none { display: grid; }
#tip .tth[data-state="loading"] { background: linear-gradient(100deg, var(--ink-1) 30%, var(--ink-3) 50%, var(--ink-1) 70%); background-size: 220% 100%; animation: tthshim 1.2s linear infinite; }
@keyframes tthshim { to { background-position: -220% 0; } }
#tip .ds.fr { margin-top: 8px; -webkit-line-clamp: 3; line-clamp: 3; }
#tip .ds.fr b { display: block; font: 500 12px/1 var(--mono); letter-spacing: .2em; color: var(--text3); margin-bottom: 5px; }
#tip .ft { flex-wrap: wrap; }

/* ---------------------------------------------------------------- phones: the HUD nav becomes a bottom bar */
@media (max-width: 1700px) and (min-width: 701px) { .hud-nav { left: 50%; top: 66px; } }
@media (max-width: 1180px) and (min-width: 701px) { .hud-tr .search { width: 190px; } }
@media (max-width: 960px) and (min-width: 701px) {
  .hud-tr .search { display: none; }
  .hud-nav button { padding: 0 12px; }
}
@media (max-width: 700px) {
  .hud-nav { top: auto; bottom: 14px; left: 14px; right: 14px; transform: none; justify-content: space-between; }
  .hud-nav button { flex: 1; justify-content: center; padding: 0 6px; height: 44px; font-size: 11px; letter-spacing: .1em; }
  .hud-nav button i { display: none; }
  #hud .tourbtn, #hud .saved { display: none; }
  #hud .escpill { top: 62px; right: 14px; }
  #hud .cleanbtn.floating { display: none; }
  #shotlabel { bottom: 76px; }
  #hud .tier { display: none; }
  .hud-tr .pa-sound__label, .hud-tr .pa-sound__sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #veil { transition: opacity .15s var(--pa-ease-out); }
  #tip .tth-scan, #tip .tth[data-state="loading"], #airtag i { animation: none; }
}

/* record mode (tools/record): nothing may fade in on its own clock */
body.rec #boot { display: none !important; }
body.rec #veil, body.rec #screens, body.rec #flash { transition: none !important; }

/* the key hints: only as many as fit */
@media (max-width: 1280px) { .hints span:nth-child(n+7) { display: none; } }
@media (max-width: 1060px) { .hints span:nth-child(n+5) { display: none; } }
@media (max-width: 860px) { .hints { display: none; } }
/* the sound toggle inside the screens bar is the glyph only */
.pa-bar-right .sound-mount .pa-sound__btn { height: 40px; padding: 0 12px; }

/* big displays: the title block and the HUD scale with --ui-zoom (main.js sets it above 2200 px wide; 1 everywhere else). The hover card and the leader line are positioned by ui.js in viewport pixels, so they are not zoomed. */
#title, #hud .crumb, #hud .hud-nav, #hud .hud-tr, #hud .legend, #hud .hints, #hud .tier, #hud .cleanbtn.floating, #hud .qual.floating, #hud .escpill, #shotlabel { zoom: var(--ui-zoom, 1); }
#tip .ft .tried{color:var(--signal);font:500 12px var(--mono);letter-spacing:.14em;border:1px solid color-mix(in srgb, var(--signal) 55%, transparent);padding:2px 6px}

/* ?demo=1 (kiosk): no dev chrome */
body.demo .qual, body.demo #perf, body.demo .cleanbtn.floating { display: none !important; }

#tip { z-index: 4; }

body.dir-playing .escpill, body.dir-playing #airtag, body.dir-playing #shotlabel { visibility: hidden !important; }


/* =====================================================================================================
   HUD FINISH (J12). The HUD's own rules are the inline <style> of index.html (the integration owner's file, not touched by the restyle), so this layer restyles it from here with a
   "body" prefix: one type selector more than the inline class rules, which come later in the cascade. Same language as the screens (css/screens.css section 1):
   flat fills, 3 to 4 px radii, mint only where something is interactive (ornaments take the screen line colour), ONE easing family (--pa-ease-*), a reaction on the press frame.
   The layout and the HUD kit's chamfers are not changed here.
   ===================================================================================================== */
html:root {
  --hud-fill: color-mix(in srgb, var(--ink-1) 92%, transparent);               /* flat HUD fill: no blur, no gloss */
  --hud-fill-solid: color-mix(in srgb, var(--ink-1) 96%, transparent);
  --hud-line-screen: color-mix(in srgb, var(--signal) 62%, var(--ink-3));      /* the series' monitor line colour; interactive mint stays brighter */
}

/* flat fills and radii */
body :is(.hud-nav, .tourbtn, .saved, .chip, .escpill, .qual, .cleanbtn, #shotlabel) { background: var(--hud-fill); }
body :is(.tourbtn, .saved, .chip, .escpill, .qual, .cleanbtn, #shotlabel, .hints) { border-radius: var(--pa-radius); }
body :is(#tip, .results) { background: var(--hud-fill-solid); }
body .results { border-radius: 0 0 var(--pa-radius) var(--pa-radius); }
body #toast { background: var(--hud-fill-solid); border-radius: var(--pa-radius); transition: opacity .3s var(--pa-ease-out), transform .3s var(--pa-ease-out); }
body :is(.dlabel, .vlabel) { border-radius: 0 var(--pa-radius) var(--pa-radius) 0; }
body #tip .tth { border-radius: var(--pa-radius); }
body :is(.qual button, .cleanbtn) { border-radius: 0; }
body .qual button:first-child { border-radius: var(--pa-radius) 0 0 var(--pa-radius); }
body .qual button:last-child { border-radius: 0 var(--pa-radius) var(--pa-radius) 0; }

/* ornaments are not interactive, so they take the screen line colour and carry no glow */
body .kicker i { background: var(--hud-line-screen); }
body .crumb .pip, body .title-top .live i { background: var(--hud-line-screen); box-shadow: none; }
body .tier .pips i.on { box-shadow: none; }

/* ONE easing family for the rules that live in index.html */
body #title { transition: opacity .6s var(--pa-ease-out), transform .8s var(--pa-ease-out); }
body #title.tfade { animation-timing-function: var(--pa-ease-out); }
body #hud { transition: opacity .6s var(--pa-ease-out); }
body .chrome { transition: opacity .5s var(--pa-ease-out); }
body .lab { transition: opacity .25s var(--pa-ease-out); }
body #lead { transition: opacity .14s var(--pa-ease-out); }
body #tip { transition: opacity .14s var(--pa-ease-out); }
body #boot { transition: opacity .5s var(--pa-ease-out); }
body .btn-primary { transition: transform .15s var(--pa-ease-out), filter .15s var(--pa-ease-out); }
body .search::before { transition: border-color .15s var(--pa-ease-out); }
@media (prefers-reduced-motion: reduce) {
  body #title, body #hud, body .chrome, body #tip, body .btn-primary, body #toast { transition: none; }
}

/* pointerdown: the first visible reaction is on the press frame (:active starts at pointerdown; transition-duration 0 s means no wait), released on the expo-out curve */
body :is(.hud-nav button, .tourbtn, .escpill, .saved, .chip button, .qual button, .cleanbtn, .btn-primary, .sub button, .legend button, .results button, #airtag button):active {
  transition-duration: 0s; transform: scale(.985); filter: brightness(1.25);
}
@media (prefers-reduced-motion: reduce) {
  body :is(.hud-nav button, .tourbtn, .escpill, .saved, .chip button, .qual button, .cleanbtn, .btn-primary, .sub button, .legend button, .results button, #airtag button):active { transform: none; }
}
body :is(.hud-nav button, .tourbtn, .escpill, .saved, .chip button, .qual button, .cleanbtn, .btn-primary, .sub button, .legend button, .results button, #airtag button) { -webkit-tap-highlight-color: transparent; }
