/* ==========================================================================
   ArenaX P4 Modern Cyber-Glassmorphism Design System
   Matches P1 / P3 / P5 visual excellence standard
   ========================================================================== */

:root {
  --bg-color: #080c14;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-card-solid: #0f172a;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(99, 102, 241, 0.4);

  --primary-cyan: #06b6d4;
  --primary-cyan-glow: rgba(6, 182, 212, 0.35);
  --primary-violet: #6366f1;
  --primary-violet-glow: rgba(99, 102, 241, 0.4);
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.3);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-violet-glow);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glowing orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  animation: floatOrb 20s ease-in-out infinite alternate;
}
.orb-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #6366f1, #3b82f6);
  top: -120px;
  left: -120px;
}
.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #06b6d4, #10b981);
  bottom: -80px;
  right: -80px;
  animation-duration: 25s;
}
.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #a855f7, #f43f5e);
  top: 40%;
  left: 45%;
  opacity: 0.16;
  animation-duration: 30s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* Subtle grid mesh overlay */
.grid-mesh-bg {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 1;
}

/* App Shell Layout */
.app-shell {
  position: relative;
  z-index: 2;
  max-width: 1720px;
  margin: 0 auto;
  padding: 16px 24px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

/* Glassmorphism Card Utility */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header */
.glass-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-violet), var(--primary-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px var(--primary-cyan-glow);
}
.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-text h1 span {
  background: linear-gradient(90deg, var(--primary-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-card);
  font-size: 0.82rem;
  font-weight: 500;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.latency-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.session-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}
.session-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 700;
}
.session-val {
  font-family: var(--font-mono);
  color: var(--accent-amber);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
}
.user-avatar {
  font-size: 1.15rem;
}
.user-name {
  font-weight: 600;
  font-size: 0.88rem;
}
.role-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.role-player {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.role-spectator {
  background: rgba(168, 85, 247, 0.18);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Metrics Row */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.metric-card {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.metric-icon.cyan { background: rgba(6, 182, 212, 0.12); color: var(--primary-cyan); }
.metric-icon.violet { background: rgba(99, 102, 241, 0.12); color: var(--primary-violet); }
.metric-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.metric-icon.amber { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.metric-icon.rose { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); }

.metric-info {
  display: flex;
  flex-direction: column;
}
.metric-info .label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.metric-info .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.emerald-text { color: var(--accent-emerald); }
.amber-text { color: var(--accent-amber); }
.rose-text { color: var(--accent-rose); }
.cyan-text { color: var(--primary-cyan); }
.purple-text { color: var(--accent-purple); }

/* Workspace Three-Column Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 16px;
  flex: 1;
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  height: calc(100vh - 210px);
  min-height: 600px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}
.panel-actions {
  display: flex;
  gap: 6px;
}
.panel-subtitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}
.section-divider {
  height: 1px;
  background: var(--border-card);
  margin: 12px 0;
}

/* Quick Join Room ID Bar */
.quick-join-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.45);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(99, 102, 241, 0.35);
}
.quick-join-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  background: rgba(2, 6, 23, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  padding: 0 8px;
}
.quick-join-hash {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 4px;
}
.quick-join-input {
  border: none !important;
  background: transparent !important;
  padding: 6px 4px !important;
  font-size: 0.85rem !important;
  color: var(--text-main) !important;
  width: 100%;
}
.quick-join-input:focus {
  outline: none !important;
  box-shadow: none !important;
}
.room-id-pill {
  font-size: 0.75rem;
  font-family: monospace;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.room-id-pill:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}
.btn-copy-room-id {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-copy-room-id:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #ffffff;
}

/* Left Panel: Rooms */
.room-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 220px;
  padding-right: 4px;
}
.room-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-card);
  transition: all 0.2s ease;
  cursor: pointer;
}
.room-card:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: var(--border-card-hover);
  transform: translateY(-1px);
}
.room-card.active {
  border-color: var(--primary-violet);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}
