/* Stage A: curriculum games — new engines, review, boss and the island map. Loaded by learn/play/curriculum pages. */
.play-stage { position: relative; }
.fx-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.fx-burst i { position: absolute; bottom: 10px; font-style: normal; font-size: 28px; animation: fx-up 1.6s ease-out forwards; }
@keyframes fx-up { from { transform: translate(0, 0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), -320px) scale(1.2); opacity: 0; } }
.reduce-motion .fx-burst { display: none; }
.eng-choice.gone { opacity: .25; text-decoration: line-through; }
.rk-from { font-size: 13px; font-weight: 700; color: var(--link); margin-bottom: -8px; }

/* ✏️ Fill the Blank */
.fb-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; }
.fb-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.fb-dots i.cur { background: var(--primary); transform: scale(1.25); }
.fb-dots i.ok { background: var(--green); }
.fb-dots i.bad { background: var(--danger); }
.fb-text { line-height: 1.7; text-align: center; }
.fb-gap { display: inline-block; min-width: 90px; padding: 0 10px; border-bottom: 4px dashed var(--primary); color: var(--link); }
.fb-gap.ok { border: 0; border-radius: 10px; background: var(--tint-green); color: var(--green-ink); animation: kg-pop .4s ease; }
.fb-gap.fix { border: 0; border-radius: 10px; background: var(--tint-orange); color: var(--orange-ink); animation: kg-pop .4s ease; }
.fb-options { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.fb-options .eng-chip { font-size: 20px; padding: 14px 22px; }
.eng-chip.right { border-color: var(--green); background: var(--tint-green); }
.eng-chip.wrong { border-color: var(--danger); background: var(--tint-red); animation: kg-shake .4s; }

/* 🧩 Crossword */
.cw-wrap { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.cw-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(28px, 40px)); gap: 3px; justify-content: center; }
.cw-void { aspect-ratio: 1; }
.cw-cell { position: relative; aspect-ratio: 1; background: var(--card); border: 2px solid var(--ink); border-radius: 6px; display: block; }
.cw-cell small { position: absolute; top: 1px; inset-inline-start: 3px; font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1; pointer-events: none; }
.cw-cell input { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font: 800 20px var(--font); color: var(--ink); padding: 0; border-radius: 4px; }
.cw-cell input:focus { outline: 3px solid var(--yellow); background: var(--tint-yellow); }
.cw-cell.act { background: var(--tint-purple); }
.cw-cell.ok { background: var(--tint-green); border-color: var(--green); }
.cw-cell.fix { background: var(--tint-orange); border-color: var(--orange); }
.cw-clues h4 { margin: 0 0 6px; }
.cw-clues ol { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.cw-clues li { padding: 8px 10px; border-radius: 12px; background: var(--bg); cursor: pointer; }
.cw-clues li.act { background: var(--tint-purple); outline: 2px solid var(--primary); }
.cw-clues li b { color: var(--link); margin-inline-end: 6px; }
.cw-clues small { color: var(--muted); }

/* 🌧️ Fact Rain */
.rn-sky { position: relative; height: 340px; border-radius: 24px; background: linear-gradient(180deg, var(--sky-top), var(--tint-blue) 70%, var(--tint-green)); overflow: hidden; margin-bottom: 14px; }
.rn-cloud { position: absolute; top: 4px; inset-inline: 0; text-align: center; font-size: 34px; letter-spacing: 8px; }
.rn-drop { position: absolute; top: 0; inset-inline: 8%; padding: 14px 18px; border-radius: 22px 22px 22px 6px; background: var(--card); box-shadow: 0 8px 20px rgba(10, 19, 48, .12); font: 700 19px var(--font); text-align: center; z-index: 1; }
.rn-drop::before { content: '💧'; position: absolute; top: -16px; inset-inline-start: -8px; font-size: 24px; }
.rn-drop.caught { background: var(--tint-green); outline: 3px solid var(--green); animation: kg-pop .4s ease; }
.rn-drop.splash { background: var(--tint-red); outline: 3px solid var(--danger); animation: kg-shake .4s; }
.rn-ground { position: absolute; bottom: 0; inset-inline: 0; height: 34px; background: #7ccf8e; text-align: center; font-size: 20px; letter-spacing: 10px; }

/* 🏰 Build Your Castle */
.eng-castle, .eng-escape { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: start; }
.cs-side { text-align: center; }
.cs-castle { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px 0; position: relative; }
.cs-castle.shake { animation: kg-shake .4s; }
.cs-flag { font-size: 30px; opacity: 0; transform: translateY(20px); transition: .5s; }
.cs-castle.done .cs-flag { opacity: 1; transform: none; animation: wiggle 1.2s ease-in-out infinite; }
.cs-row { display: flex; gap: 4px; }
.cs-stone { width: 30px; height: 22px; border-radius: 5px; border: 2px dashed var(--edge-purple); display: block; }
.cs-stone.on { border: 0; background: linear-gradient(180deg, #c7b8a3, #9d8b74); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.cs-stone.new { animation: cs-drop .5s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes cs-drop { from { transform: translateY(-80px); opacity: 0; } }
.cs-gate { font-size: 28px; margin-top: -4px; }
.cs-n { font: 700 15px var(--font-display); color: var(--muted); margin-top: 8px; }
.cs-final, .es-final { text-align: center; padding: 20px 0; }
.cs-final .cs-castle { transform: scale(1.4); margin: 20px 0 30px; }

/* 🕵️ Detective */
.dt-board { background: var(--tint-yellow); border: 3px solid var(--edge-yellow); border-radius: 22px; padding: 16px 18px; margin-bottom: 16px; }
.dt-case { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 26px; }
.dt-case span { font: 800 14px var(--font); color: #9a7b2c; text-transform: uppercase; }
.dt-case h2 { margin: 0; width: 100%; font-size: 22px; }
.dt-clues { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.dt-clues li { padding: 10px 14px; border-radius: 14px; background: var(--card); font-weight: 700; }
.dt-clues li.locked { background: transparent; border: 2px dashed #d9c58f; color: #a9955c; font-weight: 600; }
.dt-clues li.new { animation: kg-pop .45s ease; outline: 3px solid var(--yellow); }
.dt-q { font-size: clamp(19px, 3vw, 24px); }

/* 🔐 Escape Room */
.es-door { width: 150px; height: 220px; margin: 0 auto; border-radius: 16px 16px 6px 6px; background: linear-gradient(90deg, #8a5a3c, #a8714d 50%, #8a5a3c); border: 6px solid #5d3a24; position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 12px 0; transition: transform .8s; transform-origin: left center; }
[dir="rtl"] .es-door { transform-origin: right center; }
.es-door.open { transform: perspective(500px) rotateY(-70deg); }
[dir="rtl"] .es-door.open { transform: perspective(500px) rotateY(70deg); }
.es-locks { display: flex; flex-direction: column; gap: 6px; font-size: 24px; }
.es-locks .pop { animation: kg-pop .5s ease; }
.es-knob { font-size: 26px; }
#es-time.low { color: var(--danger-ink); }

/* 👾 Boss battle */
.eng-boss { text-align: center; }
.bs-arena { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.bs-fighter { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; }
.bs-face { font-size: 64px; line-height: 1; }
.bs-fighter.hit .bs-face { animation: kg-shake .45s; filter: drop-shadow(0 0 10px #ff6b9a); }
.bs-bar { width: 130px; height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bs-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--danger), var(--orange)); transition: width .5s; }
.bs-hearts { font-size: 20px; letter-spacing: 2px; }
.bs-vs { font: 800 22px var(--font-display); color: var(--muted); }

/* 🗺️ Adventure map (islands) and review */
.learn-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.adv-map { display: grid; gap: 26px; position: relative; }
.adv-island { position: relative; border-radius: 34px; padding: 18px; background: radial-gradient(120% 90% at 50% 0%, var(--tint-blue), var(--tint-blue) 55%, var(--tint-blue)); border: 3px solid var(--edge-blue); }
.adv-island:nth-child(even) { margin-inline-start: clamp(0px, 6vw, 60px); }
.adv-island:nth-child(odd) { margin-inline-end: clamp(0px, 6vw, 60px); }
.adv-island.locked { filter: grayscale(.85); opacity: .75; }
.adv-island .island-head { flex-wrap: wrap; }
.adv-island .island-head .em { background: var(--card); }
.adv-island + .adv-island::before { content: ''; position: absolute; top: -28px; inset-inline-start: 50%; height: 28px; border-inline-start: 4px dotted #9cc7e0; }
.adv-lock { margin-inline-start: auto; font-weight: 700; color: var(--muted); font-size: 14px; }
.adv-boss { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 16px; border-radius: 20px; background: #2b2f7a; color: #fff; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: start; }
.adv-boss:disabled { background: #8f94b8; cursor: not-allowed; }
.adv-boss .bf { font-size: 36px; }
.adv-boss b { font: 700 18px var(--font-display); display: block; }
.adv-boss small { opacity: .8; }
.track-pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card); color: var(--muted); }
.review-box { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 20px; background: var(--tint-yellow); border: 2px solid var(--edge-yellow); }
.review-box .big { font-size: 30px; }
.review-box div { flex: 1; }

@media (max-width: 640px) {
  .cw-wrap { grid-template-columns: 1fr; }
  .cw-grid { grid-template-columns: repeat(var(--cols), minmax(22px, 34px)); }
  .cw-cell input { font-size: 16px; }
  .eng-castle, .eng-escape { grid-template-columns: 1fr; }
  .cs-side { order: 2; }
  .es-door { width: 120px; height: 150px; flex-direction: row; padding: 0 12px; }
  .es-locks { flex-direction: row; }
  .rn-sky { height: 300px; }
  .bs-face { font-size: 48px; }
}

/* 🧰 Teacher tools (/curriculum) */
.cur-tools { display: grid; gap: 14px; margin-top: 12px; }
.cur-tool { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--bg); }
.cur-tool small { color: var(--muted); }
.cur-tool .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cur-tool select { padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); font: inherit; max-width: 100%; }
a.eng-badge { text-decoration: none; }
a.eng-badge:hover { outline: 2px solid var(--primary); }
.play-preview { text-align: center; font-weight: 700; color: #9a7b2c; background: var(--tint-yellow); border-radius: 12px; padding: 6px 10px; margin-bottom: 10px; }

/* Word Hunt: big grid on top, words as chips underneath, drag to select (overrides app.css) */
.wh-wrap.wh-big { grid-template-columns: 1fr; gap: 16px; }
.wh-big .wh-grid { width: min(100%, 680px); margin: 0 auto; gap: 3px; touch-action: none; user-select: none; -webkit-user-select: none; }
.wh-big .wh-cell { min-width: 0; font-size: min(calc((100vw - 56px) / var(--n) * 0.56), calc(670px / var(--n) * 0.56)); -webkit-tap-highlight-color: transparent; }
.wh-big .wh-cell:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.wh-big .wh-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.wh-big .wh-list li { border-radius: 16px; padding: 6px 14px; text-align: center; }
.wh-big .wh-list li small { display: block; font-size: 12px; }
.wh-big .wh-list li.found b { text-decoration-thickness: 3px; color: var(--green-ink); }
