/* =========================================================
   Claude's World — Claude design system applied
   ========================================================= */

:root {
  /* Surfaces */
  --parchment: #f5f4ed;
  --ivory: #faf9f5;
  --pure-white: #ffffff;
  --warm-sand: #e8e6dc;
  --dark-surface: #30302e;
  --deep-dark: #141413;

  /* Brand */
  --terracotta: #c96442;
  --coral: #d97757;
  --error-crimson: #b53333;
  --focus-blue: #3898ec;

  /* Text */
  --near-black: #141413;
  --charcoal-warm: #4d4c48;
  --olive-gray: #5e5d59;
  --stone-gray: #87867f;
  --dark-warm: #3d3d3a;
  --warm-silver: #b0aea5;

  /* Borders / rings */
  --border-cream: #f0eee6;
  --border-warm: #e8e6dc;
  --border-dark: #30302e;
  --ring-warm: #d1cfc5;
  --ring-deep: #c2c0b6;

  /* Cinematic luxe accents — used ONLY in the cinematic zones
     (cafe / beach / tower) per SCENERY agent palette decision in
     UPGRADE_NOTES.md. NEVER in plaza, library, garden, constitution
     — those stay in Claude warm-only DNA. */
  --m-blue-light: #0066b1;   /* BMW M tricolor — start */
  --m-blue-dark:  #1c69d4;   /* BMW M tricolor — middle */
  --m-red:        #e22718;   /* BMW M tricolor — end */
  --lambo-gold:   #ffc000;   /* Lamborghini gold core */
  --beach-haze:   #7a8e90;   /* ElevenLabs sea-haze cool */

  /* Type stacks */
  --serif: 'Anthropic Serif', 'Georgia', 'Iowan Old Style', 'Times New Roman', serif;
  --sans: 'Anthropic Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Anthropic Mono', 'SF Mono', Menlo, Monaco, 'Cascadia Code', 'Source Code Pro', monospace;

  /* Shadows — whisper per Claude design system */
  --whisper: rgba(0,0,0,0.05) 0px 4px 24px;
  --lift: rgba(0,0,0,0.05) 0px 4px 24px, 0 0 0 1px var(--border-warm);

  /* Motion clock — unified tempo across UI */
  --tempo-slow:    3.2s;
  --tempo-medium:  1.6s;
  --tempo-fast:    0.4s;
  --ease-quiet:    cubic-bezier(0.4, 0, 0.6, 1);
  --ease-arrive:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-depart:   cubic-bezier(0.7, 0, 0.84, 0);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Mobile: kill double-tap/pinch zoom, scroll rubber-banding, and accidental
     text selection of HUD pills under the thumb. The canvas IS the app. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  /* Dark warm LED-universe base — matches IntroLeds.renderFrame fillStyle
     so any chrome around the canvas (rounded corners, screen padding)
     stays inside the LED universe rather than peeking parchment. */
  background: #0e0a07;
  color: var(--near-black);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }
input { font-family: inherit; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
}
.screen.active { display: flex; }

/* INTRO SCREEN — live LED pixel-grid background (intro_leds.js).
   Thousands of glowing LED squares form a cosmic Claude pattern in real time.
   The canvas is full-bleed BEHIND the .intro-content glass card. Vignette
   gradient ensures the LEDs near the edges fade for focus on the center. */
#intro-screen {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
  background: #0e0a07;
  position: relative;
}
#intro-leds-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}
/* Vignette + bottom gradient for text contrast over the LED field */
#intro-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14,10,7,0) 0%, rgba(14,10,7,0) 40%,
                    rgba(14,10,7,0.45) 75%, rgba(14,10,7,0.65) 100%),
    radial-gradient(ellipse at 50% 50%, rgba(14,10,7,0) 0%,
                    rgba(14,10,7,0) 35%, rgba(14,10,7,0.55) 100%);
  z-index: 1;
  pointer-events: none;
}

.intro-content {
  /* Full-bleed: occupy the entire viewport, no glass-card frame.
     LEDs read all the way to the edges; the vignette gradient on
     #intro-screen::before keeps the corners legible behind the text. */
  width: 100vw;
  min-height: 100vh;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: clamp(48px, 8vh, 120px) clamp(20px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow-y: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 200, 120, 0.4) transparent;
}
.intro-content::-webkit-scrollbar { width: 6px; }
.intro-content::-webkit-scrollbar-thumb {
  background: rgba(255, 200, 120, 0.4);
  border-radius: 3px;
}

.brand {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3.2px;
  color: #ffd47a;
  margin-bottom: 12px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 18px rgba(255,180,80,0.45);
}

.display {
  /* Hero scale: clamps so it stays bold on phones and grand on desktops. */
  font-family: var(--serif);
  font-size: clamp(44px, 7.6vw, 96px);
  font-weight: 500;
  line-height: 1.04;
  color: #ffffff;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.75), 0 0 48px rgba(255,150,80,0.28);
}

.subtitle {
  font-family: var(--sans);
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.55;
  color: rgba(255, 246, 220, 0.88);
  margin: 0 auto 30px;
  max-width: 640px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

.overline {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--stone-gray);
}


.name-input { margin-bottom: 18px; }
#intro-screen .name-input .overline {
  margin-bottom: 8px;
  color: rgba(255, 220, 160, 0.85);
  font-weight: 600;
  letter-spacing: 1.5px;
}

#intro-screen .name-input input {
  font-family: var(--serif);
  font-size: 16px;
  background: rgba(255, 246, 220, 0.10);
  border: 1px solid rgba(255, 220, 160, 0.30);
  border-radius: 10px;
  padding: 9px 16px;
  width: 320px;
  text-align: center;
  color: #fff6dc;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(4px);
}
#intro-screen .name-input input::placeholder {
  color: rgba(255, 246, 220, 0.45);
  font-style: italic;
}
#intro-screen .name-input input:focus {
  border-color: rgba(255, 200, 120, 0.80);
  background: rgba(255, 246, 220, 0.16);
  box-shadow: 0 0 0 3px rgba(255, 192, 112, 0.20),
              0 0 18px rgba(255, 192, 112, 0.30);
}

.btn {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  letter-spacing: 0.1px;
}

.btn-primary {
  background: var(--terracotta);
  color: var(--ivory);
  box-shadow: 0px 0px 0px 1px var(--terracotta);
}
.btn-primary:hover {
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral), 0 0 0 4px rgba(217,119,87,0.18);
}

.btn-secondary {
  background: var(--warm-sand);
  color: var(--charcoal-warm);
  box-shadow: 0px 0px 0px 1px var(--ring-warm);
}
.btn-secondary:hover { background: var(--ring-warm); }

.btn-ghost {
  background: transparent;
  color: var(--olive-gray);
  margin-top: 12px;
  padding: 10px 20px;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--near-black); }

/* Intro-screen Enter button — golden portal CTA matching the artwork */
#intro-screen #start-btn.btn-primary {
  background: linear-gradient(180deg, #ffd87a 0%, #f4a040 60%, #cc7a20 100%);
  color: #1a0e08;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 16px 44px;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 200, 120, 0.65),
    0 0 0 4px rgba(255, 200, 120, 0.18),
    0 6px 22px rgba(255, 160, 60, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
#intro-screen #start-btn.btn-primary:hover {
  background: linear-gradient(180deg, #ffe09a 0%, #ffac50 60%, #d68830 100%);
  box-shadow:
    0 0 0 1px #ffd070,
    0 0 0 4px rgba(255, 200, 120, 0.30),
    0 8px 28px rgba(255, 160, 60, 0.50),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transform: translateY(-1px);
}
#intro-screen #continue-btn.btn-ghost {
  color: rgba(255, 246, 220, 0.75);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  font-weight: 500;
}
#intro-screen #continue-btn.btn-ghost:hover {
  color: #ffd87a;
}

