/* Psionic Xybots — arcade dual-path shell */
:root {
  --psi-cyan: #5ef0e0;
  --psi-gold: #e0b552;
  --psi-purple: #9b6bff;
  --psi-pink: #ff5ec8;
  --psi-bg: #05060c;
  --psi-panel: rgba(6, 10, 22, 0.88);
  --psi-border: rgba(94, 240, 224, 0.45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  background: var(--psi-bg); color: #e8f7f5;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none;
}
canvas#game-canvas {
  display: block; width: 100%; height: 100%;
  position: fixed; inset: 0; z-index: 0;
}

/* Rosebud splash */
#rosebud-exported-splash {
  position: fixed; inset: 0; z-index: 2147483647;
  display: flex; align-items: center; justify-content: center;
  background: #000; opacity: 1; transition: opacity 500ms ease-in-out;
}
#rosebud-exported-splash.is-hiding { opacity: 0; pointer-events: none; }
.rosebud-exported-splash__content {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  text-align: center; color: #fff;
}
.rosebud-exported-splash__logo {
  width: 100px; height: 100px;
  animation: rosebud-breathe 2.4s ease-in-out infinite;
}
.rosebud-exported-splash__text {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 16px; letter-spacing: 0.06em;
}
@keyframes rosebud-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Game splash carousel — playfield-matched art system */
#game-splash {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #05060c;
  padding: 24px; text-align: center;
  overflow: hidden;
}
#game-splash.hidden { display: none !important; }
.splash-bg {
  position: absolute; inset: 0;
  background: center/cover no-repeat;
  background-image: url('../assets/splash/bg_title_maze.jpg');
  filter: saturate(1.05) brightness(0.55);
  transform: scale(1.04);
  z-index: 0;
  transition: background-image 0.45s ease, filter 0.45s ease;
}
.splash-scrim {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(10, 14, 32, 0.35) 0%, rgba(5, 6, 12, 0.82) 70%),
    linear-gradient(90deg, rgba(5, 6, 12, 0.88) 0%, rgba(5, 6, 12, 0.45) 55%, rgba(5, 6, 12, 0.7) 100%);
  pointer-events: none;
}
#game-splash .attract-layout { position: relative; z-index: 2; }
#game-splash h1 {
  font-family: ui-monospace, Consolas, monospace;
  font-size: clamp(1.4rem, 5vw, 2.6rem);
  letter-spacing: 0.18em; color: var(--psi-cyan);
  text-shadow: 0 0 18px rgba(94, 240, 224, 0.55), 3px 3px 0 #4a1fff;
  margin: 0 0 8px;
}
#game-splash .subtitle {
  color: var(--psi-gold); letter-spacing: 0.2em; text-transform: uppercase;
  font-size: 12px; margin-bottom: 12px;
}
.splash-kicker {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--psi-purple);
  text-shadow: 0 0 10px rgba(155, 107, 255, 0.55);
  margin-bottom: 4px;
}
.splash-plate {
  width: 100%;
  height: min(168px, 22vh);
  border: 1px solid var(--psi-border);
  border-radius: 8px;
  background: #0a0e1a center/cover no-repeat;
  box-shadow:
    0 0 28px rgba(155, 107, 255, 0.22),
    inset 0 0 40px rgba(5, 6, 12, 0.35);
  margin-bottom: 8px;
  display: none;
  position: relative;
  overflow: hidden;
}
.splash-plate.is-visible { display: block; }
.splash-plate::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(5, 6, 12, 0.55) 100%);
  pointer-events: none;
}
#splash-blurb {
  max-width: 560px; font-size: 14px; line-height: 1.5; color: #b8c9c6;
  min-height: 0; margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(94, 240, 224, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
}
#splash-blurb.hidden { display: none !important; }
#splash-hint {
  color: var(--psi-gold); animation: blink 1.1s steps(2) infinite;
  letter-spacing: 0.14em; font-size: 13px; text-transform: uppercase;
}
@keyframes blink { 50% { opacity: 0.25; } }
#build-note-splash {
  position: absolute; right: 16px; bottom: calc(12px + var(--safe-bottom));
  font-size: 11px; color: #7a8a88; letter-spacing: 0.1em;
  z-index: 3;
}

