/**
 * Korridorer – Taktisk labyrintduell (Quoridor)
 * Sleek modern dark mode, responsive 9x9 board, glassmorphism,
 * micro-animations, pixel-crisp sprite rendering, and 3D wall interactions.
 */

:root {
  --font-main: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-pixel: "Press Start 2P", monospace;

  /* Color Palette */
  --bg-dark: #090d16;
  --bg-card: rgba(18, 26, 46, 0.88);
  --bg-card-hover: rgba(24, 34, 59, 0.95);
  --bg-surface: #101728;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(245, 158, 11, 0.4);

  /* Player Accents */
  --p1-color: #ef4444;
  --p1-glow: rgba(239, 68, 68, 0.4);
  --p2-color: #06b6d4;
  --p2-glow: rgba(6, 182, 212, 0.4);
  --p3-color: #10b981;
  --p3-glow: rgba(16, 185, 129, 0.4);
  --p4-color: #a855f7;
  --p4-glow: rgba(168, 85, 247, 0.4);

  /* Wall Styling */
  --wall-wood-top: #fbbf24;
  --wall-wood-base: #d97706;
  --wall-wood-shadow: #78350f;
  --wall-glow: rgba(245, 158, 11, 0.6);

  /* Text & Foreground */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Sizing */
  --board-max-size: 560px;
  --header-height: 64px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Parallax Layer */
.parallax-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

/* App Outer Shell */
.korridorer-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ======================================================== */
/* HEADER                                                   */
/* ======================================================== */
.app-header {
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(-2px);
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-game-icon {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
}

.header-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.header-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fbbf24;
  letter-spacing: 0.08em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-leave-room {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-leave-room:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

/* ======================================================== */
/* MAIN CONTENT & VIEW PANELS                               */
/* ======================================================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

.view-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================================================== */
/* VIEW 1: LOBBY & SETUP CARDS                              */
/* ======================================================== */
.lobby-card {
  width: 100%;
  max-width: 820px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.25rem 2.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(245, 158, 11, 0.12);
  margin: auto;
}

.lobby-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-icon-wrap {
  display: inline-block;
  padding: 10px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  margin-bottom: 0.75rem;
}

.hero-icon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 16px rgba(245, 158, 11, 0.5));
  animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Lobby Mode Tabs */
.lobby-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
  gap: 0.35rem;
}

.lobby-tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lobby-tab-btn.active {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

.tab-panel.hidden {
  display: none !important;
}

/* Online Lobby Deck */
.online-lobby-deck {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Online Profile Card */
.online-profile-card {
  background: rgba(14, 20, 36, 0.85);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 24px rgba(245, 158, 11, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.opc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.65rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.opc-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.opc-badge {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.opc-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.opc-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.opc-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .opc-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.avatar-input-combo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.avatar-circle-preview {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-circle-preview img {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  animation: spriteWiggle 2.5s ease-in-out infinite;
}

/* Online Split (Create vs Join) */
.online-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .online-split {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.action-box {
  background: rgba(14, 20, 36, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
}

.action-box.single-box {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.card-theme-amber {
  background: linear-gradient(160deg, rgba(26, 32, 48, 0.95) 0%, rgba(14, 18, 32, 0.95) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-theme-amber:hover {
  border-color: #f59e0b;
  box-shadow: 0 12px 36px rgba(245, 158, 11, 0.18);
  transform: translateY(-2px);
}

.card-theme-cyan {
  background: linear-gradient(160deg, rgba(16, 32, 48, 0.95) 0%, rgba(10, 20, 32, 0.95) 100%);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-theme-cyan:hover {
  border-color: #06b6d4;
  box-shadow: 0 12px 36px rgba(6, 182, 212, 0.18);
  transform: translateY(-2px);
}

.box-badge-row {
  margin-bottom: 0.5rem;
}

.action-card-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.btn-cyan-accent {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn-cyan-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(6, 182, 212, 0.5);
  filter: brightness(1.08);
}

.btn-cyan-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Waiting Room Footer Actions */
.waiting-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.waiting-footer-actions button {
  flex: 1;
}

.btn-add-bot {
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(147, 51, 234, 0.5);
  color: #c084fc;
  font-weight: 800;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-bot:hover {
  background: rgba(147, 51, 234, 0.35);
  border-color: #a855f7;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.35);
}

.box-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: #fff;
}

.box-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

/* Form Styles */
.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
}

.text-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.code-input {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  color: #fbbf24;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 0.25rem;
  gap: 0.25rem;
}

.seg-btn {
  flex: 1;
  padding: 0.55rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-btn.active {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Sprite Picker Grid */
.sprite-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.sprite-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sprite-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.sprite-chip.selected {
  background: rgba(245, 158, 11, 0.18);
  border-color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  transform: scale(1.04);
}

.sprite-chip-img {
  width: 38px;
  height: 38px;
  image-rendering: pixelated;
  transition: transform 0.2s ease;
}

.sprite-chip.selected .sprite-chip-img {
  animation: spriteWiggle 1.5s ease-in-out infinite;
}

@keyframes spriteWiggle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.08) rotate(-4deg); }
  75% { transform: scale(1.08) rotate(4deg); }
}

.sprite-chip-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sprite-chip.selected .sprite-chip-name {
  color: #fbbf24;
}

/* Action Buttons */
.primary-btn {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.5);
  filter: brightness(1.08);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.secondary-btn {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.pulse-glow {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35); }
  50% { box-shadow: 0 6px 28px rgba(245, 158, 11, 0.65); }
}

/* Local Players Configuration Rows */
.local-players-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.local-player-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.local-p-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  color: #fff;
}

.local-p-avatar-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.local-p-avatar-img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.local-p-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ======================================================== */
/* VIEW 2: ONLINE WAITING ROOM LOBBY                        */
/* ======================================================== */
.waiting-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 35px rgba(245, 158, 11, 0.12);
  text-align: center;
  margin: auto;
}

.waiting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.room-code-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.room-code-display {
  font-family: var(--font-pixel);
  font-size: 2rem;
  color: #fbbf24;
  letter-spacing: 0.15em;
  line-height: 1.1;
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  color: #fbbf24;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-2px);
}

.waiting-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.player-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.player-slot-card {
  background: rgba(14, 20, 36, 0.7);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  transition: all 0.2s ease;
}

.player-slot-card.occupied {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(20, 28, 48, 0.85);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.slot-avatar-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 4px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-avatar-img {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
}

.slot-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.slot-role-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.slot-empty {
  opacity: 0.4;
  border-style: dashed;
}

.slot-empty-icon {
  font-size: 1.5rem;
  margin: 0.5rem 0;
}

.hint-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ======================================================== */
/* VIEW 3: GAMEPLAY ARENA                                   */
/* ======================================================== */
.game-layout {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* Game Top Status Bar */
.game-top-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  gap: 1rem;
  flex-wrap: wrap;
}

.turn-announcer {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.turn-pawn-preview {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.turn-pawn-preview img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  animation: spriteWiggle 2s infinite ease-in-out;
}

.turn-text-group {
  display: flex;
  flex-direction: column;
}

.turn-label {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
}

.turn-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Mode Toggles */
.mode-toggles {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mode-btn {
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.mode-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.icon-sub-btn {
  padding: 0.55rem 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-sub-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Arena Stage (Players + Board) */
.arena-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 900px) {
  .arena-stage {
    flex-direction: column;
    gap: 1rem;
  }
}

.players-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 190px;
}

@media (max-width: 900px) {
  .players-column {
    flex-direction: row;
    width: 100%;
    max-width: var(--board-max-size);
  }
}

/* Player Status Card */
.player-game-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 900px) {
  .player-game-card {
    flex: 1;
  }
}

.player-game-card.active-turn {
  border-color: #fbbf24;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
  transform: scale(1.02);
}

.pg-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pg-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--p1-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pg-avatar-img {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
}

.pg-crown {
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 0.85rem;
}

.pg-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pg-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-goal {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Wall Rack Slats */
.pg-walls-rack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pg-walls-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pg-walls-slats {
  display: flex;
  gap: 3px;
  height: 12px;
}

.wall-slat {
  flex: 1;
  height: 100%;
  background: linear-gradient(180deg, var(--wall-wood-top) 0%, var(--wall-wood-base) 100%);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.wall-slat.used {
  opacity: 0.15;
  filter: grayscale(1);
  transform: scaleY(0.6);
}

/* ======================================================== */
/* THE 9x9 BOARD                                            */
/* ======================================================== */
.board-outer-container {
  position: relative;
  width: 100%;
  max-width: var(--board-max-size);
  aspect-ratio: 1 / 1;
  padding: 16px;
  background: linear-gradient(145deg, #182032 0%, #0d1322 100%);
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 2px 6px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Edge Goal Neon Stripes */
.goal-indicator {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  opacity: 0.55;
  pointer-events: none;
  z-index: 5;
}

.goal-north {
  top: 3px;
  left: 30px;
  right: 30px;
  height: 8px;
  color: var(--p1-color);
  background: linear-gradient(90deg, transparent, var(--p1-color), transparent);
}

.goal-south {
  bottom: 3px;
  left: 30px;
  right: 30px;
  height: 8px;
  color: var(--p2-color);
  background: linear-gradient(90deg, transparent, var(--p2-color), transparent);
}

.goal-west {
  left: 3px;
  top: 30px;
  bottom: 30px;
  width: 8px;
  color: var(--p4-color);
  background: linear-gradient(180deg, transparent, var(--p4-color), transparent);
  writing-mode: vertical-rl;
}

.goal-east {
  right: 3px;
  top: 30px;
  bottom: 30px;
  width: 8px;
  color: var(--p3-color);
  background: linear-gradient(180deg, transparent, var(--p3-color), transparent);
  writing-mode: vertical-rl;
}

.board-grid-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 8px;
  background: #080c16;
  border-radius: 12px;
  padding: 8px;
  user-select: none;
  touch-action: manipulation;
}

/* 81 Cell Tiles */
.board-cells {
  display: contents;
}

.board-cell {
  background: #141c2e;
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.08), 0 2px 4px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 5;
  pointer-events: auto;
}

.board-cell:hover {
  background: #1d273f;
}

/* Move Destination Target Highlighting */
.board-cell.valid-move {
  background: rgba(16, 185, 129, 0.22);
  box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.5), 0 0 10px rgba(16, 185, 129, 0.3);
  animation: targetPulse 1.5s ease-in-out infinite;
  z-index: 10;
  cursor: pointer;
}

.board-cell.valid-move::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  pointer-events: none;
}

@keyframes targetPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.96); }
}

/* Ghost sprite preview on hover over valid destination */
.board-cell.valid-move:hover::after {
  display: none;
}

.board-cell.valid-move .ghost-preview-pawn {
  opacity: 0;
  filter: drop-shadow(0 0 8px #10b981);
  transform: scale(0.9);
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.board-cell.valid-move:hover .ghost-preview-pawn {
  opacity: 0.75;
}

/* ======================================================== */
/* PAWNS ON THE BOARD                                       */
/* ======================================================== */
.pawn-token {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  border: 2.5px solid var(--p1-color);
  z-index: 10;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.pawn-token.active-turn {
  animation: pawnActiveBounce 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.7), 0 8px 18px rgba(0, 0, 0, 0.7);
}

@keyframes pawnActiveBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.pawn-token img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.pawn-player-tag {
  position: absolute;
  bottom: -6px;
  font-size: 0.55rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  color: #fff;
  background: rgba(0, 0, 0, 0.85);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ======================================================== */
/* WALL GROOVES & PLACED WALLS                              */
/* ======================================================== */
/* 
   The board is 9x9 cells with 8px gap.
   The walls and grooves sit on the gap lines!
   There are 8 rows and 8 columns of intersections.
*/
.board-walls-layer {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 20;
}

.board-grooves-layer {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 25;
}

/* Groove Intersection Touch Targets */
.groove-intersection {
  position: absolute;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  pointer-events: auto;
}

.groove-intersection::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.18s ease;
}

.groove-intersection:hover::after {
  width: 12px;
  height: 12px;
  background: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
}

/* Placed Walls (2 grid units long) */
.placed-wall {
  position: absolute;
  background: linear-gradient(135deg, var(--wall-wood-top) 0%, var(--wall-wood-base) 100%);
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7), 0 0 10px var(--wall-glow);
  z-index: 22;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: wallPlacePop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wallPlacePop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Wall Thickness & Length relative to 9x9 board */
.placed-wall.wall-h {
  height: 8px;
  transform: translate(0, -50%);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-bottom: 1.5px solid var(--wall-wood-shadow);
}

.placed-wall.wall-v {
  width: 8px;
  transform: translate(-50%, 0);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 1.5px solid var(--wall-wood-shadow);
}

/* Ghost Wall Preview */
.ghost-wall {
  position: absolute;
  border-radius: 4px;
  z-index: 24;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.ghost-wall.valid {
  background: rgba(245, 158, 11, 0.75);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.9);
  border: 1px solid #fef08a;
}

.ghost-wall.invalid {
  background: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.9);
  border: 1px solid #fca5a5;
  animation: wallShake 0.25s ease-in-out;
}

@keyframes wallShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.ghost-wall.wall-h {
  height: 8px;
  transform: translate(0, -50%);
}

.ghost-wall.wall-v {
  width: 8px;
  transform: translate(-50%, 0);
}

/* Staged Wall Highlight State */
.ghost-wall.staged {
  box-shadow: 0 0 24px rgba(245, 158, 11, 1), 0 0 40px rgba(245, 158, 11, 0.6);
  border: 1.5px solid #fff;
  z-index: 35;
}

/* Floating Wall Toolbar (Confirmed / Staged micro-toolbar) */
.floating-wall-toolbar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  border: 1.5px solid #fbbf24;
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), 0 0 24px rgba(245, 158, 11, 0.4);
  z-index: 50;
  pointer-events: auto;
  transform: translate(-50%, -140%);
  animation: toolbarPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.floating-wall-toolbar.hidden {
  display: none !important;
}

@keyframes toolbarPop {
  0% { transform: translate(-50%, -115%) scale(0.85); opacity: 0; }
  100% { transform: translate(-50%, -140%) scale(1); opacity: 1; }
}

.fwt-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.fwt-rotate {
  padding: 5px 11px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.fwt-rotate:hover {
  background: rgba(245, 158, 11, 0.35);
  transform: scale(1.05);
}

.fwt-confirm {
  padding: 5px 13px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.5);
}

.fwt-confirm:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.fwt-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.7);
  box-shadow: none;
  transform: none;
}

.fwt-cancel {
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.fwt-cancel:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Floating Wall Error Tooltip */
.ghost-wall-tooltip {
  position: absolute;
  transform: translate(-50%, -160%);
  background: rgba(220, 38, 38, 0.95);
  border: 1px solid #fca5a5;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 48;
  white-space: nowrap;
  animation: tooltipFade 0.2s ease;
}

.ghost-wall-tooltip.hidden {
  display: none !important;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translate(-50%, -130%); }
  to { opacity: 1; transform: translate(-50%, -160%); }
}

/* Wall Mode Runway Guides on Board */
.board-grid-wrapper.wall-mode-active {
  box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.15);
}

.board-grid-wrapper.wall-mode-active .groove-intersection {
  width: 32px;
  height: 32px;
}

.board-grid-wrapper.wall-mode-active .groove-intersection::after {
  width: 8px;
  height: 8px;
  background: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.board-grid-wrapper.wall-mode-active .groove-intersection:hover::after {
  width: 14px;
  height: 14px;
  background: #fbbf24;
  box-shadow: 0 0 16px #fbbf24;
}

/* Modern Ergonomic Action Command Dock */
.game-action-dock {
  width: 100%;
  max-width: var(--board-max-size);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1.5px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0.65rem 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dock-mode-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.dock-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  flex: 1;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.dock-btn.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: #fbbf24;
  color: #fff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

.dock-btn-icon {
  font-size: 1.4rem;
}

.dock-btn-text {
  display: flex;
  flex-direction: column;
}

.dock-btn-title {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

.dock-btn.active .dock-btn-title {
  color: #fbbf24;
}

.dock-btn-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dock-wall-options {
  display: flex;
  align-items: center;
}

.dock-rotate-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.dock-rotate-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

.rotate-icon {
  font-size: 1.2rem;
  transition: transform 0.25s ease;
}

.dock-rotate-btn:hover .rotate-icon {
  transform: rotate(90deg);
}

.rotate-info {
  display: flex;
  flex-direction: column;
}

.rotate-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fbbf24;
}

.rotate-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.rotate-preview-badge {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fbbf24;
  padding: 0.1rem 0.4rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Make wall rack clickable to trigger wall mode */
.pg-walls-rack {
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.18s ease;
}

.pg-walls-rack:hover {
  background: rgba(245, 158, 11, 0.12);
}

/* ======================================================== */
/* GAME BOTTOM BAR & CHAT REACTIONS                         */
/* ======================================================== */
.game-bottom-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.65rem 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.reactions-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.reactions-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.reaction-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaction-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.18);
}

.game-control-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ======================================================== */
/* CHAT TOAST OVERLAY                                       */
/* ======================================================== */
.chat-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 100;
}

.chat-bubble-toast {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #fbbf24;
  border-radius: 999px;
  padding: 0.45rem 1rem 0.45rem 0.55rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(245, 158, 11, 0.3);
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.4s ease 2.6s forwards;
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

.chat-bubble-img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

.chat-bubble-sender {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fbbf24;
}

.chat-bubble-text {
  font-size: 1.1rem;
}

/* ======================================================== */
/* MODALS                                                   */
/* ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  animation: modalFade 0.2s ease;
}

.modal-backdrop.hidden {
  display: none !important;
}

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

.modal-card {
  width: 100%;
  max-width: 540px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(245, 158, 11, 0.15);
  position: relative;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

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

.rules-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.rule-block {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.rule-icon {
  font-size: 1.5rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.rule-block h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 0.2rem;
}

.rule-block p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Victory Modal */
.victory-card {
  text-align: center;
  padding: 2.5rem 2rem;
}

.victory-trophy {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: trophyFloat 2s ease-in-out infinite;
}

@keyframes trophyFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.victory-winner-avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.3) 0%, rgba(0, 0, 0, 0.6) 80%);
  border: 3px solid #fbbf24;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.victory-winner-img {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  animation: winnerSpin 3s ease-in-out infinite;
}

@keyframes winnerSpin {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.victory-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.5rem;
}

.victory-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.vstat-item {
  display: flex;
  flex-direction: column;
}

.vstat-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fbbf24;
}

.vstat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