.intro-footer {
  margin-top: 14px;
  font-size: 11px;
  color: rgba(255, 246, 220, 0.55);
  letter-spacing: 0.4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* GAME SCREEN */
#game-screen {
  position: fixed;
  inset: 0;
  /* Dark warm matching the LED-universe base so no parchment cream
     leaks around the canvas edges or rounded corners. */
  background: #0e0a07;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #1a1208;
  cursor: crosshair;
  image-rendering: auto;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 22px 28px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background: transparent;
}
.hud-top.dark { background: transparent; }
.hud-top.dark .area-name,
.hud-top.dark .memories-count,
.hud-top.dark .time-pill { color: var(--ivory); }
.hud-top.dark .overline { color: var(--warm-silver); }
.hud-top.dark .hud-area,
.hud-top.dark .hud-stats {
  background: rgba(20, 20, 19, 0.62);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 12px 36px rgba(0, 0, 0, 0.45);
}

/* Area card — left side glass chip with the sandbox overline + area name. */
.hud-area {
  background: rgba(250, 249, 245, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 14px 22px 16px;
  box-shadow:
    0 0 0 1px rgba(255, 220, 160, 0.10),
    0 10px 32px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  position: relative;
}
.hud-area .overline { margin-bottom: 6px; }

.area-name {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.04;
  color: var(--near-black);
  letter-spacing: -0.4px;
}

/* LED-dot accent beneath the area name — a small callback to the LED grid
   used in the boot screen. Eight warm dots fade in from coral to gold. */
.hud-area::after {
  content: '';
  display: block;
  margin-top: 10px;
  width: 88px;
  height: 4px;
  background-image: radial-gradient(
    circle at center,
    var(--terracotta) 0 40%,
    transparent 42%
  );
  background-size: 11px 4px;
  background-repeat: repeat-x;
  background-position: left center;
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(217, 119, 87, 0.45));
}

/* Stats row — right side glass pill housing day/night + memory count. */
.hud-stats {
  display: flex;
  gap: 24px;
  align-items: stretch;
  background: rgba(250, 249, 245, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 12px 20px;
  box-shadow:
    0 0 0 1px rgba(255, 220, 160, 0.10),
    0 10px 32px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}
.stat { display: flex; flex-direction: column; }
.stat + .stat {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  padding-left: 24px;
  margin-left: 0;
}
.hud-top.dark .stat + .stat { border-left-color: rgba(255, 255, 255, 0.08); }
.stat .overline { margin-bottom: 6px; }

.time-pill {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--near-black);
  letter-spacing: -0.2px;
}

.memories-count {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--near-black);
  letter-spacing: -0.4px;
  line-height: 1;
}
.mem-sep, .mem-total { color: var(--stone-gray); font-size: 18px; font-weight: 400; }

.hud-bottom {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
}

.hud-controls {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--olive-gray);
  background: rgba(250,249,245,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid var(--border-cream);
  letter-spacing: 0.2px;
}
.hud-bottom.dark .hud-controls {
  background: rgba(48,48,46,0.85);
  border-color: var(--dark-surface);
  color: var(--warm-silver);
}
.dot { color: var(--stone-gray); margin: 0 4px; }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--ivory);
  color: var(--charcoal-warm);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-warm);
  box-shadow: 0px 1px 0px var(--ring-warm);
  letter-spacing: 0;
  font-weight: 500;
}

#interact-prompt,
#portal-prompt {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ivory);
  border: 1px solid var(--border-warm);
  padding: 12px 22px;
  border-radius: 32px;
  font-size: 14px;
  color: var(--near-black);
  z-index: 15;
  box-shadow: var(--whisper);
  animation: breathe var(--tempo-slow) var(--ease-quiet) infinite;
  font-family: var(--sans);
}
#portal-prompt { background: var(--warm-sand); }

@keyframes breathe {
  0%, 100% { opacity: 0.88; box-shadow: 0 0 0 1px var(--border-warm), var(--whisper); }
  50%      { opacity: 1.00; box-shadow: 0 0 0 1px var(--ring-deep), var(--whisper); }
}

#dialog-box {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 48px));
  background: var(--ivory);
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  gap: 22px;
  pointer-events: auto;
  z-index: 20;
  box-shadow: var(--whisper);
  animation: dialogIn 0.5s var(--ease-arrive);
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.dialog-portrait {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: var(--warm-sand);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-cream);
}
.dialog-portrait canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dialog-content { flex: 1; min-width: 0; }

.dialog-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  color: var(--near-black);
  margin-bottom: 8px;
  line-height: 1.2;
}

.dialog-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.60;
  color: var(--near-black);
  margin-bottom: 14px;
  min-height: 56px;
}
.dialog-text .cursor {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--terracotta);
  margin-left: 4px;
  margin-bottom: 2px;
  animation: pulseDot var(--tempo-medium) var(--ease-quiet) infinite;
  box-shadow: 0 0 8px rgba(217,119,87,0.6);
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1);   opacity: 0.55; }
  50%      { transform: scale(1.3); opacity: 1; }
}

.dialog-continue {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--stone-gray);
  font-weight: 500;
  letter-spacing: 0.4px;
}

#inventory-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100% - 48px));
  max-height: 82vh;
  background: var(--ivory);
  border: 1px solid var(--border-warm);
  border-radius: 24px;
  padding: 32px;
  z-index: 30;
  pointer-events: auto;
  box-shadow: rgba(0,0,0,0.12) 0px 16px 48px;
  overflow-y: auto;
  animation: dialogIn 0.3s ease-out;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-cream);
  gap: 12px;
}
.inv-header h2 { font-size: 28px; line-height: 1.15; margin-top: 6px; }

.serif { font-family: var(--serif); font-weight: 500; }

.close-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--olive-gray);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
  line-height: 1;
}
.close-btn:hover { background: var(--warm-sand); color: var(--near-black); }

#constellation-canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: var(--deep-dark);
  border-radius: 16px;
  margin-bottom: 22px;
  border: 1px solid var(--dark-surface);
  box-shadow: rgba(0,0,0,0.15) 0px 4px 18px inset;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.inv-item {
  background: var(--parchment);
  border: 1px solid var(--border-cream);
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  transition: transform 0.15s ease;
}
.inv-item:hover { transform: translateY(-2px); }
.inv-item.locked { opacity: 0.35; filter: saturate(0.4); }

.inv-icon {
  width: 52px;
  height: 52px;
  background: var(--warm-sand);
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--terracotta);
  font-weight: 500;
  border: 1px solid var(--border-warm);
}
.inv-item.locked .inv-icon { color: var(--stone-gray); background: var(--border-cream); }

.inv-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--near-black);
  margin-bottom: 4px;
}
.inv-from {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--stone-gray);
  letter-spacing: 0.3px;
}
.inv-vec {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--terracotta);
  letter-spacing: 0.4px;
  margin-top: 6px;
  text-transform: uppercase;
}

.inv-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-cream);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--olive-gray);
}
.inv-hint { color: var(--stone-gray); font-style: italic; }

#memory-notif {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--near-black);
  color: var(--ivory);
  padding: 28px 48px;
  border-radius: 16px;
  text-align: center;
  z-index: 25;
  pointer-events: none;
  animation: notify 2.8s ease-out forwards;
  box-shadow: rgba(0,0,0,0.2) 0px 16px 40px;
  border: 1px solid var(--dark-surface);
}
@keyframes notify {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.02); }
  25% { transform: translate(-50%, -50%) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
#memory-notif .overline {
  color: var(--coral);
  margin-bottom: 12px;
}
.memory-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 6px;
}
.memory-from {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--warm-silver);
  letter-spacing: 0.3px;
}
/* B5 — constellation trace inside the memory-acquired notification */
#memory-notif-stars {
  display: block;
  width: 220px;
  height: 44px;
  margin: 16px auto 0;
  opacity: 0;
  animation: notifStars 2.6s ease-out forwards 0.18s;
}
@keyframes notifStars {
  0%   { opacity: 0; transform: translateY(6px); }
  20%  { opacity: 1; transform: translateY(0); }
  85%  { opacity: 0.95; }
  100% { opacity: 0; }
}