/* HUD */
#hud {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  padding: calc(10px + var(--safe-top)) 12px calc(10px + var(--safe-bottom));
}
#hud .panel {
  pointer-events: none;
  background: var(--psi-panel); border: 1px solid var(--psi-border);
  border-radius: 8px; padding: 8px 12px;
  box-shadow: 0 0 20px rgba(94, 240, 224, 0.08);
  backdrop-filter: blur(6px);
}
#hud-top {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
#hud-top .stat { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
#hud-top .label { color: #7fd9cf; letter-spacing: 0.08em; font-size: 10px; text-transform: uppercase; }
#hud-top .value { color: #fff; }
#toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  max-width: min(520px, 90vw); text-align: center; color: #fff;
  font-weight: 700; text-shadow: 0 2px 8px #000; opacity: 0;
  transition: opacity 0.25s; pointer-events: none; z-index: 200;
}
#toast.show { opacity: 1; }
#prompt {
  position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
  font-size: 13px; color: var(--psi-gold); text-align: center;
  max-width: 90vw;
}
#build-note {
  position: absolute; right: 12px; bottom: calc(88px + var(--safe-bottom));
  font-size: 10px; color: #6a7876; letter-spacing: 0.08em; text-transform: uppercase;
}

/* Title / modal overlays */
.modal {
  position: fixed; inset: 0; z-index: 4000;
  display: grid; place-items: center;
  background: radial-gradient(circle, rgba(20, 10, 40, 0.75), rgba(0, 0, 0, 0.92));
  background-size: cover;
  background-position: center;
  padding: 16px;
}
.modal.hidden { display: none !important; }
.modal.title-shell {
  background-image:
    linear-gradient(180deg, rgba(5, 6, 12, 0.72), rgba(5, 6, 12, 0.9)),
    url('../assets/splash/bg_title_maze.jpg');
  background-size: cover;
  background-position: center;
}
.modal.rankings-shell {
  background-image:
    linear-gradient(180deg, rgba(5, 6, 12, 0.7), rgba(5, 6, 12, 0.92)),
    url('../assets/splash/bg_hiscore.jpg');
  background-size: cover;
  background-position: center;
}
.card {
  width: min(640px, 94vw); max-height: 88vh; overflow: auto;
  background: linear-gradient(145deg, rgba(10, 12, 28, 0.97), rgba(30, 12, 48, 0.95));
  border: 1px solid var(--psi-border); border-radius: 12px;
  padding: 22px 24px; box-shadow: 0 0 50px rgba(155, 107, 255, 0.2);
  pointer-events: auto;
}
.card.title-card {
  width: min(720px, 96vw);
  border-color: rgba(94, 240, 224, 0.5);
  box-shadow:
    0 0 60px rgba(94, 240, 224, 0.12),
    0 0 80px rgba(155, 107, 255, 0.18),
    inset 0 0 0 1px rgba(94, 240, 224, 0.08);
  background:
    linear-gradient(160deg, rgba(8, 12, 28, 0.96), rgba(24, 10, 42, 0.94));
}
.title-hero {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
}
.title-emblem {
  width: 112px; height: 112px; flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(94, 240, 224, 0.45);
  object-fit: cover;
  box-shadow: 0 0 24px rgba(155, 107, 255, 0.4);
  background: #0a0e1a;
}
.title-hero-text { flex: 1; min-width: 0; }
.title-hero-text h2 { margin-bottom: 4px; }
.card.hiscore-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(224, 181, 82, 0.45);
  box-shadow: 0 0 50px rgba(224, 181, 82, 0.15), 0 0 40px rgba(94, 240, 224, 0.1);
}
.hiscore-banner {
  position: absolute; inset: 0 0 auto 0; height: 88px;
  background: url('../assets/splash/bg_hiscore.jpg') center/cover no-repeat;
  opacity: 0.35;
  mask-image: linear-gradient(180deg, #000 20%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 20%, transparent 100%);
  pointer-events: none;
}
.card.hiscore-card > *:not(.hiscore-banner) { position: relative; z-index: 1; }
.card h2 {
  margin: 0 0 10px; font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.14em; color: var(--psi-cyan);
  text-shadow: 0 0 12px rgba(94, 240, 224, 0.4);
}
.card p { color: #b8c9c6; line-height: 1.45; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
button.psi-btn, .psi-btn {
  pointer-events: auto; cursor: pointer;
  border: 1px solid var(--psi-gold); background: #120d1a;
  color: var(--psi-gold); padding: 10px 16px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase; border-radius: 6px;
  font-size: 13px;
}
button.psi-btn:hover, .psi-btn:hover {
  background: var(--psi-gold); color: #120d1a;
}
button.psi-btn.primary {
  border-color: var(--psi-cyan); color: var(--psi-cyan);
}
button.psi-btn.primary:hover {
  background: var(--psi-cyan); color: #05060c;
}
button.psi-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Shop */
.shop-grid {
  display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px;
}
.shop-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  border: 1px solid rgba(94, 240, 224, 0.22); padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35); border-radius: 6px;
}
.shop-item b { color: var(--psi-gold); }
.shop-item .cost { color: var(--psi-cyan); font-family: ui-monospace, monospace; }

