/* Game shell + per-engine styles */

.game-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.game-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--amber-light);
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.35);
  flex: 1;
  text-align: center;
}
.pill {
  background: rgba(30, 27, 75, 0.55);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font-size: 0.85rem;
  color: var(--text);
}
.back-btn { cursor: pointer; transition: background 0.15s; }
.back-btn:hover { background: rgba(245, 158, 11, 0.18); }

.level-pill-row { text-align: center; margin-bottom: 0.85rem; }
.level-pill {
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber-light);
  padding: 0.3rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--amber);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.instructions-panel {
  display: flex;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  margin-bottom: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  align-items: flex-start;
}
.instructions-icon { font-size: 1.6rem; flex-shrink: 0; }
.instructions-text { color: var(--text); font-size: 0.95rem; line-height: 1.5; }

.game-parchment { padding: 1.6rem 1.25rem; }

.question-area { min-height: 100px; margin-bottom: 1rem; }

.question-prompt {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: #1e1b4b;
  text-align: center;
  margin-bottom: 0.95rem;
}
.question-quote {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--amber-dark);
  text-align: center;
  font-weight: 700;
  margin: 0.4rem 0 1rem;
  font-style: italic;
}
.question-context {
  text-align: center;
  font-size: 0.95rem;
  color: rgba(30, 27, 75, 0.7);
  margin-bottom: 0.85rem;
}
.question-sentence {
  font-size: 1.15rem;
  text-align: center;
  margin: 0.5rem 0 1.1rem;
  color: #1e1b4b;
  line-height: 1.7;
}
.target-word {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  padding: 0.1rem 0.5rem;
  border-radius: 0.4rem;
  font-weight: 700;
  color: #451a03;
}
.blank, .cloze-blank {
  display: inline-block;
  min-width: 4rem;
  border-bottom: 3px solid var(--amber-dark);
  padding: 0 0.3rem;
  font-weight: 700;
  text-align: center;
  color: var(--amber-dark);
}
.cloze-blank.filled-correct { color: #047857; border-color: #047857; }
.cloze-blank.filled-wrong  { color: #b91c1c; border-color: #b91c1c; }
.pattern-hint {
  background: rgba(245, 158, 11, 0.15);
  border-left: 4px solid var(--amber-dark);
  padding: 0.5rem 0.85rem;
  border-radius: 0.4rem;
  color: #1e1b4b;
  margin: 0.5rem 0 0.85rem;
  font-size: 0.95rem;
}

/* Options grid (choice + cloze) */
.options-grid {
  display: grid;
  gap: 0.65rem;
  margin: 0.5rem 0;
}
.options-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.options-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 540px) {
  .options-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.option-btn {
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #1e1b4b;
  font-weight: 700;
  font-size: 1.05rem;
  border: 2px solid #d97706;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.option-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(217, 119, 6, 0.3); }
.option-btn.flash-correct {
  background: linear-gradient(135deg, #6ee7b7, #10b981);
  color: white;
  border-color: #047857;
  animation: pop-in 0.25s ease;
}
.option-btn.flash-wrong {
  background: linear-gradient(135deg, #fca5a5, #dc2626);
  color: white;
  border-color: #991b1b;
  animation: shake 0.35s ease;
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Typing input */
.typing-area {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  justify-content: center;
}
.typing-input {
  flex: 1; min-width: 220px;
  padding: 0.85rem 1.05rem;
  border-radius: 0.75rem;
  border: 3px solid var(--amber-dark);
  background: rgba(255, 251, 235, 0.85);
  color: #1e1b4b;
  font-family: var(--sans);
  font-size: 1.15rem;
  outline: none;
  text-align: center;
  font-weight: 700;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.typing-input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25); }
.typing-input.flash-correct { background: rgba(16, 185, 129, 0.2); border-color: #047857; }
.typing-input.flash-wrong   { background: rgba(244, 63, 94, 0.15); border-color: #b91c1c; animation: shake 0.35s ease; }
.typing-submit {
  padding: 0.85rem 1.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #1e1b4b;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 5px 15px rgba(217, 119, 6, 0.3);
}
.typing-submit:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(217, 119, 6, 0.4); }
.typing-submit:disabled { opacity: 0.55; cursor: not-allowed; }

/* Feedback area */
.feedback {
  margin-top: 1.1rem;
  padding: 1.05rem 1.2rem;
  border-radius: 0.95rem;
  text-align: center;
  border: 2px solid;
}
.feedback.correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(110, 231, 183, 0.18));
  border-color: #047857;
}
.feedback.wrong {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(252, 165, 165, 0.18));
  border-color: #b91c1c;
}
.feedback-headline {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin-bottom: 0.45rem;
  font-weight: 700;
}
.feedback.correct .feedback-headline { color: #047857; }
.feedback.wrong .feedback-headline  { color: #b91c1c; }
.feedback-message { color: #1e1b4b; font-size: 1rem; margin-bottom: 0.85rem; }
.next-btn {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #1e1b4b;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.progress-line {
  margin-top: 0.85rem;
  text-align: center;
  color: rgba(30, 27, 75, 0.6);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

/* ---- tap engine ---- */
.tap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
  margin: 0.85rem 0;
}
.tap-tile {
  padding: 0.85rem 0.5rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #1e1b4b;
  font-weight: 700;
  font-size: 1.05rem;
  border: 2px solid #d97706;
  transition: transform 0.12s, box-shadow 0.18s;
  cursor: pointer;
}
.tap-tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(217, 119, 6, 0.3); }
.tap-tile.tap-selected {
  background: linear-gradient(135deg, #6ee7b7, #10b981);
  color: white;
  border-color: #047857;
}
.tap-tile.tap-wrong {
  background: linear-gradient(135deg, #fca5a5, #dc2626);
  color: white;
  border-color: #991b1b;
}
.tap-tile.tap-revealed-correct {
  outline: 3px solid #047857;
  outline-offset: -3px;
}
.tap-tile.tap-revealed-wrong {
  background: linear-gradient(135deg, #fca5a5, #dc2626);
  color: white;
  border-color: #991b1b;
}
.tap-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.tap-progress {
  color: rgba(30, 27, 75, 0.7);
  font-size: 0.92rem;
}

/* ---- match engine ---- */
.match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin: 0.85rem 0;
}
.match-grid[data-count="12"] { grid-template-columns: repeat(4, 1fr); }
.match-grid[data-count="8"]  { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) {
  .match-grid { grid-template-columns: repeat(2, 1fr); }
}
.match-card {
  position: relative;
  aspect-ratio: 1;
  min-height: 70px;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #d8b4fe, #a855f7);
  border: 2px solid #6b21a8;
  color: #2e1065;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.18s ease;
  overflow: hidden;
}
.match-card .match-back, .match-card .match-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s ease;
  padding: 0.4rem;
}
.match-card .match-face { opacity: 0; background: #fef3c7; color: #1e1b4b; }
.match-card.match-flipped .match-back { opacity: 0; }
.match-card.match-flipped .match-face { opacity: 1; }
.match-card.match-matched {
  background: linear-gradient(135deg, #6ee7b7, #10b981);
  border-color: #047857;
  cursor: default;
}
.match-card.match-matched .match-face { background: rgba(16, 185, 129, 0.15); color: #064e3b; }
.match-status {
  display: flex; justify-content: space-between;
  font-size: 0.88rem;
  color: rgba(30, 27, 75, 0.7);
  margin-top: 0.5rem;
}
.match-wrong-count { color: rgba(244, 63, 94, 0.85); }

/* ---- builder engine ---- */
.builder-clue {
  text-align: center;
  color: #1e1b4b;
  font-size: 1.05rem;
  margin: 0.5rem 0 0.85rem;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
}
.builder-clue .clue-icon { font-size: 2.4rem; }
.builder-slots {
  display: flex; gap: 0.5rem; justify-content: center;
  margin: 1rem 0 1.2rem;
  flex-wrap: wrap;
  padding: 0.6rem;
  border-radius: 0.6rem;
  background: rgba(217, 119, 6, 0.06);
  border: 2px dashed rgba(217, 119, 6, 0.25);
  transition: all 0.25s;
}
.builder-slot {
  min-width: 3rem; height: 3.6rem;
  padding: 0 0.55rem;
  border: 2px solid var(--amber-dark);
  border-radius: 0.45rem;
  background: rgba(255, 251, 235, 0.5);
  font-family: var(--serif);
  font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  color: #1e1b4b;
  cursor: pointer;
  text-transform: lowercase;
  white-space: nowrap;
}
.builder-slot.filled {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  font-weight: 700;
}
.builder-slots.flash-correct { background: rgba(16, 185, 129, 0.15); border-color: #047857; }
.builder-slots.flash-wrong   { background: rgba(244, 63, 94, 0.12);  border-color: #b91c1c; animation: shake 0.4s ease; }

.builder-tiles {
  display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center;
  margin-bottom: 1rem;
}
.builder-tile {
  min-width: 2.8rem; height: 3.3rem;
  padding: 0 0.55rem;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #d97706;
  color: #1e1b4b;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
  text-transform: lowercase;
  white-space: nowrap;
}
.builder-tile:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(217, 119, 6, 0.3); }
.builder-tile.used { opacity: 0.35; cursor: not-allowed; }
.builder-actions {
  display: flex; gap: 0.5rem; justify-content: center; align-items: center;
}
.builder-clear {
  background: rgba(30, 27, 75, 0.08);
  color: #1e1b4b;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 27, 75, 0.25);
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---- dragdrop engine ---- */
.dd-buckets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  margin: 0.85rem 0;
}
.dd-bucket {
  min-height: 110px;
  border: 2px dashed var(--amber-dark);
  border-radius: 0.85rem;
  padding: 0.6rem 0.55rem;
  background: rgba(245, 158, 11, 0.08);
  transition: background 0.15s, border-color 0.15s;
}
.dd-bucket.dd-over { background: rgba(245, 158, 11, 0.22); border-color: var(--amber); }
.dd-bucket-label {
  font-weight: 700;
  font-family: var(--serif);
  color: var(--amber-dark);
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  text-align: center;
}
.dd-bucket-area {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  min-height: 60px;
}
.dd-tray {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  margin-top: 0.85rem;
  padding: 0.65rem;
  border-radius: 0.7rem;
  background: rgba(30, 27, 75, 0.06);
  border: 2px dashed rgba(30, 27, 75, 0.2);
  min-height: 70px;
}
.dd-tray.dd-over { background: rgba(30, 27, 75, 0.18); }
.dd-item {
  padding: 0.5rem 0.85rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #d97706;
  color: #1e1b4b;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  transition: transform 0.12s, box-shadow 0.15s;
}
.dd-item:active { cursor: grabbing; }
.dd-item.dd-picked {
  background: linear-gradient(135deg, #93c5fd, #3b82f6);
  color: white;
  border-color: #1e40af;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}
.dd-item.flash-correct { background: linear-gradient(135deg, #6ee7b7, #10b981); color: white; border-color: #047857; }
.dd-item.flash-wrong   { background: linear-gradient(135deg, #fca5a5, #dc2626); color: white; border-color: #991b1b; }

/* ---- complete screen ---- */
.complete-screen { padding: 1.25rem 1rem; }
.complete-card { max-width: 560px; margin: 1rem auto; text-align: center; }
.complete-owl  { font-size: 4rem; filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.5)); animation: bob 3s ease-in-out infinite; }
.complete-title {
  font-family: var(--serif);
  color: var(--amber-dark);
  font-size: 1.85rem;
  letter-spacing: 0.05em;
  margin: 0.6rem 0 0.4rem;
}
.score-big {
  font-family: var(--serif);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--amber-dark);
  line-height: 1;
}
.stars-row { font-size: 2rem; margin: 0.5rem 0 1rem; }
.star-filled { color: #f59e0b; text-shadow: 0 0 8px rgba(245, 158, 11, 0.55); }
.star-empty  { color: rgba(0, 0, 0, 0.15); }
.complete-msg { color: rgba(30, 27, 75, 0.85); font-size: 1.05rem; margin-bottom: 1.1rem; line-height: 1.5; }

.level-unlock {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--amber-dark);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.lock-icon { font-size: 1.7rem; }
.lock-headline { font-family: var(--serif); font-weight: 700; color: var(--amber-dark); margin: 0.25rem 0; }
.lock-detail { color: rgba(30, 27, 75, 0.7); font-size: 0.92rem; }

.try-again {
  background: rgba(168, 85, 247, 0.13);
  border: 1px solid #a855f7;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.ta-headline { font-family: var(--serif); color: #6b21a8; font-weight: 700; margin-bottom: 0.4rem; }

.level-replay {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
  margin-top: 0.85rem;
}
.level-replay button {
  background: rgba(30, 27, 75, 0.08);
  color: #1e1b4b;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 27, 75, 0.18);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.12s;
}
.level-replay button:hover { background: rgba(245, 158, 11, 0.18); }

/* ---- spelling test ---- */
.spelling-test-screen { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem; }
.spelling-test-parchment { padding: 1.5rem 1.3rem; }
.st-audio-row { display: flex; gap: 0.55rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.st-audio-btn {
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: rgba(30, 27, 75, 0.08);
  color: #1e1b4b;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid rgba(30, 27, 75, 0.2);
  cursor: pointer;
}
.st-audio-btn.primary {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  color: #1e1b4b;
  border-color: var(--amber-dark);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}
.st-audio-btn:hover { transform: translateY(-1px); }
.st-input-row { margin-bottom: 0.95rem; }
.st-input {
  width: 100%;
  padding: 1rem 1.1rem;
  font-size: 1.3rem;
  text-align: center;
  font-weight: 700;
  border-radius: 0.85rem;
  border: 3px solid var(--amber-dark);
  background: rgba(255, 251, 235, 0.85);
  color: #1e1b4b;
}
.st-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25); }
.st-submit-row { text-align: center; margin-bottom: 0.7rem; }
.st-submit-btn {
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #1e1b4b;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.3);
}
.st-progress-line { text-align: center; color: rgba(30, 27, 75, 0.55); font-size: 0.85rem; }

.spelling-test-results { padding: 1.25rem 1rem; }
.st-results-parchment { max-width: 620px; margin: 0 auto; text-align: center; }
.st-results-owl  { font-size: 3.5rem; animation: bob 3s ease-in-out infinite; }
.st-results-headline {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0.6rem 0 0.3rem;
}
.st-results-headline.passed { color: var(--emerald); }
.st-results-headline.failed { color: var(--amber-dark); }
.st-results-score {
  font-family: var(--serif);
  font-size: 3.5rem;
  font-weight: 700;
}
.st-results-score.passed { color: var(--emerald); }
.st-results-score.failed { color: var(--amber-dark); }
.st-results-pct { font-size: 1.1rem; color: rgba(30, 27, 75, 0.6); margin-bottom: 0.85rem; }
.st-results-message { color: rgba(30, 27, 75, 0.85); font-size: 1.02rem; margin-bottom: 1rem; line-height: 1.5; }
.st-results-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.st-action-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: rgba(30, 27, 75, 0.08);
  color: #1e1b4b;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid rgba(30, 27, 75, 0.18);
  cursor: pointer;
}
.st-action-btn.primary {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  border-color: var(--amber-dark);
}
.st-review-title { font-family: var(--serif); color: var(--amber-dark); font-size: 1.15rem; margin-bottom: 0.55rem; }
.st-review-list { text-align: left; }
.st-review-row {
  display: flex; gap: 0.7rem; align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  margin-bottom: 0.35rem;
}
.st-review-row.correct { background: rgba(16, 185, 129, 0.12); }
.st-review-row.wrong   { background: rgba(244, 63, 94, 0.1); }
.st-review-mark { font-size: 1.25rem; font-weight: 700; width: 1.5rem; text-align: center; flex-shrink: 0; }
.st-review-row.correct .st-review-mark { color: #047857; }
.st-review-row.wrong   .st-review-mark { color: #b91c1c; }
.st-review-correct { font-weight: 700; color: #1e1b4b; }
.st-review-typed   { font-size: 0.85rem; color: rgba(30, 27, 75, 0.6); margin-top: 0.15rem; }

@media (max-width: 600px) {
  .game-title { font-size: 1.05rem; flex: 1 0 100%; order: -1; text-align: center; }
  .game-header { flex-direction: row; justify-content: space-between; }
}
