/* =====================================================
   赛博棋社 · 朋克主题 punk.css
   霓虹青紫 + 品红 + 荧光绿 赛博朋克风
   统一 CSS 变量 + 通用组件
   ===================================================== */
:root {
  /* 背景 */
  --bg-deep: #0a0a12;
  --bg-panel: #12121f;
  --bg-card: #1a1a2e;
  --bg-input: #0d0d18;

  /* 霓虹主色 */
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00ff;
  --neon-green: #39ff14;
  --neon-yellow: #fff200;
  --neon-purple: #bf00ff;
  --neon-orange: #ff6600;

  /* 文字 */
  --text-primary: #e0e0ff;
  --text-secondary: #8888aa;
  --text-dim: #555577;

  /* 边框/发光 */
  --border-glow: rgba(0, 240, 255, 0.35);
  --border-solid: #2a2a4a;

  /* 字体 */
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 赛博网格背景 + 扫描线 ===== */
.cyber-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(0, 240, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 0% 100%, rgba(255, 0, 255, 0.08), transparent 60%),
    var(--bg-deep);
}
.cyber-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 85%);
}
.cyber-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px, rgba(0, 0, 0, 0.06) 3px, rgba(0, 0, 0, 0.06) 4px
  );
  animation: scanMove 8s linear infinite;
  opacity: 0.4;
}
@keyframes scanMove {
  from { transform: translateY(0); }
  to { transform: translateY(100px); }
}

.hidden { display: none !important; }

/* ===== 霓虹标题（带故障效果） ===== */
.neon-title {
  text-align: center;
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff;
  text-shadow:
    0 0 8px rgba(0, 240, 255, 0.9),
    0 0 20px rgba(0, 240, 255, 0.6),
    0 0 40px rgba(0, 240, 255, 0.3);
  animation: neonFlicker 4s infinite;
  position: relative;
}
@keyframes neonFlicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.4; }
  94% { opacity: 1; }
  96% { opacity: 0.6; }
  97% { opacity: 1; }
}
.neon-title.dual {
  text-shadow:
    0 0 8px rgba(0, 240, 255, 0.9),
    0 0 24px rgba(255, 0, 255, 0.5),
    0 0 48px rgba(255, 0, 255, 0.3);
}

/* 故障 RGB 分离 */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0;
}
.glitch:hover::before {
  opacity: 0.8;
  color: var(--neon-cyan);
  transform: translate(2px, -2px);
  animation: glitchShift 0.3s infinite;
}
.glitch:hover::after {
  opacity: 0.8;
  color: var(--neon-magenta);
  transform: translate(-2px, 2px);
  animation: glitchShift 0.3s infinite reverse;
}
@keyframes glitchShift {
  0% { clip-path: inset(0 0 80% 0); }
  50% { clip-path: inset(40% 0 20% 0); }
  100% { clip-path: inset(80% 0 0 0); }
}

/* ===== 霓虹面板 ===== */
.neon-panel {
  background: rgba(18, 18, 31, 0.92);
  border: 1px solid var(--border-solid);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.05),
    0 0 24px rgba(0, 240, 255, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.6);
}
.neon-panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.4), transparent 30%, transparent 70%, rgba(255, 0, 255, 0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ===== 霓虹按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  background: rgba(26, 26, 46, 0.8);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  position: relative;
  overflow: hidden;
  font-family: var(--font);
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-cyan {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15), inset 0 0 12px rgba(0, 240, 255, 0.06);
}
.btn-cyan:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.16);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.35), inset 0 0 16px rgba(0, 240, 255, 0.1);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}
.btn-magenta {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
  background: rgba(255, 0, 255, 0.08);
  box-shadow: 0 0 12px rgba(255, 0, 255, 0.15), inset 0 0 12px rgba(255, 0, 255, 0.06);
}
.btn-magenta:hover:not(:disabled) {
  background: rgba(255, 0, 255, 0.16);
  box-shadow: 0 0 24px rgba(255, 0, 255, 0.35), inset 0 0 16px rgba(255, 0, 255, 0.1);
  text-shadow: 0 0 8px rgba(255, 0, 255, 0.8);
}
.btn-green {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(57, 255, 20, 0.08);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.15), inset 0 0 12px rgba(57, 255, 20, 0.06);
}
.btn-green:hover:not(:disabled) {
  background: rgba(57, 255, 20, 0.16);
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.35), inset 0 0 16px rgba(57, 255, 20, 0.1);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
}
.btn-yellow {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: rgba(255, 242, 0, 0.08);
  box-shadow: 0 0 12px rgba(255, 242, 0, 0.15), inset 0 0 12px rgba(255, 242, 0, 0.06);
}
.btn-yellow:hover:not(:disabled) {
  background: rgba(255, 242, 0, 0.16);
  box-shadow: 0 0 24px rgba(255, 242, 0, 0.35), inset 0 0 16px rgba(255, 242, 0, 0.1);
  text-shadow: 0 0 8px rgba(255, 242, 0, 0.8);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-solid);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); border-color: #3a3a6a; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-block { width: 100%; }

