/* GALDR COOL LAYER — matrix runes, glitch, CRT, stamp, 3D, audio cues */

/* ─── MATRIX RUNE CANVAS ──────────────────────────── */
#matrix-rune {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
  mix-blend-mode: screen;
}

/* ─── CRT SCANLINES ───────────────────────────────── */
#crt {
  position: fixed;
  inset: 0;
  z-index: 998;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0) 0px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.18) 3px,
      rgba(0,0,0,0) 4px
    );
  mix-blend-mode: multiply;
}
#crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
@keyframes crt-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.75; }
  94% { opacity: 1; }
  95% { opacity: 0.88; }
  96% { opacity: 1; }
}
html { animation: crt-flicker 7s infinite; }

/* ─── GLITCH TITLE ────────────────────────────────── */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-glitch);
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-shadow: inherit;
}
.glitch::before {
  left: 2px; text-shadow: -2px 0 #ff003c;
  clip-path: inset(0 0 55% 0);
  opacity: 0.85;
}
.glitch::after {
  left: -2px; text-shadow: 2px 0 #00ffe1;
  clip-path: inset(55% 0 0 0);
  opacity: 0.85;
}
.glitch.glitching::before {
  animation: glitch-top 0.32s cubic-bezier(.25,.46,.45,.94) both;
}
.glitch.glitching::after {
  animation: glitch-bot 0.32s cubic-bezier(.25,.46,.45,.94) both;
}
.glitch.glitching {
  animation: glitch-shake 0.32s steps(3) both;
}
@keyframes glitch-shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-3px, 1px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, 2px); }
  80% { transform: translate(2px, 0); }
}
@keyframes glitch-top {
  0% { clip-path: inset(0 0 55% 0); transform: translate(0,0); }
  30% { clip-path: inset(0 0 60% 0); transform: translate(-6px, 0); }
  60% { clip-path: inset(8% 0 45% 0); transform: translate(4px, -2px); }
  100% { clip-path: inset(0 0 55% 0); transform: translate(0,0); }
}
@keyframes glitch-bot {
  0% { clip-path: inset(55% 0 0 0); transform: translate(0,0); }
  30% { clip-path: inset(60% 0 0 0); transform: translate(6px, 0); }
  60% { clip-path: inset(45% 0 8% 0); transform: translate(-4px, 2px); }
  100% { clip-path: inset(55% 0 0 0); transform: translate(0,0); }
}

/* ─── 3D CARD TILT ────────────────────────────────── */
.tilt {
  transform-style: preserve-3d;
  transition: transform 0.18s cubic-bezier(.18,.7,.4,1);
  will-change: transform;
}
.tilt-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--gx, 50%) var(--gy, 50%),
    rgba(245,200,66,0.18) 0%,
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}
.tilt:hover .tilt-glow { opacity: 1; }

/* ─── STAMP — PASSED ──────────────────────────────── */
.stamp-passed {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 5000;
  font-family: 'Cinzel', 'Impact', sans-serif;
  font-size: 130px;
  font-weight: 800;
  letter-spacing: 12px;
  color: rgba(139, 58, 46, 0.85);
  border: 12px solid rgba(139, 58, 46, 0.85);
  padding: 24px 60px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(3) rotate(-12deg);
  opacity: 0;
  text-shadow: 4px 4px 0 rgba(107, 45, 45, 0.5);
  text-transform: uppercase;
  background: rgba(5,3,2,0.4);
  backdrop-filter: blur(2px);
}
.stamp-passed.go {
  animation: stamp-drop 0.85s cubic-bezier(.18,.89,.32,1.6) forwards;
}
@keyframes stamp-drop {
  0% { transform: translate(-50%, -50%) scale(3) rotate(-12deg); opacity: 0; }
  35% { transform: translate(-50%, -50%) scale(1.05) rotate(-8deg); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(0.95) rotate(-8deg); opacity: 1; }
  85% { transform: translate(-50%, -50%) scale(1) rotate(-8deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(-8deg); opacity: 0; }
}

/* ─── TYPEWRITER ──────────────────────────────────── */
.typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid #f5c842;
  animation: typewriter-blink 0.8s step-end infinite;
}
@keyframes typewriter-blink {
  50% { border-color: transparent; }
}

/* ─── KONAMI / ODIN OVERLAY ───────────────────────── */
#odin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(5,3,2,0.97);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  animation: odin-in 0.6s ease;
}
@keyframes odin-in {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(4px); }
}
#odin-overlay.show { display: flex; }
.odin-runes {
  font-family: 'Cinzel', serif;
  font-size: 80px;
  letter-spacing: 40px;
  color: #f5c842;
  text-shadow: 0 0 30px rgba(245,200,66,0.6), 4px 4px 0 #6b2d2d;
  margin-bottom: 40px;
  animation: odin-pulse 2s ease infinite;
}
@keyframes odin-pulse {
  0%, 100% { text-shadow: 0 0 30px rgba(245,200,66,0.6), 4px 4px 0 #6b2d2d; }
  50% { text-shadow: 0 0 60px rgba(245,200,66,0.95), 4px 4px 0 #8b3a2e; }
}
.odin-msg {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 5px;
  color: #d4b777;
  text-align: center;
  max-width: 520px;
  line-height: 2.2;
}
.odin-msg em {
  color: #f5c842;
  font-style: normal;
  font-weight: 600;
}
.odin-close {
  margin-top: 50px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  letter-spacing: 5px;
  color: #6a5535;
  background: none;
  border: 1px solid #6a5535;
  padding: 12px 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.odin-close:hover {
  color: #f5c842;
  border-color: #f5c842;
  letter-spacing: 8px;
}

/* ─── SOUND TOGGLE ────────────────────────────────── */
#sound-toggle {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 200;
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: #6a5535;
  background: rgba(5,3,2,0.7);
  border: 1px solid #3a2f20;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}
#sound-toggle:hover {
  color: #f5c842;
  border-color: #8b3a2e;
}
#sound-toggle.on { color: #f5c842; border-color: #8b3a2e; }
#sound-toggle.on::before { content: '♪ '; }
#sound-toggle.off::before { content: '× '; }

/* ─── KONAMI HINT (subtle) ────────────────────────── */
.konami-hint {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #3a2f20;
  user-select: none;
  pointer-events: none;
}

@media (max-width: 800px) {
  .stamp-passed { font-size: 60px; padding: 16px 30px; border-width: 6px; }
  .odin-runes { font-size: 40px; letter-spacing: 18px; }
  .odin-msg { font-size: 12px; letter-spacing: 3px; }
}
