/**
 * Neon Arcade Design System
 * 霓虹街机游戏大厅设计系统 CSS
 *
 * 用途：Peoway 游戏大厅 (games.peoway.com)
 * 风格：Neon Arcade（霓虹街机）— 与主站 Nebula Tech 形成反差
 * 兼容：共享组件 page-header.php 等依赖的 Nebula Tech 变量
 */

/* ============================================
   1. CSS Variables (Nebula Tech + Neon Arcade)
   ============================================ */

:root {
  /* ---- Nebula Tech 兼容变量 ---- */
  --bg-primary: #050508;
  --bg-secondary: #0a0a12;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --accent-cyan: #00f5ff;
  --accent-purple: #9b5de5;
  --border-color: #2a2a3a;

  --bg-glass: rgba(10, 10, 20, 0.72);
  --border-glass: rgba(0, 245, 255, 0.18);
  --accent-gradient: linear-gradient(135deg, #ff006e 0%, #00f5ff 50%, #9b5de5 100%);

  /* ---- Neon Arcade 专属变量 ---- */
  --arcade-bg: #050508;
  --arcade-bg-secondary: #0a0a12;
  --arcade-bg-card: #11111a;
  --arcade-text: #ffffff;
  --arcade-text-muted: #8a8a9a;

  /* 核心霓虹配色 */
  --neon-magenta: #ff006e;
  --neon-cyan: #00f5ff;
  --neon-yellow: #ccff00;
  --neon-amber: #ff9f1c;
  --neon-violet: #9b5de5;
  --neon-green: #39ff14;
  --neon-red: #ff073a;
  --neon-coral: #ff6b9d;

  /* 每游戏主色调，默认品红，可被覆盖 */
  --game-accent: var(--neon-magenta);

  /* 特效变量 */
  --glow-magenta: 0 0 5px #ff006e, 0 0 10px #ff006e, 0 0 20px #ff006e, 0 0 40px #ff006e;
  --glow-cyan: 0 0 5px #00f5ff, 0 0 10px #00f5ff, 0 0 20px #00f5ff, 0 0 40px #00f5ff;
  --glow-yellow: 0 0 5px #ccff00, 0 0 10px #ccff00, 0 0 20px #ccff00, 0 0 40px #ccff00;
  --glow-green: 0 0 5px #39ff14, 0 0 10px #39ff14, 0 0 20px #39ff14, 0 0 40px #39ff14;
  --glow-red: 0 0 5px #ff073a, 0 0 10px #ff073a, 0 0 20px #ff073a, 0 0 40px #ff073a;

  /* 过渡与动画 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* ============================================
   2. Base Arcade Styles (scoped to body.arcade)
   ============================================ */

body.arcade {
  background-color: var(--arcade-bg);
  color: var(--arcade-text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
}

/* ---- 背景网格脉动效果 ---- */
body.arcade::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* ============================================
   3. Shared Components
   ============================================ */

/* ---- 霓虹文字发光 ---- */
.neon-text {
  color: var(--game-accent);
  text-shadow:
    0 0 5px var(--game-accent),
    0 0 10px var(--game-accent),
    0 0 20px var(--game-accent),
    0 0 40px var(--game-accent);
}

.neon-text.cyan {
  color: var(--neon-cyan);
  text-shadow:
    0 0 5px var(--neon-cyan),
    0 0 10px var(--neon-cyan),
    0 0 20px var(--neon-cyan),
    0 0 40px var(--neon-cyan);
}

.neon-text.yellow {
  color: var(--neon-yellow);
  text-shadow:
    0 0 5px var(--neon-yellow),
    0 0 10px var(--neon-yellow),
    0 0 20px var(--neon-yellow),
    0 0 40px var(--neon-yellow);
}

.neon-text.green {
  color: var(--neon-green);
  text-shadow:
    0 0 5px var(--neon-green),
    0 0 10px var(--neon-green),
    0 0 20px var(--neon-green),
    0 0 40px var(--neon-green);
}

/* ---- 街机卡片 ---- */
.arcade-card {
  position: relative;
  background: var(--arcade-bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  overflow: hidden;
}

.arcade-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--game-accent), var(--neon-cyan), var(--neon-violet));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.arcade-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.arcade-card:hover::before {
  opacity: 1;
  animation: borderBreathe 2s ease-in-out infinite;
}

@keyframes borderBreathe {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ---- 街机按钮 ---- */
.neon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--arcade-bg);
  background: var(--game-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--game-accent) 35%, transparent);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.neon-btn:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--game-accent) 50%, transparent);
}

.neon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--game-accent) 30%, transparent);
}

.neon-btn.secondary {
  background: transparent;
  color: var(--game-accent);
  border: 2px solid var(--game-accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--game-accent) 20%, transparent);
}