/* Music HUD */
/* International music catalogue: Akkadian translit (š ṣ ā ē…), Cyrillic, Glagolitic, cuneiform.
   Courier New lacks these glyphs — use Noto + historic system fallbacks. */
#music-hud {
  position: fixed; bottom: calc(6px + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%); min-width: 280px; max-width: 94vw;
  background: rgba(2, 14, 20, 0.35); border: 1px solid rgba(90, 200, 190, 0.55);
  border-radius: 8px; padding: 5px 12px; z-index: 9000;
  font-family: "Noto Sans", "Noto Sans Glagolitic", "Noto Sans Cuneiform",
    "Segoe UI", "Segoe UI Historic", "Arial Unicode MS", "Lucida Sans Unicode",
    system-ui, sans-serif;
  color: #bfeae2; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 0 14px rgba(90, 200, 190, 0.2); pointer-events: auto;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}
#music-now-playing {
  font-size: 11px; letter-spacing: 0.02em; color: #8fded1;
  display: flex; align-items: center; gap: 6px; text-shadow: 0 1px 3px #000;
  max-width: 92vw; flex-wrap: wrap; justify-content: center;
}
#track-title {
  color: #fff;
  font-weight: 600;
  unicode-bidi: plaintext;
  white-space: normal;
  word-break: break-word;
  max-width: 78vw;
}
#music-credit {
  font-size: 9px; color: #e0b552; display: flex; gap: 8px; align-items: center;
  max-width: 92vw; flex-wrap: wrap; justify-content: center;
}
/* Do NOT uppercase: breaks Glagolitic/Cyrillic dual labels and Akkadian macrons visually */
#music-album {
  color: #e0b552;
  text-transform: none;
  max-width: 72vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
  letter-spacing: 0.02em;
}
#music-links { display: flex; gap: 5px; margin-top: 1px; flex-wrap: wrap; justify-content: center; }
.music-btn {
  background: rgba(2,14,20,0.4); border: 1px solid #5ac8be; color: #8fded1;
  font-family: "Noto Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 9px; padding: 2px 7px;
  border-radius: 4px; cursor: pointer; letter-spacing: 0.06em;
}
.music-btn:hover { background: #5ac8be; color: #021014; }
.music-ctl {
  background: rgba(2,14,20,0.4); border: 1px solid #e0b552; color: #f0cf7a;
  font-size: 10px; padding: 1px 7px; border-radius: 4px; cursor: pointer;
}
#music-mix {
  display: flex; gap: 12px; margin-top: 2px; align-items: center;
  font-size: 8px; color: #8fded1;
}
#music-mix label { display: flex; align-items: center; gap: 4px; }
#music-mix input[type=range] { width: 74px; height: 3px; accent-color: #5ac8be; }

