/* ==========================================================================
   AI In RL - Educational Games Studio Stylesheet (10 Templates Edition)
   Matching Dark Editorial & Notebook Theme with High-Contrast Touch Design
   ========================================================================== */

/* Navigation & Tabs */
.games-nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 24px;
}

.games-nav-tabs .tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-muted, #9ba1b0);
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.games-nav-tabs .tab-btn:hover {
  color: var(--text-main, #f0f2f5);
  background: rgba(255, 255, 255, 0.04);
}

.games-nav-tabs .tab-btn.active {
  background: var(--accent, #48bb78);
  color: #0d1510;
  box-shadow: 0 2px 10px rgba(72, 187, 120, 0.25);
}

/* Explore Hero Banner */
.explore-hero {
  background: linear-gradient(135deg, rgba(72, 187, 120, 0.12) 0%, rgba(159, 122, 234, 0.15) 100%), var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.explore-hero::after {
  content: '🎮';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 88px;
  opacity: 0.15;
  pointer-events: none;
}

.hero-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 8px;
}

.hero-content p {
  color: var(--text-muted, #9ba1b0);
  max-width: 680px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Filters */
.explore-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.template-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-filter {
  background: var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  color: var(--text-muted, #9ba1b0);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.chip-filter:hover {
  color: var(--text-main, #f0f2f5);
  border-color: #4a5260;
}

.chip-filter.active {
  background: rgba(72, 187, 120, 0.18);
  border-color: var(--accent, #48bb78);
  color: var(--accent, #48bb78);
  font-weight: 600;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.game-card {
  background: var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent, #48bb78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-tpl-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main, #f0f2f5);
}

.card-lang-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: #252830;
  color: #cbd5e1;
}

.card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 8px;
  line-height: 1.35;
}

.card-desc {
  font-size: 0.86rem;
  color: var(--text-muted, #9ba1b0);
  line-height: 1.45;
  margin-bottom: 16px;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-items-count {
  font-size: 0.8rem;
  color: var(--text-muted, #8a909d);
}

.btn-play-card {
  padding: 8px 16px;
  background: var(--accent, #48bb78);
  color: #0b1510;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-play-card:hover {
  background: #5cd28d;
}

/* My Games Section */
.my-games-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-color, #2d3139);
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title-wrap h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
}

/* Creator Studio */
.creator-card {
  background: var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 16px;
  padding: 28px;
}

.creator-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color, #2d3139);
}

.creator-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 6px;
}

.creator-desc {
  color: var(--text-muted, #9ba1b0);
  max-width: 650px;
  font-size: 0.92rem;
}

.creator-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ai-magic {
  background: linear-gradient(135deg, #9f7aea 0%, #d53f8c 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(159, 122, 234, 0.35);
  transition: all 0.2s ease;
}

.btn-ai-magic:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.form-step {
  margin-bottom: 28px;
}

.step-label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 10px;
}

/* Template Selector Grid (10 Templates) */
.template-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid var(--border-color, #2d3139);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main, #f0f2f5);
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #4a5260;
}

.template-card.active {
  border-color: var(--accent, #48bb78);
  background: rgba(72, 187, 120, 0.08);
  box-shadow: 0 0 0 1px var(--accent, #48bb78);
}

.template-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.template-name {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.template-info {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted, #8a909d);
  line-height: 1.3;
}

/* Metadata Step */
.metadata-step {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.meta-field {
  flex: 1;
  min-width: 240px;
}

.meta-field-lang {
  flex: 0 0 180px;
}

.game-input {
  width: 100%;
  padding: 10px 14px;
  background: #111214;
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 8px;
  color: var(--text-main, #f0f2f5);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
  min-height: 44px;
}

.game-input:focus {
  outline: none;
  border-color: var(--accent, #48bb78);
  box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.2);
}

/* Items Editor */
.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.items-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.items-tip {
  font-size: 0.85rem;
  color: var(--text-muted, #8a909d);
  margin-bottom: 14px;
}

.items-editor-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 10px;
  padding: 10px 14px;
}

.item-index {
  font-weight: 700;
  color: var(--text-muted, #717784);
  font-size: 0.85rem;
  min-width: 28px;
}

.item-row .game-input {
  flex: 1;
}

.item-row-extra {
  flex: 1.2;
}

.btn-remove-row {
  background: transparent;
  color: #e53e3e;
  border: none;
  font-size: 1.2rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-row:hover {
  background: rgba(229, 62, 62, 0.15);
}

.items-actions {
  display: flex;
  gap: 10px;
}

.creator-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color, #2d3139);
}

/* ==========================================================================
   GAME ARENA / PLAYER
   ========================================================================== */
.play-arena {
  background: var(--bg-panel, #18191a);
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 580px;
}

.arena-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: #131416;
  border-bottom: 1px solid var(--border-color, #2d3139);
}

.arena-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arena-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 2px;
}

.arena-badges {
  display: flex;
  gap: 6px;
}

.arena-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #1e2025;
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main, #f0f2f5);
}

.btn-icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.arena-progress-wrap {
  width: 100%;
  height: 6px;
  background: #18191d;
  overflow: hidden;
}

.arena-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
  transition: width 0.3s ease;
}

.arena-stage {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 480px;
}

/* 1. MATCH UP ENGINE */
.match-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 860px;
  gap: 28px;
  margin: 0 auto;
}

.match-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-card {
  padding: 16px 20px;
  background: #1f2127;
  border: 2px solid #2f3440;
  border-radius: 12px;
  color: var(--text-main, #f0f2f5);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}

.match-card:hover:not(.locked) {
  border-color: #4a5468;
  transform: scale(1.02);
}

.match-card.selected {
  border-color: #9f7aea;
  background: rgba(159, 122, 234, 0.15);
  box-shadow: 0 0 0 3px rgba(159, 122, 234, 0.3);
}

.match-card.locked {
  border-color: var(--accent, #48bb78);
  background: rgba(72, 187, 120, 0.15);
  color: #a7f3d0;
  cursor: default;
  opacity: 0.85;
}

.match-card.shake {
  animation: shakeError 0.4s ease;
  border-color: #f56565 !important;
  background: rgba(245, 101, 101, 0.2) !important;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* 2. SPIN THE WHEEL ENGINE */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 10px;
}

.wheel-canvas-wrap {
  position: relative;
  width: 380px;
  height: 380px;
  max-width: 90vw;
  max-height: 90vw;
  margin-bottom: 24px;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 26px solid #e53e3e;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
  z-index: 10;
  transition: transform 0.05s ease;
}

.wheel-spin-btn {
  padding: 14px 44px;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: #0b1510;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(72, 187, 120, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.wheel-spin-btn:hover:not(:disabled) {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.wheel-spin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wheel-result-modal {
  position: absolute;
  background: #1e2026;
  border: 2px solid var(--accent, #48bb78);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 20;
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.wheel-result-term {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent, #48bb78);
  margin-bottom: 8px;
}

.wheel-result-meaning {
  font-size: 1.1rem;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 20px;
  line-height: 1.4;
}

.wheel-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* 3. MISSING WORD ENGINE */
.missing-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.missing-sentence-box {
  background: #1f2127;
  border: 2px solid #2f3440;
  border-radius: 14px;
  padding: 32px 28px;
  font-size: 1.4rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-main, #f0f2f5);
  width: 100%;
}

.missing-blank-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 38px;
  padding: 2px 14px;
  border-bottom: 3px dashed var(--accent, #48bb78);
  border-radius: 6px;
  background: rgba(72, 187, 120, 0.1);
  color: var(--accent, #48bb78);
  font-weight: 700;
  margin: 0 6px;
  vertical-align: baseline;
  transition: all 0.2s ease;
}

.missing-blank-slot.filled {
  border-bottom-style: solid;
  background: rgba(72, 187, 120, 0.2);
}

.missing-chips-pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.missing-chip {
  padding: 12px 22px;
  background: #252830;
  border: 2px solid #363b48;
  border-radius: 24px;
  color: var(--text-main, #f0f2f5);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.missing-chip:hover {
  border-color: var(--accent, #48bb78);
  transform: translateY(-2px);
}

.missing-chip.used {
  opacity: 0.3;
  pointer-events: none;
}

/* 4. FLASHCARDS ENGINE */
.flashcards-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1000px;
}

.flashcard-progress {
  font-size: 0.95rem;
  color: var(--text-muted, #9ba1b0);
  margin-bottom: 14px;
  font-weight: 600;
}

.flashcard-3d {
  width: 100%;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  margin-bottom: 24px;
}

.flashcard-3d.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  border: 2px solid var(--border-color, #2d3139);
  background: #1f2127;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.flashcard-back {
  transform: rotateY(180deg);
  background: #17231e;
  border-color: rgba(72, 187, 120, 0.4);
}

.flashcard-hint-top {
  position: absolute;
  top: 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted, #717784);
}

.flashcard-term {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 10px;
}

.flashcard-meaning {
  font-size: 1.2rem;
  color: #a7f3d0;
  line-height: 1.5;
}

.flashcard-flip-prompt {
  position: absolute;
  bottom: 14px;
  font-size: 0.8rem;
  color: var(--text-muted, #717784);
}

.flashcards-controls {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
}

.btn-card-learn {
  flex: 1;
  max-width: 160px;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* 5. ANAGRAM ENGINE */
.anagram-container {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.anagram-clue {
  background: #1f2127;
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 12px;
  padding: 18px 24px;
  font-size: 1.2rem;
  color: var(--text-main, #f0f2f5);
  text-align: center;
  width: 100%;
}

.anagram-answer-slot {
  display: flex;
  gap: 8px;
  min-height: 56px;
  padding: 8px 16px;
  background: #111214;
  border: 2px dashed #3a404d;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.anagram-tile {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  border: 2px solid #4a5568;
  border-radius: 8px;
  color: #f7fafc;
  font-size: 1.4rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.anagram-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #48bb78);
}

.anagram-tiles-bank {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.anagram-actions {
  display: flex;
  gap: 12px;
}

/* 6. QUIZ / GAMESHOW ENGINE */
.quiz-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-timer-bar-wrap {
  width: 100%;
  height: 8px;
  background: #1e2026;
  border-radius: 4px;
  overflow: hidden;
}

.quiz-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #48bb78 0%, #ecc94b 70%, #e53e3e 100%);
  transition: width 0.1s linear;
}

.quiz-question-box {
  background: #1f2127;
  border: 2px solid #2f3440;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  line-height: 1.4;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quiz-option-btn {
  padding: 16px 20px;
  background: #252830;
  border: 2px solid #363b48;
  border-radius: 12px;
  color: var(--text-main, #f0f2f5);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--accent, #48bb78);
  background: #2c303a;
  transform: scale(1.01);
}

.quiz-option-btn.correct {
  border-color: #48bb78 !important;
  background: rgba(72, 187, 120, 0.25) !important;
  color: #a7f3d0 !important;
}

.quiz-option-btn.wrong {
  border-color: #e53e3e !important;
  background: rgba(229, 62, 62, 0.25) !important;
  color: #feb2b2 !important;
}

/* ==========================================================================
   NEW TEMPLATE 7: GROUP SORT ENGINE
   ========================================================================== */
.sort-container {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.sort-card-stage {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sort-active-card {
  padding: 22px 36px;
  background: #1f2127;
  border: 2px solid #9f7aea;
  border-radius: 16px;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(159, 122, 234, 0.25);
  animation: cardFloat 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

@keyframes cardFloat {
  from { transform: scale(0.8) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.sort-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
}

.sort-bucket {
  background: #15161a;
  border: 2px dashed #3a404d;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.sort-bucket:hover {
  border-color: var(--accent, #48bb78);
  background: rgba(72, 187, 120, 0.05);
  transform: translateY(-2px);
}

.sort-bucket-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent, #48bb78);
  margin-bottom: 10px;
}

.sort-bucket-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.sort-placed-chip {
  font-size: 0.85rem;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #cbd5e1;
}

/* ==========================================================================
   NEW TEMPLATE 8: TRUE OR FALSE ENGINE
   ========================================================================== */
.truefalse-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.truefalse-card {
  width: 100%;
  background: #1f2127;
  border: 2px solid #2f3440;
  border-radius: 16px;
  padding: 36px 30px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.truefalse-statement {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  line-height: 1.5;
  margin-bottom: 16px;
}

.truefalse-hint {
  font-size: 0.88rem;
  color: var(--text-muted, #8a909d);
}

.truefalse-buttons-wrap {
  display: flex;
  gap: 20px;
  width: 100%;
}

.btn-tf {
  flex: 1;
  padding: 20px;
  border-radius: 14px;
  font-size: 1.35rem;
  font-weight: 800;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-tf:hover:not(:disabled) {
  transform: scale(1.03);
}

.btn-tf-true {
  background: linear-gradient(135deg, #48bb78 0%, #2f855a 100%);
  color: #0b1510;
  box-shadow: 0 6px 20px rgba(72, 187, 120, 0.3);
}

.btn-tf-false {
  background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(245, 101, 101, 0.3);
}

.truefalse-explanation-box {
  background: #15161a;
  border-left: 4px solid var(--accent, #48bb78);
  padding: 16px 20px;
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text-main, #f0f2f5);
  line-height: 1.45;
  width: 100%;
  animation: popIn 0.25s ease;
}

/* ==========================================================================
   NEW TEMPLATE 9: OPEN THE BOX ENGINE
   ========================================================================== */
.boxes-container {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.boxes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  width: 100%;
}

.box-item {
  height: 120px;
  background: linear-gradient(135deg, #2b313d 0%, #1e222b 100%);
  border: 2px solid #3e4656;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  user-select: none;
  position: relative;
}

.box-item:hover:not(.opened) {
  border-color: var(--accent, #48bb78);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 24px rgba(72, 187, 120, 0.25);
}

.box-item.opened {
  background: #15161a;
  border-color: #48bb78;
  opacity: 0.8;
  cursor: pointer;
}

.box-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent, #48bb78);
  margin-bottom: 4px;
}

.box-label {
  font-size: 0.75rem;
  color: var(--text-muted, #8a909d);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Box Reveal Modal */
.box-reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.box-reveal-card {
  background: #18191d;
  border: 2px solid var(--accent, #48bb78);
  border-radius: 18px;
  padding: 32px 28px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.box-reveal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 12px;
}

.box-reveal-content {
  font-size: 1.25rem;
  line-height: 1.5;
  color: #a7f3d0;
  margin-bottom: 24px;
  background: #111214;
  padding: 18px;
  border-radius: 12px;
}

/* ==========================================================================
   NEW TEMPLATE 10: WORDSEARCH ENGINE
   ========================================================================== */
.wordsearch-container {
  display: flex;
  gap: 28px;
  width: 100%;
  max-width: 860px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.wordsearch-board {
  flex: 1;
  min-width: 320px;
  background: #15161a;
  border: 2px solid #2d3139;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 4px;
  user-select: none;
}

.ws-cell {
  aspect-ratio: 1;
  background: #1f2127;
  border: 1px solid #2f3440;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f0f2f5;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ws-cell:hover {
  background: #2f3440;
}

.ws-cell.selected {
  background: #9f7aea;
  color: #ffffff;
}

.ws-cell.found {
  background: rgba(72, 187, 120, 0.35);
  border-color: #48bb78;
  color: #a7f3d0;
}

.wordsearch-targets {
  width: 240px;
  background: #15161a;
  border: 1px solid #2d3139;
  border-radius: 16px;
  padding: 20px;
}

.ws-target-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 12px;
}

.ws-target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-target-item {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted, #9ba1b0);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.ws-target-item.found {
  color: var(--accent, #48bb78);
  text-decoration: line-through;
  opacity: 0.6;
}

/* ==========================================================================
   AI CONFIG GRID & ADVANCED MODAL
   ========================================================================== */
.ai-dialog-advanced {
  max-width: 580px;
}

.ai-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 16px;
}

/* Shared Modals & Overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-dialog {
  background: #18191d;
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color, #2d3139);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main, #f0f2f5);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: #131416;
  border-top: 1px solid var(--border-color, #2d3139);
}

.ai-prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.suggestions-label {
  font-size: 0.8rem;
  color: var(--text-muted, #717784);
  width: 100%;
  margin-bottom: 2px;
}

.chip-suggestion {
  font-size: 0.82rem;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #363b48;
  border-radius: 14px;
  color: var(--text-main, #cbd5e1);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-suggestion:hover {
  border-color: #9f7aea;
  color: #ffffff;
}

/* Share Modal QR */
.share-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.share-url-input {
  font-family: monospace;
  font-size: 0.88rem;
  background: #101114;
}

.qr-container {
  text-align: center;
  padding: 18px;
  background: #121316;
  border: 1px solid var(--border-color, #2d3139);
  border-radius: 12px;
}

.qr-container h4 {
  font-size: 0.95rem;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 12px;
}

.qr-canvas {
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.qr-hint {
  font-size: 0.8rem;
  color: var(--text-muted, #8a909d);
  margin-top: 10px;
}

/* Victory Overlay */
.victory-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 15, 18, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.victory-card {
  background: #18191d;
  border: 2px solid var(--accent, #48bb78);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  animation: victoryBounce 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes victoryBounce {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.victory-stars {
  font-size: 38px;
  margin-bottom: 8px;
}

.victory-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main, #f0f2f5);
  margin-bottom: 6px;
}

.victory-sub {
  color: var(--text-muted, #9ba1b0);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.victory-stats {
  display: flex;
  justify-content: space-around;
  background: #111214;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 28px;
}

.v-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v-label {
  font-size: 0.78rem;
  color: var(--text-muted, #717784);
  text-transform: uppercase;
}

.v-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent, #48bb78);
}

.victory-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  width: 100vw;
  height: 100vh;
}

/* Responsive adjustments */
@media (max-width: 680px) {
  .match-container {
    flex-direction: column;
    gap: 16px;
  }
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
  .ai-config-grid {
    grid-template-columns: 1fr;
  }
  .wheel-canvas-wrap {
    width: 300px;
    height: 300px;
  }
  .item-row {
    flex-wrap: wrap;
  }
  .item-row .game-input {
    min-width: 100%;
  }
  .creator-header {
    flex-direction: column;
  }
  .creator-quick-actions {
    width: 100%;
  }
  .btn-ai-magic {
    width: 100%;
    justify-content: center;
  }
  .wordsearch-container {
    flex-direction: column;
  }
  .wordsearch-targets {
    width: 100%;
  }
}


/* ==========================================================================
   30 TEMPLATES EXTENSIONS & ADVANCED UX
   ========================================================================== */

/* Search bar & Category pills */
.explore-search-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  max-width: 600px;
  background: #14161a;
  border-radius: 10px;
}

.explore-category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-pill {
  padding: 8px 16px;
  background: #1a1c22;
  border: 1px solid #2d3139;
  border-radius: 20px;
  color: var(--text-muted, #9ba1b0);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-pill:hover {
  color: #ffffff;
  border-color: #4a5468;
}

.category-pill.active {
  background: rgba(159, 122, 234, 0.2);
  border-color: #9f7aea;
  color: #d6bcfa;
}

/* Template Selector Filter Mini */
.step-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.template-filter-mini {
  display: flex;
  gap: 6px;
}

.mini-tab {
  padding: 4px 12px;
  background: #1c1e24;
  border: 1px solid #2d3139;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #8a909d);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-tab.active {
  background: rgba(72, 187, 120, 0.2);
  border-color: var(--accent, #48bb78);
  color: var(--accent, #48bb78);
}

/* Delete button on user game cards */
.btn-delete-card {
  padding: 6px 12px;
  background: transparent;
  color: #e53e3e;
  border: 1px solid rgba(229, 62, 62, 0.3);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete-card:hover {
  background: rgba(229, 62, 62, 0.2);
  border-color: #e53e3e;
  color: #ffffff;
}

.section-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted, #8a909d);
  margin-top: 2px;
}

/* 11. HANGMAN ENGINE */
.hangman-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 680px;
}

.hangman-lives {
  font-size: 1.5rem;
  letter-spacing: 4px;
}

.hangman-word-slots {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 60px;
}

.hm-slot {
  width: 44px;
  height: 52px;
  border-bottom: 4px solid var(--accent, #48bb78);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
}

.hangman-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 540px;
  justify-content: center;
}

.hm-key {
  width: 38px;
  height: 42px;
  background: #252830;
  border: 1px solid #363b48;
  border-radius: 6px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
}

.hm-key:hover:not(:disabled) {
  background: #3b4252;
  border-color: var(--accent, #48bb78);
}

.hm-key:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* 12. SENTENCE UNSCRAMBLE ENGINE */
.unscramble-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 720px;
}

.unscramble-target-slot {
  min-height: 70px;
  width: 100%;
  background: #111214;
  border: 2px dashed #3a404d;
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.unscramble-pool {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.unscramble-chip {
  padding: 10px 18px;
  background: #252830;
  border: 2px solid #3d4352;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unscramble-chip:hover {
  border-color: var(--accent, #48bb78);
  transform: translateY(-2px);
}

/* 13. MEMORY PAIRS ENGINE */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 640px;
}

.memory-card {
  height: 110px;
  background: #1f2127;
  border: 2px solid #363b48;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  transition: all 0.25s ease;
  user-select: none;
}

.memory-card.face-down {
  background: repeating-linear-gradient(45deg, #181a20, #181a20 10px, #21242c 10px, #21242c 20px);
  color: transparent !important;
  border-color: #2c303c;
}

.memory-card.matched {
  border-color: var(--accent, #48bb78);
  background: rgba(72, 187, 120, 0.2);
  color: #a7f3d0 !important;
  cursor: default;
}

/* 15. WHACK-A-MOLE ENGINE */
.whack-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 660px;
}

.whack-holes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
}

.whack-hole {
  height: 120px;
  background: #15161a;
  border: 3px solid #2d3139;
  border-radius: 50% / 20%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.whack-mole {
  width: 90%;
  height: 90%;
  background: linear-gradient(180deg, #805ad5 0%, #553c9e 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transform: translateY(110%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.whack-mole.up {
  transform: translateY(0%);
}

/* 20. TYPING RACER ENGINE */
.typing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 680px;
}

.typing-target-box {
  background: #1f2127;
  border: 2px solid #2f3440;
  border-radius: 14px;
  padding: 28px;
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  letter-spacing: 0.5px;
  width: 100%;
}

.typing-input-box {
  font-size: 1.4rem;
  text-align: center;
  height: 56px;
}

.model-badge-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-muted, #94a3b8);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  opacity: 0.75;
  user-select: none;
  letter-spacing: 0.02em;
}

.model-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  opacity: 0.9;
  flex-shrink: 0;
}
