 :root {
    --font-size: 18px;
    --primary: #e8552c;
    --primary-hover: #c8431f;
    --primary-light: #fff1ec;
    --primary-mid: #ffd6b0;
    --text-dark: #111827;
    --text-light: #6b7280;
    --bg-app: #f5f5f5;
    --bg-card: #ffffff;
    --success-bg: #e8f7ef;
    --success-text: #2d9a5f;
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --radius: 8px;
}

body {
    font-family: 'Nunito', sans-serif;
    padding: 2em 1.5em;
    background-color: var(--bg-app);
    color: var(--text-dark);
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 600;
}

/* Subtle noise texture overlay — matches index.html */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.025;
    pointer-events: none;
    z-index: 0;
}

/* Keep main content above the noise overlay */
.activity {
    position: relative;
    z-index: 1;
}

/* --- Typography & Hierarchy --- */
h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    margin-bottom: 0.2em;
    text-align: center;
}

/* Optional subtitle class for instructions */
.subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 3em;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Containers & Cards --- */
.activity {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5em;
    box-shadow: var(--shadow);
    margin-bottom: 2em;
}

.form-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

/* --- Interactive Elements --- */
button, select, input[type="number"] {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    transition: all 0.18s ease;
    outline: none;
    line-height: 1.3;
}

/* Buttons */
button {
    border: none;
    background-color: var(--primary);
    color: white;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(232,93,4,0.18);
    transform: translateY(0);
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:not(.no-hover):hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(232,93,4,0.28);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(232,93,4,0.2);
}

details summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  box-shadow: 0 3px 8px rgba(232,93,4,0.18);
  transition: all 0.15s ease;
  display: inline-block;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary:active {
    box-shadow: 0 2px 3px rgba(232,93,4,0.2);
    transform: translateY(1px);
}

details {
  width: 100%;
}

details summary {
  width: 55%;
  text-align: center;
}

/* Inputs & Selects */
select, input[type="number"] {
    background-color: #f8fafc;
    border: 2px solid var(--border);
    color: var(--text-dark);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}

select:hover, input[type="number"]:hover {
    border-color: #cbd5e0;
}

select:focus, input[type="number"]:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(232,93,4,0.1);
}
/* --- Utilities & Footer --- */
.hidden { display: none !important; }
.red { color: var(--primary); }
.nohover:hover { background: inherit; color: inherit; cursor: default; box-shadow: none; transform: none;}

footer {
    font-size: 0.9em;
    color: var(--text-light);
    text-align: center;
    margin-top: 4em;
}

  /* Word Search Styles */
  #wordSearchGrid {
    display: grid;
    grid-template-columns: repeat(10, 30px);
    grid-template-rows: repeat(10, 30px);
    gap: 4px;
    justify-content: center;
    margin: 1em 0;
  }
  .ws-cell {
    width: 30px;
    height: 30px;
    background: #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 4px;
    font-size: 18px;
  }
  .ws-cell.selected {
    background: #4f46e5;
    color: white;
  }
  .ws-cell.found {
    background: #a2d5a2;
    color: black;
    cursor: default;
  }

  /* Word Jumble */
  #wordJumbleLetters button {
    margin: 5px;
    padding: 10px 15px;
    font-size: 1.2em;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    user-select: none;
  }
  #wordJumbleLetters button:disabled {
    background: #ccc;
    cursor: default;
  }
  #wordJumbleAnswer {
    font-size: 1.5em;
    min-height: 1.5em;
    margin: 10px 0;
  }
  #wordJumbleFeedback {
    margin-top: 1em;
    font-weight: bold;
  }

/* === Racing Game: Neon Arcade === */

#racingTrack {
  position: relative;
  width: 100%;
  height: 150px;
  background-color: #1a1b26; /* Dark background */
  
  /* Creates glowing horizontal lane lines */
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 39px,
    rgba(255, 255, 255, 0.1) 39px,
    rgba(255, 255, 255, 0.1) 41px
  );
  
  border: 2px solid var(--primary);
  box-shadow: 0 0 15px rgba(225, 69, 29, 0.2);
  border-radius: 12px;
  margin: 20px 0;
  overflow: hidden;
}

/* Generic car style */
.car {
  position: absolute;
  left: 0;
  width: 70px; /* Slightly longer for sporty look */
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  
  /* Skew to make it look fast */
  transform: skewX(-20deg);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  color: white;
  z-index: 2;
}

/* Engine Trail Effect */
.car::after {
  content: '';
  position: absolute;
  left: -20px;
  top: 5px;
  width: 20px;
  height: 15px;
  /* Fades out behind the car */
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
  opacity: 0.6;
}

/* Player Car */
.car-player {
  background: var(--primary);
  /* Neon Glow */
  box-shadow: 0 0 15px var(--primary);
  top: 15px;
  border-right: 2px solid white; /* Headlight hint */
}

/* AI 1 (Red/Pink Neon) */
.car-ai1 {
  background: #ff0055; 
  box-shadow: 0 0 15px #ff0055;
  top: 55px;
}

/* AI 2 (Cyan/Green Neon) */
.car-ai2 {
  background: #00ff99; 
  box-shadow: 0 0 15px #00ff99;
  top: 95px;
}

#racingPrompt {
  font-weight: 700;
  font-size: 1.5em;
  margin-bottom: 10px;
  color: #000; 
  text-transform: uppercase;
  letter-spacing: 1px;
}