/* Mobile controls */
#mobile-controls {
  position: fixed; inset: 0; z-index: 800; pointer-events: none;
  display: none;
}
#mobile-controls.active { display: block; }
.vstick {
  position: absolute; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(94, 240, 224, 0.12);
  border: 2px solid rgba(94, 240, 224, 0.45); pointer-events: auto;
  touch-action: none;
}
.vstick .knob {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(94, 240, 224, 0.75); top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
#stick-move { left: 18px; bottom: calc(100px + var(--safe-bottom)); }
#stick-turn { right: 18px; bottom: calc(100px + var(--safe-bottom)); }
.mbtn {
  position: absolute; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(224, 181, 82, 0.18); border: 2px solid rgba(224, 181, 82, 0.55);
  color: #f0cf7a; font: 700 11px ui-monospace, monospace;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto; touch-action: none; letter-spacing: 0.06em;
}
.mbtn:active, .mbtn.held { background: rgba(224, 181, 82, 0.45); }
#btn-fire { right: 28px; bottom: calc(28px + var(--safe-bottom)); width: 72px; height: 72px;
  border-color: var(--psi-pink); color: var(--psi-pink); background: rgba(255, 94, 200, 0.15); }
#btn-seize { right: 110px; bottom: calc(36px + var(--safe-bottom));
  border-color: var(--psi-purple); color: #c9b0ff; }
#btn-use { left: 150px; bottom: calc(28px + var(--safe-bottom));
  border-color: var(--psi-cyan); color: var(--psi-cyan); }
#btn-pause-m { top: calc(12px + var(--safe-top)); right: 12px; width: 48px; height: 48px; font-size: 10px; }

@media (max-width: 640px) {
  #music-hud { font-size: 9px; min-width: 0; }
  .music-btn { font-size: 8px; padding: 2px 5px; }
  #music-mix input[type=range] { width: 48px; }
  #hud-top .stat { font-size: 11px; }
  #build-note { bottom: calc(150px + var(--safe-bottom)); }
}
.hidden { display: none !important; }

/* Archive codex (obscure raycast lore) */
#codex-panel {
  background: var(--psi-panel);
  border: 1px solid var(--psi-border);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 0 24px rgba(155, 107, 255, 0.18);
  backdrop-filter: blur(6px);
}
#codex-panel h2 { font-size: 1rem; }
#codex-panel .entry {
  border-top: 1px solid rgba(94, 240, 224, 0.22);
  padding: 10px 0;
}
#codex-panel .entry b { color: #e0b552; }
#codex-panel .skill-rank {
  color: #5ef0e0;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  margin-left: 6px;
}

/* ═══════════════════════════════════════════════════════════
   Psi-Ribbon Copyright — (c) 2026 Douglas P. Stoothoff
   Novel variation (not letterBob-only / not static footer):
   dual-stream Lissajous figure-8 + reverse chroma + scan bar
   ═══════════════════════════════════════════════════════════ */
.psi-copyright {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  user-select: none;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.2;
  z-index: 8500;
}
.psi-copyright__ribbon {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  max-width: 96vw;
}
.psi-copyright__cell {
  position: relative;
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  /* triple animation: lissajous path, reverse chroma, soft scale breath */
  animation:
    psiLissajous 2.4s ease-in-out infinite,
    psiChromaRev 5.5s linear infinite,
    psiBreath 3.1s ease-in-out infinite;
  transform-origin: 50% 70%;
}
.psi-copyright__glyph {
  position: relative;
  z-index: 2;
  display: block;
  text-align: center;
  background: linear-gradient(
    115deg,
    #5ef0e0 0%,
    #9b6bff 35%,
    #e0b552 70%,
    #5ef0e0 100%
  );
  background-size: 280% 280%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 4px rgba(94, 240, 224, 0.35));
  /* chroma driven by parent animation via background-position inheritance hack */
  animation: psiGlyphSlide 5.5s linear infinite reverse;
  animation-delay: inherit;
}
.psi-copyright__ghost {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  text-align: center;
  opacity: 0.38;
  color: #c9b0ff;
  -webkit-text-fill-color: #c9b0ff;
  filter: blur(0.6px);
  /* opposite phase of the figure-8 */
  animation: psiLissajousInv 2.4s ease-in-out infinite;
  pointer-events: none;
}
.psi-copyright__scan {
  display: block;
  width: min(280px, 70vw);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(94, 240, 224, 0.15) 20%,
    rgba(155, 107, 255, 0.85) 50%,
    rgba(224, 181, 82, 0.15) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: psiScan 2.8s linear infinite;
  opacity: 0.75;
  box-shadow: 0 0 8px rgba(155, 107, 255, 0.45);
}

