/* === PREMIUM GAME SHELL & GLOBAL THEMES === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body.game-page {
  background: #0d0e12;
  color: #e2e8f0;
  font-family: "JetBrains Mono", monospace;
  cursor: default;
  overflow-x: hidden;
}

/* NAV */
.game-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(13, 14, 18, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.5px;
}
.brand i {
  font-size: 18px;
  color: var(--theme-accent, #00f5ff);
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.4);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* CONTAINER */
.game-area {
  max-width: 860px;
  margin: 24px auto 80px;
  padding: 0 20px;
}

/* === PLATO STYLED LOBBY HUD & STATS === */
.plato-hud {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.hud-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}
.chip-pies {
  border-color: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}
.chip-streak {
  border-color: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}
.chip-xp {
  border-color: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

/* CATEGORIES HORIZONTAL SLIDER TABS */
.category-slider {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
  overflow-x: auto;
}
.cat-tab {
  flex: 0 1 90px;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Orbitron", sans-serif;
  position: relative;
}
.cat-tab .cat-icon {
  font-size: 20px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.cat-tab .cat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.cat-tab .cat-badge {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 1px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


/* Active & Hover tab styling */
.cat-tab:hover, .cat-tab.active {
  color: var(--theme-accent, #fff);
  opacity: 1;
}
.cat-tab:hover .cat-icon, .cat-tab.active .cat-icon {
  border-color: var(--theme-accent, rgba(255, 255, 255, 0.25));
  background: var(--theme-accent-glow, rgba(255, 255, 255, 0.05));
  color: var(--theme-accent, #fff);
  box-shadow: 0 0 10px var(--theme-accent-glow);
}
.cat-tab:hover .cat-icon {
  transform: translateY(-2px);
}
.cat-tab.active .cat-icon {
  transform: translateY(0);
}
.cat-tab:hover .cat-badge, .cat-tab.active .cat-badge {
  border-color: var(--theme-accent, rgba(255, 255, 255, 0.25));
  background: var(--theme-accent-glow, rgba(255, 255, 255, 0.05));
  color: var(--theme-accent, #fff);
  box-shadow: 0 0 8px var(--theme-accent-glow);
}

/* Category Colors Map */
.cat-tab[data-category="math"] {
  --theme-accent: #f59e0b;
  --theme-accent-glow: rgba(245, 158, 11, 0.15);
}
.cat-tab[data-category="memory"] {
  --theme-accent: #00f5ff;
  --theme-accent-glow: rgba(0, 245, 255, 0.15);
}
.cat-tab[data-category="puzzle"] {
  --theme-accent: #22c55e;
  --theme-accent-glow: rgba(34, 197, 94, 0.15);
}
.cat-tab[data-category="logic"] {
  --theme-accent: #ec4899;
  --theme-accent-glow: rgba(236, 72, 153, 0.15);
}

/* GAME CARDS LIST GRID */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.game-card {
  display: none;
  position: relative;
  padding: 24px 30px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.game-card.active-tab-card {
  display: block;
}
.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.01) 0%,
    transparent 100%
  );
  pointer-events: none;
}
.game-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--theme-accent, rgba(255, 255, 255, 0.15));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.card-kicker {
  font-family: "Orbitron", sans-serif;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--theme-accent, #fff);
  margin-bottom: 6px;
}
.card-title {
  font-family: "Orbitron", sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.card-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  font-family: "JetBrains Mono", monospace;
}
.card-arrow {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.3);
  transition: all 0.2s;
}
.game-card:hover .card-arrow {
  color: var(--theme-accent, #fff);
  transform: translate(4px, -50%);
}

/* Card themes */
.game-card[data-category="math"] {
  --theme-accent: #f59e0b;
}
.game-card[data-category="memory"] {
  --theme-accent: #00f5ff;
}
.game-card[data-category="puzzle"] {
  --theme-accent: #22c55e;
}
.game-card[data-category="logic"] {
  --theme-accent: #ec4899;
}

/* MODULAR SETUP LOBBY */
.setup-lobby-panel {
  display: none;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
  padding: 32px 24px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}
.setup-lobby-panel.active {
  display: block;
}
.setup-lobby-panel h2 {
  font-family: "Orbitron", sans-serif;
  color: #fff;
  font-size: 24px;
  margin-bottom: 24px;
  letter-spacing: 1px;
}
.setup-group {
  margin-bottom: 22px;
  text-align: left;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.setup-group label {
  display: block;
  font-size: 10px;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 8px;
}
.lobby-modes {
  display: flex;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.lobby-btn {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.lobby-btn:last-child {
  border-right: none;
}
.lobby-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--setup-theme-color, #fff);
  text-shadow: 0 0 8px var(--setup-theme-glow, rgba(255, 255, 255, 0.4));
  border-bottom: 2px solid var(--setup-theme-color, #fff);
}
.matiks-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  padding: 12px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: all 0.2s;
}
.matiks-input:focus {
  border-color: var(--setup-theme-color, #fff);
  box-shadow: 0 0 10px var(--setup-theme-glow, rgba(255, 255, 255, 0.15));
}
.matiks-status-log {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 14px;
  font-family: "JetBrains Mono", monospace;
  min-height: 18px;
}
.room-code-display {
  font-family: "Orbitron", sans-serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--setup-theme-color, #fff);
  letter-spacing: 4px;
  text-shadow: 0 0 14px var(--setup-theme-glow, rgba(255, 255, 255, 0.4));
  margin: 16px 0;
}

/* TTT Difficulty Selector */
.ttt-difficulty {
  display: flex;
  justify-content: center;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}
.ttt-difficulty .diff-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.ttt-difficulty .diff-btn:last-child {
  border-right: none;
}
.ttt-difficulty .diff-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--setup-theme-color, #fff);
  text-shadow: 0 0 8px var(--setup-theme-glow, rgba(255, 255, 255, 0.4));
}
.ttt-difficulty .diff-btn:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

/* BUTTONS GLOBAL */
.restart-btn {
  padding: 12px 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.restart-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--setup-theme-color, #fff);
  box-shadow: 0 0 16px var(--setup-theme-glow, rgba(255, 255, 255, 0.15));
}
.start-btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.start-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--setup-theme-color, #fff);
  box-shadow: 0 0 12px var(--setup-theme-glow, rgba(255, 255, 255, 0.15));
}

/* ARENA CONSOLE SWITCHERS */
.matiks-arena {
  display: none;
}
.matiks-arena.active {
  display: block;
}

/* === ARENA STYLE DEFAULTS === */
.speed-arena-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  align-items: start;
}
@media (min-width: 768px) {
  .speed-arena-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.matiks-player-card {
  border-radius: 16px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.01);
  border: 2px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  transition: all 0.3s;
  position: relative;
}
.matiks-player-card::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid transparent;
  pointer-events: none;
}
.p1-card {
  border-color: rgba(0, 245, 255, 0.15);
}
.p1-card::after {
  top: 8px;
  right: 8px;
  border-top-color: rgba(0, 245, 255, 0.3);
  border-right-color: rgba(0, 245, 255, 0.3);
}
.p2-card {
  border-color: rgba(245, 158, 11, 0.15);
}
.p2-card::after {
  top: 8px;
  right: 8px;
  border-top-color: rgba(245, 158, 11, 0.3);
  border-right-color: rgba(245, 158, 11, 0.3);
}

.p1-card.is-answering {
  border-color: #00f5ff;
  box-shadow:
    0 0 20px rgba(0, 245, 255, 0.15),
    inset 0 0 10px rgba(0, 245, 255, 0.05);
}
.p2-card.is-answering {
  border-color: #f59e0b;
  box-shadow:
    0 0 20px rgba(245, 158, 11, 0.15),
    inset 0 0 10px rgba(245, 158, 11, 0.05);
}

.player-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.player-name {
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.player-score {
  font-family: "Orbitron", sans-serif;
  font-size: 24px;
  font-weight: 900;
}
.p1-card .player-score {
  color: #00f5ff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}
.p2-card .player-score {
  color: #f59e0b;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Question displays */
.player-question-box {
  text-align: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.p1-card .player-question-box {
  background: rgba(0, 245, 255, 0.01);
  border: 1px solid rgba(0, 245, 255, 0.1);
}
.p2-card .player-question-box {
  background: rgba(245, 158, 11, 0.01);
  border: 1px solid rgba(245, 158, 11, 0.1);
}

.player-question-text {
  font-family: "Orbitron", sans-serif;
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}
.player-question-subtext {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.p1-card .player-question-subtext {
  color: rgba(0, 245, 255, 0.6);
}
.p2-card .player-question-subtext {
  color: rgba(245, 158, 11, 0.6);
}

.matiks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

/* Option Buttons */
.matiks-opt-btn {
  aspect-ratio: 1.6;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
  position: relative;
}
.p1-card .matiks-opt-btn:hover:not(:disabled) {
  border-color: #00f5ff;
  background: rgba(0, 245, 255, 0.08);
  transform: translateY(-2px);
}
.p2-card .matiks-opt-btn:hover:not(:disabled) {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  transform: translateY(-2px);
}
.matiks-opt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.matiks-opt-btn .keycap-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  font-family: "Orbitron", sans-serif;
  pointer-events: none;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}
.p1-card .matiks-opt-btn:hover:not(:disabled) .keycap-badge {
  border-color: rgba(0, 245, 255, 0.4);
  color: #00f5ff;
  background: rgba(0, 245, 255, 0.1);
}

/* Answer flash visual classes */
.matiks-opt-btn.correct-flash {
  background: rgba(34, 197, 94, 0.22) !important;
  border-color: #22c55e !important;
  color: #22c55e !important;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: successPulse 0.3s ease;
}
.matiks-opt-btn.wrong-flash {
  background: rgba(225, 29, 72, 0.22) !important;
  border-color: #e11d48 !important;
  color: #e11d48 !important;
  text-shadow: 0 0 8px rgba(225, 29, 72, 0.6);
  animation: errorPulse 0.3s ease;
}
@keyframes successPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}
@keyframes errorPulse {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* === CENTRAL TIMER DESIGN === */
.central-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.matiks-timer-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
}
.matiks-timer-circle {
  transform: rotate(-90deg);
  width: 60px;
  height: 60px;
}
.matiks-timer-circle circle {
  fill: transparent;
  stroke-width: 4;
}
.matiks-timer-circle .bg-circle {
  stroke: rgba(255, 255, 255, 0.04);
}
.matiks-timer-circle .progress-circle {
  stroke: #22c55e;
  stroke-dasharray: 176;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition:
    stroke-dashoffset 1s linear,
    stroke 0.3s;
}
.matiks-timer-circle.low-time .progress-circle {
  stroke: #e11d48;
  filter: drop-shadow(0 0 4px #e11d48);
}
.matiks-timer-val {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Orbitron", sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #22c55e;
}
.matiks-timer-val.low-time {
  color: #e11d48;
  animation: heartBeat 0.5s infinite alternate;
}

/* === SUB-ARENA 2: MATH MAZE ARENA === */
.maze-target-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.1);
  padding: 12px 28px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 24px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.maze-target-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-family: "Orbitron", sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.maze-target-val {
  font-family: "Orbitron", sans-serif;
  font-size: 42px;
  font-weight: 900;
  color: #22c55e;
  text-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}

.maze-grid-wrapper {
  position: relative;
  padding: 24px;
  max-width: 320px;
  margin: 0 auto;
}
.maze-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
.maze-svg path {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px var(--path-shadow, rgba(0, 245, 255, 0.4)));
  transition: stroke-dashoffset 0.1s ease;
}
#mazeSvgP1 {
  --path-shadow: rgba(0, 245, 255, 0.5);
}
#mazeSvgP2 {
  --path-shadow: rgba(245, 158, 11, 0.5);
}

.maze-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  z-index: 10;
}

.maze-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.9);
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 15;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.03);
}
.maze-cell:hover:not(:disabled) {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.maze-cell.is-num {
  border-color: rgba(34, 197, 94, 0.2);
  background: rgba(34, 197, 94, 0.04);
}
.maze-cell.is-op {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
  font-size: 22px;
}
.maze-cell.is-start,
.maze-cell.is-end {
  border-color: rgba(245, 240, 220, 0.35) !important;
  background: radial-gradient(
    circle,
    #fbf7eb 0%,
    #e8e2c4 100%
  ) !important;
  color: #3b3a30 !important;
  text-shadow: none !important;
  box-shadow: 0 0 12px rgba(232, 226, 196, 0.25) !important;
}

.maze-cell.in-path-p1 {
  border-color: #00f5ff !important;
  background: rgba(0, 245, 255, 0.15) !important;
  color: #00f5ff !important;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.45) !important;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.6);
}
.maze-cell.in-path-p2 {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45) !important;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}
.maze-cell.flash-wrong {
  border-color: #e11d48 !important;
  background: rgba(225, 29, 72, 0.22) !important;
  color: #e11d48 !important;
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.5) !important;
  text-shadow: 0 0 8px rgba(225, 29, 72, 0.6);
  animation: errorPulse 0.3s ease;
}