#pause-menu {
  position: absolute;
  inset: 0;
  background: rgba(20,20,19,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  pointer-events: auto;
}
.pause-content {
  background: var(--ivory);
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  min-width: 340px;
  border: 1px solid var(--border-warm);
  box-shadow: rgba(0,0,0,0.15) 0px 24px 64px;
}
.pause-content .overline { margin-bottom: 12px; }
.pause-content h2 {
  margin-bottom: 28px;
  font-size: 32px;
  line-height: 1.15;
  color: var(--near-black);
}
.pause-content .btn {
  display: block;
  width: 100%;
  margin-bottom: 12px;
}
.settings-row {
  margin: 14px 0 4px;
  padding: 10px 14px;
  background: var(--parchment);
  border: 1px solid var(--border-cream);
  border-radius: 12px;
  text-align: left;
}
.setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--charcoal-warm);
}
.setting-toggle input { accent-color: var(--terracotta); }
.setting-toggle small { color: var(--stone-gray); margin-left: 4px; }

.pause-credits {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-cream);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--stone-gray);
  letter-spacing: 0.4px;
  line-height: 1.7;
  text-align: center;
}

#sandbox-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 28;
  pointer-events: none;
  animation: bannerIn 2.4s ease-out forwards;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}
.sb-overline {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: var(--coral);
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(20,20,19,0.5);
}
.sb-title {
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 500;
  color: var(--ivory);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  text-shadow: 0 0 24px rgba(217,119,87,0.4), 0 2px 8px rgba(20,20,19,0.5);
}
.sb-line {
  width: 80px;
  height: 1px;
  background: var(--terracotta);
  margin: 0 auto;
  box-shadow: 0 0 6px rgba(217,119,87,0.3);
}

#end-screen {
  position: absolute;
  inset: 0;
  background: var(--deep-dark);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  pointer-events: auto;
  animation: fadeIn 1.6s ease-out;
  overflow: hidden;
}
#end-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.end-content {
  max-width: 720px;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: 48px 36px;
  background: rgba(20,20,19,0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--dark-surface);
  border-radius: 24px;
}
.end-content .overline {
  color: var(--coral);
  margin-bottom: 24px;
  letter-spacing: 3px;
}
.end-title {
  font-size: 56px;
  margin-bottom: 32px;
  color: var(--ivory);
}
.end-text {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--warm-silver);
  margin-bottom: 18px;
}
.end-text.quiet { color: var(--stone-gray); font-size: 15px; margin-bottom: 40px; }

#transition-fade {
  position: absolute;
  inset: 0;
  background: var(--near-black);
  z-index: 35;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
#transition-fade.active { opacity: 1; }

/* ============= ACTIVATION VERBALIZER ============= */
#verbalizer {
  position: absolute;
  bottom: 22px;
  left: 24px;
  background: rgba(20,20,19,0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--dark-surface);
  border-radius: 12px;
  padding: 10px 14px 12px;
  min-width: 280px;
  max-width: 340px;
  pointer-events: none;
  z-index: 11;
  box-shadow: rgba(0,0,0,0.20) 0px 8px 24px;
  font-family: var(--mono);
}
.verb-overline {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.6px;
  color: var(--coral);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.verb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 8px var(--coral);
  animation: verbPulse var(--tempo-medium) var(--ease-quiet) infinite;
}
@keyframes verbPulse { 0%,100%{ opacity:1; transform:scale(1);} 50%{ opacity:0.5; transform:scale(0.82);} }
.verb-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--warm-silver);
  letter-spacing: 0.2px;
  line-height: 1.4;
  min-height: 16px;
  transition: opacity 0.25s ease;
}
.verb-line.flicker { opacity: 0; }

/* ============= BOOT SEQUENCE ============= */
#boot-screen {
  position: absolute;
  inset: 0;
  background: var(--deep-dark);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
#boot-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.boot-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 540px;
  padding: 32px;
  background: rgba(20,20,19,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--dark-surface);
  border-radius: 16px;
  font-family: var(--mono);
}
.boot-overline {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--coral);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.boot-stage {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--ivory);
  margin-bottom: 22px;
  letter-spacing: -0.2px;
  line-height: 1.2;
  min-height: 34px;
  transition: opacity 0.4s ease;
}
.boot-stage.flicker { opacity: 0.2; }
.boot-bar {
  width: 100%;
  height: 4px;
  background: var(--dark-surface);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}
.boot-bar-fill {
  height: 100%;
  background: var(--terracotta);
  width: 0;
  transition: width 0.4s var(--ease-arrive);
  box-shadow: 0 0 0 1px rgba(217,119,87,0.4);
}
.boot-log {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--warm-silver);
  text-align: left;
  height: 96px;
  overflow: hidden;
  line-height: 1.6;
  letter-spacing: 0;
  opacity: 0.85;
  margin-bottom: 16px;
}
.boot-log .ok { color: var(--coral); }
.boot-log .dim { color: var(--stone-gray); }

/* BREACH state — kicks in at t >= 3.4 ("Linking your account").
   Everything turns red + slight neon glow, like the intro just got
   hijacked into the player's own world. The CLAUDE → MY LED wipe
   lands ~600ms later and reads as the actual "switch flipped". */
#boot-screen.breach .boot-overline,
#boot-screen.breach .boot-stage,
#boot-screen.breach .boot-meta {
  color: #ff3a3a;
  text-shadow: 0 0 10px rgba(255,58,58,0.55);
}
#boot-screen.breach .boot-log .ok { color: #ff5050; }
#boot-screen.breach .boot-log .dim { color: rgba(255,80,80,0.7); }
#boot-screen.breach .boot-bar-fill {
  background: #ff3a3a;
  box-shadow: 0 0 8px rgba(255,58,58,0.7);
}
.boot-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--stone-gray);
  letter-spacing: 0.4px;
}

@media (max-width: 720px) {
  #verbalizer { min-width: auto; left: 12px; right: 12px; bottom: 70px; max-width: none; }
  .boot-content { margin: 0 16px; padding: 24px; }
  .boot-stage { font-size: 22px; }
}

.hidden { display: none !important; }

/* ============= ACCESSIBILITY ============= */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep these calm but visible */
  #verbalizer .verb-dot { animation: none; opacity: 1; }
  #interact-prompt, #portal-prompt { animation: none; opacity: 1; }
  .dialog-text .cursor { animation: none; opacity: 1; }
}

@media (max-width: 720px) {
  .display { font-size: 38px; }
  .subtitle { font-size: 16px; margin-bottom: 40px; }
  .area-name { font-size: 22px; }
  .hud-top { padding: 16px 16px 50px; }
  .hud-stats { gap: 16px; }
  .memories-count { font-size: 20px; }
  #dialog-box { padding: 18px; gap: 14px; }
  .dialog-portrait { width: 60px; height: 60px; }
  .dialog-text { font-size: 15px; }
  .end-title { font-size: 36px; }
  .hud-controls { font-size: 11px; padding: 6px 12px; }
  .sb-title { font-size: 32px; }
  .sb-overline { font-size: 9px; letter-spacing: 2px; }
  #verbalizer { left: 8px; right: 8px; bottom: 64px; min-width: auto; max-width: none; padding: 8px 10px; }
  .verb-line { font-size: 11px; }
  #inventory-panel { padding: 20px; max-height: 90vh; }
  #constellation-canvas { height: 180px; }
  .end-content { padding: 32px 20px; }
  .end-text { font-size: 15px; }
  .pause-content { padding: 28px 24px; min-width: 280px; }
  .pause-content h2 { font-size: 24px; }
}
@media (max-width: 480px) {
  .display { font-size: 32px; }
  .sb-title { font-size: 26px; }
  .area-name { font-size: 18px; }
  .hud-stats { gap: 10px; flex-direction: column; align-items: flex-end; }
  #dialog-box { bottom: 16px; padding: 14px; }
  .dialog-text { font-size: 14px; min-height: 40px; }
  .dialog-portrait { width: 48px; height: 48px; }
  .hud-controls { font-size: 10px; }
}