/* Figure-8 / Lissajous (never used as copyright gait in prior DPS titles) */
@keyframes psiLissajous {
  0%   { transform: translate(0px, 0px) rotate(0deg); }
  12.5%{ transform: translate(1.6px, -3.2px) rotate(-1.5deg); }
  25%  { transform: translate(0px, -4px) rotate(0deg); }
  37.5%{ transform: translate(-1.6px, -3.2px) rotate(1.5deg); }
  50%  { transform: translate(0px, 0px) rotate(0deg); }
  62.5%{ transform: translate(1.6px, 3.2px) rotate(1.2deg); }
  75%  { transform: translate(0px, 4px) rotate(0deg); }
  87.5%{ transform: translate(-1.6px, 3.2px) rotate(-1.2deg); }
  100% { transform: translate(0px, 0px) rotate(0deg); }
}
@keyframes psiLissajousInv {
  0%   { transform: translate(0px, 0px); opacity: 0.38; }
  25%  { transform: translate(-1.4px, 3.5px); opacity: 0.22; }
  50%  { transform: translate(0px, 0px); opacity: 0.38; }
  75%  { transform: translate(1.4px, -3.5px); opacity: 0.22; }
  100% { transform: translate(0px, 0px); opacity: 0.38; }
}
@keyframes psiChromaRev {
  0%   { filter: hue-rotate(0deg); }
  50%  { filter: hue-rotate(-55deg); }
  100% { filter: hue-rotate(-110deg); }
}
@keyframes psiGlyphSlide {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@keyframes psiBreath {
  0%, 100% { opacity: 0.92; }
  50%      { opacity: 1; }
}
@keyframes psiScan {
  0%   { background-position: 100% 0; opacity: 0.35; }
  50%  { opacity: 0.9; }
  100% { background-position: -100% 0; opacity: 0.35; }
}

/* Game-hook flashes */
.psi-copyright.is-seize .psi-copyright__glyph {
  filter: drop-shadow(0 0 10px rgba(255, 94, 200, 0.9));
  animation-duration: 0.35s;
}
.psi-copyright.is-sanct .psi-copyright__scan {
  box-shadow: 0 0 16px rgba(94, 240, 224, 0.95);
  height: 3px;
}
.psi-copyright.is-glitch .psi-copyright__cell {
  animation-duration: 0.12s, 0.4s, 0.2s;
}

/* Placements */
#copyright-splash {
  margin-top: 18px;
  margin-bottom: 4px;
}
#copyright-title {
  margin-top: 16px;
}
#copyright-play {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-bottom));
  transform: translateX(-50%);
  opacity: 0.72;
  transition: opacity 0.3s;
}
#copyright-play.is-dim { opacity: 0.35; }
@media (max-width: 640px) {
  .psi-copyright { font-size: 9px; }
  .psi-copyright__cell { width: 0.55em; }
  #copyright-play { bottom: calc(148px + var(--safe-bottom)); }
}