.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.room-name-label {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.room-state-pill {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}
.state-idle { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.state-playing { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.4); }

.room-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.room-btn-group {
  display: flex;
  gap: 4px;
}

/* User List */
.user-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 120px;
  padding-right: 4px;
}
.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.3);
  font-size: 0.8rem;
  transition: background 0.15s ease;
}
.user-item:hover {
  background: rgba(30, 41, 59, 0.6);
}
.user-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

/* Bot Control Card */
.bot-control-card {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bot-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.bot-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.bot-btn-group {
  display: flex;
  gap: 6px;
}
.bot-btn-group .btn {
  flex: 1;
}

/* Center Panel: Arena & Chat */
.center-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.arena-stage {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.room-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
.room-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-violet);
  font-weight: 700;
  border: 1px solid rgba(99, 102, 241, 0.35);
}
.arena-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.arena-ctrl-group {
  display: flex;
  gap: 8px;
}

/* Question Board */
.question-board {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}
.round-pill {
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-amber);
  border-radius: var(--radius-full);
  font-weight: 700;
}
.category-pill {
  padding: 2px 8px;
  background: rgba(6, 182, 212, 0.18);
  color: var(--primary-cyan);
  border-radius: var(--radius-full);
  font-weight: 600;
}
.timer-countdown {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-rose);
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-main);
  min-height: 48px;
}

/* Buzz Action Zone */
.buzz-action-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 8px 0;
}

/* Timer Ring */
.timer-ring-container {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-svg {
  transform: rotate(-90deg);
}
.timer-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}
.timer-progress-circle {
  fill: none;
  stroke: var(--accent-rose);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.8s linear, stroke 0.3s ease;
}
.timer-inner-text {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Giant Buzz Button */
.buzz-btn-wrapper {
  flex: 1;
  max-width: 380px;
}
.btn-giant-buzz {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: 2px solid var(--accent-amber);
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 0 25px var(--accent-amber-glow), 0 8px 20px rgba(0,0,0,0.4);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-giant-buzz:not(:disabled):hover {
  transform: scale(1.02);
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.6), 0 10px 24px rgba(0,0,0,0.5);
}
.btn-giant-buzz:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}
.btn-giant-buzz:disabled {
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}
.buzz-icon {
  font-size: 1.6rem;
}
.buzz-label {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.buzz-sub {
  font-size: 0.72rem;
  opacity: 0.85;
}

/* Buzz Lock Status Banner */
.buzz-lock-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: rgba(30, 41, 59, 0.5);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-muted);
}
.buzz-lock-banner.claimed {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.buzz-lock-banner.success {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.option-btn:not(:disabled):hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary-violet);
  transform: translateY(-1px);
}
.option-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.opt-letter {
  font-family: var(--font-mono);
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--primary-cyan);
}
.option-btn.correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--accent-emerald) !important;
  box-shadow: 0 0 15px var(--accent-emerald-glow);
}
.option-btn.wrong {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: var(--accent-rose) !important;
  box-shadow: 0 0 15px var(--accent-rose-glow);
}

/* Chat System */
.chat-system {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 240px;
}