.neon-btn.secondary:hover {
  background: color-mix(in srgb, var(--game-accent) 10%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--game-accent) 40%, transparent);
}

.neon-btn.cyan {
  background: var(--neon-cyan);
  box-shadow: 0 4px 15px rgba(0, 245, 255, 0.35);
}

.neon-btn.cyan:hover {
  box-shadow: 0 6px 24px rgba(0, 245, 255, 0.5);
}

/* ---- Canvas 游戏容器 ---- */
.game-canvas-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--arcade-bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}

.game-canvas-container canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* ---- CRT 扫描线效果（默认关闭） ---- */
.crt-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.15),
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 2px
    );
}

.crt-overlay.crt-on {
  display: block;
  animation: crtFlicker 0.15s infinite;
}

@keyframes crtFlicker {
  0% {
    opacity: 0.97;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.98;
  }
}

/* ---- 霓虹弹窗 ---- */
.arcade-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.arcade-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.arcade-modal .modal-content {
  background: var(--arcade-bg-card);
  border: 1px solid var(--game-accent);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 0 40px color-mix(in srgb, var(--game-accent) 25%, transparent), 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.92);
  transition: transform var(--transition-base);
}

.arcade-modal.active .modal-content {
  transform: scale(1);
}

.arcade-modal .modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--game-accent);
}

.arcade-modal .modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ---- 虚拟按键（默认隐藏，移动端显示） ---- */
.virtual-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 0;
  width: 100%;
  padding: 0 20px;
  z-index: 100;
  pointer-events: none;
}

.virtual-controls .control-group {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.virtual-controls .control-group.left {
  justify-content: flex-start;
}

.virtual-controls .control-group.right {
  justify-content: flex-end;
}

.virtual-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  background: rgba(0, 245, 255, 0.12);
  color: var(--neon-cyan);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.virtual-btn:active {
  background: rgba(0, 245, 255, 0.35);
  transform: scale(0.92);
}

.virtual-btn.action {
  border-color: var(--game-accent);
  background: color-mix(in srgb, var(--game-accent) 12%, transparent);
  color: var(--game-accent);
}

.virtual-btn.action:active {
  background: color-mix(in srgb, var(--game-accent) 35%, transparent);
}

/* ============================================
   4. Utility Classes
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-4 {
  gap: 1rem;
}

.text-center {
  text-align: center;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-4 {
  margin-top: 1rem;
}

/* ============================================
   5. Responsive Breakpoints
   ============================================ */

/* 平板及以下：单列卡片 */
@media (max-width: 768px) {
  .arcade-card {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .arcade-grid {
    grid-template-columns: 1fr !important;
  }

  .neon-btn {
    padding: 10px 20px;
    font-size: 0.9375rem;
  }
}

/* 手机横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
  body.arcade::before {
    background-size: 30px 30px;
  }

  .arcade-card {
    padding: 12px;
    border-radius: 8px;
  }

  .arcade-modal .modal-content {
    padding: 20px;
    max-width: 360px;
  }

  .game-canvas-container {
    border-radius: 8px;
  }
}

/* 移动端显示虚拟按键 */
@media (pointer: coarse) and (max-width: 768px) {
  .virtual-controls {
    display: flex;
    justify-content: space-between;
  }
}

/* ============================================
   6. Accessibility
   ============================================ */

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body.arcade::before {
    animation: none;
    opacity: 0.6;
  }

  .crt-overlay.crt-on {
    animation: none;
    opacity: 0.95;
  }

  .arcade-card:hover::before {
    animation: none;
    opacity: 1;
  }
}

/* 高对比度偏好 */
@media (prefers-contrast: more) {
  :root {
    --arcade-bg: #000000;
    --arcade-bg-secondary: #000000;
    --arcade-bg-card: #000000;
    --arcade-text: #ffffff;
    --arcade-text-muted: #ffffff;
    --border-color: #ffffff;
    --game-accent: #ffffff;
    --neon-cyan: #ffffff;
    --neon-magenta: #ffffff;
    --neon-yellow: #ffffff;
    --neon-amber: #ffffff;
    --neon-violet: #ffffff;
    --neon-green: #ffffff;
    --neon-red: #ffffff;
    --neon-coral: #ffffff;
  }

  .neon-text {
    text-shadow: none !important;
  }

  .neon-btn {
    background: #ffffff;
    color: #000000;
    box-shadow: none;
    border: 2px solid #ffffff;
  }

  .neon-btn.secondary {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }

  .arcade-card::before {
    background: #ffffff;
  }

  .arcade-modal .modal-content {
    box-shadow: none;
    border: 2px solid #ffffff;
  }

  .virtual-btn {
    border-color: #ffffff;
    background: #000000;
    color: #ffffff;
  }

  .crt-overlay {
    display: none !important;
  }
}
