/* =========================================================================
   EduGame Play Engine — Gamified UI CSS
   Colorful, playful, animated, sound-enabled, mobile-friendly.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  --play-bg: #4f46e5;
  --game-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --game-card: #ffffff;
  --game-accent: #f59e0b;
  --game-success: #10b981;
  --game-danger: #ef4444;
}

body.play-mode {
  background: var(--game-grad);
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: #1e1b2e;
}

/* Play Header */
.play-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
}
.play-title-group h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  color: #312e81;
}
.play-title-group small {
  font-size: 12px;
  color: #6366f1;
  font-weight: 600;
}

.play-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}
.play-stat-box {
  background: #ede9fe;
  padding: 6px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #4338ca;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.play-stat-box.timer {
  background: #fef3c7;
  color: #b45309;
}
.play-stat-box.timer.urgent {
  background: #fee2e2;
  color: #b91c1c;
  animation: pulse-urgent 0.8s infinite alternate;
}
@keyframes pulse-urgent {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* Arena Container */
.play-arena {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
}

.game-board-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Question Banner */
.question-banner {
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  border: 2px dashed #818cf8;
  border-radius: 18px;
  padding: 16px 20px;
  text-align: center;
  margin-bottom: 24px;
}
.question-banner .q-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #4f46e5;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.question-banner .q-text {
  font-size: 20px;
  font-weight: 700;
  color: #1e1b4b;
}
.question-banner .q-clue {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

/* ─── Anagram Engine ─── */
.letters-holder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
  min-height: 64px;
}
.letter-slot {
  width: 54px;
  height: 60px;
  border-bottom: 4px solid #a5b4fc;
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #312e81;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.letter-slot.filled {
  border-color: #6366f1;
  background: #e0e7ff;
  cursor: pointer;
}
.letter-slot.filled:hover {
  background: #c7d2fe;
}
.letter-slot.current {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  animation: pulse-slot 1.2s infinite ease-in-out;
}
@keyframes pulse-slot {
  0%, 100% { border-color: #6366f1; }
  50% { border-color: #a855f7; }
}

.scrambled-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.letter-btn {
  width: 54px;
  height: 58px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border: none;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #3730a3, 0 10px 14px rgba(79, 70, 229, 0.35);
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.letter-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #3730a3;
}
.letter-btn.used {
  opacity: 0.25;
  pointer-events: none;
  box-shadow: none;
  transform: translateY(4px);
}

/* ─── Matching Pairs Engine ─── */
.matching-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 20px 0;
}
.match-card {
  min-height: 110px;
  height: auto;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04);
}
.match-card.has-image {
  min-height: 110px;
  padding: 8px;
}
.match-card-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  overflow: hidden;
}
.match-card-img img {
  max-width: 100%;
  max-height: 90px;
  object-fit: contain;
  border-radius: 8px;
}
.match-card:hover {
  transform: translateY(-2px);
  border-color: #818cf8;
}
.match-card.selected {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #3730a3;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}
.match-card.matched {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
  pointer-events: none;
  opacity: 0.85;
}

/* ─── Match Up Engine ─── */
.matchup-board {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.matchup-targets-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.matchup-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}
.matchup-row.matched-row {
  background: #f0fdf4;
  border-color: #86efac;
  border-style: solid;
}
.matchup-slot {
  width: 170px;
  min-height: 48px;
  background: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
  transition: all 0.2s ease;
  cursor: pointer;
}
.matchup-slot.drag-over {
  border-color: #6366f1;
  background: #eef2ff;
  transform: scale(1.03);
}
.matchup-slot.has-tile {
  border-style: solid;
  border-color: transparent;
  background: transparent;
}
.matchup-slot.correct {
  border-color: #10b981;
  background: #dcfce7;
}
.matchup-slot.wrong-shake {
  animation: shake 0.5s ease-in-out;
  border-color: #ef4444;
  background: #fee2e2;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.slot-placeholder {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
.matchup-def-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.matchup-def-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
}
.matchup-def-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}
.matchup-def-text {
  flex: 1;
  min-width: 0;
}
.def-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e1b4b;
  line-height: 1.35;
}
.matchup-bank-wrapper {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.matchup-bank-header {
  font-size: 13.5px;
  font-weight: 700;
  color: #4338ca;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.matchup-bank-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 56px;
  padding: 8px;
  border-radius: 12px;
  background: #f8fafc;
}
.matchup-tile {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.matchup-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
}
.matchup-tile.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.matchup-tile.selected {
  outline: 3px solid #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
  transform: scale(1.05);
}
.matchup-tile.matched-tile {
  background: linear-gradient(135deg, #10b981, #059669);
  cursor: default;
  box-shadow: none;
}

/* ─── Matchup Actions bar ─── */
.matchup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.matchup-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  border: 1.5px solid #c7d2fe;
  color: #4338ca;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}

/* ─── Group Sort Engine ─── */
.groupsort-board {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.groupsort-columns-wrap {
  display: grid;
  gap: 16px;
  width: 100%;
}
.groupsort-col {
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.groupsort-col.drag-over {
  transform: scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
.groupsort-col-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 15px;
}
.col-count {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.groupsort-dropzone {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
}
.groupsort-dropzone.drag-over {
  background: rgba(99, 102, 241, 0.08);
}
.zone-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  margin: auto;
  pointer-events: none;
}
.groupsort-deck-wrapper {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.groupsort-deck-header {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.groupsort-deck-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 56px;
  padding: 8px;
  border-radius: 12px;
  background: #f0fdfa;
  border: 1px dashed #99f6e4;
}
.groupsort-deck-grid.drag-over {
  background: #ccfbf1;
}
.groupsort-item {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: #1e293b;
  cursor: grab;
  user-select: none;
  box-shadow: 0 3px 6px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}
.groupsort-item:hover {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 6px 12px rgba(99, 102, 241, 0.15);
}
.groupsort-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.groupsort-item.selected {
  outline: 3px solid #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
  transform: scale(1.05);
}
.groupsort-item.correct-sorted {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  cursor: default;
}
.groupsort-item.wrong-shake {
  animation: shake 0.5s ease-in-out;
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}
.gs-item-thumb {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

/* ─── Open the Box Engine ─── */
.otb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  justify-content: center;
  width: 100%;
  max-width: 720px;
  margin: 10px auto;
}
.otb-box {
  background: linear-gradient(145deg, #38bdf8, #0284c7);
  border: 3px solid #0284c7;
  border-radius: 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  box-shadow: 0 8px 0 #0369a1, 0 12px 20px rgba(2, 132, 199, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.otb-box:hover:not(.correct):not(.wrong) {
  transform: translateY(-4px);
  box-shadow: 0 12px 0 #0369a1, 0 16px 26px rgba(2, 132, 199, 0.45);
}
.otb-box:active:not(.correct):not(.wrong) {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #0369a1, 0 6px 12px rgba(2, 132, 199, 0.3);
}
.otb-number {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.25);
  line-height: 1;
}
.otb-status-icon {
  font-size: 20px;
  margin-top: 6px;
}
.otb-box.correct {
  background: linear-gradient(145deg, #34d399, #059669);
  border-color: #047857;
  box-shadow: 0 4px 0 #065f46;
  opacity: 0.85;
  cursor: default;
  transform: translateY(4px);
}
.otb-box.wrong {
  background: linear-gradient(145deg, #f87171, #dc2626);
  border-color: #b91c1c;
  box-shadow: 0 4px 0 #991b1b;
  opacity: 0.85;
  cursor: default;
  transform: translateY(4px);
}
.otb-modal-box {
  max-width: 520px;
  width: 100%;
}
.otb-modal-badge {
  font-size: 12px;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 999px;
}
.otb-q-title {
  font-size: 19px;
  font-weight: 800;
  color: #1e1b4b;
  line-height: 1.35;
}
.otb-q-image-wrap {
  max-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
}
.otb-q-image {
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
}
.otb-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
.otb-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 12px;
  transition: all 0.15s ease;
}
.otb-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ede9fe;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.otb-opt-text {
  flex: 1;
}
.otb-opt-btn.correct-answer {
  background: #dcfce7 !important;
  border-color: #10b981 !important;
  color: #15803d !important;
}

/* ─── Spin Wheel Engine ─── */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 10px 0;
}
.wheel-pointer {
  width: 0; 
  height: 0; 
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 32px solid #ef4444;
  position: absolute;
  top: -8px;
  z-index: 10;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.3));
}
#wheelCanvas {
  max-width: 100%;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  cursor: pointer;
}

/* ─── Searchword Engine ─── */
.wordsearch-container {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}
.ws-grid-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  max-width: 100%;
}
.ws-grid {
  display: inline-grid;
  gap: 3px;
  background: #e2e8f0;
  padding: 6px;
  border-radius: 14px;
  user-select: none;
}
.ws-cell {
  width: 38px;
  height: 38px;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s;
}
.ws-cell.highlight {
  background: #fde047;
  color: #854d0e;
}
.ws-cell.preview-path {
  background: #fef08a !important;
  color: #713f12 !important;
  box-shadow: inset 0 0 0 2px #eab308;
}
.ws-cell.found {
  background: #86efac;
  color: #14532d;
  font-weight: 800;
}
.ws-wordlist {
  flex: 1 1 300px;
  min-width: 260px;
  max-width: 500px;
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  transition: all 0.25s ease;
}
.ws-wordlist.collapsed {
  padding: 10px 16px;
  background: #f8fafc;
}
.ws-wordlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}
.ws-wordlist-header:hover .ws-wordlist-title {
  color: #4338ca;
}
.ws-wordlist-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ws-wordlist-title {
  margin: 0;
  color: #312e81;
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}
.ws-wordlist-badge {
  background: #e0e7ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.ws-wordlist-badge.all-found {
  background: #dcfce7;
  color: #15803d;
}
.ws-btn-collapse {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ws-btn-collapse:hover {
  background: #4f46e5;
  color: #ffffff;
}
.ws-wordlist-content {
  margin-top: 12px;
  transition: opacity 0.2s ease;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}
.ws-wordlist-content::-webkit-scrollbar {
  width: 6px;
}
.ws-wordlist-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.ws-wordlist-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.ws-wordlist.collapsed .ws-wordlist-content {
  display: none;
}
.ws-wordlist-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ws-word-item {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.ws-word-item.done {
  text-decoration: line-through;
  color: #10b981;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.ws-word-answer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  flex-shrink: 0;
}
.ws-word-val {
  font-weight: 800;
  color: #4338ca;
  font-size: 14px;
  user-select: none;
  transition: all 0.2s ease;
}
.ws-word-val.is-masked {
  letter-spacing: 2px;
  color: #4f46e5;
  font-size: 15px;
  font-weight: 800;
}
.ws-word-val.is-revealed {
  letter-spacing: 0.5px;
  color: #4338ca;
}
.ws-word-item.done .ws-word-val {
  color: #10b981;
  text-decoration: line-through;
}
.ws-btn-peek {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.ws-btn-peek:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
  transform: translateY(-1px);
}
.ws-btn-peek:active {
  transform: translateY(0);
}
.ws-btn-peek.active {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}
.ws-btn-peek.active:hover {
  background: #4f46e5;
  color: #ffffff;
}
.ws-word-item.done .ws-btn-peek {
  display: none !important;
}

/* ─── Crossword Engine ─── */
.crossword-wrap {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
}
.cw-grid-container {
  overflow: auto;
  max-width: 100%;
  padding: 16px;
  background: #f8fafc;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
}
.cw-grid-table {
  border-collapse: separate;
  border-spacing: 3px;
  margin: 0 auto;
}
.cw-grid-table td {
  width: 42px;
  height: 42px;
  padding: 0;
  text-align: center;
  position: relative;
}
.cw-grid-table td.block {
  background: transparent;
}
.cw-grid-table td.cell {
  background: #ffffff;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.15s ease;
}
.cw-grid-table td.cell:focus-within,
.cw-grid-table td.cell.highlighted {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.cw-grid-table td.cell.correct {
  background: #dcfce7 !important;
  border-color: #10b981 !important;
}
.cw-grid-table td.cell.correct input {
  color: #15803d !important;
}
.cw-grid-table td.cell.wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}
.cw-grid-table td.cell.wrong input {
  color: #b91c1c !important;
}
.cw-grid-table input {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  text-transform: uppercase;
  background: transparent;
  outline: none;
  font-family: inherit;
  color: #1e1b4b;
}
.crossword-wrap.clues-collapsed .cw-grid-container {
  max-width: 100%;
  width: 100%;
}
.cw-num {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #4338ca;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  padding: 1px 4px;
  line-height: 1.1;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s ease;
  z-index: 2;
  user-select: none;
}
.cw-num:hover,
.cw-grid-table td.cell.start-cell:hover .cw-num {
  background: #4f46e5;
  color: #ffffff;
  transform: scale(1.15);
}
.cw-grid-table td.cell.start-cell {
  cursor: pointer;
}
.cw-clues-pane {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  max-height: 520px;
  overflow-y: auto;
  font-size: 13.5px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.cw-clues-pane.collapsed {
  display: none !important;
}
.cw-clues-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  gap: 10px;
}
.cw-clues-title {
  font-weight: 800;
  color: #312e81;
  font-size: 15.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cw-btn-collapse {
  background: #ede9fe;
  color: #4f46e5;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.cw-btn-collapse:hover {
  background: #4f46e5;
  color: #ffffff;
  transform: translateX(2px);
}
.cw-btn-expand-float {
  position: fixed;
  right: 20px;
  top: 140px;
  z-index: 999;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pulseFloat 2.2s infinite;
}
.cw-btn-expand-float:hover {
  transform: scale(1.05) translateX(-3px);
  box-shadow: 0 14px 32px rgba(124, 58, 237, 0.6);
}
@keyframes pulseFloat {
  0%, 100% { box-shadow: 0 10px 25px rgba(124, 58, 237, 0.45); }
  50%      { box-shadow: 0 12px 30px rgba(124, 58, 237, 0.7); }
}
.cw-clue-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cw-clue-item:hover,
.cw-clue-item.active {
  background: #f5f3ff;
  border-color: #c4b5fd;
  transform: translateX(2px);
}

/* Question Dialog Modal (Kotak Dialog Pertanyaan) */
.cw-qmodal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: qmodalFadeIn 0.2s ease-out;
}
@keyframes qmodalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.cw-qmodal-card {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 30px rgba(99, 102, 241, 0.15);
  width: 100%;
  max-width: 500px;
  padding: 24px 28px;
  position: relative;
  animation: qmodalZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #e2e8f0;
}
@keyframes qmodalZoomIn {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.cw-qmodal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid #f1f5f9;
}
.cw-qmodal-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.cw-qmodal-close:hover {
  background: #fee2e2;
  color: #ef4444;
}
.cw-qmodal-item {
  background: #f8fafc;
  border-radius: 16px;
  border: 1.5px solid #e2e8f0;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}
.cw-qmodal-item.dir-across {
  border-left: 5px solid #4f46e5;
}
.cw-qmodal-item.dir-down {
  border-left: 5px solid #059669;
}
.cw-qmodal-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cw-qmodal-badge {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.cw-qmodal-badge.dir-across {
  background: #ede9fe;
  color: #4f46e5;
}
.cw-qmodal-badge.dir-down {
  background: #d1fae5;
  color: #059669;
}
.cw-qmodal-len {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
}
.cw-qmodal-question {
  font-size: 16.5px;
  font-weight: 800;
  color: #1e1b4b;
  line-height: 1.45;
  margin-bottom: 8px;
}
.cw-qmodal-clue {
  font-size: 13px;
  color: #475569;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 6px 12px;
  border-radius: 8px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cw-qmodal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1.5px solid #f1f5f9;
}

/* Modal Victory / Game Over */
.play-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.play-modal-box {
  background: #ffffff;
  border-radius: 28px;
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  animation: pop-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop-bounce {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Confetti canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* =========================================================================
   Mobile Responsiveness for EduGame Play Engine
   Optimized for smartphones (320px - 768px viewports)
   ========================================================================= */

@media (max-width: 768px) {
  /* Play Header: 2 clean stacked rows (Title + Teacher Badge on row 1, 3 stats on row 2) */
  .play-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 14px;
  }
  .play-title-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }
  .play-title-group h1 {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  .play-title-group small {
    font-size: 11px;
    white-space: nowrap;
    background: #ede9fe;
    color: #4338ca;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 600;
    flex-shrink: 0;
  }
  .play-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }
  .play-stat-box {
    padding: 6px 4px;
    font-size: 12px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    border-radius: 10px;
    gap: 4px;
  }

  /* Arena & Main Game Board Card */
  .play-arena {
    margin: 10px auto;
    padding: 0 10px;
    width: 100%;
    max-width: 100%;
  }
  .game-board-card {
    border-radius: 20px;
    padding: 18px 14px;
    min-height: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  }

  /* Question Banner: compact & readable */
  .question-banner {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 14px;
  }
  .question-banner .q-badge {
    font-size: 11px;
    margin-bottom: 2px;
  }
  .question-banner .q-text {
    font-size: 16px;
    line-height: 1.35;
  }
  .question-banner .q-clue {
    font-size: 12px;
    margin-top: 4px;
  }

  /* ── 1. Matching Pairs: 2-column mobile layout ── */
  .matching-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin: 12px 0 !important;
  }
  .match-card {
    min-height: 80px;
    padding: 10px 8px;
    font-size: 13.5px;
    border-radius: 14px;
    word-break: break-word;
    hyphens: auto;
  }
  .match-card.has-image {
    min-height: 85px;
    padding: 6px;
  }
  .match-card-img img {
    max-height: 65px;
  }

  /* ── 2. Anagram: Scaled letter slots and buttons ── */
  .letters-holder {
    gap: 6px;
    margin: 14px 0;
    min-height: 50px;
  }
  .letter-slot {
    width: clamp(34px, 9.5vw, 50px);
    height: clamp(42px, 11vw, 56px);
    font-size: clamp(16px, 4.8vw, 22px);
    border-radius: 10px;
  }
  .scrambled-letters {
    gap: 8px;
    margin: 14px 0;
  }
  .letter-btn {
    width: clamp(36px, 10vw, 52px);
    height: clamp(42px, 12vw, 58px);
    font-size: clamp(16px, 4.8vw, 22px);
    border-radius: 10px;
  }
  .anagram-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    margin: 16px auto 0;
  }
  .anagram-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px !important;
    font-size: 13.5px !important;
    white-space: nowrap;
    justify-content: center;
    transition: opacity 0.2s, background-color 0.15s, border-color 0.15s;
  }
  .anagram-actions .shortcut-hint {
    display: none !important;
  }

  /* ── 3. Searchword: Responsive 1:1 Aspect Ratio Grid ── */
  .wordsearch-container {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  .ws-grid-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .ws-grid {
    width: 100%;
    max-width: min(100%, 390px);
    gap: 2px;
    padding: 5px;
    border-radius: 10px;
  }
  .ws-cell {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    font-size: clamp(10px, 3.1vw, 15px);
    border-radius: 4px;
  }
  .ws-wordlist {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border-radius: 12px;
  }
  .ws-wordlist.collapsed {
    padding: 8px 12px;
  }
  .ws-wordlist-title {
    font-size: 13px;
  }
  .ws-btn-collapse {
    padding: 4px 9px;
    font-size: 11px;
  }
  .ws-wordlist-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .ws-word-item {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 8px;
  }
  .ws-btn-peek {
    width: 28px;
    height: 28px;
  }
  .ws-word-val.is-masked {
    letter-spacing: 1.5px;
    font-size: 13.5px;
  }

  /* ── 4. Spin the Wheel: Scaled Canvas and Full Width Controls ── */
  .wheel-container {
    margin: 6px 0;
  }
  #wheelCanvas {
    max-width: min(78vw, 300px) !important;
    max-height: min(78vw, 300px) !important;
    width: auto !important;
    height: auto !important;
  }
  .wheel-pointer {
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 24px solid #ef4444;
    top: -4px;
  }
  .elimination-bar {
    flex-direction: column !important;
    gap: 6px !important;
    text-align: center;
    margin-top: 12px !important;
  }
  #btnSpin {
    width: 100%;
    padding: 12px 16px !important;
    font-size: 15px !important;
  }

  /* ── 5. Crossword: Scaled Table Cells ── */
  .crossword-wrap {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  .cw-grid-container {
    padding: 8px;
    border-radius: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cw-grid-table td {
    width: clamp(26px, 7.5vw, 36px);
    height: clamp(26px, 7.5vw, 36px);
  }
  .cw-grid-table input {
    font-size: clamp(13px, 4vw, 17px);
  }
  .cw-clues-pane {
    min-width: 0;
    width: 100%;
    max-height: 300px;
  }

  /* ── 6. Match Up: Mobile Layout ── */
  .matchup-row {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }
  .matchup-slot {
    width: 100%;
    min-height: 44px;
  }
  .matchup-tile {
    padding: 8px 14px;
    font-size: 13px;
  }
  .matchup-actions {
    flex-direction: column;
    gap: 8px;
  }
  .matchup-actions .btn {
    width: 100%;
  }

  /* ── 7. Group Sort: Mobile Layout ── */
  .groupsort-columns-wrap {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .groupsort-col {
    min-height: auto;
  }
  .groupsort-dropzone {
    min-height: 90px;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .groupsort-actions {
    flex-direction: column;
    gap: 8px;
  }
  .groupsort-actions .btn {
    width: 100%;
  }

  /* ── 8. Open the Box: Mobile Layout ── */
  .otb-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .otb-box {
    min-height: 100px;
    border-radius: 16px;
  }
  .otb-number {
    font-size: 26px;
  }
  .otb-q-title {
    font-size: 16px;
  }
  .otb-opt-btn {
    padding: 10px 12px;
    font-size: 13.5px;
  }

  /* Modals on Mobile */
  .play-modal {
    padding: 12px;
  }
  .play-modal-box {
    padding: 24px 16px;
    border-radius: 20px;
    max-width: 100%;
  }
}

/* Extra small devices (< 380px) */
@media (max-width: 380px) {
  .play-stats {
    gap: 4px;
  }
  .play-stat-box {
    padding: 5px 2px;
    font-size: 11px;
    gap: 2px;
  }
  .ws-wordlist-grid {
    grid-template-columns: 1fr;
  }
  .matching-grid {
    gap: 8px !important;
  }
  .match-card {
    min-height: 72px;
    font-size: 12.5px;
    padding: 8px 6px;
  }
}

/* =========================================================================
   Game Start Overlay Screen (Wordwall-style Splash Dialog)
   ========================================================================= */

.game-start-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(18, 20, 29, 0.88);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  color: #ffffff;
  text-align: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  user-select: none;
}

.game-start-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-game-type {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.start-game-title {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: clamp(34px, 5.5vw, 56px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin: 0 0 36px 0;
  max-width: 900px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
  word-break: break-word;
}

.start-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-bottom: 32px;
}

.start-action-card {
  width: 136px;
  height: 126px;
  background: rgba(9, 13, 22, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  outline: none;
}

.start-action-card:hover {
  border-color: #00c2ff;
  box-shadow: 0 0 28px rgba(0, 194, 255, 0.45), 0 16px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(-4px) scale(1.05);
}

.start-action-card:active {
  transform: scale(0.96);
}

.start-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.start-card-label {
  font-size: 19px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.start-game-instructions {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 500;
  color: #f1f5f9;
  max-width: 780px;
  line-height: 1.5;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* Bottom Controls (Speaker & Fullscreen) */
.start-bottom-controls {
  position: absolute;
  bottom: 28px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
}

.start-ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
  outline: none;
}

.start-ctrl-btn:hover {
  background: rgba(0, 194, 255, 0.2);
  border-color: #00c2ff;
  color: #00c2ff;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(0, 194, 255, 0.4);
}

.start-ctrl-btn.muted {
  opacity: 0.6;
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.start-ctrl-btn.muted:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
  opacity: 1;
}

/* Header persistent controls */
.header-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: transform 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.header-ctrl-btn:hover {
  transform: scale(1.15);
}
.header-ctrl-btn.exit-game-btn {
  color: #4338ca;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-ctrl-btn.exit-game-btn:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  transform: scale(1.15);
}
.start-ctrl-btn.exit-game-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fca5a5 !important;
  transform: scale(1.08);
}

/* Floating Preview Mode Banner */
.preview-mode-bar {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.25);
  border-radius: 999px;
  padding: 8px 18px 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #ffffff;
  max-width: 90%;
  animation: slide-down 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slide-down {
  from { transform: translate(-50%, -100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.preview-badge-pill {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preview-bar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #e2e8f0;
}

@media (max-width: 640px) {
  .preview-mode-bar {
    border-radius: 16px;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    top: 10px;
    width: 95%;
  }
}

@media (max-width: 768px) {
  .start-actions-row {
    gap: 16px;
  }
  .start-action-card {
    width: 115px;
    height: 105px;
    border-radius: 16px;
  }
  .start-card-icon svg {
    width: 38px;
    height: 38px;
  }
  .start-card-label {
    font-size: 16px;
  }
  .start-bottom-controls {
    bottom: 16px;
    right: 16px;
    gap: 10px;
  }
  .start-ctrl-btn {
    width: 42px;
    height: 42px;
  }
}

/* =========================================================================
   Fullscreen Mode Styles (Both CSS Fallback Mode & Native Fullscreen)
   ========================================================================= */
html:fullscreen,
html:-webkit-full-screen {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100% !important;
  width: 100% !important;
}

body.fullscreen-mode {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  min-height: 100vh !important;
  height: auto !important;
  position: relative !important;
  z-index: 99999 !important;
}

:fullscreen body,
:-webkit-full-screen body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  min-height: 100vh !important;
  height: auto !important;
  position: relative !important;
}

body.fullscreen-mode .play-header,
:fullscreen .play-header,
:-webkit-full-screen .play-header {
  padding: 8px 24px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
}

body.fullscreen-mode .play-arena,
:fullscreen .play-arena,
:-webkit-full-screen .play-arena {
  max-width: 100% !important;
  width: 100% !important;
  min-height: calc(100vh - 65px) !important;
  height: auto !important;
  margin: 0 !important;
  padding: 12px 20px 24px 20px !important;
  flex: 1 !important;
  overflow-y: visible !important;
}

body.fullscreen-mode .game-board-card,
:fullscreen .game-board-card,
:-webkit-full-screen .game-board-card {
  max-width: 100% !important;
  width: 100% !important;
  min-height: calc(100vh - 90px) !important;
  height: auto !important;
  border-radius: 16px !important;
  padding: 20px 24px 32px 24px !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: none !important;
  overflow-y: visible !important;
}

body.fullscreen-mode #gameContainer,
:fullscreen #gameContainer,
:-webkit-full-screen #gameContainer {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: safe center !important;
  min-height: min-content !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   FIND THE MATCH (TEMUKAN PASANGAN) GAME STYLES
   ══════════════════════════════════════════════════════════════════════════ */
.findmatch-arena {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.findmatch-header {
  text-align: center;
  margin-bottom: 2px;
}

.findmatch-tagline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 12px;
}

.findmatch-title {
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #334155;
  letter-spacing: -0.01em;
}

.findmatch-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.findmatch-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.findmatch-counter-pill {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.findmatch-counter-icon {
  font-size: 16px;
}

.findmatch-progress-track {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.findmatch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #0284c7);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Findmatch Lives Indicator */
.findmatch-lives-container {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.findmatch-lives-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border: 1.5px solid #fecdd3;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #e11d48;
  box-shadow: 0 2px 5px rgba(225, 29, 72, 0.08);
  user-select: none;
}

.findmatch-lives-label {
  font-size: 11px;
  font-weight: 800;
  color: #be123c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.findmatch-hearts-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.findmatch-heart {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, filter 0.25s ease;
  user-select: none;
}

.findmatch-heart.filled {
  filter: drop-shadow(0 1px 2px rgba(225, 29, 72, 0.35));
}

.findmatch-heart.empty {
  opacity: 0.32;
  filter: grayscale(1);
  transform: scale(0.85);
}

.findmatch-heart.lost-anim {
  animation: heartBreakPop 0.5s forwards ease-out;
}

@keyframes heartBreakPop {
  0% { transform: scale(1.4); }
  35% { transform: scale(0.7) rotate(-15deg); filter: grayscale(0.4); }
  100% { transform: scale(0.85) rotate(0deg); opacity: 0.32; filter: grayscale(1); }
}

.findmatch-lives-txt {
  font-size: 13px;
  font-weight: 800;
  color: #be123c;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Conveyor Film-strip Track */
.findmatch-conveyor-wrapper {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.04);
  position: relative;
}

.findmatch-perforation-bar {
  height: 16px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1.5px dashed #cbd5e1;
  overflow: hidden;
}

.findmatch-perforation-bar.bottom {
  border-bottom: none;
  border-top: 1.5px dashed #cbd5e1;
}

.findmatch-hole {
  width: 9px;
  height: 7px;
  background: #cbd5e1;
  border-radius: 2px;
  opacity: 0.8;
  flex-shrink: 0;
}

.findmatch-stage {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  position: relative;
  overflow: hidden;
}

.findmatch-target-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 600px;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.findmatch-target-card.slide-left-out {
  transform: translateX(-120px) scale(0.92);
  opacity: 0;
}

.findmatch-target-card.slide-right-in {
  animation: findmatchSlideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes findmatchSlideInRight {
  from {
    transform: translateX(120px) scale(0.92);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.findmatch-img-wrapper {
  max-height: 180px;
  max-width: 280px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 14px;
  position: relative;
  cursor: zoom-in;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.findmatch-img-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

.findmatch-img {
  max-height: 155px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.findmatch-img-zoom-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.findmatch-question-text {
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin: 0;
  word-break: break-word;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.findmatch-clue-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-top: 10px;
}

/* Matching Tiles Deck (Pastel 3D Buttons) */
.findmatch-deck-container {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.03);
}

.findmatch-deck-hint {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 16px;
}

.findmatch-tiles-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.findmatch-tile {
  background: var(--tile-bg, #38bdf8);
  border: 2.5px solid var(--tile-border, #0284c7);
  color: var(--tile-text, #ffffff);
  box-shadow: 0 5px 0 var(--tile-shadow, #0369a1), 0 8px 14px rgba(0,0,0,0.12);
  border-radius: 14px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 800;
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  min-height: 48px;
}

.findmatch-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--tile-shadow, #0369a1), 0 10px 18px rgba(0,0,0,0.15);
  filter: brightness(1.05);
}

.findmatch-tile:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--tile-shadow, #0369a1), 0 3px 6px rgba(0,0,0,0.1);
}

.findmatch-tile-letter {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.findmatch-tile-text {
  letter-spacing: 0.02em;
}

/* Correct Pulse */
.findmatch-tile.correct-pulse {
  filter: brightness(1.2);
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

/* Pop Eliminate Animation */
.findmatch-tile.pop-eliminate {
  animation: findmatchTileEliminate 0.3s forwards ease-in-out;
  pointer-events: none;
}

@keyframes findmatchTileEliminate {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  40% {
    transform: scale(1.18);
    opacity: 0.9;
  }
  100% {
    transform: scale(0);
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
  }
}

/* Wrong Shake Animation */
.findmatch-tile.shake-error {
  animation: findmatchShake 0.45s ease-in-out;
  border-color: #ef4444 !important;
  background: #fee2e2 !important;
  color: #b91c1c !important;
  box-shadow: 0 4px 0 #b91c1c, 0 6px 12px rgba(239, 68, 68, 0.25) !important;
}

@keyframes findmatchShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (max-width: 640px) {
  .findmatch-title {
    font-size: 20px;
  }
  .findmatch-stage {
    min-height: 180px;
    padding: 16px 12px;
  }
  .findmatch-question-text {
    font-size: 26px;
  }
  .findmatch-stats-row {
    padding: 6px 10px;
    gap: 8px;
  }
  .findmatch-lives-pill {
    padding: 3px 8px;
    font-size: 11.5px;
  }
  .findmatch-heart {
    font-size: 14px;
  }
  .findmatch-tile {
    padding: 8px 14px;
    font-size: 14.5px;
    min-height: 42px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   FLASH CARDS (KARTU KILAT) GAME STYLES
   ══════════════════════════════════════════════════════════════════════════ */
.flashcards-arena {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.flashcards-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.flashcards-counter-pill {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.flashcards-progress-track {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.flashcards-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.flashcards-scores-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.fc-badge-mastered {
  color: #16a34a;
  background: #f0fdf4;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
}

.fc-badge-review {
  color: #dc2626;
  background: #fef2f2;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #fecaca;
}

.flashcards-stage-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.flashcards-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  position: relative;
}

.flashcards-card-perspective {
  perspective: 1200px;
  width: 100%;
  max-width: 520px;
  height: 330px;
  cursor: pointer;
  user-select: none;
}

.flashcards-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.22);
}

.flashcards-card-inner.flipped {
  transform: rotateY(180deg);
}

.flashcards-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.flashcards-front {
  background: linear-gradient(135deg, #7dd3fc 0%, #60a5fa 100%);
  color: #ffffff;
  border: 3.5px solid #3b82f6;
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.4);
}

.flashcards-back {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #1e293b;
  border: 3.5px solid #60a5fa;
  transform: rotateY(180deg);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}

.fc-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.fc-card-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.28);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.fc-card-badge.fc-badge-back {
  background: #dbeafe;
  color: #1d4ed8;
}

.fc-prompt-text {
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
  line-height: 1.3;
  max-width: 90%;
  margin: 0;
}

.fc-clue-text {
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.22);
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 999px;
  margin-top: 12px;
  max-width: 90%;
}

.fc-answer-text {
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #1e40af;
  line-height: 1.3;
  max-width: 90%;
  margin: 0;
}

.fc-card-img-wrap {
  max-height: 170px;
  max-width: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  padding: 6px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  position: relative;
  cursor: zoom-in;
}

.fc-card-img {
  max-height: 155px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.fc-img-zoom-hint {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Side Grading Controls (Checkmark & Cross) */
.flashcards-side-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.fc-side-btn {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  user-select: none;
}

.fc-btn-correct {
  background: #86efac;
  color: #15803d;
  box-shadow: 0 4px 0 #4ade80, 0 6px 14px rgba(74, 222, 128, 0.4);
}

.fc-btn-correct:hover {
  transform: scale(1.08);
  background: #4ade80;
}

.fc-btn-correct:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #4ade80;
}

.fc-btn-wrong {
  background: #fca5a5;
  color: #991b1b;
  box-shadow: 0 4px 0 #f87171, 0 6px 14px rgba(248, 113, 113, 0.4);
}

.fc-btn-wrong:hover {
  transform: scale(1.08);
  background: #f87171;
}

.fc-btn-wrong:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #f87171;
}

/* Flip Button Below Card */
.flashcards-flip-btn-wrap {
  margin-top: 14px;
  text-align: center;
}

.fc-flip-btn {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 38px;
  font-size: 15px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  box-shadow: 0 3px 0 #94a3b8, 0 4px 8px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
  font-family: 'Fredoka', 'Plus Jakarta Sans', sans-serif;
}

.fc-flip-btn:hover {
  background: #f8fafc;
  border-color: #60a5fa;
  color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #94a3b8;
}

.fc-flip-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}

/* Bottom Navigation Bar */
.flashcards-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.fc-nav-center-hint {
  font-size: 12.5px;
  color: #64748b;
  font-weight: 600;
  text-align: center;
}

.fc-nav-btn {
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 10px;
}

/* Slide Transition Animations */
.flashcards-card-inner.slide-correct {
  animation: fcSlideOutRight 0.35s ease forwards;
}

.flashcards-card-inner.slide-wrong {
  animation: fcSlideOutLeft 0.35s ease forwards;
}

@keyframes fcSlideOutRight {
  0% { transform: scale(1) translateX(0); }
  100% { transform: scale(0.9) translateX(120px); opacity: 0; }
}

@keyframes fcSlideOutLeft {
  0% { transform: scale(1) translateX(0); }
  100% { transform: scale(0.9) translateX(-120px); opacity: 0; }
}

/* Summary Modal */
.fc-summary-modal-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 24px;
  border: 2px solid #e2e8f0;
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  animation: fadeIn 0.3s ease;
}

.fc-summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.fc-stat-box {
  padding: 14px;
  border-radius: 16px;
  text-align: center;
}

.fc-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.fc-stat-num {
  font-size: 22px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .flashcards-card-perspective {
    height: 280px;
  }
  .fc-prompt-text {
    font-size: 24px;
  }
  .fc-answer-text {
    font-size: 22px;
  }
  .fc-side-btn {
    width: 44px;
    height: 44px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MODERN, LUXURIOUS & GLOSSY CONFIRMATION MODAL
   ══════════════════════════════════════════════════════════════════════════ */
.glossy-modal-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(30, 27, 75, 0.65) 0%, rgba(15, 23, 42, 0.82) 100%);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
  animation: glossyFadeIn 0.22s ease-out;
}

.glossy-modal-overlay[style*="none"],
.glossy-modal-overlay.hidden {
  display: none !important;
}

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

.glossy-modal-card {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 255, 0.94) 100%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  padding: 36px 30px 28px 30px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 
    0 25px 60px -10px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(226, 232, 240, 0.8),
    inset 0 1px 1px rgba(255, 255, 255, 1);
  overflow: hidden;
  animation: glossyPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Glass Sheen Light Reflection at Top Edge */
.glossy-sheen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;
  background: radial-gradient(ellipse 130% 100% at 50% -30%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 75%);
  pointer-events: none;
}

/* Glowing Halo Icon */
.glossy-icon-glow {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 50%, #fecdd3 100%);
  box-shadow: 
    0 0 0 8px rgba(254, 226, 226, 0.6),
    0 12px 30px -4px rgba(239, 68, 68, 0.38),
    inset 0 2px 4px rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px auto;
  color: #e11d48;
  animation: glossyPulse 2.2s infinite ease-in-out;
}

@keyframes glossyPulse {
  0%, 100% {
    box-shadow: 0 0 0 8px rgba(254, 226, 226, 0.6), 0 12px 30px -4px rgba(239, 68, 68, 0.38);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(254, 226, 226, 0.28), 0 16px 36px -4px rgba(239, 68, 68, 0.48);
  }
}

.glossy-modal-title {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 23px;
  font-weight: 700;
  color: #1e1b4b;
  margin: 0 0 8px 0;
  letter-spacing: -0.2px;
}

.glossy-modal-desc {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: #64748b;
  margin: 0 0 26px 0;
}

.glossy-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.glossy-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  user-select: none;
}

/* Cancel Button: Frosted glassy pill */
.glossy-btn-cancel {
  background: rgba(241, 245, 249, 0.92);
  color: #475569;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.glossy-btn-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.glossy-btn-cancel:active {
  transform: translateY(0);
}

/* Danger / Confirm Button: Lustrous Glossy Gradient with Inset Shine */
.glossy-btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%);
  color: #ffffff;
  border: none;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    0 8px 22px -3px rgba(225, 29, 72, 0.45);
}
.glossy-btn-danger:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    0 12px 28px -3px rgba(225, 29, 72, 0.58);
}
.glossy-btn-danger:active {
  transform: translateY(0);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(225, 29, 72, 0.35);
}

@media (max-width: 480px) {
  .glossy-modal-card {
    padding: 28px 20px 22px 20px;
    border-radius: 22px;
  }
  .glossy-icon-glow {
    width: 60px;
    height: 60px;
    margin-bottom: 14px;
  }
  .glossy-icon-glow svg {
    width: 28px;
    height: 28px;
  }
  .glossy-modal-title {
    font-size: 20px;
  }
  .glossy-modal-desc {
    font-size: 13.5px;
    margin-bottom: 20px;
  }
  .glossy-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .glossy-btn {
    width: 100%;
    padding: 12px 16px;
  }
}






/* ══════════════════════════════════════════════════════════════════════════
   COMPLETE THE SENTENCE (LENGKAPI KALIMAT / CLOZE TEST) ENGINE STYLES
   Wordwall-style interactive cloze activity with 3D pastel pills, blanks, and lives
   ══════════════════════════════════════════════════════════════════════════ */
.cs-arena {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

.cs-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-tagline {
  text-align: center;
}

.cs-title {
  display: block;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e1b4b;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.cs-subtitle {
  display: block;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13.5px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}

.cs-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.9);
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  box-sizing: border-box;
}

.cs-counter-pill {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.cs-counter-pill b {
  color: #0284c7;
}

.cs-progress-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.cs-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stage Card */
.cs-stage-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: 0 12px 35px -8px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(226, 232, 240, 0.6);
  box-sizing: border-box;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cs-content-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.cs-content-layout.has-image {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  align-items: center;
  gap: 32px;
}

/* Image Column */
.cs-image-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid #f1f5f9;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cs-image-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.cs-image-wrapper img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.cs-zoom-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* Interactive Column */
.cs-interactive-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1;
}

/* Word Bank Box */
.cs-word-bank-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 14px 18px;
  box-sizing: border-box;
}

.cs-word-bank-label {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.cs-word-bank-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* 3D Pastel Word Pill (matching user screenshot) */
.cs-word-pill {
  appearance: none;
  border: none;
  outline: none;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--pill-color, #ffffff);
  background: var(--pill-bg, #38bdf8);
  border: 2px solid var(--pill-border, #0284c7);
  box-shadow: 0 4px 0 var(--pill-shadow, #0369a1), 0 6px 12px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 8px 24px;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cs-word-pill:hover:not(.is-slotted) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--pill-shadow, #0369a1), 0 8px 16px rgba(0, 0, 0, 0.12);
}

.cs-word-pill:active:not(.is-slotted) {
  cursor: grabbing;
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--pill-shadow, #0369a1);
}

.cs-word-pill.is-slotted {
  opacity: 0.28;
  filter: grayscale(0.8);
  cursor: default;
  pointer-events: none;
  transform: scale(0.94);
  box-shadow: 0 1px 0 var(--pill-shadow, #0369a1);
}

/* Sentence with Blank Area */
.cs-sentence-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.5;
  padding: 6px 0;
}

.cs-sentence-text {
  color: #1e293b;
  white-space: pre-wrap;
}

/* Blank Slot */
.cs-blank-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  height: 52px;
  padding: 4px 14px;
  background: #f8fafc;
  border: 2.5px solid #cbd5e1;
  border-radius: 12px;
  box-sizing: border-box;
  vertical-align: middle;
  transition: all 0.2s ease;
  user-select: none;
}

.cs-blank-slot.drag-hover {
  border-color: #0284c7;
  background: #e0f2fe;
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.cs-blank-slot.has-word {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.cs-blank-slot.is-correct {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  animation: csCorrectPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cs-blank-slot.is-wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  animation: csShake 0.4s ease;
}

.cs-blank-placeholder {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

/* Slotted Pill Inside Blank */
.cs-slotted-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9px;
  background: var(--pill-bg, #38bdf8);
  border: 1.5px solid var(--pill-border, #0284c7);
  color: #ffffff;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cs-slotted-pill:hover {
  transform: scale(1.03);
  filter: brightness(1.05);
}

.cs-remove-icon {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.cs-slotted-pill:hover .cs-remove-icon {
  background: rgba(239, 68, 68, 0.9);
}

/* Clue Badge */
.cs-clue-badge {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  color: #475569;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 10px;
  padding: 6px 12px;
  display: inline-block;
  align-self: flex-start;
}

.cs-clue-badge span {
  font-weight: 700;
  color: #854d0e;
}

/* Submit Answers Row & Button */
.cs-submit-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.cs-submit-btn {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #475569;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  box-shadow: 0 4px 0 #cbd5e1, 0 6px 14px rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 10px 36px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.cs-submit-btn:not(:disabled) {
  color: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 4px 0 #0284c7, 0 8px 18px rgba(2, 132, 199, 0.22);
}

.cs-submit-btn:not(:disabled):hover {
  transform: translateY(-2px);
  background: #f0f9ff;
  box-shadow: 0 6px 0 #0284c7, 0 10px 22px rgba(2, 132, 199, 0.28);
}

.cs-submit-btn:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0284c7;
}

.cs-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@keyframes csCorrectPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes csShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

@media (max-width: 768px) {
  .cs-stage-card {
    padding: 24px 18px;
  }
  .cs-content-layout.has-image {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .cs-image-wrapper {
    max-width: 260px;
  }
  .cs-image-wrapper img {
    height: 170px;
  }
  .cs-sentence-area {
    font-size: 20px;
  }
  .cs-blank-slot {
    min-width: 110px;
    height: 46px;
  }
  .cs-word-pill {
    font-size: 16px;
    padding: 6px 18px;
  }
  .cs-submit-btn {
    width: 100%;
    padding: 12px 20px;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   SPEED SORTING (PENYORTIRAN CEPAT) ENGINE STYLES
   Wordwall-style conveyor belt sorting with perforated filmstrip rails and yellow category boxes
   ══════════════════════════════════════════════════════════════════════════ */
.ss-arena {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

.ss-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ss-tagline {
  text-align: center;
}

.ss-title {
  display: block;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e1b4b;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ss-subtitle {
  display: block;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13.5px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}

.ss-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.9);
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  box-sizing: border-box;
}

.ss-counter-pill {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.ss-counter-pill b {
  color: #f59e0b;
}

.ss-progress-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.ss-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stage Card */
.ss-stage-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  padding: 28px 28px 32px 28px;
  box-shadow: 0 12px 35px -8px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(226, 232, 240, 0.6);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top Feedback Header (Matches "Correct!" in screenshot) */
.ss-feedback-banner {
  text-align: center;
  padding: 8px 16px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  transition: all 0.25s ease;
}

.ss-feedback-text {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #475569;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ss-feedback-text small {
  font-size: 16px;
  font-weight: 700;
}

.ss-feedback-banner.is-correct {
  background: #ecfdf5;
  border-color: #10b981;
}

.ss-feedback-banner.is-correct .ss-feedback-text {
  color: #059669;
  animation: ssBannerPop 0.35s ease;
}

.ss-feedback-banner.is-wrong {
  background: #fef2f2;
  border-color: #ef4444;
}

.ss-feedback-banner.is-wrong .ss-feedback-text {
  color: #dc2626;
  animation: ssShake 0.4s ease;
}

.ss-feedback-banner.is-timeout {
  background: #fff7ed;
  border-color: #f97316;
}

.ss-feedback-banner.is-timeout .ss-feedback-text {
  color: #ea580c;
  animation: ssShake 0.4s ease;
}

/* Conveyor Viewport */
.ss-conveyor-viewport {
  position: relative;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Perforated Track Rails (filmstrip style sprocket holes matching screenshot) */
.ss-track-rail {
  height: 22px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ss-rail-top {
  border-bottom: 2px solid #cbd5e1;
}

.ss-rail-bottom {
  border-top: 2px solid #cbd5e1;
}

.ss-track-sprockets {
  width: 200%;
  height: 10px;
  background-image: repeating-linear-gradient(
    90deg,
    #cbd5e1 0px,
    #cbd5e1 10px,
    transparent 10px,
    transparent 20px
  );
  animation: ssSprocketsMove 1.6s linear infinite;
}

/* Conveyor Belt Channel */
.ss-belt-channel {
  position: relative;
  height: 160px;
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    45deg,
    #f8fafc 0,
    #f8fafc 16px,
    #ffffff 16px,
    #ffffff 32px
  );
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Active 3D Item Tile on Conveyor (Pink card matching "Banana" in screenshot) */
.ss-item-tile {
  position: absolute;
  top: 50%;
  left: 10%;
  transform: translateY(-50%);
  width: 120px;
  height: 110px;
  background: var(--tile-bg, #fb7185);
  border: 2.5px solid var(--tile-border, #e11d48);
  box-shadow: 0 5px 0 var(--tile-shadow, #be123c), 0 8px 18px rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  color: var(--tile-text, #ffffff);
  cursor: grab;
  user-select: none;
  z-index: 10;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ss-item-tile:hover {
  transform: translateY(-54%) scale(1.03);
  box-shadow: 0 7px 0 var(--tile-shadow, #be123c), 0 12px 22px rgba(0, 0, 0, 0.18);
}

.ss-item-tile:active {
  cursor: grabbing;
  transform: translateY(-46%);
  box-shadow: 0 2px 0 var(--tile-shadow, #be123c);
}

.ss-tile-thumb {
  max-width: 50px;
  max-height: 45px;
  object-fit: contain;
  margin-bottom: 4px;
  border-radius: 6px;
}

.ss-tile-label {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.ss-item-tile.fly-into-box {
  transform: translateY(120px) scale(0.2) !important;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
}

.ss-item-tile.shake-tile {
  animation: ssShake 0.4s ease;
}

.ss-item-tile.fall-off-belt {
  transform: translate(120px, 60px) rotate(30deg) !important;
  opacity: 0;
  transition: all 0.45s ease;
}

/* Item Timer Bar */
.ss-item-timer-track {
  height: 5px;
  background: #e2e8f0;
  width: 100%;
}

.ss-item-timer-bar {
  height: 100%;
  background: #38bdf8;
  transition: width 0.1s linear, background-color 0.2s ease;
}

.ss-item-timer-bar.urgent {
  background: #ef4444;
}

/* Clue Pill */
.ss-clue-pill {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  color: #854d0e;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 10px;
  padding: 6px 14px;
  text-align: center;
  align-self: center;
}

/* Category Boxes Row (Matches screenshot yellow boxes below) */
.ss-categories-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Category Box */
.ss-category-box {
  position: relative;
  background: #fef9c3;
  border: 2.5px dashed #eab308;
  border-radius: 16px;
  box-shadow: 0 5px 0 #fde047, 0 6px 14px rgba(234, 179, 8, 0.1);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  min-height: 100px;
  box-sizing: border-box;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.ss-category-box:hover {
  transform: translateY(-3px);
  background: #fef08a;
  box-shadow: 0 8px 0 #fde047, 0 10px 20px rgba(234, 179, 8, 0.18);
}

.ss-category-box:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #fde047;
}

.ss-category-box.drag-hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  border-style: solid !important;
  box-shadow: 0 8px 0 #38bdf8, 0 0 0 4px rgba(2, 132, 199, 0.25) !important;
  transform: scale(1.04) translateY(-4px);
}

.ss-category-box.is-correct {
  background: #dcfce7 !important;
  border-color: #22c55e !important;
  border-style: solid !important;
  box-shadow: 0 6px 0 #86efac !important;
  animation: ssBoxPop 0.4s ease;
}

.ss-category-box.is-correct .ss-cat-name {
  color: #15803d !important;
}

.ss-category-box.is-wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  border-style: solid !important;
  box-shadow: 0 6px 0 #fca5a5 !important;
  animation: ssShake 0.4s ease;
}

.ss-category-box.is-wrong .ss-cat-name {
  color: #b91c1c !important;
}

.ss-cat-content {
  text-align: center;
}

.ss-cat-name {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #854d0e;
  line-height: 1.25;
  transition: color 0.18s ease;
}

/* Feedback Badge Inside Box */
.ss-cat-badge-feedback {
  position: absolute;
  top: 8px;
  right: 10px;
  pointer-events: none;
}

.ss-badge-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #22c55e;
  color: #ffffff;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
  animation: ssBadgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ss-badge-cross {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #ef4444;
  color: #ffffff;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: ssBadgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ssSprocketsMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(-20px); }
}

@keyframes ssShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

@keyframes ssBannerPop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes ssBoxPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

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

@media (max-width: 640px) {
  .ss-stage-card {
    padding: 20px 16px;
  }
  .ss-belt-channel {
    height: 130px;
  }
  .ss-item-tile {
    width: 95px;
    height: 90px;
  }
  .ss-tile-label {
    font-size: 15px;
  }
  .ss-category-box {
    padding: 18px 12px;
    min-height: 85px;
  }
  .ss-cat-name {
    font-size: 18px;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   WORD MAGNETS (MAGNET KATA) ENGINE STYLES
   Wordwall-style magnetic sentence poetry on ruled whiteboard/notebook lines
   ══════════════════════════════════════════════════════════════════════════ */
.wm-arena {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

.wm-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wm-tagline {
  text-align: center;
}

.wm-title {
  display: block;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e1b4b;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.wm-subtitle {
  display: block;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13.5px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}

.wm-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.9);
  border: 1.5px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 14px;
  box-sizing: border-box;
}

.wm-counter-pill {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.wm-counter-pill b {
  color: #7c3aed;
}

.wm-progress-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.wm-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #818cf8 0%, #6366f1 50%, #a855f7 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stage Card */
.wm-stage-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  padding: 28px 28px 32px 28px;
  box-shadow: 0 12px 35px -8px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(226, 232, 240, 0.6);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Prompt Bar */
.wm-prompt-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 18px;
  box-sizing: border-box;
}

.wm-prompt-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
  flex-shrink: 0;
  cursor: pointer;
}

.wm-prompt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wm-prompt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wm-prompt-badge {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #6366f1;
  letter-spacing: 0.04em;
}

.wm-prompt-content {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
}

/* Lined Board Container (Notebook / Whiteboard ruled lines) */
.wm-board-container {
  background-color: #ffffff;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 38px,
    #e2e8f0 38px,
    #e2e8f0 40px
  );
  border: 2px solid #cbd5e1;
  border-radius: 18px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 22px 22px 26px 22px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 320px;
}

.wm-zone-label {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Sentence Drop & Placement Line */
.wm-sentence-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wm-sentence-line {
  min-height: 64px;
  background: rgba(240, 249, 255, 0.7);
  border: 2px dashed #93c5fd;
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  transition: all 0.22s ease;
}

.wm-sentence-line.is-correct {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18) !important;
  animation: wmPop 0.4s ease;
}

.wm-sentence-line.is-wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18) !important;
  animation: wmShake 0.4s ease;
}

.wm-placeholder-hint {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  color: #94a3b8;
  font-style: italic;
  font-weight: 600;
  user-select: none;
  pointer-events: none;
}

/* Ruled Divider */
.wm-ruled-divider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0.8;
}

.wm-ruled-line {
  height: 2px;
  background: #cbd5e1;
  width: 100%;
}

/* Tray Zone (Bank) */
.wm-tray-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wm-tray-lines {
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 6px 2px;
  box-sizing: border-box;
}

/* 3D Magnet Word Tile (matching user screenshot) */
.wm-magnet-tile {
  appearance: none;
  border: none;
  outline: none;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--tile-text, #ffffff);
  background: var(--tile-bg, #38bdf8);
  border: 2px solid var(--tile-border, #0284c7);
  box-shadow: 0 4px 0 var(--tile-shadow, #0369a1), 0 6px 14px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 7px 18px;
  cursor: grab;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.16s ease, filter 0.16s ease;
}

.wm-magnet-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--tile-shadow, #0369a1), 0 8px 18px rgba(0, 0, 0, 0.15);
}

.wm-magnet-tile:active {
  cursor: grabbing;
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--tile-shadow, #0369a1);
}

/* On-Line Magnet Tile with Remove Icon */
.wm-magnet-tile.on-line {
  cursor: pointer;
}

.wm-remove-x {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.wm-magnet-tile.on-line:hover .wm-remove-x {
  background: rgba(239, 68, 68, 0.9);
}

/* Action Controls Row */
.wm-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.wm-btn-reset {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
}

.wm-btn-submit {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  padding: 11px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.wm-btn-submit:disabled,
.wm-btn-reset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

@keyframes wmPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes wmShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (max-width: 640px) {
  .wm-stage-card {
    padding: 20px 16px;
  }
  .wm-board-container {
    padding: 16px 14px;
  }
  .wm-magnet-tile {
    font-size: 15px;
    padding: 6px 14px;
  }
  .wm-sentence-line {
    min-height: 52px;
  }
  .wm-btn-submit {
    width: 100%;
  }
  .wm-actions-row {
    flex-direction: column-reverse;
  }
  .wm-btn-reset {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   13. LABELLED DIAGRAM (DIAGRAM BERLABEL) GAME ENGINE STYLES
   ══════════════════════════════════════════════════════════════════════════ */
.ld-arena {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 14px 40px;
}
.ld-header {
  margin-bottom: 20px;
}
.ld-tagline {
  text-align: center;
  margin-bottom: 14px;
}
.ld-title {
  display: block;
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e1b4b;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.ld-subtitle {
  display: block;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13.5px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}
.ld-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.ld-counter-pill {
  font-weight: 700;
  font-size: 13.5px;
  color: #334155;
  white-space: nowrap;
}
.ld-progress-track {
  flex: 1;
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.ld-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ld-stage-card {
  background: #ffffff;
  border-radius: 24px;
  border: 2px solid #e2e8f0;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.06);
  padding: 24px 28px;
  position: relative;
  overflow: visible;
}

.ld-main-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.ld-diagram-viewport {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.ld-diagram-wrapper {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  background: radial-gradient(circle at center, #ffffff 0%, #f8fafc 100%);
  border: 1.5px solid #e2e8f0;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.ld-diagram-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 18px;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.ld-diagram-svg-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ld-diagram-vector {
  width: 100%;
  height: 100%;
  display: block;
}

.ld-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.ld-pins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.ld-pin-target {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  user-select: none;
}

.ld-pin-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ld-pin-target:hover .ld-pin-dot {
  transform: scale(1.25);
}

.ld-pin-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--pin-color, #475569);
  opacity: 0.3;
  animation: ld-pulse 1.8s infinite;
}

.ld-pin-target.is-empty .ld-pin-pulse {
  background: #64748b;
  opacity: 0.25;
}

.ld-pin-core {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--pin-color, #334155);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ld-pin-num {
  font-family: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: var(--pin-color, #334155);
  line-height: 1;
  user-select: none;
}

.ld-pin-target.has-label .ld-pin-core {
  background: var(--pin-color, #38bdf8);
  border-color: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.ld-pin-target.has-label .ld-pin-num {
  color: #ffffff;
}

.ld-pin-target.is-selected .ld-pin-dot {
  transform: scale(1.35);
}
.ld-pin-target.is-selected .ld-pin-core {
  background: #f59e0b !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 14px #f59e0b !important;
}
.ld-pin-target.is-selected .ld-pin-num {
  color: #ffffff !important;
}

.ld-pinned-badge {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--badge-bg, #38bdf8);
  border: 2px solid var(--badge-border, #0284c7);
  color: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  z-index: 10;
  animation: ld-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ld-pinned-badge:hover {
  filter: brightness(1.08);
}
.ld-pinned-badge .ld-badge-remove {
  font-size: 10px;
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ld-pinned-badge .ld-badge-icon {
  font-size: 13px;
  font-weight: 900;
  color: #ffffff;
}

.badge-correct {
  background: #10b981 !important;
  border-color: #059669 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.5) !important;
}
.badge-wrong {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  animation: ld-shake 0.4s ease !important;
}

.ld-tray-container {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 18px;
  padding: 16px 20px;
  margin-top: 10px;
}
.ld-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.ld-tray-title {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ld-tray-hint {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}
.ld-tray-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  min-height: 52px;
}
.ld-tray-empty {
  font-size: 13.5px;
  color: #10b981;
  font-weight: 700;
  text-align: center;
  padding: 10px;
}

.ld-label-card {
  background: var(--card-bg, #38bdf8);
  border: 2px solid var(--card-border, #0284c7);
  color: var(--card-text, #ffffff);
  font-weight: 800;
  font-size: 14.5px;
  padding: 9px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  cursor: grab;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.ld-label-card:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.ld-label-card:active {
  cursor: grabbing;
  transform: translateY(0) scale(0.97);
}
.ld-label-card.is-selected {
  outline: 3.5px solid #3b82f6;
  outline-offset: 3px;
  animation: ld-float 1s ease-in-out infinite alternate;
}

.ld-actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}
.ld-btn-reset, .ld-btn-submit {
  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ld-btn-submit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}
.ld-btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.45);
}

@keyframes ld-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes ld-pop {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes ld-float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

@keyframes ld-shake {
  0%, 100% { transform: translateX(-50%); }
  20%, 60% { transform: translateX(-55%); }
  40%, 80% { transform: translateX(-45%); }
}

@media (max-width: 640px) {
  .ld-stage-card {
    padding: 18px 14px;
  }
  .ld-diagram-wrapper {
    max-width: 100%;
  }
  .ld-actions-row {
    flex-direction: column-reverse;
  }
  .ld-btn-submit, .ld-btn-reset {
    width: 100%;
  }
}

/* ==========================================================================
   TYPE THE ANSWER GAME STYLES
   Wordwall-style prompt with clean input pill, virtual keyboard & feedback
   ========================================================================== */

.tta-arena {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tta-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tta-tagline {
  text-align: center;
}

.tta-title {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.5px;
}

.tta-subtitle {
  display: block;
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  margin-top: 4px;
}

.tta-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
}

.tta-counter-pill {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.tta-progress-track {
  flex: 1;
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.tta-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 100%);
  border-radius: 999px;
  transition: width 0.35s ease-in-out;
}

/* Main Stage Card */
.tta-stage-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  border: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

/* Prompt Container */
.tta-prompt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.tta-image-wrapper {
  position: relative;
  max-width: 380px;
  max-height: 240px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #f8fafc;
}

.tta-image-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
}

.tta-prompt-image {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.tta-zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.tta-question-box {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tta-question-text {
  font-size: 22px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.45;
  margin: 0;
}

/* Clue & Hint */
.tta-clue-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tta-clue-toggle {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tta-clue-toggle:hover, .tta-clue-toggle.is-active {
  background: #fde68a;
  color: #78350f;
  transform: translateY(-1px);
}

.tta-clue-content {
  background: #fffbeb;
  border: 1px dashed #fcd34d;
  color: #b45309;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  max-width: 480px;
  animation: pop-bounce 0.25s ease;
}

/* Typing Pill Area */
.tta-input-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.tta-input-form {
  width: 100%;
  max-width: 540px;
}

.tta-input-pill-wrapper {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 2.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 8px 6px 20px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.25s ease;
  position: relative;
}

.tta-input-pill-wrapper:focus-within {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18), 0 6px 18px rgba(59, 130, 246, 0.1);
}

.tta-input-pill-wrapper.is-correct {
  background: #f0fdf4 !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.25), 0 8px 24px rgba(16, 185, 129, 0.15) !important;
}

.tta-input-pill-wrapper.is-wrong {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.25), 0 8px 24px rgba(239, 68, 68, 0.15) !important;
}

.tta-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 19px;
  font-weight: 700;
  color: #1e293b;
  padding: 8px 0;
  min-width: 0;
}

.tta-input-field::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.tta-clear-btn {
  background: #e2e8f0;
  color: #64748b;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin: 0 8px;
  transition: all 0.15s ease;
}

.tta-clear-btn:hover {
  background: #cbd5e1;
  color: #1e293b;
}

.tta-submit-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.tta-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.tta-submit-btn:active {
  transform: translateY(1px);
}

.tta-input-pill-wrapper.is-correct .tta-submit-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Shake Animation */
.tta-shake {
  animation: ttaShake 0.45s ease-in-out;
}

@keyframes ttaShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* On-Screen Keyboard Toggle */
.tta-keyboard-toggle-row {
  display: flex;
  justify-content: center;
  margin-top: -4px;
}

.tta-keyboard-toggle-btn {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tta-keyboard-toggle-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-1px);
}

.tta-keyboard-toggle-btn.is-active {
  background: #e0e7ff;
  border-color: #818cf8;
  color: #4338ca;
}

/* Virtual Keyboard */
.tta-virtual-keyboard {
  display: none;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  max-width: 600px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 12px 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  animation: pop-bounce 0.25s ease;
}

.tta-virtual-keyboard.is-open {
  display: flex;
}

.tta-vk-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.tta-vk-key {
  flex: 1;
  max-width: 48px;
  height: 44px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom: 3px solid #94a3b8;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.tta-vk-key:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.tta-vk-key:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

.tta-vk-func {
  max-width: 64px;
  background: #e2e8f0;
  border-color: #cbd5e1;
  border-bottom-color: #94a3b8;
  color: #475569;
  font-size: 13.5px;
}

.tta-vk-space {
  max-width: 220px;
  font-size: 12px;
  letter-spacing: 1px;
  color: #64748b;
}

.tta-vk-enter {
  max-width: 110px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  border-bottom-color: #047857;
  color: #ffffff;
  font-size: 13px;
}

.tta-vk-enter:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Feedback Banner */
.tta-feedback-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  animation: pop-bounce 0.25s ease;
}

.tta-feedback-banner.is-correct {
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  color: #065f46;
}

.tta-feedback-banner.is-wrong {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #991b1b;
}

.tta-fb-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  flex-shrink: 0;
}

.tta-feedback-banner.is-correct .tta-fb-icon {
  background: #10b981;
  color: #ffffff;
}

.tta-feedback-banner.is-wrong .tta-fb-icon {
  background: #ef4444;
  color: #ffffff;
}

.tta-fb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.tta-fb-sub {
  font-size: 12.5px;
  opacity: 0.9;
}

@media (max-width: 640px) {
  .tta-stage-card {
    padding: 22px 16px;
    border-radius: 18px;
  }
  .tta-question-text {
    font-size: 18px;
  }
  .tta-input-field {
    font-size: 16px;
  }
  .tta-submit-btn {
    padding: 8px 16px;
    font-size: 13.5px;
  }
  .tta-vk-key {
    height: 40px;
    font-size: 14px;
  }
}