.chat-tabs {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.4);
  border-bottom: 1px solid var(--border-card);
  padding: 0 8px;
}
.chat-tab {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-tab:hover {
  color: var(--text-main);
}
.chat-tab.active {
  color: var(--primary-cyan);
  border-bottom-color: var(--primary-cyan);
}
.chat-tools {
  margin-left: auto;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
}

/* Chat Bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 85%;
  animation: slideMsg 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.chat-sender {
  font-weight: 600;
  color: var(--text-main);
}
.chat-bubble {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.7);
  font-size: 0.85rem;
  line-height: 1.45;
  border: 1px solid var(--border-card);
  word-break: break-word;
}
.chat-msg.self {
  align-self: flex-end;
}
.chat-msg.self .chat-msg-header {
  justify-content: flex-end;
}
.chat-msg.self .chat-bubble {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(6, 182, 212, 0.35));
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}
.chat-msg.whisper .chat-bubble {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.4);
  color: #f3e8ff;
}
.chat-msg.system {
  align-self: center;
  max-width: 90%;
}
.chat-msg.system .chat-bubble {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.quick-emojis {
  display: flex;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid var(--border-card);
}
.emoji-chip {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: transform 0.1s ease;
}
.emoji-chip:hover {
  transform: scale(1.25);
}

.chat-input-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.5);
  border-top: 1px solid var(--border-card);
}
.whisper-target-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent-purple);
}
.chat-input-wrapper {
  display: flex;
  gap: 8px;
}
.chat-input-wrapper input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.chat-input-wrapper input:focus {
  border-color: var(--primary-cyan);
}

/* Right Panel: Leaderboard & Replay */
.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 190px;
  padding-right: 4px;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.leaderboard-item.rank-1 {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
}
.leaderboard-item.rank-2 {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.1);
}
.leaderboard-item.rank-3 {
  border-color: rgba(205, 127, 50, 0.4);
  background: rgba(205, 127, 50, 0.1);
}
.lb-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-rank {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  width: 24px;
  text-align: center;
}
.lb-name {
  font-weight: 600;
  font-size: 0.85rem;
}
.lb-score {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-amber);
  font-size: 0.9rem;
}

.replay-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 160px;
  padding-right: 4px;
}
.replay-card {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid var(--border-card);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.replay-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}
.replay-result-ok { color: var(--accent-emerald); font-weight: 700; }
.replay-result-err { color: var(--accent-rose); font-weight: 700; }

.diag-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
}
.diag-row {
  display: flex;
  justify-content: space-between;
}
.diag-label {
  color: var(--text-dim);
}
.diag-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Empty State */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-violet), var(--primary-cyan));
  color: #fff;
  box-shadow: 0 0 14px var(--primary-violet-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 20px var(--primary-cyan-glow);
}
.btn-accent {
  background: var(--accent-purple);
  color: #fff;
}
.btn-success {
  background: var(--accent-emerald);
  color: #042f2e;
}
.btn-danger {
  background: var(--accent-rose);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}
.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}
.btn-outline-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.15);
}
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-xs { padding: 2px 6px; font-size: 0.7rem; border-radius: 4px; }
.btn-text { background: none; border: none; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; }
.btn-text:hover { color: var(--text-main); }
.btn-icon { background: none; border: none; font-size: 1.05rem; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.btn-block { width: 100%; }

/* Form Controls */
.form-input, .form-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}
.form-input:focus, .form-select:focus {
  border-color: var(--primary-cyan);
}
.form-select-sm { padding: 4px 8px; font-size: 0.75rem; }
.form-input-xs { padding: 2px 6px; font-size: 0.72rem; width: 100px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  width: 440px;
  max-width: 90vw;
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-backdrop.open .modal-content {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.radio-pill-group {
  display: flex;
  gap: 10px;
}
.radio-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
}
.avatar-selector {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.avatar-opt {
  font-size: 1.6rem;
  padding: 6px 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.avatar-opt:hover {
  transform: scale(1.18);
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}
.avatar-opt.selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.6);
  transform: scale(1.12);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.info { border-left: 4px solid var(--primary-cyan); }
.toast.success { border-left: 4px solid var(--accent-emerald); }
.toast.warning { border-left: 4px solid var(--accent-amber); }
.toast.error { border-left: 4px solid var(--accent-rose); }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .workspace-grid {
    grid-template-columns: 280px 1fr 280px;
  }
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    height: auto;
    min-height: auto;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .wechat-portal {
    flex-direction: column;
  }
  .wechat-sidebar {
    width: 100% !important;
    max-height: 180px;
    border-right: none !important;
    border-bottom: 1px solid var(--border-card);
  }
}

/* ==========================================================================
   WeChat Grade Communication System & View Mode Switcher
   ========================================================================== */

/* Mode Switcher Bar */
.view-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-card);
}
.view-mode-tabs {
  display: flex;
  gap: 8px;
}
.mode-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.mode-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}
.mode-tab.active {
  background: rgba(7, 193, 96, 0.16);
  border-color: rgba(7, 193, 96, 0.4);
  color: #10b981;
  box-shadow: 0 0 15px rgba(7, 193, 96, 0.25);
}
.tab-badge {
  background: #f43f5e;
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  padding: 1px 6px;
  font-weight: 700;
}
.view-mode-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #07c160;
  box-shadow: 0 0 10px #07c160;
  animation: pulseDot 2s infinite;
}