#racingInput {
  font-size: 1.2em;
  padding: 10px 15px;
  width: 300px;
  max-width: 100%;
  background: #111;
  color: #fff;
  border: 2px solid var(--primary);
  border-radius: 6px;
  outline: none;
  transition: box-shadow 0.3s ease;
}

#racingInput:focus {
  box-shadow: 0 0 10px var(--primary);
}

#racingFeedback {
  margin-top: 10px;
  font-weight: bold;
  color: var(--primary);
}

  /* Falling Words Catch */
#fallingGameContainer {
  position: relative;
  width: 100%;
  height: 300px;
  background-color: var(--game-bg);
  /* Cyberpunk Grid Background */
  background-image: 
      linear-gradient(rgba(225, 69, 29, 0.1) 1px, transparent 1px),
      linear-gradient(90deg, rgba(225, 69, 29, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  
  border: 2px solid var(--primary);
  box-shadow: 0 0 15px rgba(225, 69, 29, 0.3); /* Outer Glow */
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1em;
}

#fallingPrompt {
  font-size: 1.5em; /* Unchanged size */
  text-align: center;
  margin-bottom: 10px;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 5px var(--primary); /* Neon text effect */
}

#fallingBasket {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 80px;
  height: 30px;
  transform: translateX(-50%);
  
  /* Glowing Tray Look */
  background: linear-gradient(180deg, var(--primary) 0%, #a02e10 100%);
  border-radius: 4px; 
  box-shadow: 
      0 -2px 10px var(--primary), /* Glow upwards */
      inset 0 2px 5px rgba(255, 255, 255, 0.4); /* Inner metallic shine */
  
  border-bottom: 3px solid #7c220b; /* 3D depth */
}

/* The Falling Elements */
.fallingWord {
  position: absolute;
  /* Holographic Tag Style */
  background: rgba(26, 27, 38, 0.9); /* Semi-transparent dark */
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-family: monospace; /* Tech feel */
  box-shadow: 0 0 8px rgba(225, 69, 29, 0.2);
  z-index: 10;
}

/* Pelmanism layout */


#pelmanismGrid {
  display: grid;
  width: 100%;
  padding: 1em;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  box-sizing: border-box; /* ensures padding counts inside width */
}

#pelmanismGrid div {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px; /* more internal space */
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  cursor: pointer;
  box-sizing: border-box; /* ensures border + padding stay inside column */
}



#pelmanismGrid div:active {
  transform: scale(0.97);
}
#pelmanism > button {
  display: inline-block;
  margin-right: 10px;
  width: fit-content;         /* or fit-content */
  align-self: flex-start;  /* overrides the parent stretch */ 
}
#pelmanismStats {
  margin-top: 0.5em;
  font-size: 1rem;
}

#pelmanismFeedback {
  margin-top: 0.75em;
  font-weight: bold;
}

.pelmanismCard {
  background-color: var(--primary);
  color: white;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1em;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease;
}

.pelmanismCard:active {
  transform: scale(0.97);
}
.pelmanismCard.flipped {
  background-color: #ccc;
}
.pelmanismCard.matched {
  background-color: #a2d5a2;
}

#pelmanism2PGrid {
  display: grid;
  width: 100%;
  padding: 1em;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  box-sizing: border-box;
}
.pelmanismCard.matched-p1 {
  background-color: #1f7a8c;
  color: white;
}

.pelmanismCard.matched-p2 {
  background-color: #7a306c;
  color: white;
}

#connect3-board,
#connect3-2player-board {
  display: grid;
  gap: 8px;                     /* slightly smaller gap */
  justify-content: center;
  margin: 20px auto;
  grid-template-columns: repeat(5, 1fr);  /* flexible 5 columns */
  width: min(90vw, 500px);      /* scales on mobile, caps on desktop */
  box-sizing: border-box;
}

#connect3-board .cell,
#connect3-2player-board .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;          /* ensures square cells */
  border-radius: 6px;
  border: 2px solid #ddd;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  font-family: 'Nunito', sans-serif;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  word-wrap: break-word;
  
  /* Font scaling relative to cell width */
  font-size: clamp(0.5rem, 3vw, 0.8rem);
  line-height: 1.1em;
}

/* X / O colors */
#connect3-board .O,
#connect3-2player-board .O {
  background-color: #a2d5a2;
  color: #024;
}

#connect3-board .X,
#connect3-2player-board .X {
  background-color: #e67e7e;
  color: #420000;
}

/* Score Display */
#connect3-scores,
#connect3-2player-scores {
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 15px;
  color: #333;
}
.clearboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 90%;
  margin: 0 auto;
  padding: 8px; /* ← fixes border gap */
  box-sizing: border-box;
}

.clearboard-cell {
  background: #fff;
  border: 2px solid #444;
  padding: 12px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.4s;
  min-height: 48px;        /* ← fixes collapsing height */
  display: flex;           /* ← keeps content centred at any size */
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  word-break: break-word;  /* ← prevents overflow on long words */
}

.clearboard-cell.crumbling {
  opacity: 0.55;
}

/* 2 Player Layout */
.clearboard-2player-wrapper {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.player-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.player-board h3 {
  margin-bottom: 8px;
}

/* Optional subtle visual separation */
#clearboard-grid-p1 {
  border: 3px solid #4CAF50;
}

#clearboard-grid-p2 {
  border: 3px solid #2196F3;
}

/* Ensure good touch behaviour */
.clearboard-cell {
  touch-action: manipulation;
}

