/* Kids Block Lab - Weekly Spelling shared styles. Each launcher sets --acc, --acc-dark, --acc-light. */
:root {
  --ink: #24180f; --cream: #fff6e4; --gold: #f6c445; --grass: #1f6e16; --dirt: #6a431f; --line: #10280c;
  --acc: #1f6e16; --acc-dark: #12380f; --acc-light: #8ed45a; --bad: #ffb347;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", Verdana, sans-serif; font-size: 20px; line-height: 1.35;
  color: var(--ink); background: var(--dirt);
  background-image: linear-gradient(45deg, rgba(0,0,0,.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.06) 75%), linear-gradient(45deg, rgba(0,0,0,.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.06) 75%);
  background-size: 32px 32px; background-position: 0 0, 16px 16px;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
#kbl-app { max-width: 1000px; margin: 0 auto; }
.sky { height: calc(14px + env(safe-area-inset-top)); background: linear-gradient(#6ebef2, #d7f3ff); }
.top {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  padding: 12px 16px 14px; margin-bottom: 20px; background: var(--acc-dark); color: #fff;
  box-shadow: inset 0 8px 0 var(--acc-light), inset 0 -8px 0 rgba(0,0,0,.28);
}
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px;
  background: repeating-linear-gradient(90deg, var(--acc) 0 16px, var(--acc-light) 16px 28px, var(--acc-dark) 28px 40px);
}
/* Back to the Kids Block Lab hub (plain link, outside the game's click handler) */
.hub-link {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 14px;
  font-weight: 800; font-size: 20px; line-height: 1.1; color: #1b1b1b; text-decoration: none; background: #e4e7ea;
  border: 4px solid var(--line); box-shadow: inset 0 4px 0 #fff, inset 0 -4px 0 #b5b9be, 4px 4px 0 #1a140e;
  -webkit-tap-highlight-color: rgba(255,230,80,.45); touch-action: manipulation; white-space: nowrap;
}
.hub-link:active { transform: translate(3px, 3px); box-shadow: inset 0 4px 0 #fff, inset 0 -4px 0 #b5b9be, 1px 1px 0 #1a140e; }
.hub-link:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
@media (max-width: 480px) { .hub-link { flex: 1 1 100%; justify-content: center; } }
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0; }
.mascot { flex: none; image-rendering: pixelated; filter: drop-shadow(3px 3px 0 rgba(0,0,0,.35)); }
h1 { margin: 0; font-size: clamp(26px, 4.4vw, 40px); line-height: 1.1; color: #fff; text-shadow: 3px 3px 0 rgba(0,0,0,.3); }
.tagline { margin: 2px 0 0; font-size: 17px; color: #f3fff8; opacity: .95; }
.starbox { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  margin: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px;
  background: var(--gold); color: var(--ink); border: 3px solid var(--line); box-shadow: 3px 3px 0 var(--line); font-size: 19px; font-weight: 800;
}
.pill strong { font-size: 22px; }
main { padding: 8px 14px calc(24px + env(safe-area-inset-bottom)); }
h2 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 32px); line-height: 1.15; }
h3 { margin: 16px 0 8px; font-size: 22px; }
.panel {
  background: var(--cream); border: 4px solid var(--line);
  box-shadow: inset 4px 4px 0 #fff, inset -4px -4px 0 #e2d2ae, 6px 6px 0 #2a1a10; padding: 16px; margin-bottom: 16px;
}
.help { margin: 0 0 10px; font-size: 20px; font-weight: 700; }
.muted { margin: 4px 0 8px; font-size: 17px; color: #5a4a3a; }
.note { margin: 8px 0; padding: 10px 12px; font-size: 18px; font-weight: 700; background: #e7f6ff; border: 3px solid var(--line); }
.banner { margin: 0 0 12px; padding: 12px; background: #fff3c4; border: 4px solid var(--line); font-size: 19px; font-weight: 800; }
button {
  font-family: inherit; font-weight: 800; font-size: 22px; line-height: 1.2; color: var(--ink); background: var(--cream);
  border: 4px solid var(--line); border-radius: 0; padding: 10px 14px; min-height: 56px; min-width: 56px; cursor: pointer;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.5), inset 0 -4px 0 rgba(0,0,0,.12), 4px 4px 0 #1a140e;
  -webkit-tap-highlight-color: rgba(255,230,80,.45); -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: inset 0 4px 0 rgba(255,255,255,.5), inset 0 -4px 0 rgba(0,0,0,.12), 1px 1px 0 #1a140e; }
button:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-grass { background: var(--grass); color: #fff; box-shadow: inset 0 5px 0 #8ed45a, inset 0 -5px 0 #144c0e, 4px 4px 0 #1a140e; }
.btn-gold { background: var(--gold); box-shadow: inset 0 5px 0 #ffe9a0, inset 0 -5px 0 #d2a12a, 4px 4px 0 #1a140e; }
.btn-dirt { background: #f0c08a; box-shadow: inset 0 5px 0 #ffe0c2, inset 0 -5px 0 #c48a4a, 4px 4px 0 #1a140e; }
.btn-stone { background: #e4e7ea; color: #1b1b1b; box-shadow: inset 0 5px 0 #fff, inset 0 -5px 0 #b5b9be, 4px 4px 0 #1a140e; }
.btn-cream { background: #fff6e4; }
.btn-xl { width: 100%; min-height: 72px; font-size: 26px; }
.btn-fit { min-height: 50px; font-size: 19px; }
.btn-mini { min-height: 44px; min-width: 44px; padding: 4px 8px; font-size: 18px; }
.home-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.home-row > button { flex: 1 1 160px; }
.bar { height: 26px; background: #d9c9a3; border: 4px solid var(--line); margin: 8px 0; overflow: hidden; }
.bar.big { height: 34px; }
.bar span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--acc) 0 18px, var(--acc-light) 18px 24px); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.mastered-line { margin: 0; font-size: 26px; font-weight: 800; }
.mastered-line strong { font-size: 32px; }
.mini { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.btn-play {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 104px; margin: 4px 0 18px;
  font-size: 40px; background: var(--acc); color: #fff; text-shadow: 3px 3px 0 rgba(0,0,0,.3);
  box-shadow: inset 0 7px 0 var(--acc-light), inset 0 -7px 0 var(--acc-dark), 6px 6px 0 #1a140e;
}
.btn-play small { font-size: 20px; text-shadow: none; opacity: .95; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 128px; text-align: center; background: #efe6cf; }
.tile-icon { font-size: 40px; line-height: 1; }
.tile-name { font-size: 21px; }
.tile-extra { font-size: 16px; font-weight: 700; }
.tile.glow { background: var(--gold); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255,230,80,.75), inset 0 4px 0 rgba(255,255,255,.5), 4px 4px 0 #1a140e; } }
.grownup { text-align: center; margin-top: 18px; }
.btn-hold { position: relative; overflow: hidden; font-size: 17px; min-height: 48px; background: #d9cdb4; }
.hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--gold); }
.hold-label { position: relative; }
.btn-hold.holding .hold-fill { width: 100%; transition: width 2s linear; }
.wlist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .wlist { grid-template-columns: 1fr 1fr; } }
.wrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 3px solid var(--line); background: #fff; font-weight: 800; }
.wrow.st-practicing { background: #fff3c4; }
.wrow.st-mastered { background: #dff5d2; }
.wstars { min-width: 4.2em; }
.wword { flex: 1; font-size: 24px; }
.wlabel { font-size: 16px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; text-align: center; border: 4px solid var(--line); background: #e4e0d6; font-weight: 800; opacity: .7; }
.badge.got { background: var(--gold); opacity: 1; }
.badge-icon { font-size: 44px; }
.celebrate, .results { text-align: center; position: relative; overflow: visible; }
.res-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0; }
/* game */
.game-top { flex-wrap: nowrap; }
.btn-x { min-height: 48px; min-width: 48px; padding: 4px 10px; }
.g-title { flex: 1; font-size: clamp(20px, 3.6vw, 30px); font-weight: 800; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-top .pill { min-height: 40px; font-size: 17px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 0 0 12px; }
.dots i { width: 18px; height: 18px; border: 3px solid var(--line); background: #d9c9a3; }
.dots i.done { background: var(--acc-light); }
.dots i.cur { background: var(--gold); }
.timebar { height: 22px; border: 4px solid var(--line); background: #d9c9a3; margin: 0 0 12px; overflow: hidden; }
.timebar span { display: block; height: 100%; background: linear-gradient(90deg, #79c7f5, #b7e4ff); transition: width .25s linear; }
.boss-hp { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 26px; }
.boss-hp .bar { flex: 1; margin: 0; }
.bar.hp span { background: repeating-linear-gradient(90deg, #b04ad6 0 14px, #d98cf0 14px 20px); width: 100%; }
.stage { text-align: center; }
.cue { margin: 0 0 10px; font-size: 22px; font-weight: 800; }
.say-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px 0 12px; }
.btn-say { min-height: 56px; font-size: 20px; }
.typed { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; min-height: 76px; padding: 8px; border: 4px dashed #8a7a5a; background: #fff; }
.ph { font-size: 32px; opacity: .45; }
.caret { width: 4px; height: 44px; background: var(--ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lb { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 52px; padding: 0 4px; font-size: 34px; font-weight: 900; background: #fff6e4; border: 3px solid var(--line); box-shadow: inset 0 -4px 0 #e2d2ae; }
.lb.bad { background: var(--bad); box-shadow: inset 0 -4px 0 #e08a1e; animation: wiggle .5s ease-in-out 2; }
@keyframes wiggle { 25% { transform: translateY(-4px); } 75% { transform: translateY(2px); } }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 70px; }
.sl { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 62px; font-size: 36px; font-weight: 900; border: 4px solid var(--line); background: #fff; }
.sl.given { background: #efe6cf; }
.sl.blank { background: #fff; border-style: dashed; }
.sl.cur { border-style: solid; box-shadow: 0 0 0 4px var(--gold); }
.tile-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 16px 0 6px; }
.ltile { width: 64px; height: 64px; font-size: 34px; background: var(--gold); box-shadow: inset 0 5px 0 #ffe9a0, inset 0 -5px 0 #d2a12a, 4px 4px 0 #1a140e; }
.ltile:disabled { visibility: hidden; }
.options { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .options { grid-template-columns: 1fr 1fr; } }
.opt { min-height: 76px; font-size: 32px; letter-spacing: 1px; position: relative; background: #fff; }
.opt-n { position: absolute; left: 8px; top: 4px; font-size: 14px; opacity: .5; }
.kb { margin: 0 auto; max-width: 820px; padding: 10px 6px; background: rgba(16,40,12,.35); border: 4px solid var(--line); }
.kb-row { display: flex; justify-content: center; gap: 6px; margin: 6px 0; }
.key { flex: 1 1 0; min-width: 0; max-width: 72px; min-height: 58px; padding: 0; font-size: 28px; background: #fff6e4; }
@media (min-width: 560px) { .key { min-width: 48px; min-height: 64px; } }
.key-back { flex: 1.6 1 0; max-width: 120px; background: #f0c08a; }
.key-check { flex: 1; max-width: 520px; min-height: 64px; font-size: 26px; }
.fb { text-align: center; position: relative; overflow: visible; }
.fb.good { background: #eaffdf; }
.fb.oops { background: #fff3dc; }
.fb-word { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 6px 0; }
.fb-word.small .lb { min-width: 30px; height: 40px; font-size: 26px; }
.fb-big { margin: 8px 0; font-size: 28px; font-weight: 900; }
.earn { margin: 4px 0; font-size: 22px; font-weight: 800; }
.you { margin: 8px 0; font-size: 20px; font-weight: 800; }
.hint { margin: 4px 0; font-size: 20px; }
.btn-next { min-width: 200px; min-height: 64px; font-size: 26px; }
.blk { position: absolute; left: 50%; top: 40%; width: 18px; height: 18px; border: 3px solid var(--line); pointer-events: none; animation: pop .95s ease-out forwards; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 60px)) rotate(200deg) scale(1); opacity: 0; } }
/* parent */
.field { width: 100%; font: inherit; font-size: 20px; padding: 10px; border: 4px solid var(--line); background: #fff; margin: 4px 0 10px; border-radius: 0; }
textarea.field { min-height: 180px; resize: vertical; }
.gate .field { max-width: 200px; font-size: 30px; text-align: center; }
.table-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 17px; }
.ptable th, .ptable td { border: 2px solid #c8b78f; padding: 6px 8px; text-align: left; vertical-align: middle; }
.ptable th { background: #efe6cf; }
.pw { font-weight: 900; font-size: 19px; }
.pm { color: #7a3d00; }
.edit-row td { background: #fffaf0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 10px; border: 3px solid var(--line); background: #fff; font-weight: 800; }
.preview { margin-top: 12px; padding: 12px; border: 4px dashed var(--line); background: #fff; }
.pv-list { margin: 6px 0; padding-left: 1.4em; font-size: 18px; }
.confirm { background: #fff3c4; }
code { background: #efe6cf; padding: 1px 4px; }
.boot { padding: 30px 16px; color: #fff; }
@media (max-width: 420px) {
  body { font-size: 18px; }
  .sl { width: 40px; height: 54px; font-size: 30px; }
  .lb { min-width: 32px; height: 46px; font-size: 28px; }
  .kb-row { gap: 4px; }
  .key { min-height: 54px; font-size: 24px; }
  .tile { min-height: 110px; }
  .btn-play { font-size: 34px; min-height: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .blk { display: none; }
}
.review-tag{margin:4px auto 0;padding:3px 12px;width:max-content;max-width:100%;border-radius:999px;background:rgba(255,255,255,.85);color:#3b2a6b;font-weight:800;font-size:.9rem}
.tiles .tile[data-mode="review"]{grid-column:1/-1}
