:root {
  --cyan: #00ffff;
  --magenta: #ff00ff;
  --yellow: #ffff00;
  --red: #ff0022;
  --green: #00ff41;
  --violet: #7b00ff;
  --gold: #ffd700;
  --ghost: rgba(0,255,255,0.08);
  --dark: #02020a;
  --panel: #05050f;
  --border: #0d0d1e;
  --text: #c8ffc8;
  --dim: #2a4a2a;
  --offering-glow: rgba(255, 215, 0, 0.6);
  --shrine-ambient: rgba(100, 0, 255, 0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; scroll-behavior: smooth; }

body {
  background-color: var(--dark);
  background-image:
    radial-gradient(circle at 50% 50%, rgba(60,0,120,0.12) 0%, transparent 70%),
    radial-gradient(circle at 20% 80%, rgba(0,80,120,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(120,0,80,0.08) 0%, transparent 50%);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='5' fill='none' stroke='%2300ffff' stroke-width='1' opacity='0.8'/%3E%3Cline x1='12' y1='0' x2='12' y2='8' stroke='%2300ffff' stroke-width='1'/%3E%3Cline x1='12' y1='16' x2='12' y2='24' stroke='%2300ffff' stroke-width='1'/%3E%3Cline x1='0' y1='12' x2='8' y2='12' stroke='%2300ffff' stroke-width='1'/%3E%3Cline x1='16' y1='12' x2='24' y2='12' stroke='%2300ffff' stroke-width='1'/%3E%3Ccircle cx='12' cy='12' r='1.5' fill='%2300ffff'/%3E%3C/svg%3E") 12 12, crosshair;
}

/* ── STAR MAP BACKGROUND ── */
.star-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.star-field canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── CRT OVERLAYS ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.22) 0px,
    rgba(0,0,0,0.22) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9000;
  animation: scanline-drift 8s linear infinite;
}
@keyframes scanline-drift {
  0% { background-position: 0 0; }
  100% { background-position: 0 40px; }
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 255, 65, 0.018);
  pointer-events: none;
  z-index: 9001;
  animation: screenflicker 0.15s infinite;
}
@keyframes screenflicker {
  0%   { opacity: 1; }
  4%   { opacity: 0.94; }
  8%   { opacity: 1; }
  56%  { opacity: 1; }
  57%  { opacity: 0.85; }
  58%  { opacity: 1; }
  97%  { opacity: 1; }
  98%  { opacity: 0.9; }
  100% { opacity: 1; }
}

/* VHS noise overlay */
.vhs-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  animation: vhs-shift 0.08s steps(1) infinite;
}
@keyframes vhs-shift {
  0%   { transform: translateY(0); }
  20%  { transform: translateY(-1px); }
  40%  { transform: translateY(0.5px); }
  60%  { transform: translateY(1px); }
  80%  { transform: translateY(-0.5px); }
  100% { transform: translateY(0); }
}

/* ── HEADER ── */
.crt-header {
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
  z-index: 100;
  background: linear-gradient(180deg, rgba(2,2,10,0.98) 0%, rgba(5,5,20,0.95) 100%);
}

.blink-bar {
  background: rgba(0, 255, 255, 0.85);
  color: var(--dark);
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  padding: 3px 0;
  text-align: center;
  animation: blink-bg 1.4s step-end infinite;
}
@keyframes blink-bg { 50% { background: transparent; color: var(--cyan); } }

.marquee-wrap {
  background: rgba(0,0,0,0.9);
  border-top: 1px solid rgba(0, 255, 65, 0.2);
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
  padding: 4px 0;
  overflow: hidden;
  white-space: nowrap;
}
.marquee-inner {
  display: inline-block;
  animation: marquee 32s linear infinite;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--green);
  letter-spacing: 0.18em;
  opacity: 0.7;
}
@keyframes marquee {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

.header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 28px 40px;
  gap: 28px;
}
.header-sigil {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 3.5rem;
  color: var(--magenta);
  text-shadow: 0 0 30px var(--magenta), 0 0 60px rgba(255,0,255,0.3), 0 0 120px rgba(255,0,255,0.1);
  animation: sigil-pulse 4s ease-in-out infinite;
  line-height: 1;
}
@keyframes sigil-pulse {
  0%,100% { text-shadow: 0 0 30px var(--magenta), 0 0 60px rgba(255,0,255,0.3); color: var(--magenta); transform: scale(1); }
  50%      { text-shadow: 0 0 50px var(--cyan), 0 0 100px rgba(0,255,255,0.4), 0 0 200px rgba(0,255,255,0.1); color: var(--cyan); transform: scale(1.05); }
}