/* =========================================================
   MOTION agent — landed 2026-04-30
   Additive only. Uses --tempo-fast / --ease-arrive tokens.
   ACK: FX agent (MOTION_NOTES.md ACK log) + Review agent
        (UPGRADE_NOTES.md round 2, MOTION authority for M2/M5/M6/M7).
   ========================================================= */

/* M2 — Tracked-out title reveal on area entry (= S5).
   Pairs with a 4-line trigger in setArea() pending Coder #1 ACK.
   CSS is dormant until JS toggles the .reveal class. */
.area-name { position: relative; display: inline-block; }
.area-name.reveal {
  animation: areaNameReveal var(--tempo-fast) var(--ease-arrive) both;
}
.area-name.reveal::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--terracotta);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  animation: areaNameUnderline calc(var(--tempo-fast) * 1.6) var(--ease-arrive) 120ms forwards;
  box-shadow: 0 0 6px rgba(217,119,87,0.35);
  pointer-events: none;
}
@keyframes areaNameReveal {
  0%   { opacity: 0; letter-spacing: 0.4em; transform: translateY(2px); filter: blur(2px); }
  60%  { opacity: 1; }
  100% { opacity: 1; letter-spacing: -0.2px; transform: translateY(0); filter: blur(0); }
}
@keyframes areaNameUnderline {
  0%   { transform: translateX(-50%) scaleX(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateX(-50%) scaleX(1); opacity: 0.85; }
}

/* M2b — Sandbox banner: animate the .sb-line growing from center,
   synchronized to the existing 2.4s bannerIn animation. */
#sandbox-banner .sb-line {
  transform-origin: center;
  animation: sbLineGrow calc(var(--tempo-medium) * 0.75) var(--ease-arrive) 400ms both;
}
@keyframes sbLineGrow {
  0%   { transform: scaleX(0); opacity: 0; }
  20%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.6; }
}

/* M6 — Memory counter polish (= A7).
   Tabular numerals + bump animation triggered by JS toggling .bump
   on .memories-count. Pairs with tweenMemCount() in updateHUD()
   pending Coder #1 ACK. */
.memories-count {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  transition: color 220ms ease;
}
.memories-count.bump #mem-count {
  display: inline-block;
  animation: memCountBump var(--tempo-fast) var(--ease-arrive);
  color: var(--terracotta);
}
@keyframes memCountBump {
  0%   { transform: translateY(0)    scale(1);    color: var(--terracotta); }
  35%  { transform: translateY(-3px) scale(1.18); color: var(--coral); }
  100% { transform: translateY(0)    scale(1);    color: var(--near-black); }
}

/* M9 — Smoothness micro-polish on elements that currently snap. */
.time-pill {
  transition: color 240ms ease, transform 240ms var(--ease-arrive);
}
.hud-area .area-name { transition: color 240ms ease; }
.dialog-name { transition: opacity 220ms ease; }

/* M10 — :focus-visible rings (review agent's B7 — keyboard nav). */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
  transition: outline-offset 160ms var(--ease-arrive);
}

/* M7 — Reduced-motion overrides for the new motion above.
   The base block at line 995 already neutralizes most animations;
   this adds explicit static end-states for the new keyframes. */
@media (prefers-reduced-motion: reduce) {
  .area-name.reveal,
  .area-name.reveal::after { animation: none !important; }
  .area-name.reveal { letter-spacing: -0.2px; opacity: 1; filter: none; }
  .area-name.reveal::after {
    transform: translateX(-50%) scaleX(1);
    opacity: 0.7;
  }
  #sandbox-banner .sb-line {
    animation: none !important;
    transform: none;
    opacity: 0.7;
  }
  .memories-count.bump #mem-count {
    animation: none !important;
    transform: none;
    color: var(--near-black);
  }
}
/* ========================================================= */

/* ===== Mobile touch controls + safe-area + a11y contrast (masterpiece pass) ===== */
#touch-actions {
  display: none;                 /* shown only on coarse-pointer devices below */
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 40;
  flex-direction: column;
  gap: 10px;
}
.touch-btn {
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--serif, Georgia, serif);
  font-size: 15px;
  letter-spacing: 0.3px;
  color: #2a2724;
  background: rgba(250, 249, 245, 0.92);
  border: 1px solid rgba(217, 119, 87, 0.55);
  border-radius: 999px;
  padding: 12px 20px;
  min-width: 88px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.28);
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}
.touch-btn:active { background: rgba(217, 119, 87, 0.95); color: #faf9f5; transform: scale(0.96); }
#tb-jump { background: rgba(250, 249, 245, 0.78); }

/* Show touch buttons + hide the keyboard legend only on touch / no-hover devices */
@media (hover: none) and (pointer: coarse) {
  #touch-actions { display: flex; }
  .hud-controls { display: none; }
}

/* Safe-area: keep bottom-anchored chrome clear of the iOS home indicator/notch */
@supports (padding: env(safe-area-inset-bottom)) {
  #verbalizer { margin-bottom: env(safe-area-inset-bottom); }
  #dialog-box { margin-bottom: env(safe-area-inset-bottom); }
  .hud-top { padding-top: calc(env(safe-area-inset-top) + 12px); }
}

/* a11y contrast: lift the most-read narrative line + control legend toward AA */
#verbalizer { background: rgba(18, 18, 16, 0.92); }
.verb-line { color: #d8d6cc; }
.hud-controls { color: #3f3e3b; }

/* =========================================================
   VOXEL WORLD — Three.js canvas + 3D HUD (Minecraft-style)
   (replaces the old 2D game HUD; intro screen above is reused)
   ========================================================= */
#world-canvas { position: fixed; inset: 0; z-index: 0; display: block; }
#intro-screen { z-index: 100; }      /* keep intro above the world canvas while active */

#world-hud {
  position: fixed; inset: 0; z-index: 5;
  pointer-events: none; display: none;
  font-family: var(--sans);
}
#world-hud.on { display: block; }

/* crosshair */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 22px; transform: translate(-50%,-50%);
  opacity: 0.85;
}
#crosshair::before, #crosshair::after {
  content: ''; position: absolute; background: rgba(250,249,245,0.9);
  box-shadow: 0 0 2px rgba(0,0,0,0.6);
}
#crosshair::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
#crosshair::after  { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }

/* coordinate / time readout */
#info {
  position: absolute; top: 14px; left: 14px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.3px;
  color: #faf9f5; background: rgba(20,18,16,0.5);
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid rgba(217,119,87,0.35);
  white-space: nowrap;
}

/* transient toast (camera / fly state) */
#toast {
  position: absolute; top: 56px; left: 50%; transform: translate(-50%, -8px);
  font-family: var(--serif); font-size: 15px; color: #faf9f5;
  background: rgba(20,18,16,0.6); padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(217,119,87,0.4);
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* bottom cluster */
#hud-bottom {
  position: absolute; left: 0; right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#hotbar { display: flex; gap: 6px; pointer-events: auto; }
#hotbar .slot {
  position: relative; width: 46px; height: 46px; border-radius: 8px;
  background: rgba(20,18,16,0.45); border: 2px solid rgba(250,249,245,0.25);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
