/* assets/css/arena.css -------------------------------------------------------
   AI Challenge Arena — ChessKidoo
   Full dark-themed game interface, analysis panel, post-game report,
   and digital certificate styles.
   --------------------------------------------------------------- */

/* ─── Arena Color Palette ─── */
#arena-page {
  --arena-bg: #0a0c0f;
  --arena-surface: #111418;
  --arena-surface2: #1a1f2e;
  --arena-surface3: #252b3a;
  --arena-border: #2d3748;
  --arena-border-light: #4a5568;
  --arena-gold: #f6c45a;
  --arena-gold-dark: #d9a82f;
  --arena-green: #10B981;
  --arena-green-light: #34d399;
  --arena-red: #EF5350;
  --arena-yellow: #F59E0B;
  --arena-orange: #f97316;
  --arena-blue: #63b3ed;
  --arena-purple: #a75ffa;
  --arena-teal: #0d9488;
  --arena-pink: #ec4899;
  --arena-cyan: #06b6d4;
  --arena-indigo: #6366f1;
  --arena-text: #f1f5f9;
  --arena-text-muted: #94a3b8;
  --arena-board-light: #ffffff;
  --arena-board-dark: #4a7c40;
  --arcade-board-light: #ffffff;
  --arcade-board-dark: #4a7c40;
  --arena-shadow: rgba(0, 0, 0, 0.4);
  --arena-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --card-puzzle: #f59e0b;
  --card-gm: #8b5cf6;
  --card-memory: #059669;
  --card-quick: #dc2626;
}

/* ─── Arena Page Layout ─── */
#arena-page {
  display: none;
  background: var(--arena-bg);
  color: var(--arena-text);
  min-height: 100vh;
  font-family: 'Poppins', sans-serif !important;
  background: var(--arena-gradient);
}
#arena-page.active {
  display: block;
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Header ─── */
.arena-header {
  background: linear-gradient(180deg, var(--arena-surface), var(--arena-surface2));
  border-bottom: 1px solid var(--arena-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px var(--arena-shadow);
  position: relative;
  overflow: hidden;
}
.arena-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 184, 75, 0.5), transparent);
}

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

.arena-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
.arena-logo:hover { opacity: 0.8; }
.arena-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--arena-gold), var(--arena-gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #0a0c0f;
  box-shadow: 0 4px 12px rgba(232, 184, 75, 0.3);
  transition: transform 0.2s;
}
.arena-logo-icon:hover { transform: scale(1.05) rotate(5deg); }
.arena-logo-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
}
.arena-logo-text span { color: var(--arena-gold); }

.arena-title-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--arena-text);
  padding-left: 16px;
  border-left: 1px solid var(--arena-border);
  opacity: 0.8;
}

.difficulty-selector {
  display: flex;
  gap: 6px;
  background: var(--arena-surface2);
  padding: 6px;
  border-radius: 12px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}
.diff-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--arena-text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.diff-btn:hover { color: var(--arena-text); background: rgba(255,255,255,0.05); }
.diff-btn.active {
  background: linear-gradient(135deg, var(--arena-gold), var(--arena-gold-dark));
  color: #0a0c0f;
  box-shadow: 0 4px 12px rgba(232, 184, 75, 0.4);
}
.diff-btn.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 1px solid var(--arena-gold);
  border-radius: 11px;
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.arena-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.arena-player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--arena-surface2);
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.2s;
}
.arena-player-info:hover { background: var(--arena-surface3); }
.arena-player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--arena-gold), var(--arena-gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #0a0c0f;
  box-shadow: 0 2px 6px rgba(232, 184, 75, 0.3);
}
.arena-player-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-back-home {
  background: var(--arena-surface2);
  border: 1px solid var(--arena-border);
  color: var(--arena-text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-back-home:hover { background: var(--arena-border); transform: translateY(-1px); }

.btn-more-games {
  background: linear-gradient(135deg, var(--arena-gold), var(--arena-gold-dark));
  color: #0a0c0f;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-more-games:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232, 184, 75, 0.4); }

/* ─── More Games Page ─── */
#more-games-page {
  display: none;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
  min-height: 100vh;
  padding: 60px 20px;
  color: var(--arena-text);
  font-family: 'Poppins', sans-serif !important;
  position: relative;
  overflow: hidden;
}
.more-games-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 30%, rgba(245, 158, 11, 0.15), transparent 30%),
              radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.15), transparent 30%),
              radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.1), transparent 40%);
  z-index: 0;
}
.more-games-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.game-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--arena-gold);
  border-radius: 50%;
  opacity: 0.5;
  animation: floatParticle 12s linear infinite;
  box-shadow: 0 0 8px var(--arena-gold);
}
@keyframes floatParticle {
  0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.4; }
  100% { transform: translate(calc(var(--tx, 100px)), calc(var(--ty, -100px))) scale(1); opacity: 0; }
}
#more-games-page.active {
  display: block;
}

.more-games-section {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.more-games-container {
  padding: 20px;
}

.more-games-header {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
}
.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--arena-text-muted);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 24px;
}
.btn-back-home:hover {
  background: rgba(255,255,255,0.1);
  color: var(--arena-text);
  transform: translateX(-4px);
}

