/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-top: #fdf0e6;
  --bg-bottom: #f0e6f6;
  --peach: #f4845f;
  --peach-light: #ffecd2;
  --mint: #88d8b0;
  --mint-light: #e0f5ea;
  --lavender: #b49fdc;
  --lavender-light: #ede5f7;
  --cream: #fff8f0;
  --gold: #f0c850;
  --gold-bright: #f5d76e;
  --green: #2ecc71;
  --green-glow: #27ae60;
  --red: #e74c3c;
  --red-glow: #c0392b;
  --heart: #e74c3c;
  --star: #f1c40f;
  --white: #ffffff;
  --text: #3d3250;
  --text-dark: #3d3250;
  --text-muted: #7a6e8a;
  --card-shadow: 0 3px 12px rgba(80, 50, 100, 0.08);
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(160deg, var(--bg-top) 0%, var(--cream) 40%, var(--bg-bottom) 100%);
  color: var(--text);
  min-height: 100vh;
}
body.in-game {
  overflow: hidden;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}
.screen.active {
  display: flex;
}

/* Game screen: full viewport, no scroll */
#screen-game {
  position: relative;
  padding: 0;
  overflow: hidden;
}

/* ===== 3D CANVAS ===== */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ===== GAME HUD OVERLAY ===== */
.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 100%);
}
.game-hud .hud,
.game-hud .sentence-area {
  pointer-events: auto;
}

/* ===== BUTTONS ===== */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  border: none;
  border-radius: 12px;
  padding: 14px 36px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(80, 50, 100, 0.15);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary {
  background: linear-gradient(135deg, var(--peach), #f6a67a);
  color: #fff;
  box-shadow: 0 3px 10px rgba(244, 132, 95, 0.3);
}
.btn-secondary {
  background: var(--cream);
  color: var(--text);
  border: 2px solid #e8ddd4;
}
.btn-secondary:hover {
  background: #f5ece2;
}
/* ===== START SCREEN ===== */
#screen-start {
  overflow-y: auto;
}
.castle-header {
  margin-top: 60px;
  margin-bottom: 40px;
  text-align: center;
}
.game-title {
  font-family: 'Baloo 2', cursive;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--peach);
  text-shadow: 0 2px 0 rgba(180, 100, 60, 0.15);
}
.game-subtitle {
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--lavender);
  opacity: 1;
  margin-top: 4px;
}

/* Navigation Container */
.nav-container {
  margin-top: 40px;
  width: 100%;
  max-width: 500px;
}
.nav-view {
  display: none;
}
.nav-view.active {
  display: block;
}
.nav-view h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  color: var(--text);
}
.nav-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
}
.nav-back {
  display: inline-block;
  background: none;
  border: none;
  color: var(--lavender);
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 10px;
  transition: opacity 0.15s;
}
.nav-back:hover {
  opacity: 0.7;
}

/* Category cards */
.category-list, .gametype-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.category-card, .gametype-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--cream);
  border: 2px solid #f0e0d0;
  border-left: 5px solid var(--mint);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  text-align: left;
  box-shadow: var(--card-shadow);
}
.category-card:nth-child(even) {
  border-left-color: var(--lavender);
  background: var(--lavender-light);
  border-color: #ddd4eb;
  border-left-color: var(--lavender);
}
.category-card:nth-child(3n) {
  border-left-color: var(--peach);
  background: var(--peach-light);
  border-color: #f0dcc8;
  border-left-color: var(--peach);
}
.category-card:hover, .gametype-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(80, 50, 100, 0.12);
}
.category-card .card-icon, .gametype-card .card-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}
.category-card .card-info, .gametype-card .card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.card-stars {
  font-size: 1rem;
  flex-shrink: 0;
  letter-spacing: 1px;
}

/* Level list */
.level-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.level-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--cream);
  border: 2px solid #f0e0d0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  box-shadow: var(--card-shadow);
}
.level-btn:hover:not(.locked) {
  transform: translateX(4px);
  box-shadow: 0 6px 18px rgba(80, 50, 100, 0.12);
}
.level-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.level-btn .level-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--mint);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}
.level-btn.locked .level-number {
  background: #e0d8e4;
  color: #b0a4b8;
}
.level-btn .level-name {
  flex: 1;
}
.level-btn .level-name-en {
  font-size: 0.85rem;
  opacity: 0.6;
  font-weight: 400;
}
.level-btn .level-lock {
  font-size: 1.3rem;
}
.level-btn .level-stars-display {
  font-size: 1.1rem;
  letter-spacing: 2px;
}