.header-text { text-align: center; }
.site-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--cyan);
  text-shadow: 3px 0 var(--magenta), -3px 0 var(--red), 0 0 40px rgba(0,255,255,0.4);
  line-height: 1;
  animation: title-glitch 9s infinite;
}
@keyframes title-glitch {
  0%,88%,100% { text-shadow:3px 0 var(--magenta),-3px 0 var(--red),0 0 40px rgba(0,255,255,0.4); transform:none; }
  89% { text-shadow:-8px 0 var(--magenta),8px 0 var(--red); transform:skewX(-3deg) translateX(4px); }
  90% { text-shadow:8px 0 var(--cyan),-8px 0 var(--yellow); transform:skewX(2deg) translateX(-3px); }
  91% { text-shadow:3px 0 var(--magenta),-3px 0 var(--red); transform:none; }
  93% { transform:skewX(-1deg); clip-path:inset(30% 0 40% 0); }
  94% { transform:none; clip-path:none; }
}
.site-sub {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--dim);
  letter-spacing: 0.35em;
  margin-top: 8px;
  opacity: 0.8;
}

.visit-counter { text-align: center; }
.counter-label {
  font-family: 'VT323', monospace;
  font-size: 0.65rem;
  color: var(--dim);
  letter-spacing: 0.2em;
  display: block;
  margin-bottom: 4px;
}
.counter-digits {
  background: #000;
  border: 1px solid rgba(0,255,65,0.4);
  color: var(--green);
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  padding: 4px 10px;
  letter-spacing: 0.15em;
  display: inline-block;
  text-shadow: 0 0 10px var(--green);
  box-shadow: 0 0 15px rgba(0,255,65,0.1) inset;
}

.notice-bar {
  background: repeating-linear-gradient(45deg, #06000d, #06000d 10px, #08001a 10px, #08001a 20px);
  border-top: 1px solid rgba(255,0,255,0.3);
  border-bottom: 1px solid rgba(255,0,255,0.3);
  padding: 10px 40px;
  font-family: 'VT323', monospace;
  font-size: 0.95rem;
  color: var(--magenta);
  text-align: center;
  letter-spacing: 0.15em;
  opacity: 0.9;
}
.notice-bar span { animation: blink-text 1.1s step-end infinite; }
@keyframes blink-text { 50% { opacity: 0; } }

/* ── NAV ── */
.nav-panel {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(0,0,0,0.8);
  overflow-x: auto;
  background: rgba(0,0,0,0.95);
  position: relative;
  z-index: 100;
}
.nav-btn {
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--dim);
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.04);
  padding: 12px 28px;
  cursor: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(0, 255, 65, 0.12);
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

/* ── STAT BAR ── */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 8px 40px;
  background: rgba(0,0,0,0.98);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: var(--dim);
  position: relative;
  z-index: 100;
}
.stat-bar .stat { color: var(--yellow); }

/* ── OFFERING TRAY ── */
.offering-chamber {
  position: relative;
  z-index: 200;
  background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(20,0,40,0.6) 50%, rgba(0,0,0,0.0) 100%);
  padding: 48px 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid rgba(123,0,255,0.2);
  overflow: hidden;
}
.offering-chamber::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(100,0,200,0.12) 0%, transparent 100%);
  pointer-events: none;
}

.offering-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(0,255,255,0.5);
  letter-spacing: 0.2em;
  text-align: center;
  opacity: 0.9;
  animation: title-breathe 5s ease-in-out infinite;
}
@keyframes title-breathe {
  0%,100% { opacity: 0.7; text-shadow: 0 0 20px rgba(0,255,255,0.3); }
  50%      { opacity: 1;   text-shadow: 0 0 40px rgba(0,255,255,0.7), 0 0 80px rgba(0,255,255,0.2); }
}