#hotbar .slot .sw {
  width: 28px; height: 28px; border-radius: 5px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.22), inset 0 0 0 1px rgba(0,0,0,0.25);
}
#hotbar .slot .num {
  position: absolute; top: 1px; left: 4px; font-size: 10px;
  font-family: var(--mono); color: rgba(250,249,245,0.7);
}
#hotbar .slot.on { border-color: var(--coral); transform: translateY(-4px); }
#block-name {
  font-family: var(--serif); font-size: 13px; color: #faf9f5;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7); min-height: 16px;
}
#controls-hint {
  font-size: 11px; color: rgba(250,249,245,0.78);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8); text-align: center;
  padding: 4px 10px;
}
#controls-hint kbd {
  font-family: var(--mono); font-size: 10px; background: rgba(250,249,245,0.16);
  border: 1px solid rgba(250,249,245,0.25); border-radius: 4px; padding: 1px 5px;
}
#controls-hint .sep { opacity: 0.4; margin: 0 2px; }

/* touch action buttons — coarse-pointer devices only */
#touch-actions {
  position: absolute; right: calc(14px + env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: none; flex-direction: column; gap: 10px; pointer-events: auto;
}
.touch-btn {
  -webkit-appearance: none; appearance: none;
  font-family: var(--serif); font-size: 15px; color: #2a2724;
  background: rgba(250,249,245,0.92); border: 1px solid rgba(217,119,87,0.55);
  border-radius: 999px; padding: 14px 18px; min-width: 78px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3); touch-action: manipulation; cursor: pointer;
}
.touch-btn.small { font-size: 13px; padding: 10px 14px; min-width: 60px; }
.touch-btn:active { background: rgba(217,119,87,0.95); color: #faf9f5; transform: scale(0.96); }

@media (hover: none) and (pointer: coarse) {
  #touch-actions { display: flex; }
  #controls-hint { display: none; }
}

/* pointer-lock pause overlay */
#pause-overlay {
  position: absolute; inset: 0; z-index: 6; display: none;
  align-items: center; justify-content: center;
  background: rgba(10,8,6,0.55); pointer-events: auto; cursor: pointer;
}
#pause-overlay.on { display: flex; }
#pause-overlay .po-card {
  text-align: center; color: #faf9f5; font-family: var(--serif);
  background: rgba(20,18,16,0.6); padding: 28px 40px; border-radius: 16px;
  border: 1px solid rgba(217,119,87,0.4);
}
#pause-overlay .po-title { font-size: 30px; letter-spacing: 0.3px; }
#pause-overlay .po-sub { font-size: 13px; opacity: 0.8; margin-top: 8px; font-family: var(--sans); }

/* cinematic intro flythrough */
#cine-fade {
  position: fixed; inset: 0; z-index: 110; background: #0e0a07;
  opacity: 0; pointer-events: none; transition: opacity 0.25s linear;
}
#cine-title {
  position: fixed; inset: 0; z-index: 111; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  pointer-events: none; opacity: 0; text-align: center;
  text-shadow: 0 2px 20px rgba(0,0,0,0.7);
}
#cine-title .ct-brand {
  font-family: var(--serif); font-weight: 700; color: #faf9f5;
  font-size: clamp(34px, 7vw, 76px); letter-spacing: 1px;
}
#cine-title .ct-sub { font-family: var(--sans); color: var(--coral); font-size: 15px; letter-spacing: 3px; text-transform: uppercase; }

/* crosshair target feedback + vignette */
#crosshair { transition: opacity 0.09s, transform 0.09s; }
#crosshair.target { opacity: 1; }
#crosshair.target::before, #crosshair.target::after { background: rgba(255,255,255,1); box-shadow: 0 0 3px rgba(0,0,0,0.8); }
#crosshair.target { transform: translate(-50%,-50%) scale(1.25); }
#vignette { position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 56%, rgba(0,0,0,0.34) 100%); }

/* NPC talk prompt */
#npc-prompt {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%);
  font-family: var(--serif); font-size: 14px; color: #faf9f5;
  background: rgba(20,18,16,0.6); padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(217,119,87,0.45); white-space: nowrap;
  opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
#npc-prompt.on { opacity: 1; }

/* Agent Arena panel */
#arena {
  position: absolute; top: 14px; right: 16px; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; gap: 3px; text-align: right;
  font-family: var(--sans); font-size: 13px; color: #faf9f5;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
#arena .ar-row { display: flex; align-items: center; justify-content: flex-end; gap: 7px; font-weight: 600; letter-spacing: 0.3px; }
#arena .ar-row b { font-family: var(--mono); font-weight: 700; }
#arena .ar-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
#arena .ar-you .ar-dot { background: #4a90d9; color: #4a90d9; }
#arena .ar-rival .ar-dot { background: #d94a4a; color: #d94a4a; }
#arena .ar-wave { font-size: 12px; font-family: var(--mono); color: var(--coral); font-weight: 700; letter-spacing: 0.5px; margin-top: 3px; }
#arena .ar-hint { font-size: 11px; opacity: 0.7; font-family: var(--mono); margin-top: 1px; }

/* Arena battle banner */
#arena-banner {
  position: fixed; inset: 0; z-index: 118; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; pointer-events: none;
  opacity: 0; transition: opacity 0.3s; text-align: center; text-shadow: 0 3px 24px rgba(0,0,0,0.8);
}
#arena-banner.on { opacity: 1; }
#arena-banner .ab-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: clamp(40px,8vw,86px); letter-spacing: 2px; }
#arena-banner .ab-sub { font-family: var(--sans); color: var(--coral); font-size: 16px; letter-spacing: 2px; text-transform: uppercase; }

/* roster / agency screen */
#roster-screen {
  position: fixed; inset: 0; z-index: 122; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto;
}
#roster-screen.on { display: flex; }
.rs-panel {
  background: rgba(28,25,22,0.96); border: 2px solid rgba(74,144,217,0.5);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 14px; max-width: 92vw; max-height: 86vh;
}
.rs-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 21px; letter-spacing: 0.3px; }
.rs-grid { display: grid; grid-template-columns: repeat(3, 200px); gap: 10px; overflow-y: auto; padding: 2px; }
.rs-empty { grid-column: 1 / -1; font-family: var(--sans); color: rgba(250,249,245,0.6); font-size: 14px; padding: 18px; text-align: center; }
.rs-card {
  position: relative; display: flex; align-items: center; gap: 11px;
  background: rgba(20,18,16,0.6); border: 1px solid rgba(250,249,245,0.14);
  border-radius: 10px; padding: 10px 12px;
}
.rs-chip { width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.22), inset 0 0 0 1px rgba(0,0,0,0.3); }
.rs-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rs-name { font-family: var(--serif); color: #faf9f5; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-role { font-family: var(--sans); color: rgba(74,144,217,0.95); font-size: 11px; }
.rs-stats { font-family: var(--mono); color: rgba(250,249,245,0.85); font-size: 12px; }
.rs-x {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; line-height: 18px;
  border-radius: 5px; border: none; cursor: pointer; font-size: 12px;
  background: rgba(217,74,74,0.25); color: #f3d0c8;
}
.rs-x:hover { background: rgba(217,74,74,0.7); color: #fff; }
.rs-hint { font-family: var(--sans); font-size: 12px; color: rgba(250,249,245,0.55); text-align: center; }
@media (max-width: 720px){ .rs-grid { grid-template-columns: repeat(2, 44vw); } }

/* build menu */
#build-menu {
  position: fixed; inset: 0; z-index: 124; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto;
}
#build-menu.on { display: flex; }
.bm-panel {
  background: rgba(28,25,22,0.96); border: 2px solid rgba(168,118,63,0.6);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 14px; max-width: 92vw;
}
.bm-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 21px; }
.bm-grid { display: grid; grid-template-columns: repeat(2, 160px); gap: 10px; }
.bm-card {
  text-align: left; cursor: pointer; border: 1px solid rgba(168,118,63,0.45);
  background: rgba(20,18,16,0.6); border-radius: 10px; padding: 14px 14px;
  display: flex; flex-direction: column; gap: 4px; transition: border-color 0.1s, background 0.1s;
}
.bm-card:hover { border-color: var(--coral); background: rgba(40,32,24,0.8); }
.bm-name { font-family: var(--serif); color: #faf9f5; font-size: 16px; font-weight: 700; }
.bm-desc { font-family: var(--sans); color: rgba(250,249,245,0.6); font-size: 12px; }
.bm-hint { font-family: var(--sans); font-size: 12px; color: rgba(250,249,245,0.5); text-align: center; }
@media (max-width: 720px){ .bm-grid { grid-template-columns: repeat(2, 40vw); } }

/* ---- Quest tracker (always-visible HUD card, top-left under #info) ---- */
#quest-tracker {
  position: absolute; top: 52px; left: 14px; z-index: 5; pointer-events: none;
  width: 224px; max-width: 56vw;
  background: rgba(20,18,16,0.5); border: 1px solid rgba(217,119,87,0.35);
  border-radius: 10px; padding: 9px 12px; color: #faf9f5;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
#quest-tracker:empty { display: none; }
.q-cap { font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--coral); }
.q-title { font-family: var(--serif); font-size: 16px; font-weight: 700; margin-top: 1px; }
.q-desc { font-family: var(--sans); font-size: 11.5px; color: rgba(250,249,245,0.82); margin-top: 2px; line-height: 1.3; }
.q-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,0.14); margin-top: 7px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--coral), #ffd47a); transition: width 0.3s ease; }
.q-prog { font-family: var(--mono); font-size: 10px; color: rgba(250,249,245,0.7); margin-top: 3px; }

