/**
 * DIRECTIONAL SHIELD PARRY BENCHMARK STYLESHEET (style.css)
 * Golden Standard 3D Cyber Arena with Center Holographic Kinetic Shield Terminal
 * Adheres to ReflexBench Assessment Development Specification
 */

:root {
  --test-accent: #00f0ff;
  --test-accent-soft: rgba(0, 240, 255, 0.12);
  --test-accent-border: rgba(0, 240, 255, 0.25);
  --primary-accent: #00f0ff;
  --secondary-accent: #3b82f6;
  --gold-accent: #f59e0b;
  --danger-accent: #ef4444;
  --bg-dark: #060912;
}

/* ── Test Icon Single Symbol ── */

/* ── Fullscreen Active Task Scope (ReflexBench Standard) ── */
body:has(#panelTask.active) {
  overflow: hidden !important;
}

body:has(#panelTask.active) header.panda-header,
body:has(#panelTask.active) .panda-nav,
body:has(#panelTask.active) footer.panda-footer,
body:has(#panelTask.active) .t-ambient-glow,
body:has(#panelTask.active) .t-seo-container,
body:has(#panelTask.active) .t-nav {
  display: none !important;
}

body:has(#panelTask.active) .t-shell {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body:has(#panelTask.active) .t-card {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  background: var(--bg-dark) !important;
  box-shadow: none !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
}

body:has(#panelTask.active) #panelTask {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  position: relative !important;
  overflow: hidden !important;
}

#panelTask {
  flex: 1;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: none;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-dark);
}

#panelTask.active {
  display: block;
}

/* ══ 3. RESULT PANEL (Standard ReflexBench UI) ══ */
#panelResult,
#panelResults {
  display: none;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
}

#panelResult.active,
#panelResults.active {
  display: flex;
}

/* ── 3D Cyber Arena Stage ── */
.parry-3d-arena {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

#webgl-container {
  width: 100%;
  height: 100%;
}

#webgl-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── Minimalist Top HUD ── */
.top-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 30;
  pointer-events: none;
  box-sizing: border-box;
}

.top-header a,
.top-header button {
  pointer-events: auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(13, 18, 28, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #94a3b8;
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

.hub-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.round-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(13, 18, 28, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-accent);
  box-shadow: 0 0 10px var(--primary-accent);
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.countdown-val {
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.05em;
}

.restart-pill {
  margin-left: auto !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  border-radius: 8px;
  color: #f87171 !important;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  pointer-events: auto;
}

.restart-pill:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

/* ── 2D Parry Kinetic Defense Canvas ── */
.parry-canvas-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  z-index: 10;
  pointer-events: none !important;
  cursor: default !important;
}

#parryCanvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  cursor: default !important;
}

/* ── Screen-Wide Core Breach Flash Overlay ── */
.core-breach-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(239, 68, 68, 0.6) 100%);
  transition: opacity 0.08s ease-out;
}

.core-breach-vignette.active {
  opacity: 1;
}

/* ── Realistic 3D Keyboard Cluster (WASD / Arrow Keys) - Corner HUD ── */
.keyboard-cluster {
  position: absolute;
  bottom: 28px;
  right: 32px;
  left: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 30;
  pointer-events: none;
}

.keyboard-row {
  display: flex;
  gap: 6px;
}

.keycap {
  width: 48px;
  height: 48px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom: 3px solid #050a14;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-weight: 800;
  cursor: default !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease, border-color 0.08s ease;
  user-select: none;
  pointer-events: none !important;
  position: relative;
}

.keycap.active {
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.35) 0%, rgba(0, 240, 255, 0.15) 100%) !important;
  border-color: #00f0ff !important;
  border-bottom: 1px solid #00f0ff !important;
  color: #00f0ff !important;
  box-shadow: 0 1px 4px rgba(0, 240, 255, 0.5), inset 0 0 12px rgba(0, 240, 255, 0.4) !important;
  transform: translateY(2px) !important;
}

.keycap-sub {
  font-size: 10px;
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 2px;
}

.keycap-letter {
  font-size: 15px;
  line-height: 1;
}

/* ── How It Works Interactive Preview ── */
.sp-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0 1rem;
  padding: 1.5rem;
  background: rgba(13, 19, 31, 0.85);
  border: 1px solid var(--color-outline, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 12px);
}

.sp-preview-arena {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 240, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-preview-core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-accent);
  box-shadow: 0 0 14px var(--primary-accent);
}

.sp-preview-arc {
  position: absolute;
  top: 30px;
  width: 44px;
  height: 6px;
  border-radius: 3px;
  background: var(--primary-accent);
  box-shadow: 0 0 10px var(--primary-accent);
}

.sp-preview-bolt {
  position: absolute;
  top: 8px;
  width: 8px;
  height: 16px;
  border-radius: 4px;
  background: #ff0055;
  box-shadow: 0 0 10px #ff0055;
  animation: spBoltDrop 4.8s linear infinite;
}

.sp-preview-burst {
  position: absolute;
  top: 30px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #00f0ff;
  opacity: 0;
  animation: spBurstPulse 4.8s linear infinite;
}

.sp-preview-key {
  position: absolute;
  font-family: var(--font-m, 'JetBrains Mono', monospace);
  font-size: 0.65rem;
  font-weight: 800;
  color: #64748b;
}

.sp-preview-key.n { top: -20px; color: var(--primary-accent); }
.sp-preview-key.w { left: -42px; }
.sp-preview-key.s { bottom: -20px; }
.sp-preview-key.e { right: -42px; }

@keyframes spBoltDrop {
  0% {
    top: 6px;
    opacity: 1;
    background: #ff0055;
    box-shadow: 0 0 10px #ff0055;
  }
  38% {
    top: 26px;
    opacity: 1;
    background: #00f0ff;
    box-shadow: 0 0 16px #00f0ff;
  }
  42% {
    top: 26px;
    opacity: 0;
  }
  100% {
    top: 6px;
    opacity: 0;
  }
}

@keyframes spBurstPulse {
  0%, 36% {
    opacity: 0;
    transform: scale(0.4);
  }
  38% {
    opacity: 1;
    transform: scale(1.3);
  }
  50% {
    opacity: 0;
    transform: scale(2.0);
  }
  100% {
    opacity: 0;
    transform: scale(0.4);
  }
}

/* ── Mobile Responsive Overrides (Protected from Desktop) ── */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .parry-canvas-wrapper {
    width: min(92vw, 380px) !important;
    height: min(92vw, 380px) !important;
  }

  .top-header {
    padding: 14px 16px !important;
  }

  /* Centered, touch-optimized keyboard cluster elevated above phone navigation bars */
  .keyboard-cluster {
    position: absolute !important;
    bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 22px)) !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    touch-action: manipulation !important;
    z-index: 50 !important;
    gap: 8px !important;
  }

  .keyboard-row {
    display: flex !important;
    gap: 8px !important;
    justify-content: center !important;
  }

  .keycap {
    width: 60px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 54px !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    border-radius: 10px !important;
    transition: transform 0.08s ease, background 0.08s ease !important;
  }

  .keycap:active,
  .keycap.active {
    transform: translateY(2px) scale(0.96) !important;
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.6) !important;
  }

  .keycap-letter {
    font-size: 17px !important;
    font-weight: 800 !important;
  }

  .keycap-sub {
    font-size: 13px !important;
    opacity: 0.75 !important;
  }
}