/* Mode Layout Rules */
.workspace-grid.mode-chat .arena-stage {
  display: none !important;
}
.workspace-grid.mode-chat .wechat-portal {
  flex: 1;
  height: 100%;
  min-height: 0;
}
.workspace-grid.mode-arena .wechat-portal {
  display: none !important;
}
.workspace-grid.mode-arena .arena-stage {
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}
.workspace-grid.mode-split .arena-stage {
  max-height: 310px;
  overflow-y: auto;
  flex-shrink: 0;
}
.workspace-grid.mode-split .wechat-portal {
  flex: 1;
  min-height: 280px;
}

/* WeChat Portal Dual-Column Layout */
.wechat-portal {
  display: flex;
  flex: 1;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 480px;
  position: relative;
}

/* Left: WeChat Sidebar */
.wechat-sidebar {
  width: 250px;
  background: rgba(18, 26, 44, 0.9);
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
}
.wechat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 23, 42, 0.5);
}
.wechat-search-bar .search-icon {
  font-size: 0.85rem;
  opacity: 0.6;
}
.wechat-search-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s ease;
}
.wechat-search-bar input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: #07c160;
}

.wechat-session-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  user-select: none;
}
.session-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.session-item.active {
  background: rgba(7, 193, 96, 0.12);
  border-left-color: #07c160;
}
.session-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
}
.world-avatar {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(6, 182, 212, 0.3));
}
.group-avatar {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
}
.session-info {
  flex: 1;
  min-width: 0;
}
.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.session-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-time {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.session-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.session-preview {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 125px;
}
.session-badge {
  background: #f43f5e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  min-width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.session-section-title {
  padding: 10px 14px 4px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wechat-contacts-list {
  display: flex;
  flex-direction: column;
}
.empty-contacts {
  padding: 16px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.contact-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0f172a;
}

/* Right: WeChat Main View */
.wechat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.55);
  min-width: 0;
  position: relative;
}

.wechat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-card);
  background: rgba(30, 41, 59, 0.45);
}
.wechat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wechat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.title-with-typing {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wechat-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.wechat-header p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Typing Indicator Animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #07c160;
  background: rgba(7, 193, 96, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #07c160;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

/* WeChat Message Stream */
.wechat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* WeChat Bubbles */
.chat-msg {
  position: relative;
  max-width: 78%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-msg.self {
  align-self: flex-end;
}
.chat-msg.self .chat-bubble {
  background: #07c160 !important;
  color: #ffffff !important;
  border-radius: 14px 3px 14px 14px !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.25);
}
.chat-msg:not(.self) .chat-bubble {
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  border-radius: 3px 14px 14px 14px;
  border: 1px solid var(--border-card);
}

/* WeChat Voice Bubble */
.voice-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  min-width: 90px;
  transition: all 0.15s ease;
}
.voice-bubble:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.voice-bubble:active {
  transform: scale(0.97);
}
.voice-wave-icon {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
}
.voice-wave-icon span {
  display: block;
  width: 2.5px;
  background: currentColor;
  border-radius: 1px;
}
.voice-wave-icon span:nth-child(1) { height: 6px; }
.voice-wave-icon span:nth-child(2) { height: 11px; }
.voice-wave-icon span:nth-child(3) { height: 16px; }

.voice-bubble.playing .voice-wave-icon span {
  animation: voiceWavePlay 0.8s infinite alternate ease-in-out;
}
.voice-bubble.playing .voice-wave-icon span:nth-child(2) { animation-delay: 0.2s; }
.voice-bubble.playing .voice-wave-icon span:nth-child(3) { animation-delay: 0.4s; }

@keyframes voiceWavePlay {
  from { height: 4px; }
  to { height: 16px; }
}

.voice-duration-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}
.voice-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 6px #f43f5e;
}