.dobble-grid {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  grid-gap: 8px;
}
.dobble-cell {
  border: 2px solid #444;
  padding: 12px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  user-select: none;
}
/* L1 grid: a soft warm cream/orange tint */
#dobble-grid-l1 .dobble-cell {
    background-color: #fce8de; /* very light orange/peach, complements #e1451d */
}

/* L2 grid: a cool teal/blue-green for contrast */
#dobble-grid-l2 .dobble-cell {
    background-color: #d0f0f4; /* soft teal, contrasts nicely with orange */
}

.dobble-cell.correct { background: #b5ffb5 !important; }
.dobble-cell.wrong { background: #ffbaba !important; transform: translateX(3px); }
.ticket {
  margin-top: 1rem;
  padding: 1.2rem 1.5rem;
  background: #fff7d6;
  border: 2px dashed #c69f2b;
  border-radius: 12px;
  font-size: 1.4rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  max-width: 260px;
}
.ticket:hover {
  background: #fff0b8;
}

/*MemoryFlip */

#memoryFlipGrid {
  display: grid;
  gap: 8px;
  margin: 15px 0;
}

.memory-tile {
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 10px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  cursor: pointer;
  user-select: none;
  transition: 0.2s;
}

.memory-tile:active {
  transform: scale(0.97);
}

.memory-tile.prompt {
  background: var(--primary);
  cursor: default;
}

.memory-tile.correct {
  background: #a2d5a2;
}

.memory-tile.wrong {
  background: #e57373;
}

.memory-tile.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.memory-tile.face-down {
  background: var(--primary-hover);
  color: transparent;
}

.memory-tile.face-down::after {
  color: white;
  font-size: 1.2rem;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  
  #connect3-board,
#connect3-2player-board {
    max-width: 70vw; /* allow board to shrink with screen */    
    width: 70vw;              /* shrink board to screen */
    grid-template-columns: repeat(5, 1fr);  /* simple, flexible columns */
    gap: 2px;
  }

  #connect3-board .cell,
#connect3-2player-board .cell {
    font-size: clamp(0.5rem, 4vw, 0.9rem);
    color: transparent;       /* hide letters on small screens */
    position: relative;
    box-sizing: border-box;
  }
#bttWordPair {
  touch-action: none;           /* disables default iOS gestures */
  overscroll-behavior: contain; /* prevents parent bounce */
}
  /* show numbers instead */
  #connect3-board .cell::after,
#connect3-2player-board .cell::after {
    content: attr(data-short);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
  }

  #connect3-board .cell.X::after,
#connect3-2player-board .cell.X::after,
  #connect3-board .cell.O::after,
#connect3-2player-board .cell.O::after {
    content: none;            /* keep X/O visible */
    color: inherit;
  }
}
@media (hover: none) and (pointer: coarse) {
  #fallingBasket {
    display: none;
  }
}
@media (max-width: 600px) {
  .grid ul {
    width: 100%;
  }
}
  @media screen and (orientation: portrait) {
  #fallingGameContainer::before {
    content: "Please rotate your device for the best experience!";
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    z-index: 10;
    text-align: center;
    padding: 1em;
  }
  /* Clear the Board game */
  #clearboard-container::before {
    content: "Please rotate your device for the best experience!";
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    z-index: 10;
    text-align: center;
    padding: 1em;
  }
}
  .fallingWord {
    position: absolute;
    background: var(--primary-hover);
    color: #222;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    user-select: none;
    cursor: default;
  }
  #fallingScore {
    margin-top: 10px;
    font-weight: bold;
    font-size: 1.2em;
  }

/* Flappy Bird Vocab Game */
.flappy-answer {
  position: absolute;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  border-radius: 12px;
  padding: 15px 20px;
  font-size: 1.2em;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  z-index: 5;
  min-width: 120px;
  user-select: none;
}

.flappy-answer:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.flappy-answer.correct {
  background: #a2d5a2;
  border-color: #4caf50;
}

.flappy-answer.wrong {
  background: #e67e7e;
  border-color: #f44336;
}



#flappyGameContainer {
  touch-action: none;
}

@media screen and (orientation: portrait) {
  #flappyVocab #flappyGameContainer::before {
    content: "Please rotate your device to landscape mode for the best experience!";
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    z-index: 100;
    text-align: center;
    padding: 1em;
    font-weight: bold;
  }
}

@media screen and (max-width: 768px) {
  #flappyGameContainer {
    height: 220px;        /* Smaller, reliable */
    max-height: 50vh;     /* Absolute safety */
  }

/* Move prompt inside the top of the game area */
#flappyPrompt {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.4em;
  font-weight: bold;
  z-index: 20;
  text-shadow: 1px 1px 2px white;
  pointer-events: none; /* Allows taps to pass through to the game */
}

  #flappyScore {
    font-size: 0.95em;
    margin: 2px 0;
  }

  .flappy-answer {
    font-size: 0.9em;
    padding: 8px 12px;
    min-width: 85px;
  }

  #flappyBird {
    width: 30px;
    height: 30px;
  }
}


  #fallingLives {
    margin-top: 5px;
    color: red;
  }

@media (min-width: 768px) and (max-width: 1024px) {
  .fallingWord {
    font-size: 1.25em; /* ≈ 20 px */
    padding: 8px 14px;
  }
}

.car {
  position: absolute;
  width: 40px;
  height: 40px;
  font-size: 2em;
  transition: left 0.3s ease;
  user-select: none;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(45deg); }
  50% { transform: rotate(90deg); }
  75% { transform: rotate(45deg); }
  100% { transform: rotate(0deg); }
}
#vocabPairList {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 600px;
}

