/* ============================================================
   world.css — Die begehbare Welt als Canvas-Raycaster
   ki-visibility.com · Schicht 1/2 (Erlebnis-Ebene)
   Klickbare Wand-Panels = Core-Seiten. Hover = Glühen.
   Klick = scrollbarer Reader mit echtem Seiteninhalt.
   Der Raycaster ist reiner KONSUMENT der flachen HTML-Liste.
   ============================================================ */

#world {
  position: fixed; inset: 0; z-index: 50;
  background: #02030a;
  overflow: hidden;
}

#world { touch-action: none; }
#world canvas {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges;
  cursor: grab; touch-action: none;
}
#world.grabbing canvas { cursor: grabbing; }
#world.pointer canvas { cursor: pointer; }

/* Leuchtender Bogen/Rahmen um die Welt (Hologramm-Portal, à la badde.org) */
#world .world-frame {
  position: absolute; inset: 16px; border-radius: 20px; pointer-events: none; z-index: 2;
  border: 2px solid rgba(111, 208, 255, 0.85);
  box-shadow:
    0 0 18px rgba(55, 166, 255, 0.5),
    0 0 55px rgba(55, 166, 255, 0.26),
    inset 0 0 45px rgba(55, 166, 255, 0.12);
  animation: frameGlow 3.8s ease-in-out infinite;
}
/* Glühende Eckwinkel */
#world .world-frame::before, #world .world-frame::after {
  content: ""; position: absolute; width: 30px; height: 30px;
  border: 2px solid var(--accent-bright);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
#world .world-frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 20px 0 0 0; }
#world .world-frame::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 20px 0; }
@keyframes frameGlow {
  0%, 100% { box-shadow: 0 0 16px rgba(55,166,255,0.45), 0 0 48px rgba(55,166,255,0.20), inset 0 0 40px rgba(55,166,255,0.10); }
  50%      { box-shadow: 0 0 28px rgba(111,208,255,0.75), 0 0 84px rgba(55,166,255,0.40), inset 0 0 56px rgba(55,166,255,0.16); }
}

/* Vignette + Scanlines im Buch-Look (leichtes Retro-Grain) */
#world .fx {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 120% at 50% 48%, transparent 55%, rgba(0,0,0,0.55) 100%);
}
#world .fx::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.22) 2px 3px);
  mix-blend-mode: multiply; opacity: 0.5;
}

/* ---------------- HUD ---------------- */
#world .hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#world .hud-top { position: absolute; top: 1rem; left: 1rem; }
#world .world-title { font-family: var(--font-display); color: #fff; font-size: 1.05rem; text-shadow: 0 2px 20px rgba(0,0,0,0.9); }
#world .world-title span { color: var(--accent-bright); display: block; font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; }

#world .hud-help {
  position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  pointer-events: auto;
  background: rgba(6,10,28,0.82); border: 1px solid var(--line); backdrop-filter: blur(8px);
  border-radius: 99px; padding: 0.5rem 1.1rem; font-size: 0.8rem; color: var(--ink-soft);
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; max-width: 92vw;
}
#world .hud-help kbd {
  font-family: var(--font-mono); background: rgba(55,166,255,0.16); color: #fff;
  padding: 0.1rem 0.42rem; border-radius: 5px; border: 1px solid var(--line); font-size: 0.76rem;
}

#world .aim-label {
  position: absolute; left: 50%; top: 54%; transform: translateX(-50%);
  pointer-events: none; color: var(--gold); font-family: var(--font-display);
  font-size: 1.05rem; text-shadow: 0 0 16px rgba(255,212,121,0.7); opacity: 0;
  transition: opacity 0.12s; white-space: nowrap;
}
#world.pointer .aim-label { opacity: 1; }

#world .exit-world { position: absolute; right: 1rem; top: 1rem; pointer-events: auto; z-index: 4; }

/* ---------------- Reader (aufziehendes, scrollbares Panel) ---------------- */
#reader {
  position: absolute; z-index: 6; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: min(760px, 92vw); max-height: 84vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13,21,48,0.98), rgba(7,11,30,0.98));
  border: 1px solid rgba(111,208,255,0.45); border-radius: var(--radius);
  box-shadow: 0 40px 120px -20px #000, 0 0 80px -12px var(--accent-glow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(.2,.9,.3,1.2);
}
#reader.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

/* Glass: durchscheinend, die Welt bleibt dahinter sichtbar (Welt-Eintritt) */
#reader.glass {
  background: linear-gradient(180deg, rgba(13,21,48,0.62), rgba(7,11,30,0.62));
  backdrop-filter: blur(9px) saturate(1.1);
  -webkit-backdrop-filter: blur(9px) saturate(1.1);
  border-color: rgba(111,208,255,0.6);
}
#reader.glass .reader-head, #reader.glass .reader-actions { border-color: rgba(111,208,255,0.18); }