.bubble-label {
  position: absolute;
  background: radial-gradient(circle, #fbf7eb 0%, #e8e2c4 100%);
  color: #3b3a30;
  font-family: "Orbitron", sans-serif;
  font-size: 8px;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  z-index: 25;
}
.bubble-label::after {
  content: "";
  position: absolute;
  border-width: 4px;
  border-style: solid;
}
.bubble-start {
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
}
.bubble-start::after {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-color: #e8e2c4 transparent transparent transparent;
}
.bubble-end {
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
}
.bubble-end::after {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-color: transparent transparent #e8e2c4 transparent;
}

.maze-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.maze-ctrl-btn {
  flex: 1;
  max-width: 90px;
  padding: 10px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.7);
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}
.maze-ctrl-btn:hover:not(:disabled) {
  border-color: #00f5ff;
  background: rgba(0, 245, 255, 0.08);
  color: #00f5ff;
}
.maze-ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* === SUB-ARENA 3: MIND SNAP (Memory card grids) === */
.snap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 220px;
  margin: 20px auto;
}
.snap-card {
  perspective: 1000px;
  aspect-ratio: 1;
  cursor: pointer;
  height: 90px;
  width: 90px;
}
.snap-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.snap-card.is-flipped .snap-card-inner {
  transform: rotateY(180deg);
}
.snap-card-front,
.snap-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}
.snap-card-front {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.35);
}
.snap-card-back {
  background: rgba(0, 245, 255, 0.08);
  color: #00f5ff;
  border-color: #00f5ff;
  transform: rotateY(180deg);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}