#vocabPairList li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #ddd;
  font-size: 1.1em;
}

@media (max-width: 600px) {
  #vocabPairList li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
.spin {
  animation: spin 1s ease;
}
  .form-group label {
  flex: 1 1 100%;
}

#tapTheRoad {
  text-align: center;
  background: linear-gradient(to bottom, #ccf2ff, #99ddff);
  padding: 20px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  max-width: 600px;
  margin: 0 auto;
}

#tapPrompt {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 20px;
  color: #003366; /* dark blue for strong contrast */
  min-height: 1.5em; /* reserve space to avoid jumping */
  user-select: none;
}

#seaLanes .lane.correct {
  background-color: #b6f2b6; /* light green */
  pointer-events: none;
}
#seaLanes .lane.incorrect {
  background-color: #f2b6b6; /* light red */
  pointer-events: none;
}

.lane {
  width: 140px;           /* wider */
  height: 120px;          /* taller */
  padding: 10px;
  background-color: #e0f7ff;
  border: 3px solid #0099cc;
  border-radius: 15px;
  font-size: 1.4em;       /* bigger font */
  font-weight: bold;
  line-height: 1.2em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;  /* wrap long words */
  user-select: none;
  transition: transform 0.2s ease, background-color 0.3s;
  cursor: pointer;
}

.lane:hover {
  transform: scale(1.05);
  cursor: pointer;
}

.lane.correct {
  background-color: #c1f7c1;
  border-color: #1dbf1d;
}

.lane.incorrect {
  background-color: #f7c1c1;
  border-color: #e91d1d;
}

#shipLane {
  margin-top: 20px;
  font-size: 2.5em;
  transition: transform 0.3s ease;
  min-height: 60px;
}

#tapFeedback {
  font-size: 1.2em;
  height: 30px;
  margin-top: 10px;
  color: #333;
  transition: all 0.3s ease;
}
#toast {
  visibility: hidden;
  min-width: 200px;
  max-width: 80%;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 14px 20px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#toast.show {
  visibility: visible;
  animation: fadein 0.3s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
  from { opacity: 0; bottom: 10px; }
  to   { opacity: 1; bottom: 30px; }
}

@keyframes fadeout {
  from { opacity: 1; bottom: 30px; }
  to   { opacity: 0; bottom: 10px; }
}
  
/* Fullscreen overlay */
#helpOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6); /* dark backdrop */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

/* Help box */
#helpBox {
  background: white;
  color: #333;
  padding: 20px 25px;
  padding-top: 50px; /* bigger top padding */
  border-radius: 10px;
  max-width: 500px;
  width: 80%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  position: relative;
}

/* Close button */
#helpBox .closeHelp {
   z-index: 10;
  position: absolute;
  top: 10px;
  right: 10px;
  background: #eee;
  border: none;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 8px;
}

#helpBox .closeHelp:hover {
  background: #ddd;
}
#helpOverlay.hidden {
  display: none !important;
}
#tagFilter {
  width: 100%;
  max-width: 600px;
  background-color: white;
  color: #222;
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* On focus (when clicked or tabbed) */
#tagFilter:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 6px rgba(225, 69, 29, 0.4);
}

/* Option list items */
#tagFilter option {
  background: white;
  color: #222;
}

/* When hovering over an option */
#tagFilter option:hover {
  background-color: #ffe1d6; /* subtle lava tint */
  color: #000;
}

/* When selected (checked) */
#tagFilter option:checked {
  background-color: var(--primary);
  color: white;
}

#setup {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100vh;
  padding: 20px;
  gap: 15px;
  overflow: hidden;
  z-index: 1; /* keep setup content above the background */
}

#setup::before {
  content: "";
  position: fixed; /* fills the entire viewport */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("logo.png") no-repeat center center;
  background-size: contain; /* or 'contain' if you want to keep the whole logo visible */
  opacity: 0.08; /* adjust for the washed-out effect */
  z-index: -1; /* ensures it sits behind all content */
  pointer-events: none; /* allows interaction with the setup content */
}
#noset {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100vh;
  padding: 20px;
  gap: 15px;
  overflow: hidden;
  z-index: 1; /* keep setup content above the background */
}

#noset::before {
  content: "";
  position: fixed; /* fills the entire viewport */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("logo.png") no-repeat center center;
  background-size: contain; /* or 'contain' if you want to keep the whole logo visible */
  opacity: 0.1; /* adjust for the washed-out effect */
  z-index: -1; /* ensures it sits behind all content */
  pointer-events: none; /* allows interaction with the setup content */

}

/* ── Word Bomb Game ─────────────────────────────────── */

#wordBomb {
  max-width: 640px;
  margin: 0 auto;
}

/* Timer */
#wbTimerDisplay {
  text-align: center;
  margin: 0.6em 0 1em;
}
#wbTimerValue {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s;
  color: #2d9c4e;
  line-height: 1;
}
#wbTimerValue.wb-warn   { color: #d97706; }
#wbTimerValue.wb-danger { color: var(--primary); animation: wbBlink 0.6s step-end infinite; }
@keyframes wbBlink { 50% { opacity: 0.3; } }
#wbTimerLabel {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 3px;
  display: block;
  margin-bottom: 4px;
}

