/* Lecture mode — accessible, kid-friendly */

body.lecture {
  background: linear-gradient(180deg, #7ec8ff 0%, #b9e2ff 50%, #ffe5a8 100%);
  color: #0a1a3a;
  font-family: "Andika", "Verdana", "Lucida Sans Unicode", system-ui, sans-serif;
  letter-spacing: 0.01em;
}

/* Local font (drop the WOFF2 in assets/lecture/fonts/Andika-Regular.woff2 ; fallback to system if absent) */
@font-face {
  font-family: "Andika";
  src: url("./assets/lecture/fonts/Andika-Regular.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

.playfield-lecture {
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 40px rgba(0, 0, 0, 0.15);
}

/* Header / nav */

.btn-back-lecture {
  border-color: #3a7ad6;
  color: #3a7ad6;
  background: rgba(255, 255, 255, 0.8);
}

body.lecture .btn-mute {
  border-color: #3a7ad6;
  color: #3a7ad6;
  background: rgba(255, 255, 255, 0.8);
}

/* Home screen */

.lecture-logo {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.title-lecture {
  margin: 0;
  font-size: clamp(36px, 8vw, 64px);
  font-weight: 900;
  color: #3a7ad6;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.7);
}

.title-lecture-small {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  color: #3a7ad6;
  text-align: center;
}

.btn-lecture {
  background: #ffd24a;
  border: 4px solid #fff;
  border-radius: 32px;
  color: #3a7ad6;
  box-shadow: 0 6px 0 #c79900, 0 12px 24px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.04em;
  font-family: inherit;
  font-weight: 800;
}

.btn-lecture-soft {
  background: #fff;
  color: #3a7ad6;
  box-shadow: 0 6px 0 #b9c5d6, 0 12px 24px rgba(0, 0, 0, 0.15);
}

.btn-secondary-lecture {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: #fff;
  border: 3px solid #3a7ad6;
  border-radius: 24px;
  color: #3a7ad6;
  font-family: inherit;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
}

.audio-warning {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ff8a3a;
  border-radius: 16px;
  color: #c43030;
  font-size: 14px;
}

.audio-warning.hidden { display: none; }

/* HUD during play */

.hud-lecture-top {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
}

.hud-stars {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  padding: 6px 14px;
  min-width: 84px;
  min-height: 36px;
  font-size: 22px;
  font-weight: 800;
  color: #c79900;
  align-items: center;
  justify-content: center;
}

.hud-stars .star { font-size: 24px; line-height: 1; }

.btn-replay-voice {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #3a7ad6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 #2a5aa6, 0 8px 16px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  z-index: 5;
}

.btn-replay-voice:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2a5aa6, 0 4px 8px rgba(0, 0, 0, 0.25);
}

/* Activity host & tiles */

.activity-host {
  position: absolute;
  inset: 80px 16px 100px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  pointer-events: auto;
}

.prompt-text {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  color: #3a7ad6;
  text-align: center;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 16px;
  max-width: 560px;
  width: 100%;
  justify-content: center;
}

.tile {
  min-width: 96px;
  min-height: 96px;
  border: 4px solid #fff;
  border-radius: 24px;
  background: #fff;
  color: #0a1a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
  transition: transform 120ms ease, box-shadow 120ms ease;
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
  font-weight: 800;
  padding: 8px;
}

.tile:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tile-letter {
  font-size: 96px;
  line-height: 1;
  color: #3a7ad6;
}

.tile-syllable {
  font-size: 72px;
  line-height: 1;
  color: #3a7ad6;
}

.tile-word {
  font-size: 36px;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: #3a7ad6;
}

.tile-image {
  min-width: 128px;
  min-height: 128px;
  padding: 12px;
}

.tile-image img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  pointer-events: none;
}

.match-target-image {
  min-width: 192px;
  min-height: 192px;
  padding: 16px;
  cursor: default;
  background: #fff;
}

.match-target-image img {
  width: 160px;
  height: 160px;
}

.tile-image-fallback {
  font-size: 24px;
  color: #3a7ad6;
  font-weight: 700;
}

.tile-fixed-letter {
  background: #3a7ad6;
  color: #fff;
  cursor: default;
}
.tile-fixed-letter:active { transform: none; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); }

.tile-illuminate {
  animation: tile-illuminate 700ms ease;
  border-color: #ffd24a;
  box-shadow: 0 0 32px rgba(255, 210, 74, 0.9), 0 4px 0 #c79900;
}

.tile-success {
  animation: tile-pulse 400ms ease;
  background: #c8f5b0;
  border-color: #6dc12a;
}

.tile-locked {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.tile-locked::after {
  content: "🔒";
  position: absolute;
  font-size: 32px;
}

@keyframes tile-illuminate {
  0%   { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); border-color: #fff; }
  40%  { box-shadow: 0 0 32px rgba(255, 210, 74, 0.95); border-color: #ffd24a; transform: scale(1.05); }
  100% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); border-color: #fff; transform: scale(1); }
}

@keyframes tile-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Reward */

.reward-title {
  margin: 0;
  font-size: clamp(40px, 8vw, 60px);
  font-weight: 900;
  color: #3a7ad6;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.7);
}

.round-stars {
  display: flex;
  gap: 12px;
  font-size: 64px;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.15));
  animation: stars-pop 600ms ease;
}