.more-games-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}
.title-gradient {
  background: linear-gradient(135deg, #fbbf24, #fde68a, #fb923c, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 300% 300%;
  animation: shimmerTitle 4s ease-in-out infinite;
}
@keyframes shimmerTitle {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.more-games-subtitle {
  color: var(--arena-text-muted);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.7;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  margin-bottom: 60px;
}

.game-card {
  position: relative;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transform-style: preserve-3d;
}
.card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 26px;
  opacity: 0;
  transition: opacity 0.4s, filter 0.4s;
  filter: blur(12px);
  z-index: -1;
}
.puzzle-card .card-glow { background: radial-gradient(circle, rgba(245, 158, 11, 0.4), transparent 70%); }
.gm-card .card-glow { background: radial-gradient(circle, rgba(139, 92, 246, 0.4), transparent 70%); }
.memory-card .card-glow { background: radial-gradient(circle, rgba(5, 150, 105, 0.4), transparent 70%); }
.quick-card .card-glow { background: radial-gradient(circle, rgba(220, 38, 38, 0.4), transparent 70%); }
.oss-card .card-glow { background: radial-gradient(circle, rgba(var(--card-color-r), var(--card-color-g), var(--card-color-b), 0.3), transparent 70%); }

.game-card:hover {
  transform: translateY(-16px) rotateX(8deg) rotateY(-5deg);
  box-shadow: 0 40px 80px rgba(0,0,0,0.5);
  border-color: var(--card-color, var(--arena-gold));
}
.game-card:hover .card-glow {
  opacity: 1;
}

.game-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  display: inline-block;
  transition: transform 0.5s ease;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.15));
}
.game-card:hover .game-icon {
  transform: scale(1.2) rotate(15deg);
  filter: drop-shadow(0 0 20px var(--card-color));
}

.card-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--arena-text);
  letter-spacing: -0.02em;
}

.card-desc {
  color: var(--arena-text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
  font-weight: 400;
}

.card-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.08);
  color: var(--arena-text-muted);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.3s ease;
}
.game-card:hover .badge {
  background: rgba(255,255,255,0.15);
  color: var(--arena-text);
  border-color: var(--card-color);
}

.badge-puzzle { color: #fbbf24; }
.badge-gm { color: #a78bfa; }
.badge-memory { color: #34d399; }
.badge-quick { color: #fca5a5; }
.badge-mit { color: #67e8f9; }
.badge-gpl { color: #c084fc; }
.badge-github, .badge-open, .badge-lib { color: #86efac; }

.opensource-section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.opensource-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--arena-text);
}
.opensource-subtitle {
  color: var(--arena-text-muted);
  font-size: clamp(0.9rem, 2vw, 1rem);
  margin-bottom: 32px;
  max-width: 500px;
}

.games-grid--oss {
  margin-bottom: 0;
  gap: 28px;
}

/* Card color variables for JS */
:root {
  --card-color-r: 6, 182, 212;
  --card-color-g: 6, 182, 212;
  --card-color-b: 6, 182, 212;
}
/* ─── Game Layout ─── */
.arena-game-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
}

.arena-board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ─── Chessboard ─── */
.arena-board-container {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0;
  perspective: 1000px;
}

.arena-board-wrapper {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255,255,255,0.08), inset 0 0 40px rgba(0,0,0,0.4);
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.arena-board-wrapper::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--arena-gold), var(--arena-gold-dark), var(--arena-purple), var(--arena-blue));
  z-index: -1;
  opacity: 0.3;
  filter: blur(4px);
}

.arena-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(560px, 65vh);
  height: min(560px, 65vh);
  border: 4px solid #7A5530;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
}

.a-sq {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: filter 0.1s;
}
.a-sq.light { background: var(--arena-board-light); }
.a-sq.dark { background: var(--arena-board-dark); }
.a-sq:hover { filter: brightness(1.1); }

.a-sq.hl-legal {
  position: relative;
}
.a-sq.hl-legal::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.5);
  pointer-events: none;
  animation: pulseLegal 1s ease-in-out infinite;
}
@keyframes pulseLegal {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.a-sq.hl-lastmove { background: rgba(255,216,0,0.45) !important; }
.a-sq.hl-selected { background: rgba(16,185,129,0.55) !important; }
.a-sq.hl-check {
  background: radial-gradient(circle, rgba(239,83,80,0.7) 0%, rgba(239,83,80,0.3) 40%, transparent 70%) !important;
  animation: checkPulse 1s ease-in-out infinite;
}
@keyframes checkPulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(239,83,80,0.4); }
  50% { box-shadow: inset 0 0 30px rgba(239,83,80,0.7); }
}

.a-sq.hl-legal::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  pointer-events: none;
}
.a-sq.hl-legal-capture::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 4px solid rgba(0,0,0,0.2);
  border-radius: 50%;
  pointer-events: none;
}

.a-piece {
  width: 85%;
  height: 85%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 2;
  position: relative;
  transition: transform 0.18s ease;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6));
  cursor: grab;
}
.a-piece svg {
  width: 100%;
  height: 100%;
  display: block;
}
.a-piece:active { cursor: grabbing; }

