/* Boot noise: 0.3s static on page load */
.boot-noise {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    repeating-linear-gradient(0deg,
      rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px,
      rgba(0,0,0,0.0) 1px, rgba(0,0,0,0.0) 2px),
    repeating-linear-gradient(90deg,
      rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px,
      rgba(0,0,0,0.0) 1px, rgba(0,0,0,0.0) 2px),
    #050505;
  opacity: 1;
  animation: boot-fade 0.45s ease-out forwards;
}
@keyframes boot-fade {
  0%   { opacity: 1; }
  60%  { opacity: 0.7; }
  100% { opacity: 0; }
}

/* Wrong-answer tear */
.input-row.tear {
  animation: tear 0.42s steps(8, end) 1;
}
@keyframes tear {
  0%   { clip-path: inset(0 0 0 0); text-shadow: none; transform: translateX(0); }
  20%  { clip-path: inset(0 0 60% 0); text-shadow: 2px 0 var(--glitch-1), -2px 0 var(--glitch-2); transform: translateX(-3px); }
  40%  { clip-path: inset(40% 0 0 0); text-shadow: -3px 0 var(--glitch-1), 3px 0 var(--glitch-2); transform: translateX(3px); }
  60%  { clip-path: inset(15% 0 30% 0); text-shadow: 1px 0 var(--glitch-1), -1px 0 var(--glitch-2); transform: translateX(-1px); }
  80%  { clip-path: inset(0 0 0 0); text-shadow: 2px 0 var(--glitch-2), -2px 0 var(--glitch-1); transform: translateX(1px); }
  100% { clip-path: inset(0 0 0 0); text-shadow: none; transform: translateX(0); }
}

/* Correct-answer phosphor bloom */
.feedback.bloom {
  animation: bloom 0.9s ease-out 1;
}
@keyframes bloom {
  0%   { text-shadow: 0 0 0 var(--phosphor); }
  30%  { text-shadow: 0 0 16px var(--phosphor), 0 0 30px rgba(212,168,67,0.6); }
  100% { text-shadow: 0 0 6px var(--phosphor); }
}

/* STATIC tier label persistent corruption */
.tier-card[data-tier=STATIC] .tier-label {
  animation: static-corrupt 3.6s steps(6, end) infinite;
}
@keyframes static-corrupt {
  0%, 100% { text-shadow: 0 0 0 var(--phosphor); transform: translateX(0); }
  10%      { text-shadow: 1px 0 var(--glitch-1), -1px 0 var(--glitch-2); transform: translateX(0.5px); }
  30%      { text-shadow: 0 0 0 var(--phosphor); transform: translateX(0); }
  55%      { text-shadow: -1px 0 var(--glitch-1), 1px 0 var(--glitch-2); transform: translateX(-0.5px); }
  80%      { text-shadow: 0 0 0 var(--phosphor); transform: translateX(0); }
}

/* Title hover effect handled by JS via .glitching */
.title.glitching {
  text-shadow: 1px 0 var(--glitch-1), -1px 0 var(--glitch-2), 0 0 6px rgba(212,168,67,0.4);
}

/* Oracle sigil (header + wait overlay) */
.oracle-mark::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.75), transparent);
  opacity: 0;
  pointer-events: none;
  animation: oracle-scanline 5.5s linear infinite;
  z-index: 2;
}

.oracle-mark img {
  animation: oracle-breathe 4.2s ease-in-out infinite;
  will-change: filter, transform;
}

.oracle-mark::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(212, 168, 67, 0.12);
  border-radius: 2px;
  pointer-events: none;
  animation: oracle-frame-pulse 4.2s ease-in-out infinite;
}

@keyframes oracle-breathe {
  0%, 100% {
    filter: drop-shadow(0 0 5px rgba(212, 168, 67, 0.28));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(212, 168, 67, 0.55));
    transform: scale(1.02);
  }
}

@keyframes oracle-frame-pulse {
  0%, 100% { border-color: rgba(212, 168, 67, 0.1); box-shadow: none; }
  50% { border-color: rgba(212, 168, 67, 0.28); box-shadow: 0 0 12px rgba(212, 168, 67, 0.12); }
}

@keyframes oracle-scanline {
  0%, 18% { top: 0; opacity: 0; }
  22% { opacity: 0.85; }
  48% { top: 92%; opacity: 0.85; }
  52%, 100% { top: 100%; opacity: 0; }
}

@keyframes oracle-glitch-burst {
  0%, 100% { transform: translate(0) scale(1); filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.4)); }
  25% { transform: translate(-2px, 1px) scale(1.01); filter: drop-shadow(2px 0 var(--glitch-1)) drop-shadow(-2px 0 var(--glitch-2)); }
  50% { transform: translate(2px, -1px) scale(0.99); filter: drop-shadow(-2px 0 var(--glitch-1)) drop-shadow(2px 0 var(--glitch-2)); }
  75% { transform: translate(-1px, 0) scale(1); filter: drop-shadow(1px 0 var(--glitch-2)) drop-shadow(-1px 0 var(--glitch-1)); }
}

.oracle-mark:hover img,
.oracle-mark-link:hover .oracle-mark img,
.brand:hover .oracle-mark img {
  animation: oracle-glitch-burst 0.42s steps(4, end) 1, oracle-breathe 4.2s ease-in-out infinite;
}

.oracle-mark.glitching img {
  animation: oracle-glitch-burst 0.38s steps(4, end) 1, oracle-breathe 4.2s ease-in-out infinite;
}

body.oracle-wait-open .oracle-mark img {
  animation: oracle-breathe 0.9s ease-in-out infinite, oracle-glitch-burst 1.8s steps(4, end) infinite;
}

body.oracle-wait-open .oracle-mark::before {
  animation-duration: 2.2s;
  opacity: 1;
}

.oracle-wait-card .oracle-mark--hero {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

@media (prefers-reduced-motion: reduce) {
  .oracle-mark::before,
  .oracle-mark::after,
  .oracle-mark img {
    animation: none !important;
  }
  .oracle-mark img {
    filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.35));
  }
}