.p2-card .snap-card-back {
  background: rgba(245, 158, 11, 0.08) !important;
  color: #f59e0b !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2) !important;
}
.snap-card.matched .snap-card-back {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.15) !important;
  color: #22c55e !important;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4) !important;
}

/* === SUB-ARENA 4: FLASH ANZAN === */
.anzan-flash-board {
  width: 100%;
  max-width: 260px;
  height: 140px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 245, 255, 0.15);
  box-shadow: inset 0 0 20px rgba(0, 245, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  margin: 20px auto;
  transition: all 0.3s;
}
.p2-card .anzan-flash-board {
  border-color: rgba(245, 158, 11, 0.15);
}
.anzan-flash-board.active-flash {
  animation: flashPulse 0.35s ease-out;
}
@keyframes flashPulse {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* === SUB-ARENA 5: CROSS MATH & KEN KEN === */
.crossmath-formula-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px auto;
  max-width: 280px;
}
.formula-line {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
}
.formula-expr {
  font-family: "Orbitron", sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  float: right;
}

/* KenKen Cage elements */
.kenken-grid-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 150px;
  height: 150px;
  margin: 20px auto;
}
.kenken-cell {
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.03);
}
.kenken-cell.cage-a {
  border-color: rgba(0, 245, 255, 0.3);
  background: rgba(0, 245, 255, 0.02);
}
.kenken-cell.cage-b {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.02);
}
.kenken-cell.cage-c {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.02);
}