/* Custom premium pieces colors */
.a-piece.piece-w {
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.7));
}
.a-piece.piece-b {
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.9));
}

/* Coordinate labels */
.arena-coords-left {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding-right: 4px;
  height: min(560px, 65vh);
}
.arena-coords-bottom {
  display: flex;
  justify-content: space-around;
  padding-top: 4px;
  width: min(560px, 65vh);
}
.arena-coord {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  width: 12.5%;
  text-align: center;
  font-family: 'Poppins', sans-serif !important;
}
.arena-coords-left .arena-coord {
  height: 12.5%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Evaluation Bar ─── */
.eval-bar-container {
  width: 24px;
  height: min(560px, 65vh);
  margin-right: 6px;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.05);
}
.eval-bar {
  width: 100%;
  position: absolute;
  transition: height 0.3s ease, top 0.3s ease;
}
.eval-bar-white {
  bottom: 0;
  background: #e2e8f0;
  border-radius: 0 0 3px 3px;
}
.eval-bar-black {
  top: 0;
  background: #181d25; /* Match --arena-surface2 dark color */
  border-radius: 3px 3px 0 0;
}
.eval-bar-label {
  position: absolute;
  right: 28px;
  font-size: 10px;
  font-weight: 700;
  color: var(--arena-text-muted);
  white-space: nowrap;
  transition: top 0.3s ease;
  pointer-events: none;
}

/* ─── Analysis Panel ─── */
.arena-analysis-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.arena-panel {
  background: var(--arena-surface);
  border: 1px solid var(--arena-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.arena-panel:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

.arena-panel-header {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--arena-text-muted);
  border-bottom: 1px solid var(--arena-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Engine eval display */
.engine-eval-display {
  padding: 16px;
  text-align: center;
}
.engine-eval-value {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--arena-green);
  line-height: 1;
  transition: color 0.3s;
}
.engine-eval-value.negative { color: var(--arena-red); }
.engine-depth {
  font-size: 0.75rem;
  color: var(--arena-text-muted);
  margin-top: 6px;
}
.engine-best-line {
  font-size: 0.75rem;
  color: var(--arena-text-muted);
  margin-top: 8px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  word-break: break-all;
}

/* Move list */
.arena-move-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--arena-border) transparent;
}
.arena-move-list::-webkit-scrollbar { width: 4px; }
.arena-move-list::-webkit-scrollbar-thumb { background: var(--arena-border); border-radius: 2px; }

