/* ============================================================
   V21 Time Warp Portal — Dark purple-black, amber/gold accent
   Mobile-first, glassmorphism panel, chromatic aberration FX
   ============================================================ */

:root {
  --primary:   #f59e0b;   /* amber/gold */
  --secondary: #8b5cf6;   /* purple */
  --accent:    #a78bfa;   /* light purple */
  --surface:   rgba(15, 5, 20, 0.8);
  --text:      #fef3c7;   /* warm white */
  --text-dim:  rgba(254, 243, 199, 0.55);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100%;
  background: #0a020f;
  font-family: 'Exo 2', sans-serif;
  color: var(--text);
  overflow: hidden; /* full viewport experience — no scroll */
}

/* ── Three.js container — full viewport background ── */
#three-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ── White flash overlay — covers entire screen during portal open ── */
.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease-in;
}

.flash-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── HUD corner boxes ── */
.interface-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.hud-box {
  position: absolute;
  padding: 10px 14px;
  background: rgba(15, 5, 20, 0.65);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  line-height: 1.8;
}

.hud-box.top-left  { top: 16px; left: 16px; }
.hud-box.top-right { top: 16px; right: 16px; text-align: right; }

.hud-box .accent {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.7);
}

/* ── Center stage layout ── */
.center-stage {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ── Glass panel — glassmorphism with purple tint ── */
.glass-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.15),
    0 0 40px rgba(139, 92, 246, 0.2),
    inset 0 1px 0 rgba(167, 139, 250, 0.15),
    0 24px 64px rgba(0, 0, 0, 0.7);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

/* ── Decorative corner brackets ── */
.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--primary);
  border-style: solid;
  opacity: 0.7;
}
.corner.tl { top: 8px;  left: 8px;  border-width: 2px 0 0 2px; border-radius: 2px 0 0 0; }
.corner.tr { top: 8px;  right: 8px; border-width: 2px 2px 0 0; border-radius: 0 2px 0 0; }
.corner.bl { bottom: 8px; left: 8px;  border-width: 0 0 2px 2px; border-radius: 0 0 0 2px; }
.corner.br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; border-radius: 0 0 2px 0; }

/* ── Panel title ── */
.panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(22px, 5.5vw, 34px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Subtle glow via drop-shadow (doesn't affect gradient text fill) */
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.35));
}

/* ── Status text ── */
.status-text {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  min-height: 1.5em;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

.status-text.active {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.7);
}

.status-text.success {
  color: var(--primary);
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.8);
}

/* ── Activate button — min 44px touch target ── */
.activate-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 14px 36px;       /* vertical ≥ 44px total via line-height */
  min-height: 48px;
  background: linear-gradient(135deg, var(--secondary) 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.4),
    0 0 24px rgba(139, 92, 246, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.2s var(--ease-smooth), box-shadow 0.2s;
  /* Pulsing glow animation in idle state */
  animation: btn-pulse 2.2s ease-in-out infinite alternate;
}

.activate-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.7),
    0 0 36px rgba(139, 92, 246, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.activate-btn:active:not(:disabled) { transform: translateY(0) scale(1); }

.activate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
  transform: none;
}

@keyframes btn-pulse {
  from { box-shadow: 0 0 0 1px rgba(245,158,11,0.3), 0 0 16px rgba(139,92,246,0.4); }
  to   { box-shadow: 0 0 0 1px rgba(245,158,11,0.7), 0 0 32px rgba(139,92,246,0.8), 0 0 60px rgba(139,92,246,0.25); }
}

/* ── Chromatic aberration effect on activation ──
   Creates RGB-split shadow: red shifted left, blue shifted right */
.glass-panel.chromatic-active {
  filter:
    drop-shadow(-3px 0   0 rgba(255, 0,   0,   0.4))
    drop-shadow( 3px 0   0 rgba(0,   0,   255, 0.4))
    drop-shadow( 0   0   0 rgba(255, 255, 255, 0.05));
}

/* ── Body shake animation — applied via JS class on activation ── */
@keyframes shake {
  0%   { transform: translate(0,     0); }
  10%  { transform: translate(-4px,  2px); }
  20%  { transform: translate(4px,  -2px); }
  30%  { transform: translate(-3px,  3px); }
  40%  { transform: translate(3px,  -3px); }
  50%  { transform: translate(-2px,  4px); }
  60%  { transform: translate(2px,  -4px); }
  70%  { transform: translate(-3px,  2px); }
  80%  { transform: translate(3px,   3px); }
  90%  { transform: translate(-2px, -2px); }
  100% { transform: translate(0,     0); }
}

body.shake {
  animation: shake 0.55s var(--ease-smooth);
}

/* ── Reduced motion — respects user OS preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .flash-overlay { transition: none !important; }
}