.kenken-cage-tag {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 8px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  font-family: "Orbitron", sans-serif;
}

/* === VICTORY OVERLAY SCREEN === */
.matiks-victory-screen {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.matiks-victory-screen > * {
  position: relative;
  z-index: 2;
}
.matiks-victory-screen > canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 1 !important;
  pointer-events: none;
}
.vic-title {
  font-family: "Orbitron", sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}
.vic-subtitle {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 30px;
  max-width: 360px;
}
.vic-scores {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 380px;
}
.vic-score-card {
  flex: 1;
  padding: 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}
.vic-score-card.vic-p1 {
  border-color: rgba(0, 245, 255, 0.2);
}
.vic-score-card.vic-p2 {
  border-color: rgba(245, 158, 11, 0.2);
}
.vic-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
}
.vic-val {
  font-family: "Orbitron", sans-serif;
  font-size: 26px;
  font-weight: 900;
}
.vic-p1 .vic-val {
  color: #00f5ff;
  text-shadow: 0 0 6px rgba(0, 245, 255, 0.4);
}
.vic-p2 .vic-val {
  color: #f59e0b;
  text-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

/* Winner Glowing pulse */
.winner-celebrate {
  animation: pulseGlow 1.2s infinite alternate;
  border-color: #00f5ff !important;
  box-shadow: 0 0 25px rgba(0, 245, 255, 0.45) !important;
  background: rgba(0, 245, 255, 0.08) !important;
}
.winner-celebrate.vic-p2 {
  border-color: #f59e0b !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.45) !important;
  background: rgba(245, 158, 11, 0.08) !important;
}
@keyframes pulseGlow {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

/* Motivation Banner */
.motivation-banner {
  animation: slideQuote 0.4s ease-out;
}
@keyframes slideQuote {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scanline overlay */
.arcade-scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
}

/* === FIREBASE PROFILE & BACKUP MODAL === */
.matiks-profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(14px);
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.profile-modal-content {
  position: relative;
  width: min(440px, calc(100% - 32px));
  padding: 36px 28px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
  box-shadow: 
    inset 0 0 40px rgba(0, 0, 0, 0.6), 
    0 10px 40px rgba(0, 0, 0, 0.7);
  text-align: center;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.profile-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
}

.profile-close-btn:hover {
  color: #fff;
}

.profile-modal-title {
  font-family: "Orbitron", sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.profile-modal-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 24px;
  line-height: 1.4;
}

.setup-notice {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
}

.setup-notice h3 {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.setup-notice p {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.4;
}

.config-textarea {
  width: 100%;
  height: 120px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #a3e635;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  padding: 12px;
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}

.config-textarea:focus {
  border-color: #ec4899;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.15);
}

.setup-help {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 14px;
  line-height: 1.3;
}

.guest-sync-card {
  background: rgba(0, 245, 255, 0.01);
  border: 1px solid rgba(0, 245, 255, 0.08);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
}

.guest-sync-card h4 {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  color: #00f5ff;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.guest-sync-card p {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.3;
}

.auth-form-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 18px;
}

.icon-glow {
  text-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

/* === MOBILE RESPONSIVE OPTIMIZATIONS === */
@media (max-width: 520px) {
  .game-nav {
    padding: 0 16px;
  }
  .game-area {
    margin: 16px auto 60px;
    padding: 0 12px;
  }
  .plato-hud {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
  }
  .hud-chip {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 16px;
    gap: 4px;
  }
  /* Stretch the profile chip to take its own row, beautifully centered */
  .chip-profile {
    flex: 1 1 100%;
    justify-content: center;
    margin-top: 4px;
  }
}

/* === FIREBASE AUTHENTICATION CUSTOM THEMED TOAST SYSTEM === */
.matiks-toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: min(420px, calc(100% - 32px));
}

.matiks-toast {
  pointer-events: auto;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 20px;
  border-radius: 12px;
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  box-shadow: 
    0 12px 36px rgba(0, 0, 0, 0.6), 
    inset 0 0 12px rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.matiks-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.matiks-toast.success {
  border-left: 4px solid #22c55e;
  box-shadow: 
    0 12px 36px rgba(34, 197, 94, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.5);
}

.matiks-toast.error {
  border-left: 4px solid #ec4899;
  box-shadow: 
    0 12px 36px rgba(236, 72, 153, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.5);
}

.matiks-toast-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.matiks-toast.success .matiks-toast-icon {
  color: #22c55e;
}

.matiks-toast.error .matiks-toast-icon {
  color: #ec4899;
}

.matiks-toast-content {
  flex: 1;
  line-height: 1.5;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}