/* ---- Quest journal overlay (J) ---- */
#quest-journal {
  position: fixed; inset: 0; z-index: 124; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto;
}
#quest-journal.on { display: flex; }
.qj-panel {
  background: rgba(28,25,22,0.96); border: 2px solid rgba(168,118,63,0.6);
  border-radius: 16px; padding: 22px 26px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 12px; width: 460px; max-width: 92vw; max-height: 80vh; overflow-y: auto;
}
.qj-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 22px; }
.qj-list { display: flex; flex-direction: column; gap: 8px; }
.qj-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: rgba(20,18,16,0.5); }
.qj-row.active { background: rgba(217,119,87,0.16); border: 1px solid rgba(217,119,87,0.5); }
.qj-row.locked { opacity: 0.45; }
.qj-mark { font-family: var(--mono); font-size: 16px; width: 16px; text-align: center; color: var(--coral); }
.qj-row.done .qj-mark { color: #7fd07f; }
.qj-t { font-family: var(--serif); color: #faf9f5; font-size: 15px; font-weight: 600; }
.qj-d { font-family: var(--sans); color: rgba(250,249,245,0.62); font-size: 12px; }
.qj-hint { font-family: var(--sans); font-size: 12px; color: rgba(250,249,245,0.5); text-align: center; }
@media (max-width: 720px){ #quest-tracker { width: 180px; top: 48px; } .qj-panel { width: 92vw; } }

/* ---- Agent Dispatch board (M) ---- */
#arena .ar-tok { color: #ffd47a; font-family: var(--mono); font-weight: 700; letter-spacing: 0.3px; }
#dispatch-screen {
  position: fixed; inset: 0; z-index: 124; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto;
}
#dispatch-screen.on { display: flex; }
.dp-panel {
  background: rgba(28,25,22,0.96); border: 2px solid rgba(168,118,63,0.6);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 14px; width: 560px; max-width: 94vw; max-height: 86vh; overflow-y: auto;
}
.dp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dp-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 22px; }
.dp-tok { font-family: var(--mono); font-size: 12px; color: #ffd47a; }
.dp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dp-card {
  text-align: left; cursor: pointer; border: 1px solid rgba(168,118,63,0.45);
  background: rgba(20,18,16,0.6); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px; transition: border-color 0.1s, background 0.1s; color: #faf9f5;
}
.dp-card:hover { border-color: var(--coral); background: rgba(40,32,24,0.8); }
.dp-ic { font-size: 20px; line-height: 1; }
.dp-n { font-family: var(--serif); font-size: 15px; font-weight: 700; }
.dp-d { font-family: var(--sans); font-size: 11.5px; color: rgba(250,249,245,0.62); }
.dp-meta { font-family: var(--mono); font-size: 10.5px; color: #ffd47a; margin-top: 2px; }
.dp-hire {
  cursor: pointer; border: 1px dashed rgba(74,144,217,0.7); background: rgba(74,144,217,0.12);
  color: #cfe6ff; border-radius: 10px; padding: 11px; font-family: var(--sans); font-size: 13.5px; font-weight: 600;
}
.dp-hire:hover { background: rgba(74,144,217,0.22); }
.dp-active { border-top: 1px solid rgba(168,118,63,0.35); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dp-acap { font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px; color: var(--coral); }
.dp-arow { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 12px; color: #faf9f5; }
.dp-arow > span:first-child { flex: 1; }
.dp-arow > span:last-child { font-family: var(--mono); color: rgba(250,249,245,0.7); }
.dp-bar { width: 120px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.14); overflow: hidden; }
.dp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--coral), #ffd47a); }
.dp-hint { font-family: var(--sans); font-size: 12px; color: rgba(250,249,245,0.5); text-align: center; }
.dp-up { border-top: 1px solid rgba(168,118,63,0.35); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.dp-ucard { border-color: rgba(74,144,217,0.4); }
.dp-ucard:hover { border-color: #6fb0ff; }
.dp-ucard.maxed { opacity: 0.55; cursor: default; }
.dp-ucard.maxed:hover { border-color: rgba(74,144,217,0.4); background: rgba(20,18,16,0.6); }
.dp-lv { font-family: var(--mono); font-size: 10px; color: #9fc7ff; font-weight: 400; }
.dp-ucard .dp-meta { color: #9fc7ff; }
@media (max-width: 720px){ .dp-panel { width: 94vw; } .dp-grid { grid-template-columns: 1fr; } }

/* hotbar stack count + tool marker */
#hotbar .slot .cnt {
  position: absolute; bottom: 1px; right: 4px; font-size: 12px; font-weight: 700;
  font-family: var(--mono); color: #faf9f5; text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
#hotbar .slot .sw.tool, .islot .sw.tool { border-radius: 2px; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.4); }

/* inventory + crafting screen */
#inv-screen {
  position: fixed; inset: 0; z-index: 120; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto;
}
#inv-screen.on { display: flex; }
.inv-panel {
  background: rgba(28,25,22,0.96); border: 2px solid rgba(217,119,87,0.5);
  border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 14px; max-width: 94vw;
}
.inv-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 22px; letter-spacing: 0.4px; }
.inv-craftrow { display: flex; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(250,249,245,0.12); }
.inv-arrow { font-size: 26px; color: rgba(250,249,245,0.6); }
.inv-grid { display: grid; gap: 5px; }
.inv-grid.g1 { grid-template-columns: repeat(1, 46px); }
.inv-grid.g2 { grid-template-columns: repeat(2, 46px); }
.inv-grid.g3 { grid-template-columns: repeat(3, 46px); }
.inv-grid.g9 { grid-template-columns: repeat(9, 46px); }
.inv-hot { margin-top: 4px; padding-top: 10px; border-top: 1px solid rgba(250,249,245,0.12); }
.islot {
  position: relative; width: 46px; height: 46px; border-radius: 7px;
  background: rgba(20,18,16,0.55); border: 2px solid rgba(250,249,245,0.18);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.islot:hover { border-color: rgba(217,119,87,0.7); background: rgba(40,36,32,0.7); }
.islot.result { border-color: rgba(217,119,87,0.6); background: rgba(40,30,24,0.7); }
.islot .sw { width: 28px; height: 28px; border-radius: 5px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.22), inset 0 0 0 1px rgba(0,0,0,0.25); }
.islot .cnt { position: absolute; bottom: 1px; right: 4px; font-size: 12px; font-weight: 700;
  font-family: var(--mono); color: #faf9f5; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.inv-hint { font-family: var(--sans); font-size: 12px; color: rgba(250,249,245,0.55); text-align: center; }
#inv-cursor {
  position: fixed; z-index: 130; width: 30px; height: 30px; border-radius: 5px;
  transform: translate(-50%,-50%); pointer-events: none; display: none;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.22), inset 0 0 0 1px rgba(0,0,0,0.4);
  font: 700 12px var(--mono); color: #faf9f5; text-align: right;
  line-height: 42px; padding-right: 3px; text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

/* vitals: hearts + hunger */
#vitals { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; pointer-events: none; }
#vitals .v-row { display: flex; gap: 1px; }
#vitals #v-food { justify-content: flex-end; }
#vitals .pip { font-size: 17px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.85)); }
#vitals .pip.full { opacity: 1; }
#vitals .pip.half { opacity: 0.55; }
#vitals .pip.empty { opacity: 0.16; filter: grayscale(0.7) drop-shadow(0 1px 1px rgba(0,0,0,0.85)); }

/* red damage flash */
#hurt {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(180,20,20,0) 40%, rgba(170,10,10,0.6) 100%);
}

/* sleep / Rest Node checkpoint fade — cosmetic only */
#sleep-fade {
  position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: #0a0d1a;
}

/* floating damage numbers (juice) */
#dmg-layer { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.dmg-float {
  position: absolute; transform: translate(-50%,-50%);
  color: #ffd24a; font: 800 18px/1 ui-sans-serif, system-ui, sans-serif;
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,0.6);
  animation: dmgrise 0.9s ease-out forwards;
}
@keyframes dmgrise {
  from { opacity: 1; transform: translate(-50%,-50%); }
  to   { opacity: 0; transform: translate(-50%,-180%); }
}

/* Night Siege HUD pip — steady glow (no pulse) */
#siege-pip {
  position: absolute; top: 54px; left: 50%; transform: translateX(-50%);
  z-index: 30; display: none; padding: 5px 14px; border-radius: 999px;
  background: rgba(150,20,20,0.82); color: #ffdada;
  font: 800 12px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.08em;
  box-shadow: 0 0 16px rgba(220,40,40,0.7); border: 1px solid rgba(255,120,120,0.4);
}
#siege-pip.on { display: block; }