.reader-head {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.3rem 1.5rem 0.9rem; border-bottom: 1px solid var(--line);
}
.reader-head .reader-num { font-family: var(--font-mono); color: var(--accent-bright); font-size: 0.85rem; }
.reader-head h3 { margin: 0.2rem 0 0; color: #fff; font-size: 1.5rem; }
.reader-head .close-reader {
  margin-left: auto; background: none; border: 0; color: var(--muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0.2rem;
}
.reader-head .close-reader:hover { color: #fff; }

.reader-body {
  padding: 1.2rem 1.5rem; overflow-y: auto; overscroll-behavior: contain;
  color: var(--ink-soft); scrollbar-width: thin; scrollbar-color: var(--accent-deep) transparent;
}
.reader-body::-webkit-scrollbar { width: 10px; }
.reader-body::-webkit-scrollbar-thumb { background: var(--accent-deep); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.reader-body h1, .reader-body h2, .reader-body h3 { color: var(--ink); }
.reader-body h1 { font-size: 1.5rem; }
.reader-body .hero { padding: 0; }
.reader-body .answer-box { margin-top: 0; }
.reader-body .soon { color: var(--gold); font-weight: 600; }
.reader-body .loading { color: var(--muted); }

.reader-actions {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  padding: 1rem 1.5rem 1.3rem; border-top: 1px solid var(--line);
}

/* Produkt-Hologramm (Shirt-Power-Up) — Hover-Preview, blockt den Canvas-Hover nicht */
#shirt-holo {
  position: absolute; right: 1rem; top: 50%; z-index: 5;
  width: min(360px, 42vw); pointer-events: none;
  transform: translateY(-50%) translateX(24px); opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
#shirt-holo.show { opacity: 1; transform: translateY(-50%) translateX(0); }
#shirt-holo .sh-card {
  max-height: 86vh; overflow: hidden;
  background: linear-gradient(180deg, rgba(13,21,48,0.85), rgba(7,11,30,0.85));
  backdrop-filter: blur(11px) saturate(1.1); -webkit-backdrop-filter: blur(11px) saturate(1.1);
  border: 1px solid rgba(111,208,255,0.5); border-radius: 14px;
  box-shadow: 0 0 70px -12px var(--accent-glow), 0 24px 70px -20px #000;
  padding: 1rem 1.15rem; color: var(--ink-soft); font-size: 0.82rem; line-height: 1.5;
}
#shirt-holo .sh-img { width: 118px; float: right; margin: 0 0 0.5rem 0.8rem; border-radius: 10px; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5)); }
#shirt-holo h3 { color: #fff; font-size: 1.05rem; margin: 0.1rem 0 0.3rem; line-height: 1.2; }
#shirt-holo .sh-price { color: var(--gold); font-weight: 700; font-family: var(--font-mono); font-size: 1rem; }
#shirt-holo .sh-tag { color: var(--accent-bright); font-style: italic; margin: 0.4rem 0; }
#shirt-holo .sh-h { color: #fff; font-weight: 700; margin: 0.6rem 0 0.2rem; }
#shirt-holo ul { margin: 0.2rem 0 0.4rem 1.05rem; padding: 0; }
#shirt-holo li { margin: 0.14rem 0; }
#shirt-holo .sh-meta { color: var(--muted); font-size: 0.72rem; margin-top: 0.5rem; }
#shirt-holo .sh-cta { color: var(--gold); font-weight: 700; margin-top: 0.5rem; }
@media (max-width: 640px) { #shirt-holo { display: none; } }

/* ---------------- Touch-Steuerung (Mobil) ---------------- */
.mobile-controls { position: absolute; inset: 0; z-index: 62; pointer-events: none; display: none; }
#world.has-touch .mobile-controls { display: block; }
#world.has-touch .hud-help { display: none; }              /* Tastatur-Hinweise weg auf Touch */
.mobile-controls .mc {
  pointer-events: auto; position: absolute;
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.3rem; line-height: 1; color: #eaf0ff;
  background: rgba(10,18,42,0.6); border: 1px solid rgba(111,208,255,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; cursor: pointer;
}
.mobile-controls .mc:active { background: rgba(55,166,255,0.5); border-color: var(--accent-bright); transform: scale(0.94); }
/* Steuerkreuz unten links: vor/zurück + strafen */
.mc-pad { position: absolute; left: 14px; bottom: 96px; width: 156px; height: 156px; }
.mc-pad .mc { width: 52px; height: 52px; }
.mc-fwd   { left: 52px; top: 0; }
.mc-left  { left: 0; top: 52px; }
.mc-right { right: 0; top: 52px; }
.mc-back  { left: 52px; bottom: 0; }
/* Drehen unten rechts, über dem 2D/3D-Umschalter */
.mc-turn { position: absolute; right: 14px; bottom: 96px; display: flex; gap: 12px; }
.mc-turn .mc { position: static; }   /* als Flex-Kinder, nicht absolut */

/* Loader */
#world .world-loading {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 8;
  color: var(--ink-soft); font-family: var(--font-display); font-size: 1.1rem;
  background: rgba(2,3,10,0.7);
}
#world .world-loading.hidden { display: none; }

@media (max-width: 640px) {
  #world .hud-help { font-size: 0.72rem; gap: 0.6rem; padding: 0.45rem 0.8rem; }
  .reader-head h3 { font-size: 1.25rem; }
}
