/* Smart21Brain — games-extra2.css
   Styles for the second wave of games: Sudoku, Code Breaker, Tic-Tac-Toe,
   Word Scramble, and the shared difficulty picker used by Math Speed,
   Money Math, Binary Numbers, Flag Quiz, Periodic Table Quiz, Tanzania
   Regions, and HTML Tag Challenge. Loaded alongside games-extra.css. */

/* ---- Shared difficulty picker ---- */
.difficulty-row { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin: 0 0 1.4rem; }
.difficulty-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: var(--radius-pill);
  color: #fff;
  padding: .5rem 1.2rem;
  font-weight: 700;
  font-size: .85rem;
  transition: all .18s var(--ease);
}
.difficulty-btn:hover { background: rgba(255,255,255,.22); }
.difficulty-btn.is-active { background: var(--s21-secondary); color: #3D2B00; border-color: var(--s21-secondary); }

/* ---- Sudoku ---- */
.sudoku-grid {
  display: grid;
  gap: 2px;
  background: rgba(255,255,255,.35);
  padding: 3px;
  border-radius: 10px;
  margin: 0 auto 1.2rem;
}
.sudoku-cell {
  width: 38px; height: 38px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 3px;
}
.sudoku-cell.is-fixed { background: rgba(255,255,255,.32); color: #fff; }
.sudoku-cell.is-error { background: var(--s21-accent); color: #fff; }
.sudoku-cell.is-hint { background: var(--s21-secondary); color: #3D2B00; }
.sudoku-cell:focus { outline: 2px solid var(--s21-secondary); outline-offset: -2px; }
.sudoku-cell.box-edge-r { border-right: 2px solid rgba(255,255,255,.7); }
.sudoku-cell.box-edge-b { border-bottom: 2px solid rgba(255,255,255,.7); }
@media (max-width: 420px) { .sudoku-cell { width: 30px; height: 30px; font-size: .95rem; } }

.sudoku-pad { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-bottom: .6rem; }
.sudoku-pad button {
  width: 40px; height: 40px; border-radius: 10px; border: none;
  background: rgba(255,255,255,.16); color: #fff; font-weight: 700; font-size: 1rem;
}
.sudoku-pad button:hover { background: rgba(255,255,255,.3); }
.sudoku-pad button.is-erase { background: var(--s21-accent); }

/* ---- Tic-Tac-Toe ---- */
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  grid-template-rows: repeat(3, 76px);
  gap: 6px;
  margin: 0 auto 1rem;
}
.ttt-cell {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
}
.ttt-cell:hover:not(:disabled) { background: rgba(255,255,255,.24); }
.ttt-cell:disabled { opacity: 1; }
.ttt-cell.is-x { color: var(--s21-secondary); }
.ttt-cell.is-o { color: #7BE3C8; }
.ttt-cell.is-win { background: var(--s21-secondary); color: #3D2B00 !important; }
@media (max-width: 420px) { .ttt-grid { grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 64px); } .ttt-cell { font-size: 1.8rem; } }

/* ---- Code Breaker (Mastermind style) ---- */
.cb-history { display: flex; flex-direction: column-reverse; gap: .4rem; max-width: 320px; margin: 0 auto 1rem; max-height: 220px; overflow-y: auto; }
.cb-guess-row { display: flex; align-items: center; gap: .6rem; justify-content: center; background: rgba(255,255,255,.08); border-radius: 10px; padding: .35rem .6rem; }
.cb-pegs { display: flex; gap: .3rem; }
.cb-peg { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); }
.cb-peg.is-empty { background: rgba(255,255,255,.08); }
.cb-feedback { display: grid; grid-template-columns: repeat(2, 8px); gap: 3px; }
.cb-feedback span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.cb-feedback span.black { background: #fff; }
.cb-feedback span.white { background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.7); }
.cb-current { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1rem; }
.cb-slot { width: 40px; height: 40px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.5); }
.cb-palette { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.cb-color-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.cb-color-btn:hover { transform: scale(1.08); }

/* ---- Word Scramble ---- */
.scramble-letters { display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.scramble-letter-btn {
  width: 46px; height: 46px; border-radius: 10px; border: none;
  background: rgba(255,255,255,.16); color: #fff;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 800;
}
.scramble-letter-btn:hover:not(:disabled) { background: rgba(255,255,255,.28); }
.scramble-letter-btn:disabled { opacity: .25; }
.scramble-answer {
  min-height: 3.2rem; display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap;
  border: 2px dashed rgba(255,255,255,.4); border-radius: var(--radius-md);
  padding: .5rem; max-width: 480px; margin: 0 auto 1rem;
}
.scramble-answer .scramble-letter-btn { background: var(--s21-secondary); color: #3D2B00; }
.scramble-clue { font-size: .9rem; opacity: .9; margin-bottom: 1rem; }

/* ---- Generic score/coming-soon roadmap card ---- */
.game-card.is-soon { opacity: .55; cursor: default; pointer-events: none; position: relative; }
.game-card.is-soon .soon-tag {
  position: absolute; top: .5rem; right: .5rem;
  background: rgba(0,0,0,.55); color: #fff; font-size: .62rem; font-weight: 800;
  padding: .18rem .5rem; border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: .04em;
}

/* ---- Connect Four ---- */
.c4-board {
  display: inline-grid;
  grid-template-columns: repeat(7, 44px);
  grid-template-rows: repeat(6, 44px);
  gap: 5px;
  background: rgba(0,0,0,.35);
  padding: 8px;
  border-radius: 14px;
  margin: 0 auto 1rem;
}
.c4-cell {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: none; padding: 0;
}
.c4-cell:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.c4-cell.is-r { background: var(--s21-accent); }
.c4-cell.is-y { background: var(--s21-secondary); }
.c4-cell.is-win { box-shadow: 0 0 0 3px #fff inset; }
@media (max-width: 420px) {
  .c4-board { grid-template-columns: repeat(7, 34px); grid-template-rows: repeat(6, 34px); }
  .c4-cell { width: 34px; height: 34px; }
}

/* ---- Spot the Difference ---- */
.sd-scenes { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.sd-grid { display: grid; gap: 3px; background: rgba(0,0,0,.25); padding: 6px; border-radius: 12px; }
.sd-cell {
  width: 42px; height: 42px; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08); border-radius: 6px; border: none;
}
.sd-grid.is-right .sd-cell { cursor: pointer; }
.sd-grid.is-right .sd-cell:hover { background: rgba(255,255,255,.18); }
.sd-cell.is-found { background: #0B6E4F; }
.sd-cell.is-wrong { background: var(--s21-accent); }
@media (max-width: 480px) { .sd-cell { width: 32px; height: 32px; font-size: 1.1rem; } }

/* ---- Prime Number Hunter ---- */
.prime-grid { display: grid; gap: 6px; justify-content: center; margin: 0 auto 1rem; }
.prime-cell {
  width: 56px; height: 56px; border-radius: 10px; border: none;
  background: rgba(255,255,255,.14); color: #fff;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
}
.prime-cell:hover:not(:disabled) { background: rgba(255,255,255,.26); }
.prime-cell.is-found { background: #0B6E4F; }
.prime-cell.is-wrong { background: var(--s21-accent); }
@media (max-width: 480px) { .prime-cell { width: 44px; height: 44px; font-size: 1rem; } }

/* ---- Chess Puzzle ---- */
.chess-board {
  display: inline-grid;
  grid-template-columns: repeat(8, 46px);
  grid-template-rows: repeat(8, 46px);
  border: 3px solid rgba(255,255,255,.5);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 1rem;
}
.chess-sq { border: none; font-size: 1.7rem; display: flex; align-items: center; justify-content: center; }
.chess-sq.is-light { background: #EDE0C8; }
.chess-sq.is-dark { background: #6B4F3B; }
.chess-sq.is-selected { box-shadow: 0 0 0 3px var(--s21-secondary) inset; }
.chess-sq .is-white-piece { color: #fff; text-shadow: 0 0 2px #000, 0 1px 2px rgba(0,0,0,.6); }
.chess-sq .is-black-piece { color: #111; text-shadow: 0 1px 1px rgba(255,255,255,.5); }
@media (max-width: 420px) {
  .chess-board { grid-template-columns: repeat(8, 36px); grid-template-rows: repeat(8, 36px); }
  .chess-sq { font-size: 1.3rem; }
}

/* ---- Checkers ---- */
.ck-board {
  display: inline-grid;
  grid-template-columns: repeat(8, 46px);
  grid-template-rows: repeat(8, 46px);
  border: 3px solid rgba(255,255,255,.5);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 1rem;
}
.ck-sq { border: none; padding: 4px; }
.ck-sq.is-light { background: #EDE0C8; }
.ck-sq.is-dark { background: #6B4F3B; }
.ck-sq.is-selected { box-shadow: 0 0 0 3px var(--s21-secondary) inset; }
.ck-sq.is-target { box-shadow: 0 0 0 3px rgba(11,110,79,.9) inset; }
.ck-piece { width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.ck-piece.is-human { background: radial-gradient(circle at 35% 30%, #FF7A9C, var(--s21-accent)); box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.ck-piece.is-ai { background: radial-gradient(circle at 35% 30%, #2b2b2b, #050505); box-shadow: 0 2px 3px rgba(0,0,0,.5); }
.ck-piece.is-king { color: var(--s21-secondary); }
@media (max-width: 420px) {
  .ck-board { grid-template-columns: repeat(8, 36px); grid-template-rows: repeat(8, 36px); }
}

/* ---- Crossword ---- */
.cw-grid { display: grid; gap: 2px; background: rgba(255,255,255,.3); padding: 2px; border-radius: 6px; margin: 0 auto 1.2rem; }
.cw-cell { position: relative; width: 38px; height: 38px; }
.cw-cell.cw-blocked { background: rgba(0,0,0,.55); border-radius: 3px; }
.cw-cell input {
  width: 100%; height: 100%; text-align: center; text-transform: uppercase;
  border: none; border-radius: 2px; background: rgba(255,255,255,.9); color: #111;
  font-weight: 800; font-size: 1rem; padding: 0;
}
.cw-cell input.is-active-word { background: #FFE8A3; }
.cw-cell input:focus { outline: 2px solid var(--s21-secondary-dark); }
.cw-num { position: absolute; top: 1px; left: 2px; font-size: .55rem; font-weight: 700; color: #333; z-index: 1; pointer-events: none; }
@media (max-width: 420px) { .cw-cell { width: 30px; height: 30px; } }
.cw-clues { text-align: left; max-width: 480px; margin: 0 auto; }
.cw-clues h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.8); margin: .8rem 0 .3rem; }
.cw-clues ul { list-style: none; padding: 0; margin: 0; }
.clue-item { font-size: .85rem; color: rgba(255,255,255,.9); padding: .3rem .5rem; border-radius: 6px; cursor: pointer; }
.clue-item:hover { background: rgba(255,255,255,.1); }
.clue-item.is-active { background: rgba(255,209,102,.25); color: #fff; font-weight: 700; }

/* ---- Keyboard Speed Test ---- */
#kb-target {
  font-family: 'Courier New', monospace; font-size: 1.15rem; line-height: 1.8;
  background: rgba(0,0,0,.25); border-radius: 12px; padding: 1rem 1.2rem;
  max-width: 560px; margin: 0 auto 1rem; text-align: left;
}
#kb-target span.is-correct { color: #7BE3C8; }
#kb-target span.is-wrong { color: var(--s21-accent); text-decoration: underline; }
#kb-target span.is-current { background: var(--s21-secondary); color: #3D2B00; border-radius: 2px; }
#kb-input {
  width: 100%; max-width: 560px; font-family: 'Courier New', monospace; font-size: 1.05rem;
  padding: .7rem 1rem; border-radius: 10px; border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.1); color: #fff;
}
#kb-input:focus { outline: none; border-color: var(--s21-secondary); }

/* ---- Story Builder ---- */
.story-bank { display: flex; flex-direction: column; gap: .5rem; max-width: 560px; margin: 0 auto 1rem; }
.story-sentence-btn {
  text-align: left; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; color: #fff; padding: .6rem .9rem; font-size: .88rem; line-height: 1.4;
}
.story-sentence-btn:hover:not(:disabled) { background: rgba(255,255,255,.24); }
.story-sentence-btn:disabled { opacity: .25; }
.story-answer { max-width: 560px; margin: 0 auto 1rem; text-align: left; min-height: 3rem; }
.story-answer-line { background: rgba(11,110,79,.25); border-radius: 8px; padding: .5rem .8rem; margin-bottom: .4rem; font-size: .86rem; color: #fff; }
.story-num { font-weight: 800; color: var(--s21-secondary); margin-right: .3rem; }

/* ---- Time & Clock Challenge / Pronunciation Challenge ---- */
#clock-svg { width: 220px; height: 220px; margin: 0 auto 1.2rem; display: block; }
#pron-replay-btn { margin-bottom: 1rem; }
#pron-no-speech { font-size: .8rem; color: rgba(255,255,255,.75); }