/* ===== HUD ===== */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 700px;
  padding: 10px 0;
  margin-bottom: 10px;
}
.hud-hearts {
  display: flex;
  gap: 6px;
  font-size: 1.6rem;
}
.hud-hearts .heart {
  transition: transform 0.3s, opacity 0.3s;
}
.hud-hearts .heart.lost {
  animation: heartBreak 0.5s forwards;
}
.hud-level {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.hud-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-bar {
  width: 100px;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.progress-text {
  font-size: 0.85rem;
  opacity: 0.7;
  min-width: 30px;
}

/* ===== SENTENCE AREA ===== */
.sentence-area {
  text-align: center;
  margin: 4px 0 0;
  max-width: 600px;
}
.sentence {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  color: #fff;
}
.sentence .blank {
  display: inline-block;
  min-width: 100px;
  border-bottom: 3px dashed var(--gold);
  margin: 0 4px;
}
.hint {
  font-size: 1rem;
  opacity: 0.6;
  margin-top: 4px;
  font-style: italic;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  color: rgba(255,255,255,0.7);
}

/* ===== CHARACTER (preview only) ===== */
.character {
  position: relative;
  width: 50px;
  height: 60px;
}
.char-hat {
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 20px solid var(--hat-color, #d4a843);
  margin: 0 auto;
  position: relative;
}
.char-hat::after {
  content: '';
  position: absolute;
  bottom: -23px;
  left: -17px;
  width: 34px;
  height: 6px;
  background: var(--hat-color, #d4a843);
  border-radius: 3px;
}
.char-face {
  width: 30px;
  height: 16px;
  background: #f5d6a8;
  border-radius: 50%;
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.char-eye {
  width: 4px;
  height: 4px;
  background: #2c1810;
  border-radius: 50%;
}
.char-body {
  width: 34px;
  height: 20px;
  background: linear-gradient(180deg, var(--robe-color, #B49FDC), color-mix(in srgb, var(--robe-color, #B49FDC) 80%, black));
  border-radius: 4px 4px 8px 8px;
  margin: 2px auto 0;
}
.char-feet {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1px;
}
.char-foot {
  width: 10px;
  height: 5px;
  background: var(--boot-color, #C8956B);
  border-radius: 0 0 4px 4px;
}

/* ===== D-PAD (mobile) ===== */
.dpad {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 130px;
  height: 130px;
  z-index: 200;
}
@media (pointer: coarse) {
  .dpad { display: block; }
}
.dpad-btn {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.dpad-btn:active {
  background: rgba(255,255,255,0.3);
}
.dpad-up    { top: 0;   left: 50%; transform: translateX(-50%); }
.dpad-down  { bottom: 0; left: 50%; transform: translateX(-50%); }
.dpad-left  { top: 50%;  left: 0;  transform: translateY(-50%); }
.dpad-right { top: 50%;  right: 0; transform: translateY(-50%); }

/* ===== FEEDBACK OVERLAY ===== */
.feedback-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
}
.feedback-overlay.visible {
  opacity: 1;
}
.feedback-text {
  font-family: 'Baloo 2', cursive;
  font-size: 3rem;
  text-shadow: 0 3px 10px rgba(0,0,0,0.4);
  animation: popIn 0.4s cubic-bezier(0.17, 0.67, 0.21, 1.3);
}
.feedback-text.correct {
  color: var(--green);
}
.feedback-text.wrong {
  color: var(--red);
}

/* ===== REWARD SCREEN ===== */
.reward-title {
  font-family: 'Baloo 2', cursive;
  font-size: 3rem;
  color: var(--gold-bright);
  margin-top: 80px;
  text-shadow: 0 0 20px rgba(212, 168, 67, 0.3);
}
.reward-subtitle {
  font-size: 1.1rem;
  opacity: 0.7;
  margin-top: 4px;
}
.stars {
  display: flex;
  gap: 16px;
  margin: 30px 0;
}
.stars .star {
  font-size: 3.5rem;
  opacity: 0;
  transform: scale(0);
}
.stars .star.earned {
  animation: starPop 0.5s cubic-bezier(0.17, 0.67, 0.21, 1.3) forwards;
}
.stars .star.empty {
  animation: starPop 0.5s cubic-bezier(0.17, 0.67, 0.21, 1.3) forwards;
  filter: grayscale(1) brightness(0.5);
}
.stars .star:nth-child(1) { animation-delay: 0.2s; }
.stars .star:nth-child(2) { animation-delay: 0.5s; }
.stars .star:nth-child(3) { animation-delay: 0.8s; }

.reward-stats {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 30px;
}
.reward-buttons {
  display: flex;
  gap: 14px;
}

/* ===== GAME OVER SCREEN ===== */
.gameover-title {
  font-family: 'Baloo 2', cursive;
  font-size: 2.8rem;
  color: var(--red);
  margin-top: 80px;
}
.gameover-subtitle {
  font-size: 1.1rem;
  opacity: 0.7;
  margin-top: 6px;
}
.gameover-icon {
  font-size: 5rem;
  margin: 30px 0;
  animation: pulse 1.5s infinite;
}
.gameover-buttons {
  display: flex;
  gap: 14px;
}

/* ===== ANIMATIONS ===== */
@keyframes heartBreak {
  0% { transform: scale(1); opacity: 1; }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(0.6); opacity: 0.3; filter: grayscale(1); }
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

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

/* ===== CUSTOMIZATION PANEL ===== */
.customize-panel {
  width: 100%;
  max-width: 500px;
  margin-top: 30px;
  background: var(--mint-light);
  border: 2px solid #c8e8d6;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}
.customize-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: var(--text);
}
.customize-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  opacity: 0.6;
  font-weight: 400;
}
.customize-body {
  display: flex;
  gap: 24px;
  align-items: center;
}
.customize-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 130px;
  flex-shrink: 0;
}
.preview-char {
  position: relative;
  transform: scale(1.8);
}
.customize-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.customize-row-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}
.customize-row-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  padding: 0;
  outline: none;
}
.swatch:hover {
  transform: scale(1.15);
}
.swatch.active {
  border-color: var(--peach);
  box-shadow: 0 0 0 3px rgba(244, 132, 95, 0.3);
}

/* ===== BOMB TIMER HUD ===== */
.bomb-timer-hud {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 24px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid var(--red);
  border-radius: 14px;
  pointer-events: auto;
}
.bomb-timer-hud.active {
  display: flex;
}
.bomb-timer-icon {
  font-size: 1.6rem;
}
.bomb-timer-text {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  min-width: 60px;
  text-align: center;
}
.bomb-timer-hud.danger {
  border-color: #ff2222;
  animation: bomb-pulse 0.5s infinite;
}
.bomb-timer-hud.danger .bomb-timer-text {
  color: #ff4444;
}

@keyframes bomb-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 34, 34, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 34, 34, 0.7); }
}

/* Timer critical state */
.bomb-timer-hud.critical .bomb-timer-text {
  color: #ff2222;
  transform: scale(1.2);
  text-shadow: 0 0 12px rgba(255, 34, 34, 0.8);
  transition: transform 0.3s, color 0.3s;
}
.bomb-timer-hud .bomb-timer-text {
  transition: transform 0.3s, color 0.3s;
}
.bomb-timer-hud.timer-pulse .bomb-timer-text {
  animation: timer-scale-pulse 0.4s ease-out;
}
@keyframes timer-scale-pulse {
  0% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ===== BOMB DASHBOARD ===== */
/* ===== BOMB DEFUSAL ===== */
.bomb-dashboard {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 6;
  background: radial-gradient(ellipse at 50% 60%, #3A3058 0%, #1A1830 100%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}
.bomb-dashboard.active { display: flex; }

/* ── Question screen (top) ── */
.bomb-dashboard > .bomb-screen {
  width: 92%;
  max-width: 520px;
  background: linear-gradient(180deg, #1A2A1A 0%, #142014 100%);
  border: 2px solid #2A4A2A;
  border-radius: 10px;
  padding: 16px 14px;
  text-align: center;
  box-shadow: inset 0 0 15px rgba(0, 60, 0, 0.12), 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.bomb-prompt {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #99cc99;
  line-height: 1.5;
  text-shadow: 0 0 4px rgba(100, 200, 100, 0.2);
}
.bomb-irish {
  font-family: 'Nunito', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #ddf0dd;
  line-height: 1.5;
  text-shadow: 0 0 6px rgba(150, 255, 150, 0.2);
}
.bomb-blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 2px dashed #99cc99;
  color: #ffcc44;
  font-weight: 800;
  padding: 0 4px;
  transition: color 0.3s, border-color 0.3s;
}
.bomb-blank.filled {
  border-bottom-color: transparent;
  color: #66dd88;
}

/* Screen flash overlays */
.bomb-screen.flash-red { animation: bomb-screen-red 0.3s ease-out; }
.bomb-screen.flash-green { animation: bomb-screen-green 0.3s ease-out; }
@keyframes bomb-screen-red {
  0% { background: rgba(231, 76, 60, 0.35); }
  100% { background: linear-gradient(180deg, #1A2A1A 0%, #142014 100%); }
}
@keyframes bomb-screen-green {
  0% { background: rgba(46, 204, 113, 0.3); }
  100% { background: linear-gradient(180deg, #1A2A1A 0%, #142014 100%); }
}

/* ── Bomb case (TNT + panel + wires) ── */
.bomb-case {
  position: relative;
  width: 92%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* ── TNT sticks bundle ── */
.bomb-tnt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;
}
.tnt-bundle {
  display: flex;
  gap: 3px;
  padding: 8px 4px;
}
.tnt-stick {
  width: 52px;
  height: 120px;
  background: linear-gradient(90deg, #d43a2a 0%, #e8564a 30%, #e8564a 50%, #d43a2a 80%, #a82820 100%);
  border-radius: 6px;
  position: relative;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.4);
}
/* Paper label on each stick */
.tnt-stick span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 900;
  color: #1a0a08;
  background: #e8d8b0;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
/* Wrap-around tape */
.tnt-tape {
  position: absolute;
  left: -4px;
  right: -4px;
  height: 14px;
  background: linear-gradient(180deg, #666 0%, #555 40%, #444 100%);
  border-radius: 2px;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.tnt-tape::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 6px, rgba(0,0,0,0.15) 6px, rgba(0,0,0,0.15) 7px);
}
.tnt-tape-1 { top: 24px; }
.tnt-tape-2 { bottom: 24px; }

/* Detonator cap on top */
.tnt-detonator {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 20px;
  background: linear-gradient(180deg, #888 0%, #666 100%);
  border-radius: 4px 4px 2px 2px;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.tnt-detonator::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: #ff4444;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.8);
  animation: detonator-blink 1.2s infinite;
}
@keyframes detonator-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(255, 68, 68, 0.8); }
  50% { opacity: 0.3; box-shadow: 0 0 3px rgba(255, 68, 68, 0.3); }
}

/* ── Control panel strapped to bomb ── */
.bomb-panel {
  background: linear-gradient(180deg, #383050 0%, #2A2540 100%);
  border: 2px solid #4A4560;
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: -4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  z-index: 2;
  align-self: center;
  width: 80%;
}

/* Timer display */
.bomb-timer-display {
  background: #151520;
  border: 2px solid #3A3550;
  border-radius: 8px;
  padding: 6px 18px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}
#bomb-time {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: #ff6644;
  letter-spacing: 4px;
  text-shadow: 0 0 8px rgba(255, 100, 68, 0.4);
}
.bomb-timer-display.pulse-mild #bomb-time { animation: bomb-timer-mild 1s infinite; }
.bomb-timer-display.pulse-critical {
  border-color: #ff3333;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6), 0 0 16px rgba(255, 34, 34, 0.3);
}
.bomb-timer-display.pulse-critical #bomb-time {
  color: #ff3333;
  font-size: 2.4rem;
  animation: bomb-timer-critical 0.4s infinite;
}
@keyframes bomb-timer-mild {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
@keyframes bomb-timer-critical {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(255, 34, 34, 0.6); }
  50% { opacity: 0.85; text-shadow: 0 0 25px rgba(255, 34, 34, 1); }
}

/* Strike indicators */
.bomb-strikes {
  display: flex;
  gap: 10px;
}
.strike-light {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #353040;
  border: 2px solid #4A4560;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
  transition: background 0.3s, box-shadow 0.3s;
}
.strike-light.lit {
  background: #e74c3c;
  border-color: #ff5555;
  box-shadow: 0 0 12px rgba(231, 76, 60, 0.8), inset 0 1px 3px rgba(255,255,255,0.2);
}

/* ── Wires from bomb ── */
.bomb-wires {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 4px 0 0 0;
  position: relative;
}
.bomb-wire {
  display: flex;
  align-items: center;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Cpath d='M8.12 8.12L12 12'/%3E%3Cpath d='M20 4L8.12 15.88'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M14.8 14.8L20 20'/%3E%3C/svg%3E") 14 14, crosshair;
  transition: transform 0.15s;
  position: relative;
  padding: 5px 0;
}

/* Vertical stem going up from each wire behind the panel */
.bomb-wire::before {
  content: '';
  position: absolute;
  width: 10px;
  border-radius: 5px 5px 0 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  z-index: 0;
  bottom: 50%;
}
/* Wire 1 (red) — top wire, shortest stem */
.bomb-wire:nth-child(1) { padding-left: 50%; }
.bomb-wire:nth-child(1)::before {
  left: calc(50% - 5px);
  height: 35px;
  background: linear-gradient(180deg, #c0392b 0%, #e74c3c 100%);
}
/* Wire 2 (blue) — middle wire, medium stem */
.bomb-wire:nth-child(2) { padding-left: 44%; }
.bomb-wire:nth-child(2)::before {
  left: calc(44% - 5px);
  height: 65px;
  background: linear-gradient(180deg, #2980b9 0%, #3498db 100%);
}
/* Wire 3 (yellow) — bottom wire, longest stem */
.bomb-wire:nth-child(3) { padding-left: 38%; }
.bomb-wire:nth-child(3)::before {
  left: calc(38% - 5px);
  height: 100px;
  background: linear-gradient(180deg, #a5860b 0%, #f1c40f 100%);
}
.bomb-wire.cut::before { opacity: 0.15; transition: opacity 0.4s; }
.bomb-wire:hover:not(.cut):not(.safe) {
  transform: scale(1.02);
}
.bomb-wire:hover:not(.cut):not(.safe) .wire-segment {
  filter: brightness(1.4);
  box-shadow: 0 0 12px var(--wire-glow);
}

.wire-segment {
  height: 10px;
  border-radius: 5px;
  transition: transform 0.4s ease, opacity 0.4s ease, filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  flex: 1;
}

/* Wire colours — thick rubber-coated wires */
.bomb-wire:nth-child(1) .wire-segment {
  background: linear-gradient(180deg, #e74c3c 0%, #b52a1c 40%, #8f2018 100%);
  --wire-glow: rgba(231, 76, 60, 0.5);
}
.bomb-wire:nth-child(2) .wire-segment {
  background: linear-gradient(180deg, #3498db 0%, #2176ad 40%, #185a85 100%);
  --wire-glow: rgba(52, 152, 219, 0.5);
}
.bomb-wire:nth-child(3) .wire-segment {
  background: linear-gradient(180deg, #f1c40f 0%, #c9a30d 40%, #a5860b 100%);
  --wire-glow: rgba(241, 196, 15, 0.5);
}

/* Wire word labels (at the end of each wire) */
.wire-word {
  font-family: 'Nunito', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #eee;
  padding: 6px 16px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  min-width: 90px;
  text-align: left;
  flex-shrink: 0;
}

/* ── Wire states ── */

/* Cut — wire retracts, word struck through */
.bomb-wire.cut .wire-segment {
  transform: scaleX(0.3);
  transform-origin: left;
  opacity: 0.2;
}
.bomb-wire.cut .wire-word {
  color: #666;
  text-decoration: line-through;
  opacity: 0.4;
}
.bomb-wire.cut {
  cursor: default;
  pointer-events: none;
}
/* Snip sparks */
.bomb-wire.cut::after {
  content: '✂ ✦';
  position: absolute;
  left: 30%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  color: #ffa;
  animation: wire-snip 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes wire-snip {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.5); }
}

/* Safe — last wire glows green */
.bomb-wire.safe .wire-segment {
  background: linear-gradient(180deg, #2ecc71 0%, #1fa85c 40%, #188a4a 100%) !important;
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.6), 0 0 40px rgba(46, 204, 113, 0.2);
}
.bomb-wire.safe .wire-word {
  color: #44ff88;
  text-shadow: 0 0 10px rgba(68, 255, 136, 0.5);
}
.bomb-wire.safe {
  cursor: default;
  pointer-events: none;
  animation: wire-safe-pulse 0.6s ease-out;
}
@keyframes wire-safe-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Danger — correct wire was cut, flashes red */
.bomb-wire.danger .wire-segment {
  background: #ff0000 !important;
  animation: wire-danger-flash 0.15s ease infinite;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}
@keyframes wire-danger-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Progress ── */
.bomb-progress {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #777;
  letter-spacing: 1px;
}

/* ── Shake animation ── */
.bomb-case.shake { animation: bomb-case-shake 0.4s ease-out; }
@keyframes bomb-case-shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px) rotate(-0.5deg); }
  20% { transform: translateX(8px) rotate(0.5deg); }
  30% { transform: translateX(-6px) rotate(-0.3deg); }
  40% { transform: translateX(6px) rotate(0.3deg); }
  50% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ── Explosion overlay ── */
.bomb-dashboard .explosion-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  pointer-events: none;
  animation: bomb-explode 0.6s ease-out forwards;
}
@keyframes bomb-explode {
  0% { background: radial-gradient(circle at center, rgba(255,100,0,0.9) 0%, rgba(255,0,0,0.6) 40%, transparent 70%); }
  40% { background: radial-gradient(circle at center, rgba(255,200,50,1) 0%, rgba(255,50,0,0.8) 50%, rgba(200,0,0,0.4) 80%); }
  100% { background: radial-gradient(circle at center, rgba(80,0,0,0.9) 0%, rgba(20,0,0,0.95) 100%); }
}

/* ── Bomb responsive ── */
@media (max-width: 480px) {
  .bomb-dashboard { gap: 10px; padding: 12px; }
  .tnt-stick { width: 40px; height: 90px; }
  .tnt-stick span { font-size: 0.7rem; }
  .bomb-panel { padding: 8px 12px; gap: 10px; }
  #bomb-time { font-size: 1.6rem; letter-spacing: 2px; }
  .bomb-prompt { font-size: 0.95rem; }
  .bomb-irish { font-size: 1.05rem; }
  .wire-word { font-size: 0.95rem; padding: 4px 10px; }
}

/* ===== WORD CONNECTIONS ===== */
.connections-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 6;
  background: linear-gradient(180deg, #2A2840 0%, #1A1828 100%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.connections-overlay.active {
  display: flex;
}

.connections-board {
  width: 92%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.connections-found {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connections-found-group {
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  animation: conn-reveal 0.5s ease-out;
}
.connections-found-group .conn-category {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #1a1a2e;
}
.connections-found-group .conn-words {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2a2a3e;
  margin-top: 2px;
}

@keyframes conn-reveal {
  0% { transform: scaleY(0); opacity: 0; }
  60% { transform: scaleY(1.05); }
  100% { transform: scaleY(1); opacity: 1; }
}

.connections-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.conn-tile {
  background: linear-gradient(135deg, #40405A 0%, #303048 100%);
  border: 2px solid #555570;
  border-radius: 10px;
  padding: 14px 6px;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e0e0f0;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
  line-height: 1.2;
}
.conn-tile:hover {
  background: linear-gradient(135deg, #505070 0%, #404058 100%);
  border-color: #7070A0;
  transform: translateY(-1px);
}
.conn-tile.selected {
  background: linear-gradient(135deg, #585878 0%, #484868 100%);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(240, 200, 80, 0.3);
  transform: scale(1.03);
  color: var(--gold-bright);
}
.conn-tile.wrong-shake {
  animation: conn-shake 0.4s ease;
}
.conn-tile.matched {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
  pointer-events: none;
}

@keyframes conn-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.connections-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.connections-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 28px;
  border-radius: 24px;
  border: 2px solid #555570;
  background: linear-gradient(135deg, #40405A 0%, #303048 100%);
  color: #e0e0f0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.connections-btn:hover:not(:disabled) {
  border-color: #8080A0;
  transform: translateY(-1px);
}
.connections-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.connections-btn-submit {
  background: linear-gradient(135deg, var(--gold) 0%, #d4a843 100%);
  color: #1a1a2e;
  border-color: var(--gold-bright);
}
.connections-btn-submit:hover:not(:disabled) {
  border-color: #fff;
  box-shadow: 0 0 12px rgba(240, 200, 80, 0.3);
}

.connections-mistakes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: #8888A0;
}
.conn-mistake-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #505068;
  transition: background 0.3s ease;
}
.conn-mistake-dot.used {
  background: var(--red);
}

.connections-one-away {
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold-bright);
  animation: conn-one-away 1.5s ease forwards;
}
@keyframes conn-one-away {
  0% { opacity: 0; transform: translateY(8px); }
  20% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Connections collapse animation (game over) */
.connections-overlay .collapse-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10;
  pointer-events: none;
  animation: conn-collapse 0.8s ease-in forwards;
}
@keyframes conn-collapse {
  0% { background: transparent; }
  30% { background: rgba(80, 50, 100, 0.15); }
  100% { background: rgba(80, 50, 100, 0.85); }
}

/* Connections responsive */
@media (max-width: 480px) {
  .connections-board { padding: 10px; gap: 8px; }
  .conn-tile { font-size: 0.85rem; padding: 10px 4px; min-height: 44px; }
  .connections-btn { font-size: 0.9rem; padding: 8px 20px; }
}

/* ===== BODY TRACKING ===== */
#bt-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
}
#bt-canvas.active {
  display: block;
}

.bt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  pointer-events: none;
  display: none;
}
.bt-overlay.active {
  display: flex;
}

.bt-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.bt-zone-left {
  left: 0;
  border-right: 2px solid rgba(255,255,255,0.1);
}
.bt-zone-right {
  right: 0;
  border-left: 2px solid rgba(255,255,255,0.1);
}

.bt-zone.active {
  border-color: var(--gold);
  box-shadow: inset 0 0 60px rgba(212, 168, 67, 0.15);
}
.bt-zone.correct {
  border-color: var(--green);
  box-shadow: inset 0 0 80px rgba(46, 204, 113, 0.25);
  animation: bt-pulse-green 0.6s ease-out;
}
.bt-zone.wrong {
  border-color: var(--red);
  box-shadow: inset 0 0 80px rgba(231, 76, 60, 0.25);
  animation: bt-shake 0.5s ease-out;
}

.bt-word {
  font-family: 'Baloo 2', cursive;
  font-size: 2.8rem;
  color: #fff;
  text-shadow: 0 3px 10px rgba(0,0,0,0.5);
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

.bt-timer {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}
.bt-timer::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 4px solid var(--gold);
  clip-path: conic-gradient(from 0deg, transparent 0%, transparent var(--bt-progress, 0%), black var(--bt-progress, 0%), black 100%);
  -webkit-clip-path: none;
  border-color: transparent;
  background: conic-gradient(var(--gold) 0%, var(--gold) var(--bt-progress, 0%), transparent var(--bt-progress, 0%), transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), black calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), black calc(100% - 4px));
}

.bt-mode-toggle {
  position: absolute;
  top: 80px;
  right: 16px;
  display: flex;
  gap: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.25);
  pointer-events: auto;
  z-index: 15;
}
.bt-mode-btn {
  background: rgba(0,0,0,0.35);
  color: #ddd;
  border: none;
  padding: 8px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.bt-mode-btn.active {
  background: var(--gold);
  color: var(--text-dark);
}
.bt-mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.2);
}

.bt-permission {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(0,0,0,0.7);
}
.bt-permission.active {
  display: flex;
}
.bt-permission-box {
  background: linear-gradient(180deg, #2A1840 0%, #3A2050 100%);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
}
.bt-permission-box h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.8rem;
  color: var(--gold-bright);
  margin-bottom: 8px;
}
.bt-permission-box p {
  opacity: 0.7;
  margin-bottom: 12px;
}
.bt-https-note {
  font-size: 0.8rem;
  opacity: 0.5 !important;
}
.bt-permission-box .btn {
  margin: 8px 6px 0;
}

@keyframes bt-pulse-green {
  0% { box-shadow: inset 0 0 80px rgba(46, 204, 113, 0.5); }
  100% { box-shadow: inset 0 0 80px rgba(46, 204, 113, 0.15); }
}

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

@keyframes bt-fall {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .game-title { font-size: 2.6rem; }
  .sentence { font-size: 1.35rem; }
  .hud { padding: 10px 8px; }
  .feedback-text { font-size: 2.4rem; }
}

@media (max-width: 480px) {
  .customize-body { flex-direction: column; gap: 14px; }
  .customize-preview { height: auto; width: auto; padding: 10px 0; }
  .customize-panel { padding: 14px; }
  #screen-start { padding: 14px; }
  .castle-header { margin-top: 30px; margin-bottom: 25px; }
  .game-title { font-size: 2rem; }
  .game-subtitle { font-size: 1rem; }
  .sentence { font-size: 1.15rem; }
  .hint { font-size: 0.85rem; }
  .hud-hearts { font-size: 1.3rem; gap: 3px; }
  .hud-level { font-size: 1rem; }
  .progress-bar { width: 60px; }
  .feedback-text { font-size: 2rem; }
  .reward-title { font-size: 2.2rem; margin-top: 50px; }
  .stars .star { font-size: 2.6rem; }
  .reward-buttons, .gameover-buttons {
    flex-direction: column;
    align-items: center;
  }
  .btn { font-size: 1.05rem; padding: 12px 28px; }
  .level-btn { padding: 12px 14px; font-size: 0.95rem; }
  .category-card, .gametype-card { padding: 16px; gap: 12px; }
  .card-icon { font-size: 1.8rem !important; }
  .card-title { font-size: 1.15rem; }
  .dpad { width: 110px; height: 110px; bottom: 16px; left: 16px; }
  .dpad-btn { width: 34px; height: 34px; font-size: 0.8rem; }
  .bt-word { font-size: 2rem; }
  .bt-mode-toggle { top: 70px; right: 8px; }
  .bt-mode-btn { font-size: 0.7rem; padding: 6px 10px; }
}

/* Soft storybook clouds */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(ellipse 120px 60px at 10% 12%, rgba(255,255,255,0.5), transparent),
    radial-gradient(ellipse 160px 50px at 85% 8%, rgba(255,255,255,0.4), transparent),
    radial-gradient(ellipse 100px 45px at 45% 6%, rgba(255,255,255,0.35), transparent),
    radial-gradient(ellipse 140px 55px at 70% 85%, rgba(255,255,255,0.3), transparent),
    radial-gradient(ellipse 110px 50px at 20% 90%, rgba(255,255,255,0.25), transparent);
  pointer-events: none;
  z-index: 0;
}

.screen { position: relative; z-index: 1; }

/* ===== LANDING SCREEN ===== */
#screen-landing {
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.landing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
}

.landing-title {
  font-family: 'Baloo 2', cursive;
  font-size: 4rem;
  font-weight: 800;
  color: var(--peach);
  text-shadow: 0 2px 0 rgba(180, 100, 60, 0.15);
  line-height: 1.1;
}

.landing-subtitle {
  font-family: 'Baloo 2', cursive;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--lavender);
  margin-top: 4px;
}

.landing-desc {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
  margin-top: 24px;
}

.landing-desc-en {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.landing-play {
  margin-top: 36px;
  font-size: 1.5rem;
  padding: 16px 60px;
  border-radius: 16px;
}

.landing-play-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== LANDING MENU (hamburger) ===== */
.landing-menu {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.landing-menu-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--cream);
  border: 2px solid #e8ddd4;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.landing-menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80, 50, 100, 0.12);
}

.menu-bar {
  display: block;
  width: 22px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.2s;
}

.landing-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--cream);
  border: 2px solid #e8ddd4;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(80, 50, 100, 0.14);
  overflow: hidden;
}