/* WeChat Image Bubble */
.image-bubble {
  max-width: 260px;
  max-height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}
.image-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-bubble:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Quoted Reply Snippet in Bubble */
.msg-quote-snippet {
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid #6366f1;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.chat-msg.self .msg-quote-snippet {
  border-left-color: #fff;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.15);
}

/* Hover Action Bar */
.msg-hover-actions {
  display: none;
  position: absolute;
  top: -24px;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  gap: 6px;
  z-index: 5;
  box-shadow: var(--shadow-sm);
}
.chat-msg:hover .msg-hover-actions {
  display: flex;
}
.action-btn-mini {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.action-btn-mini:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Quote Bar above dock */
.wechat-quote-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(30, 41, 59, 0.95);
  border-top: 1px solid var(--border-card);
  font-size: 0.78rem;
  color: var(--text-main);
  animation: slideMsg 0.15s ease;
}
.quote-tag {
  background: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  margin-right: 6px;
}
.quote-sender {
  font-weight: 700;
  color: #07c160;
  margin-right: 6px;
}
.quote-close-btn {
  font-size: 1.1rem;
  cursor: pointer;
}

/* Floating Emoji Panel */
.wechat-emoji-panel {
  position: absolute;
  bottom: 120px;
  left: 20px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 12px;
  width: 320px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  animation: slideMsg 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.emoji-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  font-size: 1.25rem;
}
.emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: transform 0.1s ease;
}
.emoji-btn:hover {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.1);
}

/* WeChat Input Dock */
.wechat-dock {
  background: rgba(18, 26, 44, 0.95);
  border-top: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
}
.wechat-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.tool-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.tool-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}
.tool-btn.active {
  background: rgba(7, 193, 96, 0.2);
  color: #07c160;
  border-color: rgba(7, 193, 96, 0.4);
}
.tool-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.wechat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 14px 12px 14px;
}
.input-text-container {
  flex: 1;
}
.input-text-container textarea {
  width: 100%;
  resize: none;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.4;
  outline: none;
  min-height: 40px;
  max-height: 90px;
  transition: border-color 0.2s ease;
}
.input-text-container textarea:focus {
  border-color: #07c160;
}

.input-voice-container {
  flex: 1;
}
.btn-hold-to-talk {
  width: 100%;
  height: 40px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-hold-to-talk:hover, .btn-hold-to-talk.active {
  background: rgba(7, 193, 96, 0.25);
  border-color: #07c160;
  color: #10b981;
}

.btn-wechat-send {
  background: #07c160;
  color: #fff;
  border: none;
  padding: 8px 18px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(7, 193, 96, 0.35);
  transition: all 0.15s ease;
}
.btn-wechat-send:hover {
  background: #06ad56;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(7, 193, 96, 0.45);
}
.btn-wechat-send:active {
  transform: translateY(0);
}

/* Lightbox Modal */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.lightbox-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}