/* Progress bar */
#wbProgressRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.2em;
}
#wbProgressTrack {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
#wbProgressFill {
  height: 100%;
  background: #2d9c4e;
  border-radius: 99px;
  width: 0%;
  transition: width 0.5s ease, background 0.4s;
}
#wbProgressLabel {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* Wire buttons grid */
#wbWiresGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1em;
}
.wb-wire-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  color: var(--text-dark);
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.wb-wire-btn:hover:not(.wb-snipped) {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}
.wb-wire-swatch {
  width: 32px;
  height: 6px;
  border-radius: 99px;
  flex-shrink: 0;
}
.wb-wire-btn.wb-snipped {
  opacity: 0.4;
  cursor: default;
  filter: grayscale(0.5);
  box-shadow: none;
}
.wb-wire-btn.wb-flash {
  animation: wbFlashGreen 0.5s ease forwards;
}
@keyframes wbFlashGreen {
  0%   { background: #d1fae5; border-color: #34d399; }
  100% { background: var(--bg-card); }
}

/* Unscramble screen */
#wbUnscrambleScreen h3 {
  text-align: center;
  font-size: 1.6rem;
  margin: 0.3em 0 1em;
  color: var(--text-dark);
}
#wbWireBadge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid;
  margin-bottom: 1em;
}
#wbWireBadgeDot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
#wbL1Prompt {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 4px;
}
#wbL1Word {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.2em;
  color: var(--text-dark);
}

/* Answer slots */
#wbAnswerRow {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  min-height: 54px;
  align-items: flex-end;
  margin-bottom: 1.2em;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
}
.wb-slot {
  width: 30px;
  height: 36px;
  border-bottom: 2.5px solid #cbd5e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  color: var(--text-dark);
}
.wb-slot.wb-space-slot {
  width: 14px;
  border-bottom-color: transparent;
  cursor: default;
}
.wb-slot.wb-filled {
  border-bottom-color: var(--primary);
}
.wb-slot.wb-filled:hover { border-bottom-color: #c93613; }
.wb-slot.wb-correct { border-bottom-color: #2d9c4e; color: #2d9c4e; }
.wb-slot.wb-wrong   { border-bottom-color: var(--primary); color: var(--primary);
  animation: wbShake 0.35s ease; }
@keyframes wbShake {
  0%,100% { transform:translateX(0); } 20% { transform:translateX(-5px); } 60% { transform:translateX(5px); }
}

/* Letter tiles */
#wbTilesRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 1.2em;
}
.wb-tile {
  width: 40px;
  height: 44px;
  background: var(--bg-card);
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  color: var(--text-dark);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.wb-tile:hover:not(.wb-used) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 5px 10px rgba(225,69,29,0.15);
}
.wb-tile.wb-used {
  opacity: 0.2;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Action row */
.wb-action-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.8em;
}
.wb-btn-secondary {
  background: #f8fafc !important;
  color: var(--text-dark) !important;
  border: 2px solid #e2e8f0 !important;
  box-shadow: none !important;
}
.wb-btn-secondary:hover {
  background: #edf2f7 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.06) !important;
}
.wb-btn-danger {
  background: #fff5f5 !important;
  color: var(--primary) !important;
  border: 2px solid #fed7d7 !important;
  box-shadow: none !important;
}
.wb-btn-danger:hover {
  background: #ffe4e1 !important;
  transform: translateY(-2px) !important;
}

#wbFeedback {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 1.4em;
}

/* Result screen */
#wbResultScreen { text-align: center; }
#wbResultIcon   { font-size: 4rem; margin-bottom: 0.3em; }
#wbResultHeading {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5em;
}
#wbResultDetail {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1em 1.5em;
  margin-bottom: 1.5em;
  font-size: 0.95rem;
  line-height: 2;
  color: var(--text-light);
}

/* Penalty toast */
#wbPenaltyToast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 8px 24px;
  border-radius: 10px;
  pointer-events: none;
  display: none;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(225,69,29,0.35);
}
#wbPenaltyToast.wb-toast-show {
  display: block;
}

/* Launch button in revise list */
#wbLaunchRow {
  margin-top: 12px;
  text-align: center;
}

/* ══════════════════════════════════════════════
   GAME HEADER BAR
   ══════════════════════════════════════════════ */