.amove-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  gap: 2px;
  align-items: center;
  margin-bottom: 1px;
  transition: background 0.2s;
}
.amove-row:hover { background: rgba(255,255,255,0.03); }
.amove-num {
  color: var(--arena-text-muted);
  font-size: 0.7rem;
  text-align: right;
  padding-right: 4px;
}
.amove-san {
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
  color: var(--arena-text);
}
.amove-san:hover { background: rgba(255,255,255,0.06); }
.amove-san.active { background: var(--arena-gold); color: #0a0c0f; font-weight: 700; }

.amove-san.class-brilliant { border-left: 3px solid #00d4aa; }
.amove-san.class-best { border-left: 3px solid var(--arena-green); }
.amove-san.class-excellent { border-left: 3px solid var(--arena-green-light); }
.amove-san.class-good { border-left: 3px solid var(--arena-blue); }
.amove-san.class-inaccuracy { border-left: 3px solid var(--arena-yellow); }
.amove-san.class-mistake { border-left: 3px solid var(--arena-orange); }
.amove-san.class-blunder { border-left: 3px solid var(--arena-red); }

/* Captured pieces */
.captured-pieces {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 28px;
}
.captured-piece {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.captured-piece svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Clock display */
.arena-clock {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.clock-time {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--arena-text);
}
.clock-time.active { color: var(--arena-gold); }
.clock-label { font-size: 0.7rem; color: var(--arena-text-muted); }

/* ─── Game Controls ─── */
.arena-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.arena-ctrl-btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--arena-border);
  background: var(--arena-surface);
  color: var(--arena-text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.arena-ctrl-btn:hover { background: var(--arena-surface2); border-color: var(--arena-border-light); }
.arena-ctrl-btn.danger { border-color: rgba(239,83,80,0.3); color: var(--arena-red); }
.arena-ctrl-btn.danger:hover { background: rgba(239,83,80,0.1); }
.arena-ctrl-btn.primary { background: var(--arena-gold); color: #0a0c0f; border-color: var(--arena-gold); }
.arena-ctrl-btn.primary:hover { background: var(--arena-gold-dark); }
.arena-ctrl-btn.hint { border-color: var(--arena-blue); color: var(--arena-blue); }
.arena-ctrl-btn.hint:hover { background: rgba(99, 179, 237, 0.2); }

/* Hint highlight animation */
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 179, 237, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(99, 179, 237, 0); }
}

/* ─── Game Status Bar ─── */
.arena-status {
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--arena-text-muted);
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.arena-status.check { color: var(--arena-red); }
.arena-status.gameover { color: var(--arena-gold); }

/* ─── Loading Spinner ─── */
.arena-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}
.arena-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--arena-border);
  border-top-color: var(--arena-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.arena-loading-text {
  font-size: 0.85rem;
  color: var(--arena-text-muted);
}

/* ─── Test Your Skill Button (on landing page) ─── */
.test-skill-btn {
  background: linear-gradient(135deg, #f6ca59 0%, #e2ab2f 100%);
  color: #211603 !important;
  border: none;
  border-radius: 28px;
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Poppins', sans-serif !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(226, 171, 47, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  min-width: 160px;
  text-decoration: none;
}
.test-skill-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.test-skill-btn:hover::before { opacity: 1; }
.test-skill-btn:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 12px 30px rgba(226, 171, 47, 0.5), 0 0 20px rgba(226, 171, 47, 0.3);
}
.test-skill-btn:active { transform: translateY(0) scale(0.98); }
.tsb-icon { 
  font-size: 20px; 
  line-height: 1; 
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.tsb-text { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-shadow: 0 0 1px rgba(255,255,255,0.1); }
.tsb-sub { font-size: 9px; font-weight: 600; opacity: 0.85; letter-spacing: 0.04em; text-transform: uppercase; }

/* ─── Post-Game Report Modal ─── */
.arena-report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.arena-report-overlay.active { display: flex; }

.arena-report-modal {
  background: var(--arena-surface);
  border: 1px solid var(--arena-border);
  border-radius: 20px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  animation: reportIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--arena-border) transparent;
}
@keyframes reportIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.arena-report-header {
  padding: 28px 32px 16px;
  text-align: center;
  border-bottom: 1px solid var(--arena-border);
}
.arena-report-result {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  margin-bottom: 4px;
}
.arena-report-result.win { color: var(--arena-green); }
.arena-report-result.loss { color: var(--arena-red); }
.arena-report-result.draw { color: var(--arena-yellow); }
.arena-report-sub {
  font-size: 0.85rem;
  color: var(--arena-text-muted);
}

.arena-report-body {
  padding: 24px 32px;
}

/* Stat cards */
.report-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.report-stat-card {
  background: var(--arena-surface2);
  border: 1px solid var(--arena-border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}
.report-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--arena-gold);
  line-height: 1;
}
.report-stat-label {
  font-size: 0.65rem;
  color: var(--arena-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* Move breakdown bar */
.move-breakdown {
  margin-bottom: 24px;
}
.move-breakdown-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--arena-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.breakdown-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.breakdown-label {
  width: 80px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: right;
}
.breakdown-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--arena-surface2);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
.bar-seg { height: 100%; transition: width 0.6s ease; }
.bar-brilliant { background: #00d4aa; }
.bar-best { background: var(--arena-green); }
.bar-excellent { background: var(--arena-green-light); }
.bar-good { background: var(--arena-blue); }
.bar-inaccuracy { background: var(--arena-yellow); }
.bar-mistake { background: var(--arena-orange); }
.bar-blunder { background: var(--arena-red); }
.breakdown-count {
  width: 30px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--arena-text-muted);
}

/* Eval graph */
.eval-graph-container {
  margin-bottom: 24px;
  background: var(--arena-surface2);
  border-radius: 12px;
  padding: 16px;
}
.eval-graph-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--arena-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* Key moments */
.key-moments {
  margin-bottom: 24px;
}
.key-moments-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--arena-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.key-moment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--arena-surface2);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.key-moment-item:hover { background: var(--arena-border); }
.km-move {
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  min-width: 50px;
}
.km-type {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.km-type.blunder { background: rgba(239,83,80,0.2); color: var(--arena-red); }
.km-type.mistake { background: rgba(249,115,22,0.2); color: var(--arena-orange); }
.km-type.brilliant { background: rgba(0,212,170,0.2); color: #00d4aa; }
.km-desc { color: var(--arena-text-muted); flex: 1; }

/* Report actions */
.arena-report-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 0 32px 28px;
}
.report-btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border: none;
}
.report-btn-primary {
  background: var(--arena-gold);
  color: #0a0c0f;
}
.report-btn-primary:hover { background: var(--arena-gold-dark); }
.report-btn-secondary {
  background: var(--arena-surface2);
  color: var(--arena-text);
  border: 1px solid var(--arena-border);
}
.report-btn-secondary:hover { background: var(--arena-border); }

/* ─── Certificate Modal ─── */
.cert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
}
.cert-overlay.active { display: flex; }

.cert-modal {
  background: #fffdf5;
  border-radius: 8px;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  animation: certIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 25px 80px rgba(0,0,0,0.5);
  border: 1px solid rgba(200, 154, 56, 0.3);
}