/* Voice Recording Floating Overlay */
.voice-recording-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.recording-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #07c160;
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 280px;
  box-shadow: 0 0 35px rgba(7, 193, 96, 0.35);
  animation: slideMsg 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.recording-icon-mic {
  font-size: 2.8rem;
  animation: micPulse 1.2s infinite alternate ease-in-out;
}
@keyframes micPulse {
  from { transform: scale(1); filter: drop-shadow(0 0 5px #07c160); }
  to { transform: scale(1.15); filter: drop-shadow(0 0 15px #07c160); }
}
.recording-mic-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
}
.wave-bar {
  width: 4px;
  height: 8px;
  background: #07c160;
  border-radius: 2px;
  animation: waveBarBounce 0.8s infinite alternate ease-in-out;
}
.wave-bar:nth-child(2) { animation-delay: 0.15s; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; }
.wave-bar:nth-child(4) { animation-delay: 0.45s; }
.wave-bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes waveBarBounce {
  from { height: 6px; }
  to { height: 24px; }
}
.recording-time {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}
.recording-tip {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.recording-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

/* =========================================================================
   🛡️ 管理控制台与内容安全审核样式 (Admin Control Panel & Censorship Styles)
   ========================================================================= */

.admin-btn-glow {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(236, 72, 153, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.5) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.admin-btn-glow:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(236, 72, 153, 0.5));
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
  transform: translateY(-1px);
}

.modal-xl {
  max-width: 1180px !important;
  width: 95vw;
}

.admin-modal-card {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.2);
}

.admin-modal-header {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}
.admin-badge-icon {
  font-size: 1.8rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}
.admin-title-box h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
  letter-spacing: -0.02em;
}
.admin-title-box p {
  font-size: 0.8rem;
  margin: 2px 0 0 0;
  color: var(--text-dim);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}
.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Admin Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(10, 15, 29, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.admin-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.admin-tab-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.tab-chip {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.tab-chip.chip-danger {
  background: rgba(244, 63, 94, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.admin-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.admin-tab-pane {
  display: none;
}
.admin-tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

/* Grid Layout inside tabs */
.admin-section-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .admin-section-grid {
    grid-template-columns: 1fr;
  }
}

.admin-subcard {
  background: rgba(17, 24, 39, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.admin-subcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.admin-subcard-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

/* Admin Tables */
.admin-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 29, 0.4);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}
.admin-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}
.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Policy Switcher Cards */
.censor-policy-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}
.policy-card {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}
.policy-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.policy-card.selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}
.policy-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.policy-card.selected .policy-radio {
  border-color: #818cf8;
}
.policy-card.selected .policy-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #818cf8;
}
.policy-body {
  flex: 1;
}
.policy-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 4px;
}
.policy-body p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Engine Metrics Row */
.censor-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 600px) {
  .censor-metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
.censor-metric-item {
  background: rgba(10, 15, 29, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}
.censor-metric-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}
.censor-metric-lbl {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Sandbox */
.sandbox-box textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 15, 29, 0.6);
  color: #fff;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  resize: vertical;
}
.sandbox-actions {
  display: flex;
  gap: 10px;
}
.sandbox-result {
  background: rgba(10, 15, 29, 0.5);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
}
.sandbox-result h5 {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  color: #a5b4fc;
}
.sandbox-report-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
}
.report-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.report-item .lbl {
  width: 100px;
  color: var(--text-dim);
  font-weight: 600;
  flex-shrink: 0;
}
.hit-words-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hit-tag {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fca5a5;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}
.hit-cat-tag {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}
.filtered-preview {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: #38bdf8;
  word-break: break-all;
}

/* Lexicon Manager */
.lexicon-control-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.lexicon-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cat-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.cat-pill.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.lexicon-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.add-word-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lexicon-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding: 16px;
  background: rgba(10, 15, 29, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transition: all 0.2s ease;
}
.word-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.word-chip-cat {
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 600;
}
.cat-tag-politics { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.cat-tag-violence { background: rgba(249, 115, 22, 0.2); color: #fdba74; }
.cat-tag-pornography { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; }
.cat-tag-gambling { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.cat-tag-abuse { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.cat-tag-advertisement { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }

.word-chip-del {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: bold;
  line-height: 1;
  padding: 0 2px;
  border-radius: 50%;
  transition: color 0.15s ease;
}
.word-chip-del:hover {
  color: #f43f5e;
}

/* Muted Users Chips */
.muted-users-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}
.muted-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fca5a5;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
}
.muted-chip-unmute {
  cursor: pointer;
  color: #fff;
  background: rgba(244, 63, 94, 0.4);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

/* Audit Stream */
.audit-stream-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.audit-summary-text {
  font-size: 0.85rem;
  color: var(--text-dim);
}