.landing-dropdown.open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--lavender-light);
}

.dropdown-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== GAME INFO MODAL ===== */
.game-info-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(61, 50, 80, 0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.game-info-modal.open {
  display: flex;
}

.game-info-box {
  background: linear-gradient(160deg, var(--bg-top) 0%, var(--cream) 40%, var(--bg-bottom) 100%);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(80, 50, 100, 0.2);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 2px solid #e8ddd4;
  flex-shrink: 0;
}

.game-info-header h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.game-info-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.game-info-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.game-info-close:hover {
  color: var(--text);
}

.game-info-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-info-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--cream);
  border: 2px solid #f0e0d0;
  border-left: 5px solid var(--mint);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.game-info-card:nth-child(2) {
  border-left-color: var(--lavender);
}

.game-info-card:nth-child(3) {
  border-left-color: var(--peach);
}

.game-info-card:nth-child(4) {
  border-left-color: #e74c3c;
}

.game-info-card:nth-child(5) {
  border-left-color: #e67e22;
}

.game-info-card:nth-child(6) {
  border-left-color: #34495e;
}

.game-info-card.coming-soon {
  opacity: 0.75;
}

.game-info-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
  padding-top: 2px;
}

.game-info-details {
  flex: 1;
}

.game-info-details h3 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.game-info-details h3 span {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.badge-soon {
  display: inline-block;
  background: var(--lavender);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
}

.game-info-rules,
.game-info-controls {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.game-info-rules strong,
.game-info-controls strong {
  color: var(--text-dark);
}

/* ===== LANDING RESPONSIVE ===== */
@media (max-width: 480px) {
  .landing-title { font-size: 2.6rem; }
  .landing-subtitle { font-size: 1.2rem; }
  .landing-desc { font-size: 0.95rem; margin-top: 18px; }
  .landing-play { font-size: 1.25rem; padding: 14px 44px; }
  .landing-menu { top: 14px; right: 14px; }
  .game-info-body { padding: 12px 16px 20px; }
  .game-info-header { padding: 16px; }
  .game-info-card { flex-direction: column; gap: 8px; padding: 14px; }
  .game-info-icon { width: auto; text-align: left; }
}

/* ===== AUTH SCREEN ===== */
#screen-auth {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-container {
  background: var(--cream);
  border-radius: 20px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 4px 20px var(--card-shadow);
}

.auth-title {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  color: var(--peach);
  text-align: center;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: var(--lavender);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.auth-form h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 16px;
}

.auth-hint {
  font-weight: 400;
  color: #888;
  font-size: 0.85em;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-field input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0d6cc;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--lavender);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-error {
  background: #fce4ec;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: none;
}

.auth-error:not(:empty) {
  display: block;
}

.auth-toggle {
  text-align: center;
  margin-top: 14px;
  font-size: 0.9rem;
  color: #666;
}

.auth-toggle a {
  color: var(--lavender);
  font-weight: 700;
  text-decoration: none;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

/* ===== DASHBOARD SCREEN ===== */
#screen-dashboard {
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #fdf6f0 0%, #f0e8f5 50%, #e8f4ec 100%);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--cream);
  border-bottom: 2px solid #e8ddd4;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.5rem;
  color: var(--peach);
  margin: 0;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-name {
  font-weight: 700;
  color: var(--text);
}

.dashboard-school {
  color: #888;
  font-size: 0.85rem;
}

.dashboard-logout {
  padding: 6px 16px;
  font-size: 0.85rem;
}

.dashboard-body {
  padding: 20px 24px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.dashboard-section {
  margin-bottom: 24px;
}

.dashboard-section-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 10px;
}

.dashboard-section-title .nav-hint {
  font-weight: 400;
  color: #999;
  font-size: 0.75em;
}

/* Stage buttons */
.dashboard-stages {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  background: var(--cream);
  border: 2px solid #e0d6cc;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  min-width: 140px;
}

.stage-btn:hover {
  border-color: var(--lavender);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.stage-btn.active {
  border-color: var(--lavender);
  background: linear-gradient(135deg, #f0e8f5, #e8ddf0);
}

.stage-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.stage-classes {
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
}

/* Theme buttons */
.dashboard-themes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--cream);
  border: 2px solid #e0d6cc;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
}

.theme-btn:hover {
  border-color: var(--mint);
  transform: translateY(-1px);
}

.theme-btn.active {
  border-color: var(--mint);
  background: linear-gradient(135deg, #e8f4ec, #ddf0e8);
}

.theme-icon {
  font-size: 1.1em;
}

.theme-name {
  font-weight: 600;
  color: var(--text);
}

.theme-name-en {
  color: #999;
  font-size: 0.8em;
}

.offline-note {
  color: #888;
  font-style: italic;
  font-size: 0.9rem;
  padding: 8px 0;
}

/* Level groups */
.dashboard-levels {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.level-group {
  background: var(--cream);
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid #e8ddd4;
}

.level-group-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 10px;
}

.level-group-hint {
  font-weight: 400;
  color: #999;
  font-size: 0.8em;
}

.level-group-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid #e0d6cc;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  min-width: 100px;
}

.dashboard-level-btn:hover {
  border-color: var(--peach);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px var(--card-shadow);
}

.dashboard-level-btn .level-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.dashboard-level-btn .level-title-en {
  font-size: 0.75rem;
  color: #999;
}

.no-levels {
  color: #888;
  font-style: italic;
  font-size: 0.9rem;
}

/* Recent sessions */
.dashboard-sessions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--cream);
  border-radius: 8px;
  border: 1px solid #e8ddd4;
  font-size: 0.9rem;
}