.cert-border-outer {
  border: 3px solid #c89a38;
  margin: 16px;
  padding: 2px;
  position: relative;
}
.cert-border-outer::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(200, 154, 56, 0.5);
  border-radius: 4px;
}
.cert-border-inner {
  border: 1px solid #e8b84b;
  padding: 50px;
  text-align: center;
  position: relative;
  background: radial-gradient(circle at center top, #fffdf5 0%, #fef9e7 100%);
}

/* Watermarked background */
.cert-border-inner::after {
  content: '♛';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 180px;
  color: rgba(200, 154, 56, 0.05);
  z-index: 0;
  pointer-events: none;
}

/* Gold shimmer */
.cert-border-inner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(232,184,75,0.08) 50%, transparent 60%);
  animation: certShimmer 8s linear infinite;
  pointer-events: none;
}
@keyframes certShimmer {
  from { transform: translateX(-30%) translateY(-30%) rotate(0deg); }
  to { transform: translateX(30%) translateY(30%) rotate(360deg); }
}
.cert-overlay.active { display: flex; }

.cert-modal {
  background: #fffdf5;
  border-radius: 4px;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  animation: certIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
@keyframes certIn {
  from { opacity: 0; transform: scale(0.85) rotateX(5deg); }
  to { opacity: 1; transform: scale(1) rotateX(0deg); }
}

.cert-border-outer {
  border: 3px solid #c89a38;
  margin: 12px;
  padding: 2px;
}
.cert-border-inner {
  border: 1px solid #e8b84b;
  padding: 40px 50px;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, #fffdf5 0%, #fef9e7 100%);
}

/* Gold shimmer */
.cert-border-inner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(232,184,75,0.06) 50%, transparent 60%);
  animation: certShimmer 6s linear infinite;
  pointer-events: none;
}
@keyframes certShimmer {
  from { transform: translateX(-30%) translateY(-30%) rotate(0deg); }
  to { transform: translateX(30%) translateY(30%) rotate(360deg); }
}