.offering-subtitle {
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  color: var(--dim);
  letter-spacing: 0.25em;
  text-align: center;
  margin-top: -20px;
}

/* Hologram entity */
.hologram-entity {
  position: relative;
  width: 200px;
  height: 260px;
  cursor: pointer;
}
.hologram-figure {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entity-glyph {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 7rem;
  color: rgba(0, 200, 255, 0.6);
  text-shadow:
    0 0 20px rgba(0,255,255,0.8),
    0 0 40px rgba(0,150,255,0.5),
    0 0 80px rgba(100,0,255,0.3);
  animation: entity-float 6s ease-in-out infinite, entity-flicker 8s step-end infinite;
  filter: blur(0.3px);
  position: relative;
  z-index: 2;
}
@keyframes entity-float {
  0%,100% { transform: translateY(0px) rotate(-1deg); }
  33%     { transform: translateY(-12px) rotate(0.5deg); }
  66%     { transform: translateY(-6px) rotate(1deg); }
}
@keyframes entity-flicker {
  0%,89%,91%,93%,100% { opacity: 1; }
  90%  { opacity: 0.4; filter: blur(1px) brightness(3); }
  92%  { opacity: 0.85; }
  94%  { opacity: 0.2; filter: blur(2px); }
}

.entity-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0,200,255,0.08) 0%, transparent 70%);
  animation: halo-pulse 5s ease-in-out infinite;
}
@keyframes halo-pulse {
  0%,100% { transform: scale(1); opacity: 0.5; }
  50%     { transform: scale(1.3); opacity: 1; }
}

.entity-rings {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}
.entity-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,255,255,0.12);
  animation: ring-expand 4s ease-in-out infinite;
}
.entity-ring:nth-child(1) { inset: 20%; animation-delay: 0s; }
.entity-ring:nth-child(2) { inset: 10%; animation-delay: -1.3s; border-color: rgba(255,0,255,0.08); }
.entity-ring:nth-child(3) { inset: 0%; animation-delay: -2.6s; border-color: rgba(123,0,255,0.06); }
@keyframes ring-expand {
  0%,100% { transform: scale(1) rotate(0deg); opacity: 0.4; }
  50%     { transform: scale(1.08) rotate(180deg); opacity: 1; }
}

.entity-state-label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  color: var(--cyan);
  letter-spacing: 0.3em;
  text-shadow: 0 0 8px var(--cyan);
  white-space: nowrap;
  opacity: 0.6;
  animation: blink-text 2s step-end infinite;
}

/* Entity state classes */
.hologram-entity.state-grief .entity-glyph {
  color: rgba(100, 0, 200, 0.7);
  text-shadow: 0 0 20px rgba(100,0,200,0.8), 0 0 40px rgba(50,0,100,0.5);
  animation: entity-float 8s ease-in-out infinite, entity-grief 12s ease-in-out infinite;
}
@keyframes entity-grief {
  0%,100% { filter: blur(0.3px) grayscale(0.3); transform: translateY(0) rotate(-1deg); }
  50%     { filter: blur(1px) grayscale(0.6); transform: translateY(-4px) rotate(0deg); }
}
.hologram-entity.state-worship .entity-glyph {
  color: rgba(255, 200, 0, 0.8);
  text-shadow: 0 0 30px rgba(255,200,0,0.9), 0 0 60px rgba(255,150,0,0.5), 0 0 100px rgba(255,100,0,0.2);
}
.hologram-entity.state-corruption .entity-glyph {
  color: rgba(255, 0, 50, 0.7);
  text-shadow: 0 0 20px rgba(255,0,50,0.9), 0 0 40px rgba(200,0,0,0.5);
  animation: entity-float 2s ease-in-out infinite, entity-corrupt 0.3s steps(1) infinite;
}
@keyframes entity-corrupt {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0,0) rotate(-1deg); }
  20%  { clip-path: inset(10% 0 50% 0); transform: translate(-3px,1px); }
  40%  { clip-path: inset(60% 0 5% 0); transform: translate(3px,-1px); }
  60%  { clip-path: inset(0 0 0 0); transform: translate(0,0); }
  80%  { clip-path: inset(20% 0 20% 0); transform: translate(2px,2px); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0,0) rotate(-1deg); }
}
.hologram-entity.state-transcendence .entity-glyph {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 40px rgba(255,255,255,0.8), 0 0 80px rgba(100,200,255,0.6), 0 0 160px rgba(200,100,255,0.4);
  animation: entity-float 10s ease-in-out infinite, transcend-spin 20s linear infinite;
}
@keyframes transcend-spin {
  0%   { filter: hue-rotate(0deg) brightness(1.2); }
  100% { filter: hue-rotate(360deg) brightness(1.2); }
}
.hologram-entity.state-nostalgia .entity-glyph {
  color: rgba(255, 150, 100, 0.6);
  text-shadow: 0 0 20px rgba(255,150,100,0.5), 0 0 40px rgba(200,100,50,0.3);
  filter: blur(0.8px) sepia(0.3);
}