.session-time {
  color: #888;
  font-size: 0.8rem;
  min-width: 80px;
}

.session-info {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.session-stars {
  font-size: 0.9rem;
}

.no-sessions {
  color: #888;
  font-style: italic;
  font-size: 0.9rem;
}

/* ===== TEACHER CONTROLS ===== */
.tc-gear {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.25);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tc-gear:hover {
  background: rgba(0, 0, 0, 0.6);
}

.tc-bar {
  position: fixed;
  bottom: 72px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tc-bar.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.tc-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #eee;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.tc-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tc-btn.active {
  background: var(--mint);
  color: var(--text);
  border-color: var(--mint);
}

.tc-btn-exit {
  border-color: rgba(231, 76, 60, 0.35);
}

.tc-btn-exit:hover {
  background: rgba(231, 76, 60, 0.25);
}

.tc-icon {
  font-size: 1.1em;
}

.tc-label {
  font-weight: 600;
}

/* Pause overlay */
.tc-pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.tc-pause-overlay.visible {
  display: flex;
}

.tc-pause-content {
  text-align: center;
  color: #fff;
}

.tc-pause-content h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 3rem;
  color: var(--peach);
  margin-bottom: 8px;
}

.tc-pause-content p {
  color: #ccc;
  margin-bottom: 24px;
}

.tc-resume-btn {
  font-size: 1.1rem;
  padding: 12px 32px;
}

/* Reveal correct wire (bomb mode) */
.bomb-wire.reveal-correct .wire-segment {
  box-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00;
  transition: box-shadow 0.3s;
}

/* Dashboard responsive */
@media (max-width: 600px) {
  .dashboard-header {
    padding: 12px 16px;
  }
  .dashboard-title { font-size: 1.2rem; }
  .dashboard-body { padding: 14px 16px; }
  .stage-btn { min-width: 100px; padding: 10px 14px; }
  .theme-btn { padding: 6px 12px; font-size: 0.85rem; }
  .dashboard-level-btn { min-width: 80px; padding: 8px 12px; }
  .auth-container { padding: 24px 20px; }
}