.cert-logo {
  font-size: 2.4rem;
  margin-bottom: 8px;
  color: #c89a38;
}
.cert-academy-name {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.cert-academy-name span { color: #c89a38; }
.cert-title {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: #c89a38;
  text-transform: uppercase;
  letter-spacing: 6px;
  margin: 20px 0 8px;
  border-bottom: 2px solid #e8b84b;
  display: inline-block;
  padding-bottom: 8px;
}
.cert-subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 24px;
  font-style: italic;
}

/* Name input section */
.cert-input-section {
  margin: 20px 0;
  padding: 16px;
  background: rgba(232, 184, 75, 0.05);
  border-radius: 12px;
  border: 1px dashed rgba(200, 154, 56, 0.3);
}
.cert-presented {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 8px;
}
.cert-player-name {
  font-family: 'Poppins', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: #1a1a1a;
  margin: 8px 0 20px;
  border-bottom: 1px solid #ddd;
  display: inline-block;
  padding: 0 40px 8px;
}

.cert-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 440px;
  margin: 0 auto 24px;
  text-align: left;
}
.cert-detail-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px dotted #ddd;
}
.cert-detail-label { color: #888; font-weight: 500; }
.cert-detail-value { color: #1a1a1a; font-weight: 700; }

.cert-grade {
  font-size: 3.5rem;
  font-weight: 900;
  font-family: 'Poppins', sans-serif;
  margin: 16px 0;
  line-height: 1;
}
.cert-grade.grade-s { color: #c89a38; }
.cert-grade.grade-a { color: #10B981; }
.cert-grade.grade-b { color: #5b96f6; }
.cert-grade.grade-c { color: #F59E0B; }
.cert-grade.grade-d { color: #EF5350; }

.cert-id {
  font-size: 0.7rem;
  color: #aaa;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  margin-top: 16px;
}
.cert-date {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

/* Signature area */
.cert-signature-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed rgba(200, 154, 56, 0.3);
}
.cert-signature {
  text-align: center;
}
.cert-signature-line {
  width: 120px;
  height: 1px;
  background: #333;
  margin: 0 auto 8px;
}
.cert-signature-label {
  font-size: 0.75rem;
  color: #666;
  font-style: italic;
}

.cert-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.cert-btn {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border: none;
}
.cert-btn-print {
  background: #c89a38;
  color: #fff;
}
.cert-btn-print:hover { background: #b8892e; }
.cert-btn-close {
  background: #eee;
  color: #333;
}
.cert-btn-close:hover { background: #ddd; }

/* ─── Print Styles ─── */
@media print {
  body * { visibility: hidden; }
  .cert-overlay, .cert-overlay * { visibility: visible; }
  .cert-overlay {
    position: absolute;
    inset: 0;
    background: #fff;
    display: block;
    padding: 0;
    max-height: none;
    overflow: visible;
  }
  .cert-modal {
    box-shadow: none;
    max-width: 100%;
    animation: none;
    max-height: none;
    overflow: visible;
  }
  .cert-actions { display: none !important; }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .arena-game-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .arena-analysis-col {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .arena-panel { flex: 1; min-width: 250px; }
  .arena-board { width: min(500px, 80vw); height: min(500px, 80vw); }
  .eval-bar-container { height: min(500px, 80vw); }
  .arena-coords-left { height: min(500px, 80vw); }
  .arena-coords-bottom { width: min(500px, 80vw); }
}

@media (max-width: 768px) {
  .arena-header { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .arena-title-text { display: none; }
  .difficulty-selector { order: 3; width: 100%; justify-content: center; }
  .arena-board { width: min(380px, 90vw); height: min(380px, 90vw); }
  .eval-bar-container { height: min(380px, 90vw); }
  .arena-coords-left { height: min(380px, 90vw); }
  .arena-coords-bottom { width: min(380px, 90vw); }
  .arena-analysis-col { flex-direction: column; }
  .report-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .arena-report-modal { max-height: 95vh; }
  .arena-report-header { padding: 20px 20px 12px; }
  .arena-report-body { padding: 16px 20px; }
  .arena-report-actions { padding: 0 20px 20px; }
  .cert-border-inner { padding: 24px 20px; }
  .cert-details-grid { grid-template-columns: 1fr; }
}

/* ─── ChessKidoo Arcade Cabinets (Playable Games Redesign) ─── */
.arcade-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 17, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  animation: arcadeFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes arcadeFadeIn {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}
.arcade-overlay.active {
  display: flex;
}

.arcade-cabinet {
  background: linear-gradient(145deg, #111827 0%, #030712 100%);
  border: 2px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8), 0 0 50px rgba(245, 158, 11, 0.15);
  border-radius: 28px;
  width: 100%;
  max-width: 960px;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.arcade-cabinet::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #f59e0b, #10b981, #06b6d4, #f59e0b);
  background-size: 300% 100%;
  animation: arcadeBorderShimmer 6s linear infinite;
}
@keyframes arcadeBorderShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.arcade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.arcade-title-area {
  display: flex;
  align-items: center;
  gap: 16px;
}
.arcade-game-icon {
  font-size: 2.2rem;
  animation: arcadeBounce 2s ease-in-out infinite;
}
@keyframes arcadeBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.arcade-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.arcade-title span {
  color: #f59e0b;
}

.arcade-exit-btn {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.25);
  color: #ef5350;
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.arcade-exit-btn:hover {
  background: #ef5350;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(239, 83, 80, 0.4);
}

.arcade-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
}

/* Play Board Area */
.arcade-play-area {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.04);
  position: relative;
}
.arcade-board-wrap {
  position: relative;
  width: 400px;
  height: 400px;
  max-width: 100%;
}
.arcade-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 4px solid #3a5220;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(85,107,47,0.3), inset 0 0 20px rgba(0,0,0,0.2);
  position: relative;
}
.arcade-sq {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s ease, outline 0.1s ease;
}
.arcade-sq.light {
  background-color: var(--arcade-board-light, #f5f5e8);
}
.arcade-sq.dark {
  background-color: var(--arcade-board-dark, #556b2f);
}
.arcade-sq:hover {
  filter: brightness(1.15);
  outline: 2px solid rgba(85,107,47,0.55);
  outline-offset: -2px;
  z-index: 1;
}
.arcade-sq.valid-dest::before {
  content: '';
  width: 34%;
  height: 34%;
  background: rgba(232,184,75,0.75);
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 12px rgba(232,184,75,0.9), 0 0 4px rgba(232,184,75,0.5);
  animation: pulseScale 0.9s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes pulseScale {
  from { transform: scale(0.85); opacity: 0.8; }
  to   { transform: scale(1.12); opacity: 1; }
}
.arcade-sq.selected {
  background-color: rgba(232,184,75,0.45) !important;
  outline: 3px solid rgba(232,184,75,0.85);
  outline-offset: -3px;
}
.arcade-sq.success-glow {
  animation: successFlash 0.65s ease;
}
@keyframes successFlash {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.8); background-color: rgba(52,211,153,0.65) !important; }
  100% { filter: brightness(1); }
}

/* Pieces — high-contrast on olive/ivory board */
.arcade-piece {
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  line-height: 1;
  pointer-events: none;
}
.arcade-piece.white {
  color: #fffde7;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.9),
     1px -1px 0 rgba(0,0,0,0.9),
    -1px  1px 0 rgba(0,0,0,0.9),
     1px  1px 0 rgba(0,0,0,0.9),
     0 0 10px rgba(0,0,0,0.7);
  filter: none;
}
.arcade-piece.black {
  color: #1a1a2e;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.85),
     1px -1px 0 rgba(255,255,255,0.85),
    -1px  1px 0 rgba(255,255,255,0.85),
     1px  1px 0 rgba(255,255,255,0.85),
     0 0 8px rgba(255,255,255,0.4);
  filter: none;
}

.arcade-star {
  font-size: 1.8rem;
  color: #fbbf24;
  animation: arcadeStarGlow 1.2s ease-in-out infinite alternate;
  z-index: 4;
}
@keyframes arcadeStarGlow {
  from { transform: scale(0.9); filter: drop-shadow(0 0 4px #fbbf24); }
  to { transform: scale(1.15); filter: drop-shadow(0 0 12px #fbbf24); }
}

/* Sidebar Dashboard */
.arcade-dashboard {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}
.arcade-hud-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 24px;
}
.arcade-game-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 8px;
}
.arcade-game-desc {
  font-size: 0.88rem;
  color: var(--arena-text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.arcade-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.arcade-stat-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
}
.arcade-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--arena-text-muted);
  margin-bottom: 4px;
}
.arcade-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
}

.arcade-progress-container {
  margin-bottom: 20px;
}
.arcade-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.arcade-progress-bar {
  background: rgba(255, 255, 255, 0.08);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.arcade-progress-fill {
  background: linear-gradient(90deg, #f59e0b, #10b981);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.arcade-btn-group {
  display: flex;
  gap: 12px;
}
.arcade-action-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.arcade-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.arcade-action-btn.primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: none;
  color: #030712;
}
.arcade-action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

/* Match-3 Card Grid Specifics */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 420px;
}
.memory-card-element {
  aspect-ratio: 1;
  perspective: 1000px;
  cursor: pointer;
}
.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.memory-card-element.flipped .memory-card-inner {
  transform: rotateY(180deg);
}
.memory-card-front, .memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.memory-card-front {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  font-size: 2rem;
  color: #f59e0b;
}
.memory-card-back {
  background: #ffffff;
  color: #0c121e;
  transform: rotateY(180deg);
  font-size: 2.2rem;
}
.memory-card-element.matched .memory-card-back {
  background: #d1fae5;
  border: 1.5px solid #10b981;
}

/* Guess the GM layout */
.gm-card-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.gm-clues {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.04);
}
.gm-clue-item {
  font-size: 0.9rem;
  color: var(--arena-text-muted);
  line-height: 1.5;
}
.gm-clue-item span {
  color: #fbbf24;
  font-weight: 700;
}
.gm-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
.gm-option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gm-option-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
}
.gm-option-btn.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}
.gm-option-btn.wrong {
  background: rgba(239, 83, 80, 0.15) !important;
  border-color: #ef5350 !important;
  color: #ef5350 !important;
}

@media (max-width: 768px) {
  .arcade-main {
    grid-template-columns: 1fr;
  }
  .arcade-board-wrap {
    width: 320px;
    height: 320px;
  }
}

/* ─── Premium AI Challenge Arena Look & Design Overhaul ─── */
#arena-page {
  background-color: #0c121e !important;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px) !important;
  background-size: 40px 40px !important;
  background-position: center !important;
}

.arena-header {
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35) !important;
}

.arena-logo {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}
.arena-logo::before {
  content: '♘';
  width: 36px;
  height: 36px;
  background: #E8A020;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c2e4a;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(232, 160, 32, 0.35);
}
.arena-logo img {
  display: none !important; /* Hide old img logo inside arena */
}

.difficulty-selector {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.06) !important;
  padding: 4px !important;
  border-radius: 14px !important;
}
.diff-btn {
  padding: 8px 16px !important;
  font-size: 0.8rem !important;
  border-radius: 10px !important;
}
.diff-btn.active {
  background: linear-gradient(135deg, #eab308 0%, #d97706 100%) !important;
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.35) !important;
}

/* Glassmorphism Panels */
.arena-panel {
  background: rgba(15, 23, 42, 0.45) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-radius: 20px !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden;
}
.arena-panel:hover {
  transform: translateY(-3px) !important;
  border-color: rgba(232, 160, 32, 0.2) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
}

.arena-panel-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  font-size: 0.75rem !important;
  color: #fbbf24 !important;
}

/* Custom Neon Led evaluation bar */
.eval-bar-container {
  border-radius: 8px !important;
  border: 1.5px solid rgba(255,255,255,0.06) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
  overflow: hidden;
  position: relative;
}
.eval-bar-white {
  background: #ffffff !important;
}
.eval-bar-black {
  background: #111827 !important;
}
.eval-bar-container::after {
  content: '';
  position: absolute;
  left: 0; right: 0; height: 3px;
  background: #fbbf24;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 12px #fbbf24, 0 0 4px #fbbf24;
  z-index: 5;
}

/* Neon Digital Timer clocks */
.arena-clock {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 16px !important;
  padding: 16px !important;
  border: 1px solid rgba(255,255,255,0.04) !important;
}
#arena-clock-white-wrap, #arena-clock-black-wrap {
  background: rgba(15, 23, 42, 0.5) !important;
  border: 1.5px solid rgba(255,255,255,0.04) !important;
  border-radius: 12px !important;
  padding: 12px !important;
}
#arena-clock-white-wrap .clock-time {
  color: #06b6d4 !important;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.4) !important;
  font-family: 'Courier New', monospace !important;
}
#arena-clock-black-wrap .clock-time {
  color: #f59e0b !important;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
  font-family: 'Courier New', monospace !important;
}