.game-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2.5em -2.5em 1.8em -2.5em;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.ghb-left {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.ghb-logo {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.ghb-brand {
  font-weight: 900;
  font-size: 1rem;
  color: var(--primary);
  white-space: nowrap;
}

.ghb-title {
  flex: 2;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghb-actions {
  flex: 1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-home {
  background: var(--bg-app) !important;
  color: var(--text-dark) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  font-size: 0.82rem !important;
  padding: 6px 13px !important;
  font-weight: 700 !important;
  font-family: 'Nunito', sans-serif !important;
}

.btn-home:hover {
  background: var(--border) !important;
  transform: translateY(-1px) !important;
  box-shadow: none !important;
}

.btn-help {
  background: var(--bg-app) !important;
  color: var(--text-light) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  font-size: 0.82rem !important;
  padding: 6px 11px !important;
  font-weight: 800 !important;
  font-family: 'Nunito', sans-serif !important;
}

.btn-help:hover {
  background: var(--border) !important;
  transform: translateY(-1px) !important;
  box-shadow: none !important;
}

@media (max-width: 480px) {
  .game-header-bar {
    margin: -2.5em -1.5em 1.5em -1.5em;
    padding: 0 14px;
  }
  .ghb-brand { display: none; }
  .ghb-title { font-size: 0.88rem; }
}

/* ══════════════════════════════════════════════
   CODE BREAKER GAME STYLES
   ══════════════════════════════════════════════ */

/* Phase badge */
.cb-phase-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 6px;
  transition: background 0.4s;
}
.cb-phase-badge.match-phase { background: #2563eb; }

/* Stats pills */
.cb-stats-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cb-stat-pill {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-light);
}
.cb-stat-pill span { color: var(--primary); }

/* Progress bar */
.cb-prog-wrap { max-width: 480px; margin: 0 auto 20px; }
.cb-prog-track { background: var(--border); border-radius: 999px; height: 7px; overflow: hidden; }
.cb-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ff9a3c);
  border-radius: 999px;
  transition: width 0.5s ease;
  width: 0%;
}

/* Cipher key */
.cb-cipher-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.cb-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.cb-cipher-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-cipher-cell {
  display: flex; flex-direction: column; align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  min-width: 38px;
  transition: border-color 0.3s, background 0.3s;
}
.cb-cipher-cell.known { background: #e8f7ef; border-color: #a3d9bc; }
.cb-cipher-sym { font-size: 1rem; line-height: 1.2; color: var(--primary); }
.cb-cipher-arr { font-size: 0.45rem; color: var(--text-light); margin: 1px 0; }
.cb-cipher-let { font-size: 0.7rem; font-weight: 800; color: var(--text-light); transition: color 0.3s; }
.cb-cipher-cell.known .cb-cipher-let { color: #2d9a5f; }

/* Instruction banner */
.cb-instruction {
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  text-align: center;
  transition: all 0.2s;
}
.cb-instruction.blue { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }
.cb-instruction.error { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* Decode layout: word grid + meanings sidebar */
.cb-decode-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}
@media (max-width: 640px) {
  .cb-decode-layout { grid-template-columns: 1fr; }
}

/* Meanings sidebar */
.cb-meanings-sidebar {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  position: sticky;
  top: 16px;
}
.cb-meaning-tag {
  display: inline-block;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  margin: 3px 2px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  transition: all 0.3s;
}
.cb-meaning-tag.used {
  background: #e8f7ef;
  border-color: #a3d9bc;
  color: #2d9a5f;
  text-decoration: line-through;
  opacity: 0.6;
}

/* Word grid */
.cb-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
@media (max-width: 480px) {
  .cb-word-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* Word cards */
.cb-word-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.cb-word-card:hover:not(.cb-solved):not(.cb-selected) {
  border-color: var(--primary-mid);
  background: var(--primary-light);
}
.cb-word-card.cb-selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(232,93,4,0.12);
}
.cb-word-card.cb-solved {
  border-color: #a3d9bc;
  background: #e8f7ef;
  cursor: default;
}
.cb-word-card.cb-shake { animation: cbShake 0.35s ease; }
@keyframes cbShake {
  0%,100% { transform:translateX(0); }
  25%      { transform:translateX(-7px); }
  75%      { transform:translateX(7px); }
}
.cb-word-num {
  position: absolute; top: 7px; right: 9px;
  font-size: 0.62rem; font-weight: 800; color: var(--text-light);
}
.cb-encoded-text {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 3px;
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 4px;
}
.cb-encoded-text .cb-rev { color: #2d9a5f; }
.cb-solved-fr { font-size: 1rem; font-weight: 800; color: #2d9a5f; letter-spacing: 1px; display: none; }
.cb-word-card.cb-solved .cb-encoded-text { display: none; }
.cb-word-card.cb-solved .cb-solved-fr { display: block; }

/* Card input area */
.cb-card-input { display: none; margin-top: 8px; flex-direction: column; gap: 5px; }
.cb-word-card.cb-selected .cb-card-input { display: flex; }
.cb-decode-input {
  width: 100%;
  border: 2px solid var(--primary-mid);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  outline: none;
  background: white;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.cb-decode-input:focus { border-color: var(--primary); }
.cb-decode-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 7px;
  padding: 7px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cb-decode-btn:hover { opacity: 0.88; }

/* Phase 2 match layout */
.cb-match-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 560px) {
  .cb-match-columns { grid-template-columns: 1fr; }
}
.cb-match-col-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.cb-match-item {
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 7px;
  font-size: 0.95rem;
  font-weight: 800;
  background: white;
  cursor: pointer;
  transition: all 0.16s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.cb-match-item:last-child { margin-bottom: 0; }
.cb-match-fr:hover:not(.cb-matched):not(.cb-sel-fr) {
  border-color: var(--primary-mid); background: var(--primary-light);
}
.cb-match-fr.cb-sel-fr {
  border-color: var(--primary); background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(232,93,4,0.12); color: var(--primary);
}
.cb-match-fr.cb-matched { border-color: #a3d9bc; background: #e8f7ef; color: #2d9a5f; cursor: default; opacity: 0.65; }
.cb-match-fr.cb-wrong-flash { animation: cbWrongFlash 0.45s ease; }
@keyframes cbWrongFlash {
  0%,100% { background:white; border-color:var(--border); }
  50%      { background:#fef2f2; border-color:#fca5a5; }
}
.cb-match-en:hover:not(.cb-matched):not(.cb-sel-en) {
  border-color: #bfdbfe; background: #eff6ff;
}
.cb-match-en.cb-sel-en {
  border-color: #2563eb; background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12); color: #2563eb;
}
.cb-match-en.cb-matched { border-color: #a3d9bc; background: #e8f7ef; color: #2d9a5f; cursor: default; opacity: 0.65; }
.cb-match-tick { display: none; }
.cb-matched .cb-match-tick { display: inline; }

/* Victory */
.cb-victory {
  display: none;
  text-align: center;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 28px;
  animation: cbFadeUp 0.5s ease;
}
@keyframes cbFadeUp { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:none} }
.cb-victory.show { display: block; }
.cb-victory h2 { font-size: 1.8rem; font-weight: 900; color: #2d9a5f; margin-bottom: 6px; }
.cb-victory p  { color: var(--text-light); font-weight: 600; margin-bottom: 22px; }
.cb-v-stats { display: flex; justify-content: center; gap: 28px; margin-bottom: 22px; }
.cb-v-val { display: block; font-size: 1.8rem; font-weight: 900; color: var(--primary); }
.cb-v-lbl { font-size: 0.72rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }

/* ── End Code Breaker ── */


/* ── Language Select Screen (noset) ─────────────────── */
.ns-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}
.ns-logo-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.ns-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
}
.ns-accordion {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ns-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ns-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}
.ns-card-header:hover { background: var(--bg-app); }
.ns-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ns-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
}
.ns-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 9px;
  white-space: nowrap;
}
.ns-chevron {
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ns-chevron.open { transform: rotate(180deg); }
.ns-card-body {
  display: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.ns-card-body.open { display: block; }
.ns-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.ns-lang-btn {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  font-family: 'Nunito', sans-serif;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  width: 100%;
  box-shadow: none;
}
button.ns-lang-btn:hover, .ns-lang-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  transform: none;
  box-shadow: 4px 4px 0 var(--primary);
}
button.ns-lang-btn:active, .ns-lang-btn:active { transform: none; box-shadow: 4px 4px 0 var(--primary); }
.ns-lang-flag { font-size: 20px; flex-shrink: 0; }
.ns-lang-info { display: flex; flex-direction: column; min-width: 0; }
.ns-lang-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ns-lang-level {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 1px;
}

/* ── Setup page activity grid ────────────────────────── */
.setup-divider {
  height: 1px;
  background: var(--border);
  width: 100%;
  max-width: 600px;
  margin: 4px 0 20px;
}
.setup-section {
  width: 100%;
  max-width: 600px;
  margin-bottom: 20px;
  text-align: left;
}
.setup-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.setup-section-pip {
  /* Replaced by the section-label left bar (matches index.html). */
  display: none;
}
/* Eyebrow label matching index.html .section-label */
.setup-section-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  line-height: 1.2;
}
.setup-act-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}
.setup-act-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 12px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  font-family: 'Nunito', sans-serif;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  width: 100%;
  box-shadow: none;
}
/* button.* raises specificity to beat the global button:hover rule */
button.setup-act-card:hover, .setup-act-card:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  transform: none;
  box-shadow: 4px 4px 0 var(--primary);
}
button.setup-act-card:active, .setup-act-card:active { transform: none; box-shadow: 4px 4px 0 var(--primary); }
.setup-act-icon { font-size: 20px; margin-bottom: 4px; }
.setup-act-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.25;
}
.setup-act-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.35;
  margin-top: 2px;
}