/* Prophecy reveal */
.prophecy-display {
  max-width: 500px;
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  color: rgba(0,255,255,0.7);
  letter-spacing: 0.15em;
  line-height: 1.8;
  min-height: 60px;
  opacity: 0;
  transition: opacity 1s ease;
  border: 1px solid rgba(0,255,255,0.1);
  padding: 16px 24px;
  background: rgba(0,255,255,0.02);
  position: relative;
}
.prophecy-display.visible { opacity: 1; }
.prophecy-display::before {
  content: '◈ ';
  color: var(--magenta);
}
.prophecy-display::after {
  content: ' ◈';
  color: var(--magenta);
}

/* Offering tray */
.offering-tray-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 700px;
}

.offering-objects {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.offering-obj {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: grab;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  transition: all 0.3s ease;
  position: relative;
  user-select: none;
  min-width: 70px;
}
.offering-obj:hover {
  border-color: rgba(0,255,255,0.3);
  background: rgba(0,255,255,0.04);
  transform: translateY(-4px);
  box-shadow: 0 0 20px rgba(0,255,255,0.15), 0 8px 24px rgba(0,0,0,0.4);
}
.offering-obj:active { cursor: grabbing; }
.offering-obj.dragging {
  opacity: 0.3;
  pointer-events: none;
}

.obj-icon {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px currentColor);
  animation: obj-shimmer 3s ease-in-out infinite;
}
@keyframes obj-shimmer {
  0%,100% { filter: drop-shadow(0 0 4px rgba(255,255,255,0.3)); }
  50%      { filter: drop-shadow(0 0 12px rgba(255,255,255,0.7)) brightness(1.2); }
}
.obj-label {
  font-family: 'VT323', monospace;
  font-size: 0.65rem;
  color: var(--dim);
  letter-spacing: 0.15em;
  text-align: center;
}

/* Altar drop zone */
.altar-zone {
  width: 240px;
  height: 120px;
  border: 1px dashed rgba(0,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.3s ease;
  background: rgba(0,0,0,0.3);
}
.altar-zone::before,
.altar-zone::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-color: rgba(0,255,255,0.4);
  border-style: solid;
}
.altar-zone::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.altar-zone::after  { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.altar-zone.drag-over {
  border-color: var(--gold);
  border-style: solid;
  background: rgba(255,215,0,0.04);
  box-shadow: 0 0 30px rgba(255,215,0,0.2), inset 0 0 30px rgba(255,215,0,0.05);
}
.altar-zone-text {
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  color: rgba(0,255,255,0.3);
  letter-spacing: 0.2em;
  text-align: center;
  line-height: 1.6;
  pointer-events: none;
}
.altar-zone-sigil {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 2rem;
  color: rgba(0,255,255,0.15);
  pointer-events: none;
  animation: sigil-idle 6s ease-in-out infinite;
}
@keyframes sigil-idle {
  0%,100% { opacity: 0.2; transform: rotate(-2deg); }
  50%     { opacity: 0.5; transform: rotate(2deg); }
}
.altar-zone.has-offering .altar-zone-sigil { display: none; }
.altar-zone.has-offering .altar-zone-text  { display: none; }

/* Placed offerings display */
.placed-offerings {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  pointer-events: none;
}
.placed-icon {
  font-size: 1.4rem;
  animation: placed-float 3s ease-in-out infinite, placed-appear 0.5s ease;
  filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 0 4px rgba(255,255,255,0.5));
}
@keyframes placed-appear {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes placed-float {
  0%,100% { transform: translateY(0) scale(1); }
  50%     { transform: translateY(-5px) scale(1.05); }
}

/* Offering count */
.offering-log {
  font-family: 'VT323', monospace;
  font-size: 0.75rem;
  color: var(--dim);
  text-align: center;
  letter-spacing: 0.2em;
  opacity: 0.6;
}

/* Particle canvas */
#particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
}