/* ── Attract / arcade / library ───────────────────────── */
.arcade-font {
  font-family: ui-monospace, "Press Start 2P", Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.insert-coin {
  color: var(--psi-gold);
  animation: blink 1.1s steps(2) infinite;
  letter-spacing: 0.2em;
  font-weight: 800;
  font-size: 13px;
}
.attract-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  width: min(960px, 96vw);
  align-items: stretch;
  text-align: left;
}
.attract-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(6, 10, 22, 0.55);
  border: 1px solid rgba(94, 240, 224, 0.18);
  border-radius: 10px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
}
.attract-right {
  border: 1px solid var(--psi-border);
  border-radius: 10px;
  background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(8px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  box-shadow: 0 0 30px rgba(94, 240, 224, 0.08), inset 0 0 0 1px rgba(155, 107, 255, 0.08);
}
.attract-demo-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--psi-gold);
  margin-bottom: 6px;
  text-transform: uppercase;
}
#attract-demo {
  width: 100%;
  height: 200px;
  border-radius: 6px;
  background: #05060c;
  image-rendering: pixelated;
}
.attract-lines {
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #b8c9c6;
  margin: 0;
  max-height: 42vh;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(94, 240, 224, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
}
#game-splash {
  justify-content: center;
  padding: 20px;
}
#game-splash h1 { text-align: left; }
@media (max-width: 800px) {
  .attract-layout { grid-template-columns: 1fr; }
  #game-splash h1 { text-align: center; }
  .attract-left { align-items: center; text-align: center; }
  .attract-lines { text-align: left; width: 100%; }
  .title-hero { flex-direction: column; text-align: center; }
  .title-emblem { width: 96px; height: 96px; }
  .splash-plate { height: min(140px, 20vh); }
}