/* ── Teacher tools layout ──────────────────────────────── */
.tt-page { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 0; }
.tt-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.tt-logo { width: 48px; height: 48px; object-fit: contain; }
.tt-header-text h2 { margin: 0; font-size: 1.3rem; font-weight: 900; color: var(--text-dark); }
.tt-header-text p { margin: 0; font-size: 0.85rem; color: var(--text-light); }
.tt-school { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; padding: 16px; background: var(--bg-app); border: 1px solid var(--border); border-radius: 10px; }
.tt-section-label { font-size: 11px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; }
.tt-section { margin-bottom: 24px; }
.tt-selected-set { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--primary-light); border: 1px solid var(--primary-mid); border-radius: 8px; font-size: 0.88rem; font-weight: 700; color: var(--primary-hover); margin-top: 10px; }
.tt-tag-wrap { border: 1.5px solid var(--border); border-radius: 12px; overflow-y: auto; max-height: 240px; background: var(--bg-card); }
.tt-actions { display: flex; flex-direction: column; gap: 10px; }
.tt-action-btn { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); cursor: pointer; font-family: 'Nunito', sans-serif; font-size: 0.9rem; font-weight: 700; color: var(--text-dark); box-shadow: var(--shadow); transition: border-color 0.15s, background 0.15s, transform 0.1s; text-align: left; width: 100%; min-height: 42px; }
.tt-action-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.tt-action-btn:active { transform: translateY(0); }
.tt-generate-btn { width: 100%; padding: 14px; font-size: 1rem; font-weight: 800; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #ff7a2f); box-shadow: 0 4px 14px rgba(232,93,4,0.30); }
.tt-link-wrap { position: relative; width: 100%; }
.tt-link-wrap input { width: 100%; padding: 10px 48px 10px 14px; box-sizing: border-box; border: 1.5px solid var(--border); border-radius: 10px; font-family: 'Nunito', sans-serif; font-size: 0.9rem; background: var(--bg-app); color: var(--text-dark); }
.tt-link-wrap input:focus { border-color: var(--primary); outline: none; }
.tt-copy-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none !important; border: none !important; box-shadow: none !important; cursor: pointer; font-size: 16px; padding: 4px; min-height: unset !important; }

/* ── Arena ───────────────────────────────────────────── */
#ptbArena {
  position: relative;
  width: 100%;
  height: 400px;
  background: radial-gradient(ellipse at 60% 40%, #dbeafe 0%, #e0f2fe 55%, #f0f9ff 100%);
  border: 2px solid #bae6fd;
  border-radius: 16px;
  overflow: hidden;
  margin: 10px 0;
  touch-action: none;
}