/* ── GRID ── */
.reliquary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
  padding: 2px;
  background: #000;
  position: relative;
  z-index: 10;
}

/* ── SHRINE ITEM ── */
.shrine-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #03030a;
  cursor: inherit;
  animation: item-in 0.4s ease backwards;
}
@keyframes item-in {
  from { opacity:0; filter:brightness(4) saturate(0); transform: scale(0.95); }
  to   { opacity:1; filter:none; transform: scale(1); }
}

.shrine-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.6) contrast(1.15) brightness(0.9);
  transition: filter 0.3s;
}
.shrine-item:hover .shrine-img {
  animation: img-glitch 0.5s steps(1) infinite;
}
@keyframes img-glitch {
  0%   { filter:saturate(1.5) contrast(1.2) hue-rotate(0deg); transform:translate(0,0); }
  10%  { filter:saturate(2) contrast(1.5) hue-rotate(80deg); transform:translate(-3px,1px); clip-path:inset(10% 0 60% 0); }
  20%  { filter:saturate(1) contrast(1.1) hue-rotate(170deg); transform:translate(2px,-1px); clip-path:inset(0 0 0 0); }
  30%  { filter:saturate(1.8) hue-rotate(250deg); transform:translate(0,2px); }
  40%  { filter:saturate(1.3) contrast(1.3) hue-rotate(0deg); transform:translate(3px,0); clip-path:inset(60% 0 0 0); }
  50%  { filter:saturate(1.4) contrast(1.2); transform:translate(0,0); clip-path:inset(0 0 0 0); }
  60%  { transform:translate(-2px,-2px); filter:saturate(2) hue-rotate(120deg); }
  80%  { transform:translate(1px,3px); clip-path:inset(20% 0 30% 0); }
  100% { filter:saturate(1.4) contrast(1.2); transform:translate(0,0); clip-path:inset(0 0 0 0); }
}

.rgb-r, .rgb-b {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.1s;
}
.rgb-r { mix-blend-mode: screen; }
.rgb-b { mix-blend-mode: screen; }
.shrine-item:hover .rgb-r { opacity: 0.18; animation: rgb-r 0.4s steps(2) infinite; }
.shrine-item:hover .rgb-b { opacity: 0.18; animation: rgb-b 0.4s steps(2) infinite; }
@keyframes rgb-r {
  0%   { transform: translateX(-6px) translateY(0); }
  50%  { transform: translateX(-8px) translateY(2px); }
  100% { transform: translateX(-6px) translateY(0); }
}
@keyframes rgb-b {
  0%   { transform: translateX(6px) translateY(0); }
  50%  { transform: translateX(8px) translateY(-2px); }
  100% { transform: translateX(6px) translateY(0); }
}

.shrine-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.12) 3px, rgba(0,0,0,0.12) 4px);
  pointer-events: none;
  z-index: 3;
}