@keyframes stars-pop {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.end-actions {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Album */

.album-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(640px, 92%);
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
}

.album-section h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #3a7ad6;
  font-weight: 800;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.album-cell {
  position: relative;
  background: #fff;
  border: 3px solid #b9e2ff;
  border-radius: 16px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: #3a7ad6;
}

.album-cell.mastered {
  border-color: #ffd24a;
  box-shadow: 0 0 0 2px #ffd24a inset;
}

.album-cell.mastered::after {
  content: "⭐";
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.album-cell.learning { border-color: #7ec8ff; }
.album-cell.unknown { opacity: 0.35; }

.album-cell.unknown::after {
  content: "🔒";
  font-size: 20px;
  position: absolute;
}

.album-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.album-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #ffd24a;
  border: 3px solid #fff;
  border-radius: 18px;
  font-weight: 800;
  color: #3a2a00;
  box-shadow: 0 3px 0 #c79900;
}

.album-cell-word {
  font-size: 16px;
  padding: 4px;
}

.album-cell-word img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Parent panel */

.parent-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(520px, 92%);
  background: rgba(255, 255, 255, 0.9);
  padding: 18px 22px;
  border-radius: 18px;
  color: #0a1a3a;
  font-size: 16px;
  line-height: 1.5;
}

.parent-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(58, 122, 214, 0.3);
  padding: 4px 0;
}

.parent-row:last-child { border-bottom: none; }

.parent-row .label { color: #3a7ad6; font-weight: 700; }

.parent-row .value { font-variant-numeric: tabular-nums; }

.btn-reset {
  background: #ff8a3a;
  border: 3px solid #fff;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  padding: 10px 18px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 #c44a08;
}

.btn-reset.confirm {
  background: #c43030;
  animation: reset-pulse 800ms infinite alternate;
}

@keyframes reset-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

/* Badge celebration overlay */

.badge-celebration {
  position: absolute;
  inset: 0;
  background: rgba(58, 122, 214, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 9;
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  animation: badge-pop 1500ms ease;
  pointer-events: none;
}

.badge-celebration.hidden { display: none; }

.badge-celebration .badge-icon {
  font-size: 96px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

@keyframes badge-pop {
  0%   { opacity: 0; transform: scale(0.4); }
  20%  { opacity: 1; transform: scale(1.1); }
  85%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

/* Activity-specific helpers */

.compose-host {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.compose-target {
  font-size: clamp(28px, 5vw, 36px);
  color: #3a7ad6;
  font-weight: 700;
  text-align: center;
}

.compose-plus {
  font-size: 48px;
  font-weight: 900;
  color: #ffd24a;
  text-shadow: 0 2px 0 #c79900;
}

.compose-host .tile-grid {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  max-width: 360px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .tile-illuminate, .tile-success, .round-stars, .badge-celebration { animation: none; }
}