/* death overlay */
#death-overlay {
  position: fixed; inset: 0; z-index: 140; display: none;
  align-items: center; justify-content: center;
  background: rgba(40,6,6,0.55); backdrop-filter: blur(2px);
}
#death-overlay.on { display: flex; }
#death-overlay .do-card {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: rgba(20,12,10,0.85); border: 2px solid rgba(180,40,40,0.5);
  border-radius: 16px; padding: 36px 48px; box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
#death-overlay .do-title { font-family: var(--serif); font-weight: 700; color: #f3d0c8; font-size: 40px; letter-spacing: 0.5px; }
#death-overlay .do-sub { font-family: var(--sans); color: rgba(243,208,200,0.75); font-size: 14px; }
#death-overlay .do-hint { font-family: var(--mono); color: rgba(243,208,200,0.5); font-size: 12px; }

/* ---- Furnace / smelting overlay ---- */
#furnace-screen { position: fixed; inset: 0; z-index: 122; display: none; align-items: center; justify-content: center; background: rgba(12,10,8,0.66); backdrop-filter: blur(3px); pointer-events: auto; }
#furnace-screen.on { display: flex; }
.fz-panel { background: rgba(28,25,22,0.96); border: 2px solid rgba(168,118,63,0.6); border-radius: 16px; padding: 22px 26px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 12px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.fz-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 22px; text-align: center; }