.rank-preview {
  margin-top: 12px;
  border: 1px solid rgba(224, 181, 82, 0.35);
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
}
.rank-mini { color: #8fded1; font-family: ui-monospace, monospace; margin: 2px 0; }
.rank-table { width: 100%; margin: 12px 0; }
.rank-head, .rank-row {
  display: grid;
  grid-template-columns: 40px 70px 1fr 50px;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(94, 240, 224, 0.15);
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.rank-head { color: var(--psi-gold); font-size: 11px; letter-spacing: 0.12em; }
.rank-row.hi { color: #fff; background: rgba(94, 240, 224, 0.12); box-shadow: inset 0 0 12px rgba(94, 240, 224, 0.15); }
.rank-ini { color: #5ef0e0; font-weight: 800; }
.rank-sc { color: #fff; text-align: right; }
.arcade-card { text-align: center; }
.arcade-card h2 {
  animation: blink 1.4s steps(2) infinite;
}

/* Initials entry */
.arcade-initials { text-align: center; padding: 8px; }
.ai-blink {
  color: var(--psi-gold);
  letter-spacing: 0.2em;
  animation: blink 0.9s steps(2) infinite;
  font-weight: 800;
  margin-bottom: 10px;
}
.ai-score {
  font-size: 42px;
  font-family: ui-monospace, monospace;
  color: #5ef0e0;
  text-shadow: 0 0 18px rgba(94, 240, 224, 0.5);
  margin: 8px 0;
}
.ai-label { color: #e0b552; letter-spacing: 0.14em; font-size: 12px; margin-bottom: 14px; }
.ai-letters { display: flex; justify-content: center; gap: 16px; margin: 16px 0; }
.ai-letter {
  width: 52px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(94, 240, 224, 0.35);
  background: rgba(0, 0, 0, 0.5);
  font: 800 32px ui-monospace, monospace;
  color: #b8c9c6;
}
.ai-letter.active {
  border-color: #e0b552;
  color: #fff;
  box-shadow: 0 0 18px rgba(224, 181, 82, 0.45);
  transform: scale(1.08);
}
.ai-hint { font-size: 11px; color: #8fded1; margin-top: 10px; }
.ai-mobile { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

/* Library shell — TIE craft bay */
.library-shell {
  width: min(1100px, 96vw);
  height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(8, 10, 22, 0.98), rgba(20, 12, 40, 0.96));
  border: 1px solid var(--psi-border);
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(155, 107, 255, 0.22);
  overflow: hidden;
  pointer-events: auto;
}
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(94, 240, 224, 0.25);
}
.library-header h2 {
  margin: 0;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.16em;
  color: var(--psi-cyan);
  font-size: 1.1rem;
}
.library-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  min-height: 0;
}
.lib-list {
  overflow: auto;
  border-right: 1px solid rgba(94, 240, 224, 0.18);
  padding: 8px;
  background: rgba(0, 0, 0, 0.35);
}
.lib-cat {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--psi-gold);
  margin: 10px 6px 4px;
  text-transform: uppercase;
}
.lib-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: #b8c9c6;
  padding: 7px 8px;
  margin: 2px 0;
  border-radius: 4px;
  cursor: pointer;
  font: 600 12px ui-monospace, monospace;
}
.lib-item:hover { border-color: rgba(94, 240, 224, 0.35); background: rgba(94, 240, 224, 0.08); }
.lib-item.active {
  border-color: var(--psi-cyan);
  color: #fff;
  background: rgba(94, 240, 224, 0.14);
  box-shadow: inset 0 0 12px rgba(94, 240, 224, 0.12);
}
.lib-glyph {
  display: inline-flex;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border: 1px solid rgba(224, 181, 82, 0.5);
  color: #e0b552;
  font-weight: 800;
}
.lib-stage {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}
#lib-canvas {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: block;
  background: radial-gradient(ellipse at 50% 40%, #1a1440 0%, #05060c 70%);
}
.lib-card {
  padding: 12px 16px 8px;
  border-top: 1px solid rgba(94, 240, 224, 0.2);
  background: rgba(0, 0, 0, 0.45);
  max-height: 28%;
  overflow: auto;
}
.lib-card h3 {
  margin: 0 0 6px;
  color: var(--psi-gold);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
}
.lib-card p {
  margin: 0 0 6px;
  color: #b8c9c6;
  font-size: 13px;
  line-height: 1.45;
}
.library-foot {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(94, 240, 224, 0.15);
  justify-content: center;
}
@media (max-width: 700px) {
  .library-body { grid-template-columns: 1fr; grid-template-rows: 140px 1fr; }
  .lib-list { border-right: none; border-bottom: 1px solid rgba(94, 240, 224, 0.18); max-height: 140px; }
  .library-shell { height: min(92vh, 900px); }
}

/* ── O.C.A. ad cutscenes (Lattice Bulletin TV) ───────── */
.ad-tv {
  width: min(720px, 96vw);
  pointer-events: auto;
}
.ad-tv-bezel {
  background: linear-gradient(160deg, #1a1528, #0a0812 60%, #12101c);
  border: 3px solid #5a4a2a;
  border-radius: 14px;
  box-shadow:
    0 0 0 2px #2a2010,
    0 0 40px rgba(224, 181, 82, 0.25),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
  padding: 12px 14px 10px;
}
.ad-tv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ad-bug {
  color: #ff5e6a;
  animation: blink 1.2s steps(2) infinite;
}
.ad-org { color: #8fded1; max-width: 60%; text-align: right; }
.ad-tv-screen {
  background: #05060c;
  border: 2px solid #333;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.ad-show-title {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  z-index: 2;
  font: 700 11px ui-monospace, monospace;
  letter-spacing: 0.14em;
  color: #e0b552;
  text-shadow: 0 1px 3px #000;
  text-align: center;
}
#ad-demo-canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: #0a0614;
}
.ad-lower-third {
  background: linear-gradient(90deg, rgba(10, 6, 20, 0.95), rgba(30, 12, 48, 0.92));
  border-top: 2px solid #e0b552;
  padding: 10px 14px 12px;
  min-height: 72px;
}
.ad-card {
  font: 700 10px ui-monospace, monospace;
  letter-spacing: 0.16em;
  color: #5ef0e0;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ad-line {
  font-size: 15px;
  line-height: 1.4;
  color: #f2e8d8;
  font-weight: 600;
}
.ad-tv-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ad-live {
  font: 700 10px ui-monospace, monospace;
  color: #ff5e6a;
  letter-spacing: 0.1em;
}
@media (max-width: 520px) {
  #ad-demo-canvas { height: 150px; }
  .ad-line { font-size: 13px; }
}