/* Beautiful custom promotional banner below chessboard controls */
.arena-arcade-promo {
  width: 100%;
  max-width: 580px;
  margin: 24px auto 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.85) 100%);
  border: 2px solid rgba(245, 158, 11, 0.2);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 25px rgba(245, 158, 11, 0.08);
  animation: promoPulseBorder 3s infinite alternate;
}
@keyframes promoPulseBorder {
  0% { border-color: rgba(245, 158, 11, 0.2); }
  100% { border-color: rgba(245, 158, 11, 0.45); }
}

.arcade-promo-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.1), transparent 60%);
  pointer-events: none;
}

.arcade-promo-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.arcade-promo-icon {
  font-size: 2.8rem;
  animation: arcadePulseScale 2s infinite alternate;
}
@keyframes arcadePulseScale {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.1); }
}

.arcade-promo-text {
  text-align: left;
  flex: 1;
}
.arcade-promo-text h4 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
}
.arcade-promo-text p {
  font-size: 0.85rem;
  color: var(--arena-text-muted);
  margin: 0;
  line-height: 1.5;
}

.arcade-promo-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  border: none;
  color: #030712;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}
.arcade-promo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

/* Arena Multi-Device Auto-Size Layer */
@media (min-width: 1600px) {
  .arena-wrapper { max-width: 1550px; margin: 0 auto; width: 100%; }
  .arena-board { width: 560px !important; height: 560px !important; }
}
@media (max-width: 1024px) and (min-width: 769px) {
  .arena-grid { grid-template-columns: 1fr !important; gap: 32px; }
  .arena-board { width: 440px !important; height: 440px !important; margin: 0 auto; }
}