/* ===== 输入框 ===== */
.input-field {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-solid);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
  font-family: var(--font);
}
.input-field::placeholder { color: var(--text-dim); }
.input-field:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25), inset 0 0 8px rgba(0, 240, 255, 0.05);
}
.input-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.input-group { margin-bottom: 16px; }

/* ===== 房号显示（发光呼吸） ===== */
.room-id {
  font-size: 30px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--neon-green);
  text-shadow:
    0 0 8px rgba(57, 255, 20, 0.8),
    0 0 20px rgba(57, 255, 20, 0.5);
  animation: roomIdGlow 2s ease-in-out infinite;
  letter-spacing: 6px;
}
@keyframes roomIdGlow {
  0%, 100% { text-shadow: 0 0 8px rgba(57, 255, 20, 0.8), 0 0 20px rgba(57, 255, 20, 0.5); }
  50% { text-shadow: 0 0 14px rgba(57, 255, 20, 1), 0 0 36px rgba(57, 255, 20, 0.7); }
}

/* ===== 玩家徽章 ===== */
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-solid);
  border-radius: 24px;
  background: rgba(26, 26, 46, 0.7);
  font-size: 13px;
  color: var(--text-secondary);
}
.player-chip .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.player-chip.black .dot { background: #111; color: #fff; border: 1px solid #555; }
.player-chip.white .dot { background: #fff; color: #fff; }
.player-chip.host-tag { color: var(--neon-yellow); }
.player-chip.ai-tag { color: var(--neon-magenta); }

/* ===== 状态横幅 ===== */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(26, 26, 46, 0.6);
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.status-bar .turn-glow {
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  font-weight: 700;
}

/* ===== 顶部栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
}
.topbar .back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
}
.topbar .back-btn:hover { color: var(--neon-cyan); }

/* ===== 通用容器 ===== */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}
.center-flex {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 二维码区（统一） ===== */
.qr-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 20px;
  margin-top: 20px;
  background: rgba(18, 18, 31, 0.85);
  border: 1px solid var(--border-solid);
  border-radius: 14px;
}
.qr-item {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}
.qr-box {
  width: 90px; height: 90px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  margin: 0 auto 6px;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}
.qr-box img, .qr-box canvas { width: 100%; height: 100%; }

/* ===== 弹窗 ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.overlay.hidden { display: none; }
.modal {
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}
.modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
  white-space: pre-line;
}
.modal-text b { color: var(--neon-green); }
.modal-text .red { color: var(--neon-magenta); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ===== 聊天区 ===== */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 200px;
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  background: rgba(13, 13, 24, 0.8);
  overflow: hidden;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.chat-body .msg { margin-bottom: 4px; }
.chat-body .msg .name { color: var(--neon-cyan); font-weight: 700; }
.chat-body .msg .name.mine { color: var(--neon-magenta); }
.chat-body .sys { color: var(--neon-yellow); text-align: center; font-size: 12px; }
.chat-input-row {
  display: flex;
  border-top: 1px solid var(--border-solid);
}
.chat-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
}
.chat-input-row input::placeholder { color: var(--text-dim); }
.chat-input-row button {
  background: rgba(0, 240, 255, 0.1);
  border: none;
  border-left: 1px solid var(--border-solid);
  color: var(--neon-cyan);
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.chat-input-row button:hover { background: rgba(0, 240, 255, 0.2); }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 240, 255, 0.4); }

/* ===== 响应式微调 ===== */
@media (max-width: 600px) {
  .neon-title { font-size: 26px; letter-spacing: 4px; }
  .container { padding: 10px; }
  .qr-footer { gap: 12px; padding: 12px; }
  .btn { padding: 10px 14px; font-size: 14px; }
}