/* ── Prompt bar ──────────────────────────────────────── */
/* Tap to replay; in TTS-fallback mode shows the foreign word */
#ptbPromptBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  min-height: 44px;
}
#ptbPromptBar:hover  { background: var(--primary-mid); }
#ptbPromptBar:active { background: var(--primary-mid); }

#ptbPromptText {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-hover);
}

#ptbSpeakerIcon { font-size: 1.2rem; }
#ptbSpeakerIcon.speaking {
  animation: ptbSpeakerPulse 0.6s ease infinite alternate;
}
@keyframes ptbSpeakerPulse {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(1.25); opacity: 0.65; }
}

/* ── HUD ─────────────────────────────────────────────── */
#ptbHud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ptb-pill {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
}
.ptb-pill b { color: var(--primary); }

/* Countdown bar */
#ptbCountdownWrap {
  flex: 1;
  min-width: 80px;
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
#ptbCountdownBar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: #2d9c4e;
  transition: background 0.4s;
}

/* ── Bubbles ─────────────────────────────────────────── */
.ptb-bubble {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  line-height: 1.25;
  will-change: left, top;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10),
              inset 0 -4px 8px rgba(255,255,255,0.5);
}

/* Glass highlight spot */
.ptb-bubble::before {
  content: '';
  position: absolute;
  top: 14%;
  left: 18%;
  width: 30%;
  height: 18%;
  background: rgba(255,255,255,0.75);
  border-radius: 50%;
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Six colour themes */
.ptb-c0 { background: radial-gradient(circle at 35% 30%, #fff 0%, #bfdbfe 55%, #93c5fd 100%); border: 2px solid #60a5fa80; }
.ptb-c1 { background: radial-gradient(circle at 35% 30%, #fff 0%, #bbf7d0 55%, #86efac 100%); border: 2px solid #4ade8080; }
.ptb-c2 { background: radial-gradient(circle at 35% 30%, #fff 0%, #fde68a 55%, #fcd34d 100%); border: 2px solid #f59e0b80; }
.ptb-c3 { background: radial-gradient(circle at 35% 30%, #fff 0%, #fbcfe8 55%, #f9a8d4 100%); border: 2px solid #ec489980; }
.ptb-c4 { background: radial-gradient(circle at 35% 30%, #fff 0%, #ddd6fe 55%, #c4b5fd 100%); border: 2px solid #8b5cf680; }
.ptb-c5 { background: radial-gradient(circle at 35% 30%, #fff 0%, #fed7aa 55%, #fdba74 100%); border: 2px solid #f9731680; }

/* Pop animation */
@keyframes ptbPop {
  0%   { transform: scale(1);   opacity: 1; }
  45%  { transform: scale(1.4); opacity: 0.7; }
  100% { transform: scale(0);   opacity: 0; }
}
.ptb-bubble.popping {
  animation: ptbPop 0.28s ease-out forwards;
  pointer-events: none;
}

/* Wrong-tap shake */
@keyframes ptbShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-7px); }
  60%     { transform: translateX(7px); }
}
.ptb-bubble.ptb-shaking {
  animation: ptbShake 0.35s ease;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.25) !important;
}

/* ── Floating score / feedback labels ────────────────── */
.ptb-float {
  position: absolute;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  pointer-events: none;
  z-index: 10;
  animation: ptbFloatUp 0.9s ease-out forwards;
}
@keyframes ptbFloatUp {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-52px); }
}

/* ── Quick-streak arena flash ────────────────────────── */
@keyframes ptbArenaFlash {
  0%,100% { box-shadow: inset 0 0 0px 0px rgba(251,191,36,0); }
  50%     { box-shadow: inset 0 0 50px 12px rgba(251,191,36,0.45); }
}
#ptbArena.ptb-streak-flash {
  animation: ptbArenaFlash 0.55s ease;
}

/* ── Voice warning ───────────────────────────────────── */
#ptbVoiceWarning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
  display: none;
}

/* ── Dictation ───────────────────────────────────────── */
#dictationVoiceWarning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
  display: none;
}

.dictation-progress {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 6px;
}

#dictationPromptBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  min-height: 52px;
}
#dictationPromptBar:hover,
#dictationPromptBar:active { background: var(--primary-mid); }

#dictationPromptText {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-hover);
}

#dictationSpeakerIcon { font-size: 1.6rem; }
#dictationSpeakerIcon.speaking {
  animation: ptbSpeakerPulse 0.6s ease infinite alternate;
}

.dictation-replay-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#dictationAccentButtons button {
  margin: 2px;
}

.dictation-fb-good  { color: #15803d; }
.dictation-fb-close { color: #b45309; }
.dictation-fb-bad   { color: #b91c1c; }

.dictation-correct,
.dictation-user-wrong { font-weight: 800; }
.dictation-user-wrong { text-decoration: line-through; opacity: 0.8; }

.dictation-diff {
  color: #b91c1c;
  text-decoration: underline;
  font-weight: 900;
}

/* ── Accent helper panel (typing + dictation) ───────────── */
.accent-area {
  margin-top: 12px;
  margin-bottom: 22px;   /* breathing room before the action button */
}

.accent-toggle {
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-mid);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.accent-toggle:hover { background: var(--primary-mid); }

.accent-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.accent-panel button {
  min-width: 2.4em;
  margin: 0;
}

/* ── Typing direction toggle ────────────────────────────── */
.direction-toggle {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.direction-toggle:hover { background: #e0e7ff; }