@media (max-width: 768px) {
  .arcade-promo-content {
    flex-direction: column;
    text-align: center;
  }
  .arcade-promo-text {
    text-align: center;
  }
  .arcade-promo-btn {
    width: 100%;
  }
  .arena-board {
    width: min(360px, 92vw) !important;
    height: min(360px, 92vw) !important;
  }
  .arena-panel {
    padding: 16px !important;
  }
  .diff-btn {
    padding: 6px 10px !important;
    font-size: 0.75rem !important;
  }
  .arena-header {
    padding: 14px 16px !important;
  }
}

/* ─── Arcade Responsive & Production Fixes ─── */

/* Make board-wrap square and fully responsive */
.arcade-board-wrap {
  position: relative;
  width: min(400px, calc(100vw - 64px));
  height: min(400px, calc(100vw - 64px));
  max-width: 100%;
  aspect-ratio: 1 / 1;
}

/* Board coordinate labels overlaid on the board */
.arcade-board-coords {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Tablet: stack board + dashboard vertically */
@media (max-width: 900px) {
  .arcade-cabinet {
    padding: 20px 16px;
    border-radius: 18px;
  }
  .arcade-main {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .arcade-board-wrap {
    width: min(340px, calc(100vw - 40px));
    height: min(340px, calc(100vw - 40px));
  }
  .arcade-dashboard {
    max-height: unset;
  }
  .arcade-stats-row {
    gap: 10px;
  }
}

/* Mobile */
@media (max-width: 520px) {
  .arcade-overlay {
    padding: 8px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .arcade-cabinet {
    padding: 14px 10px;
    border-radius: 14px;
    max-height: unset;
  }
  .arcade-board-wrap {
    width: min(280px, calc(100vw - 28px));
    height: min(280px, calc(100vw - 28px));
  }
  .arcade-title { font-size: 1.3rem !important; }
  .arcade-game-icon { font-size: 1.6rem !important; }
  .arcade-piece { font-size: 1.8rem !important; }
}

/* More Games page responsive */
@media (max-width: 640px) {
  .games-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .games-score-strip {
    gap: 8px;
    flex-wrap: wrap;
  }
  .score-strip-item {
    min-width: 80px;
    flex: 1;
  }
  .more-games-title {
    font-size: 1.8rem !important;
  }
}
@media (max-width: 420px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Production: Arcade board coord labels ─── */
.arcade-board-frame {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.arcade-ranks {
  position: absolute;
  left: -20px;
  top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(85,107,47,0.7);
  pointer-events: none;
}
.arcade-files {
  display: flex;
  justify-content: space-around;
  width: 100%;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(85,107,47,0.7);
  pointer-events: none;
  padding: 0 2px;
  margin-top: 4px;
}

/* ─── Production: Game card hover improvement ─── */
.game-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-best {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 10px;
}
.card-best span {
  font-weight: 700;
  color: var(--arena-gold, #f6c45a);
}

/* Force Poppins Font on Arena Page Elements */
#arena-page, #arena-page * {
  font-family: 'Poppins', sans-serif !important;
}

/* ─── Match Commentary Feed ─── */
.commentary-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.commentary-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  animation: commentarySlideIn 0.35s ease both;
}
.commentary-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}
.commentary-text {
  margin: 0;
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.6;
}
.commentary-text strong { color: #f1f5f9; }
@keyframes commentarySlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Grade value in stat card (colored) ─── */
.grade-val.grade-s { color: #e8b84b; text-shadow: 0 0 12px rgba(232,184,75,0.5); }
.grade-val.grade-a { color: #10b981; text-shadow: 0 0 12px rgba(16,185,129,0.4); }
.grade-val.grade-b { color: #5b9cf6; text-shadow: 0 0 12px rgba(91,156,246,0.4); }
.grade-val.grade-c { color: #f59e0b; text-shadow: 0 0 12px rgba(245,158,11,0.4); }
.grade-val.grade-d { color: #ef5350; text-shadow: 0 0 12px rgba(239,83,80,0.4); }

/* ─── Puzzle Board Olive Theme ─── */
.pz-board-inner {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
}
.pz-board-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