.shrine-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
}
.shrine-item:hover .shrine-hud { opacity: 1; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; }
.hud-corner {
  font-family: 'VT323', monospace;
  font-size: 0.7rem;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
  background: rgba(0,0,0,0.8);
  padding: 1px 4px;
}
.hud-status {
  font-family: 'VT323', monospace;
  font-size: 0.7rem;
  color: var(--green);
  background: rgba(0,0,0,0.8);
  padding: 1px 4px;
  animation: blink-text 0.7s step-end infinite;
}
.hud-bottom {
  background: rgba(0,0,0,0.9);
  border-top: 1px solid rgba(0,255,255,0.2);
  padding: 4px 6px;
}
.hud-name {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
}
.hud-meta {
  font-size: 0.6rem;
  color: var(--dim);
  letter-spacing: 0.08em;
  margin-top: 1px;
}

.shrine-item.glitch-burst .shrine-img {
  animation: img-glitch 0.25s steps(1) 1 !important;
}
.shrine-item.glitch-burst::after {
  content: 'ERR';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: var(--red);
  text-shadow: 0 0 10px var(--red);
  z-index: 10;
  pointer-events: none;
  letter-spacing: 0.3em;
}

/* Ambient mouse-parallax distortion on grid items */
.shrine-item { transform-style: preserve-3d; }
.shrine-item.parallax-tilt .shrine-img {
  transition: transform 0.1s ease-out;
}

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.lightbox.open { opacity: 1; pointer-events: all; }

.lb-window {
  background: var(--panel);
  border: 1px solid rgba(0,255,255,0.5);
  box-shadow: 0 0 0 1px #000, 0 0 60px rgba(0,255,255,0.15), inset 0 0 40px rgba(0,0,0,0.9);
  max-width: 88vw;
  animation: lb-in 0.3s ease;
}
@keyframes lb-in {
  from { transform: scale(0.93) skewX(-1deg); opacity:0; filter:brightness(5) saturate(0); }
  to   { transform: none; opacity:1; filter:none; }
}
.lb-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  padding: 4px 10px;
}
.lb-titlebar-text {
  font-family: 'VT323', monospace;
  font-size: 0.95rem;
  color: #000;
  letter-spacing: 0.1em;
}
.lb-controls { display: flex; gap: 4px; }
.lb-btn {
  width: 16px; height: 16px;
  background: #000;
  border: 1px solid #222;
  color: var(--cyan);
  font-size: 0.55rem;
  font-family: monospace;
  cursor: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.lb-btn:hover { background: var(--red); color: #fff; }
.lb-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lb-img-wrap { position: relative; }
.lb-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,255,255,0.015) 3px, rgba(0,255,255,0.015) 4px);
  pointer-events: none;
}
.lb-img {
  display: block;
  max-width: 70vw;
  max-height: 58vh;
  object-fit: contain;
}
.lb-img.glitching { animation: img-glitch 0.35s steps(1) 3; }
.lb-footer {
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.lb-name {
  font-family: 'VT323', monospace;
  font-size: 1.4rem;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
  letter-spacing: 0.15em;
}
.lb-data {
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  color: var(--dim);
  text-align: right;
  line-height: 1.9;
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding: 28px 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  background: rgba(0,0,0,0.98);
  margin-top: 2px;
  position: relative;
  z-index: 100;
}
.footer-block {
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 2.1;
}
.footer-block a { color: rgba(0,255,65,0.6); text-decoration: none; transition: color 0.2s; }
.footer-block a:hover { color: var(--green); text-shadow: 0 0 8px var(--green); }
.footer-webring {
  border: 1px solid rgba(255,255,255,0.06);
  padding: 10px 20px;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: var(--dim);
  text-align: center;
}
.footer-webring .blink { color: var(--magenta); animation: blink-text 1.8s step-end infinite; display: inline-block; }
.do-not-close { color: var(--red); animation: blink-text 0.9s step-end infinite; display: inline-block; }

/* ── AMBIENT GLOW OVERLAY (reacts to offerings) ── */
#ambient-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 2s ease, background 2s ease;
}

/* ── GHOST TRAIL ── */
.ghost-trail {
  position: fixed;
  width: 8px; height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9500;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
}

/* scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: rgba(0,255,255,0.3); }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .header-main { grid-template-columns: 1fr; text-align: center; padding: 20px; }
  .header-sigil, .visit-counter { display: none; }
  .offering-chamber { padding: 32px 16px 48px; }
  .reliquary { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}