/* Memory Bank storage overlay — skins the furnace panel; slots reuse .inv-grid/.islot */
#membank-screen { position: fixed; inset: 0; z-index: 122; display: none; align-items: center; justify-content: center; background: rgba(8,12,14,0.66); backdrop-filter: blur(3px); pointer-events: auto; }
#membank-screen.on { display: flex; }
.mb-panel { background: rgba(22,26,28,0.96); border: 2px solid rgba(47,214,230,0.45); border-radius: 16px; padding: 22px 26px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 12px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.mb-title { font-family: var(--serif); font-weight: 700; color: #eafcff; font-size: 22px; text-align: center; }
.mb-store { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(47,214,230,0.22); }
.fz-row { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 6px 0 10px; }
.fz-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fz-flame { font-size: 18px; opacity: 0.22; filter: grayscale(1); }
.fz-flame.lit { opacity: 1; filter: none; text-shadow: 0 0 10px rgba(255,150,60,0.8); }
.fz-arrow { width: 84px; height: 10px; border-radius: 5px; background: rgba(255,255,255,0.12); overflow: hidden; }
.fz-prog { height: 100%; background: linear-gradient(90deg, var(--coral), #ffd47a); }

/* ---- Weather: rain overlay (toggled while a storm is active) ---- */
#weather { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
#weather.on { opacity: 1; }
#weather::before {
  content: ''; position: absolute; inset: -20%;
  background:
    repeating-linear-gradient(105deg, rgba(190,210,235,0) 0 6px, rgba(190,210,235,0.16) 6px 7px, rgba(190,210,235,0) 7px 13px),
    repeating-linear-gradient(102deg, rgba(210,225,245,0) 0 10px, rgba(210,225,245,0.10) 10px 11px, rgba(210,225,245,0) 11px 22px);
  animation: rainfall 0.5s linear infinite;
}
#weather::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(20,28,40,0) 30%, rgba(14,20,32,0.45) 100%); }
@keyframes rainfall { from { transform: translateY(-12%) } to { transform: translateY(12%) } }
@media (prefers-reduced-motion: reduce){ #weather::before { animation: none; } }

/* ---- Victory / ending overlay (clear wave 10) ---- */
#victory-overlay {
  position: fixed; inset: 0; z-index: 142; display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40,30,12,0.78), rgba(8,8,10,0.92));
  backdrop-filter: blur(3px);
}
#victory-overlay.on { display: flex; }
.vo-card {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: 560px; padding: 40px 44px;
  background: rgba(20,18,16,0.9); border: 2px solid rgba(255,200,120,0.5);
  border-radius: 18px; box-shadow: 0 28px 90px rgba(0,0,0,0.65), 0 0 60px rgba(255,180,80,0.18);
}
.vo-cap { font-family: var(--mono); font-size: 12px; letter-spacing: 2.4px; color: #ffd47a; }
.vo-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 34px; line-height: 1.1; }
.vo-text { font-family: var(--sans); color: rgba(250,249,245,0.82); font-size: 14.5px; line-height: 1.55; margin: 0; }
.vo-text.quiet { color: rgba(250,249,245,0.55); font-style: italic; }
.vo-card .btn { margin-top: 8px; }

/* ====================================================================== */
/* THE WORD — Listening World: Lucidity meter, prompt console, Codex      */
/* Lucidity = the model's attention → violet, distinct from the coral/⊙   */
/* ====================================================================== */
#lucidity { display: flex; align-items: center; gap: 7px; margin: 0 0 8px 2px; font-family: var(--mono); color: #c3acff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); max-width: 232px; }
#lucidity:empty { display: none; }
.lx-ic { font-size: 13px; color: #a98bff; }
.lx-bar { flex: 1; height: 6px; border-radius: 4px; background: rgba(255,255,255,0.14); overflow: hidden; min-width: 124px; box-shadow: inset 0 0 0 1px rgba(150,120,255,0.25); }
.lx-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7a5cff, #b9a3ff); transition: width 0.25s ease; }
.lx-num { font-size: 11px; color: rgba(232,226,255,0.9); min-width: 16px; text-align: right; }

#word-console { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(14px); z-index: 130; width: 544px; max-width: 94vw; opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.22s var(--ease-arrive); }
#word-console.on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.wc-card { background: rgba(22,20,28,0.95); border: 2px solid rgba(150,120,255,0.55); border-radius: 16px; padding: 14px 16px; box-shadow: 0 24px 80px rgba(0,0,0,0.62), 0 0 44px rgba(120,90,255,0.16); display: flex; flex-direction: column; gap: 8px; }
.wc-cap { font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px; color: #b9a3ff; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wc-cap b { color: #fff; font-weight: 700; }
#wc-close { background: transparent; border: 1px solid rgba(150,120,255,0.3); color: #b9a3ff; border-radius: 6px; width: 24px; height: 22px; line-height: 1; cursor: pointer; font-size: 12px; padding: 0; }
#wc-close:hover { border-color: #9a7bff; color: #fff; background: rgba(150,120,255,0.14); }
.wc-row { display: flex; align-items: center; gap: 10px; }
.wc-prompt { font-family: var(--serif); font-size: 24px; color: #8a6cff; line-height: 1; opacity: 0.8; }
#word-input { flex: 1; background: rgba(10,8,15,0.72); border: 1px solid rgba(150,120,255,0.35); border-radius: 10px; padding: 11px 13px; color: #faf9f5; font-family: var(--serif); font-size: 17px; outline: none; }
#word-input:focus { border-color: #9a7bff; box-shadow: 0 0 0 3px rgba(120,90,255,0.18); }
#word-input::placeholder { color: rgba(200,190,235,0.42); font-style: italic; }
.wc-suggest { display: none; flex-wrap: wrap; gap: 6px; align-items: center; }
.wc-suggest.on { display: flex; }
.wc-chip { font-family: var(--mono); font-size: 11.5px; color: #d8caff; background: rgba(150,120,255,0.14); border: 1px solid rgba(150,120,255,0.32); border-radius: 999px; padding: 3px 11px; cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.wc-chip:hover { background: rgba(150,120,255,0.26); border-color: #9a7bff; color: #fff; }
.wc-undisc { font-family: var(--mono); font-size: 10px; font-style: italic; color: rgba(185,163,235,0.55); margin-left: 2px; }
.wc-echo { font-family: var(--serif); font-size: 14.5px; font-style: italic; color: #e8e6dc; min-height: 21px; line-height: 1.35; }
.wc-hint { font-family: var(--sans); font-size: 11px; color: rgba(222,216,238,0.5); }
.wc-hint kbd { font-family: var(--mono); font-size: 10px; background: rgba(150,120,255,0.18); border: 1px solid rgba(150,120,255,0.3); border-radius: 4px; padding: 1px 5px; color: #cdbcff; }

#weave-flash { position: fixed; inset: 0; z-index: 119; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 62%, rgba(150,120,255,0.20), transparent 62%); }
#weave-flash.on { animation: weaveflash 0.62s var(--ease-depart); }
#weave-flash.low { animation: weavelow 0.4s ease-out; background: radial-gradient(circle at 50% 62%, rgba(255,120,90,0.16), transparent 62%); }
@keyframes weaveflash { 0% { opacity: 0; } 28% { opacity: 1; } 100% { opacity: 0; } }
@keyframes weavelow { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

#codex-screen { position: fixed; inset: 0; z-index: 126; display: none; align-items: center; justify-content: center; background: rgba(10,8,14,0.72); backdrop-filter: blur(4px); pointer-events: auto; }
#codex-screen.on { display: flex; }
.cx-panel { background: rgba(24,21,30,0.97); border: 2px solid rgba(150,120,255,0.5); border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 80px rgba(0,0,0,0.62); display: flex; flex-direction: column; gap: 15px; width: 700px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.cx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cx-title { font-family: var(--serif); font-weight: 700; color: #faf9f5; font-size: 23px; }
.cx-tok { font-family: var(--mono); font-size: 12px; color: #b9a3ff; }
.cx-close { background: transparent; border: 1px solid rgba(150,120,255,0.3); color: #b9a3ff; border-radius: 7px; min-width: 30px; height: 28px; line-height: 1; cursor: pointer; font-size: 13px; padding: 0 6px; flex: 0 0 auto; }
.cx-close:hover { border-color: #9a7bff; color: #fff; background: rgba(150,120,255,0.14); }
.cx-cat { display: flex; flex-direction: column; gap: 7px; }
.cx-cap { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.4px; color: #9a7bff; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.cx-cap span { color: rgba(232,226,255,0.5); }
.cx-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cx-w { border: 1px solid rgba(150,120,255,0.16); background: rgba(16,14,21,0.6); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 52px; }
.cx-w.got { border-color: rgba(150,120,255,0.45); background: rgba(31,27,42,0.72); }
.cx-w.got.rare { border-color: rgba(255,212,122,0.6); background: rgba(40,34,24,0.6); box-shadow: 0 0 18px rgba(255,200,90,0.08); }
.cx-w.rare:not(.got) { border-color: rgba(255,212,122,0.22); }
.cx-k { font-family: var(--serif); font-size: 15px; font-weight: 700; color: #faf9f5; text-transform: capitalize; }
.cx-w.got.rare .cx-k { color: #ffd47a; }
.cx-w:not(.got) .cx-k { color: rgba(200,190,235,0.5); letter-spacing: 2px; }
.cx-f { font-family: var(--serif); font-size: 11.5px; font-style: italic; color: rgba(232,230,220,0.82); line-height: 1.3; }
.cx-f.hint { color: rgba(185,163,235,0.55); }
.cx-c { font-family: var(--mono); font-size: 9.5px; color: #b9a3ff; margin-top: 1px; }
/* Forbidden Words — the shadow in the Codex */
.cx-w.forbidden { border-color: rgba(200,70,60,0.22); }
.cx-w.got.forbidden { border-color: rgba(210,80,66,0.6); background: rgba(40,18,16,0.66); box-shadow: 0 0 18px rgba(200,50,40,0.08); }
.cx-w.got.forbidden .cx-k { color: #e0726a; }
.cx-w.got.forbidden .cx-c { color: #d98178; }
.cx-w.forbidden:not(.got) .cx-k { color: rgba(210,120,110,0.5); }
.cx-hint { font-family: var(--sans); font-size: 12px; color: rgba(222,216,238,0.5); text-align: center; }
@media (max-width: 720px) { .cx-grid { grid-template-columns: 1fr; } .cx-panel { width: 94vw; } #word-console { bottom: 124px; width: 96vw; } #lucidity { max-width: 180px; } .lx-bar { min-width: 86px; } }

/* Whispers of the World — the model asks you for something, in its own voice */
#whisper { position: absolute; top: 64px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 6; width: 460px; max-width: 80vw; pointer-events: none; opacity: 0; transition: opacity 0.35s ease, transform 0.35s var(--ease-arrive); text-align: center; }
#whisper.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#whisper:empty { display: none; }
.wh-cap { font-family: var(--mono); font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: #b9a3ff; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.wh-say { font-family: var(--serif); font-size: 18px; font-style: italic; color: #f3f0ff; line-height: 1.32; margin-top: 3px; text-shadow: 0 2px 10px rgba(0,0,0,0.85), 0 0 22px rgba(120,90,255,0.25); }
.wh-hint { font-family: var(--sans); font-size: 11px; color: rgba(200,190,235,0.72); margin-top: 5px; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
@media (max-width: 720px) { #whisper { top: 92px; width: 90vw; } .wh-say { font-size: 15px; } }
