/* USA States Adventure — bright, warm, kid-friendly (Grades 3–5). */
:root {
  --ink: #2b2a4c; --gold: #ffcf4d; --gold-d: #e0a12a; --sky1: #3b5bdb; --sky2: #9b59b6;
  --ok: #2e9e5b; --no: #e5484d; --paper: #fffaf0; --font: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #1e1a4d; color: var(--ink); font-family: var(--font); }
button, input { font-family: inherit; }
.scr { position: relative; min-height: 100vh; min-height: 100dvh; padding: 56px 16px 28px; overflow-x: hidden;
  background: linear-gradient(180deg, #4b6cd9 0%, #8e6fd8 55%, #f7b267 100%); color: #fff; }
.scr-body { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.proto-badge { position: fixed; left: 8px; bottom: 6px; font-size: .72rem; background: #0008; color: #ffe08a; padding: 2px 8px; border-radius: 8px; z-index: 50; pointer-events: none; }
.topbar { position: fixed; top: 8px; right: 10px; display: flex; gap: 8px; z-index: 40; }
.tb { border: 2px solid #ffffffaa; background: #1e1a4dcc; color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 800; cursor: pointer; }
h1, h2 { margin: 0; }
.h1, .logo { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; color: #fff; text-shadow: 0 3px 0 #2a1d6b, 0 6px 14px #0006; }
.logo { font-size: clamp(2.2rem, 7vw, 4.2rem); color: var(--gold); }
.sub, .tag { margin: 0; font-size: clamp(1rem, 2.4vw, 1.25rem); font-weight: 700; text-shadow: 0 2px 6px #0007; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btns.low { margin-top: 6px; }
.big, .ghost, .warn { border-radius: 999px; padding: 12px 26px; font-size: 1.15rem; font-weight: 800; cursor: pointer; border: 3px solid #fff; transition: transform .15s; }
.big { background: linear-gradient(180deg, #ffe27a, var(--gold-d)); color: #3b2300; box-shadow: 0 5px 0 #b77b14, 0 8px 18px #0005; }
.big:disabled { filter: grayscale(1); opacity: .55; cursor: not-allowed; }
.big:not(:disabled):hover, .ghost:hover { transform: translateY(-2px); }
.ghost { background: #ffffff22; color: #fff; }
.warn { background: var(--no); color: #fff; }
.art { display: block; }
[data-say] { cursor: pointer; }
.saying { animation: glow .9s; }
@keyframes glow { 50% { filter: drop-shadow(0 0 10px #fff6a8); } }

/* title */
.title-art { display: flex; align-items: flex-end; gap: 6px; }
.title-art .art-explorer { width: 130px; } .title-art .art-dog { width: 110px; }

/* choose explorer */
.pick-row { display: flex; gap: clamp(20px, 6vw, 70px); }
.pick { background: #ffffff1a; border: 3px solid transparent; border-radius: 24px; padding: 14px 24px; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.pick .art { width: clamp(110px, 18vw, 160px); }
.pick.on { transform: scale(1.05); box-shadow: 0 0 0 4px var(--gold), 0 0 30px var(--gold); }
.pick-dog .art { width: 120px; animation: hop 1.2s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-8px); } }
.name-box { display: grid; gap: 6px; }
.name-box label { font-size: 1.3rem; font-weight: 800; }
.name-box input { font-size: 1.4rem; padding: 10px 16px; border-radius: 14px; border: 3px solid var(--gold); text-align: center; width: min(320px, 80vw); }

/* story */
.story .scr-body { max-width: 1200px; }
.sky { width: min(820px, 96vw); }
.sky-map .st { fill: #ffffff26; stroke: #ffffff88; stroke-width: 1; }
.star { font-size: 26px; fill: #ffe066; filter: drop-shadow(0 0 6px #ffd43b); transition: transform 1.4s, opacity 1.4s; }
.star.dim { fill: #ffffff55; filter: none; font-size: 20px; }
.scatter .sky-map .star { animation: scatter 1.6s forwards; }
@keyframes scatter { to { transform: translate(var(--dx, 60px), 120px) rotate(200deg); opacity: .15; } }
.story-cast { display: flex; align-items: flex-end; gap: 4px; margin-top: -60px; align-self: flex-start; margin-left: 4%; }
.story-cast .art-explorer { width: 100px; } .story-cast .art-dog { width: 80px; }
.story-panel { background: #1e1a4dcc; border: 2px solid #ffd76a88; border-radius: 22px; padding: 14px 18px; width: min(820px, 96vw); }
.story-text { font-size: clamp(1.1rem, 2.6vw, 1.5rem); font-weight: 700; margin: 0 0 8px; line-height: 1.35; }
.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: #ffffff55; } .dots span.on { background: var(--gold); }

/* magic map hub */
.hub-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; }
.stars-count { background: #1e1a4dcc; border-radius: 999px; padding: 6px 16px; font-weight: 800; color: var(--gold); }
.hub-grid { display: grid; grid-template-columns: 200px 1fr; gap: 16px; width: 100%; align-items: start; }
.menu { display: grid; gap: 10px; }
.menu button { background: #1e1a4dcc; color: #fff; border: 2px solid #ffffff55; border-radius: 16px; padding: 12px; font-weight: 800; font-size: 1rem; cursor: pointer; text-align: left; }
.menu button:hover { border-color: var(--gold); }
.hub-map { background: #1e1a4d66; border-radius: 24px; padding: 10px; }
.usa { width: 100%; height: auto; display: block; }
.usa .st { fill: #c9d3ec; stroke: #fff; stroke-width: 1.2; }
.hub-map .st.locked { fill: #8c94b8; }
.hub-map .st.open { fill: #ffd43b; cursor: pointer; animation: pulse 1.4s ease-in-out infinite; }
.hub-map .st.done, .sr-map .st.done { fill: #ffe066; }
.hub-map .star { cursor: pointer; pointer-events: none; }
@keyframes pulse { 50% { fill: #fff3a3; } }
.hint { margin: 6px 0 0; font-weight: 700; }

/* welcome */
.welcome-top .wt { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: .1em; }
.state-big { font-size: clamp(2.6rem, 9vw, 5rem); color: var(--gold); text-shadow: 0 4px 0 #8a4b00, 0 8px 18px #0006; line-height: 1; }
.abbr { margin: 4px 0 0; font-size: 1.6rem; font-weight: 800; }
.welcome-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; width: 100%; align-items: end; }
.loc-card { background: #fffffff0; color: var(--ink); border-radius: 22px; padding: 12px; }
.loc-card p { margin: 6px 0 0; font-weight: 700; }
.loc-map .st { fill: #dfe4f2; } .loc-map .st.hi { fill: #ffcf4d; stroke: #b5651d; stroke-width: 2; }
.welcome-cast { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.welcome-cast .art-explorer { width: 120px; } .welcome-cast .art-dog { width: 95px; }

/* route */
.route-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 18px; width: 100%; align-items: center; }
.route-map { width: 100%; max-height: 70vh; background: #ffffff22; border-radius: 24px; }
.route-state { fill: #ffe9a8; stroke: #b5651d; stroke-width: 3; }
.route-trail { fill: none; stroke: #8a4b00; stroke-width: 4; stroke-dasharray: 10 8; }
.stop circle { fill: #fff; stroke: #8a4b00; stroke-width: 4; }
.stop.done circle { fill: var(--ok); } .stop.next circle { fill: var(--gold); animation: blink 1s infinite; }
.stop text { font-size: 18px; font-weight: 800; fill: #2b2a4c; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
@keyframes blink { 50% { r: 18; } }
.route-side { display: grid; gap: 12px; }
.next-stop { background: #fffffff0; color: var(--ink); border-radius: 18px; padding: 14px; margin: 0; font-size: 1.2rem; }
.next-stop small { font-size: .95rem; }

/* time of day backgrounds (placeholder for the 3 real-place backgrounds) */
.t-morning { background: linear-gradient(180deg, #74c0fc 0%, #a5d8ff 50%, #ffe8a3 100%); }
.t-evening { background: linear-gradient(180deg, #5f3dc4 0%, #f76707 70%, #ffd43b 100%); }
.t-night { background: linear-gradient(180deg, #0b1440 0%, #24308a 60%, #3b5bdb 100%); }

/* knowledge cards */
.kcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; width: 100%; }
.kcard { background: #fffef5; color: var(--ink); border: 4px solid #ffffff; border-radius: 20px; padding: 16px 12px; display: grid; gap: 4px; justify-items: center; cursor: pointer; box-shadow: 0 6px 16px #0004; transform: rotateY(0); transition: transform .3s, border-color .3s; font-size: 1rem; }
.kcard:not(.read) { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 12px, #ffd25e 12px, #ffd25e 24px); }
.kcard:not(.read) .kv, .kcard:not(.read) img { visibility: hidden; }
.kcard.read { border-color: var(--ok); }
.ki { font-size: 2.2rem; } .kl { font-weight: 800; color: #8a4b00; } .kv { font-weight: 800; font-size: 1.2rem; }
.kcard img { width: 90px; border: 1px solid #ccc; }
.kcards.small .kcard { background: #fffef5; } .kcards.small .kv, .kcards.small img { visibility: visible !important; }

/* battle */
.place-tag { background: #1e1a4dcc; padding: 4px 14px; border-radius: 999px; font-weight: 800; text-transform: capitalize; }
.arena { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; min-height: 300px; }
.cast { display: flex; align-items: flex-end; gap: 4px; } .cast .art-explorer { width: 110px; } .cast .art-dog { width: 85px; }
.foe { display: grid; justify-items: center; gap: 8px; }
.art-monster { animation: bob 1.6s ease-in-out infinite; }
.foe .m-small { width: 150px; } .foe .m-medium { width: 210px; } .foe .m-boss { width: 300px; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.bubble { background: #fff; color: var(--ink); border-radius: 18px; padding: 10px 16px; margin: 0; font-weight: 800; max-width: 420px; box-shadow: 0 4px 12px #0004; }
.bubble.big { font-size: 1.5rem; }
.hud { display: flex; justify-content: space-between; align-items: center; width: 100%; font-size: 1.4rem; font-weight: 800; background: #1e1a4dcc; border-radius: 18px; padding: 6px 16px; }
.round-dots { display: flex; gap: 8px; } .round-dots span { width: 14px; height: 14px; border-radius: 50%; background: #ffffff44; } .round-dots .on { background: var(--gold); } .round-dots .done { background: var(--ok); }
.battle-grid { display: grid; grid-template-columns: 170px 1fr; gap: 14px; width: 100%; align-items: start; }
.mini-foe { display: grid; justify-items: center; background: #ffffff22; border-radius: 18px; padding: 8px; font-weight: 800; }
.mini-foe .art { width: 140px; }
.game-box { background: #fffef8; color: var(--ink); border-radius: 22px; padding: 14px; box-shadow: 0 8px 22px #0005; }
.q { font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 800; margin: 0 0 10px; }
.ghost.free { background: var(--ok); }
.shake .game-box { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* mini-game: drag map */
.drag-map .st { fill: #d7dcef; stroke: #fff; }
.piece-shape { fill: #ffcf4d; stroke: #b5651d; stroke-width: 3; filter: drop-shadow(0 4px 4px #0005); }
.piece { touch-action: none; } .piece.dragging .piece-shape { fill: #ffe27a; } .piece.snapped .piece-shape { fill: #8ce99a; stroke: var(--ok); }

/* mini-game: match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col { display: grid; gap: 10px; }
.mcard { min-height: 64px; border-radius: 16px; border: 3px solid #c9b8ff; background: #f3efff; color: var(--ink); font-weight: 800; font-size: 1.1rem; cursor: pointer; padding: 8px; }
.mcard img { height: 46px; display: block; margin: 0 auto; }
.mcard.left { background: #fff4d6; border-color: #ffcf4d; }
.mcard.sel { box-shadow: 0 0 0 4px var(--sky1); }
.mcard.ok { background: #d3f9d8; border-color: var(--ok); cursor: default; }
.mcard.no { background: #ffe3e3; border-color: var(--no); }

/* mini-game: true / false */
.tf-top { display: flex; justify-content: space-between; font-weight: 800; }
.combo { color: #e8590c; }
.tf-q { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 800; margin: 10px 0; }
.timer { height: 10px; background: #eee; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.timer span { display: block; height: 100%; background: linear-gradient(90deg, var(--no), var(--gold)); }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-b { font-size: 1.4rem; font-weight: 800; border-radius: 18px; padding: 16px; border: 0; color: #fff; cursor: pointer; }
.tf-b.yes { background: var(--ok); } .tf-b.no { background: var(--no); }

/* mini-game: typing */
.typer { display: grid; gap: 10px; justify-items: center; }
.typer .hint { margin: 0; font-weight: 700; color: #8a4b00; }
.type-in { font-size: 1.8rem; padding: 10px 16px; border-radius: 14px; border: 3px solid var(--sky1); text-align: center; width: min(420px, 90%); }
.type-in.ok { border-color: var(--ok); background: #d3f9d8; } .type-in.no { border-color: var(--no); background: #ffe3e3; }

/* hit close-up */
.hit .scr-body { justify-content: center; min-height: 70vh; }
.closeup .art-monster { width: min(70vw, 420px); animation: hitwobble .6s; }
@keyframes hitwobble { 30% { transform: scale(.9) rotate(-6deg); } 60% { transform: scale(1.05) rotate(4deg); } }
.hp-flash { font-size: 2.6rem; }
.hp-flash.flash { animation: flash .5s 3; }
@keyframes flash { 50% { opacity: .2; } }

/* star returns */
.star-return { background: linear-gradient(180deg, #1b1f5e, #4b3bb5); }
.sr-map { width: min(900px, 96vw); }
.sr-map .st { fill: #ffffff22; stroke: #ffffff66; }
.sr-map .st.glow { fill: #ffe066; filter: drop-shadow(0 0 12px #ffd43b); }
.flying-star { font-size: 70px; fill: #ffe066; filter: drop-shadow(0 0 14px #ffd43b); }
.restored { font-size: clamp(1.8rem, 5vw, 3rem); color: var(--gold); display: grid; }
.restored small { font-size: 1.2rem; color: #fff; }

/* state cards (2.5 × 3.5 in, landscape) */
.card-pair { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.scard { width: 350px; height: 250px; background: #fff; color: var(--ink); border-radius: 14px; border: 3px solid #2b2a4c; padding: 10px; display: flex; flex-direction: column; box-shadow: 0 6px 16px #0005; text-align: center; }
.sc-name { font-size: 1.5rem; font-weight: 800; }
.sc-mid { flex: 1; display: grid; grid-template-columns: 90px 1fr; gap: 6px; align-items: center; min-height: 0; }
.sc-hero .art { width: 80px; margin: 0 auto; }
.card-map .st { fill: #e9ecef; stroke: #8a8f98; stroke-width: 1; }
.card-map .st.target { fill: #fff3a8; stroke: #2b2a4c; stroke-width: 2.6; }
.card-map .st-label { font-size: 44px; font-weight: 800; fill: #000; }
.sc-foot { font-weight: 800; font-size: .95rem; }
.scard.back { justify-content: flex-start; }
.sc-flag { height: 52px; margin: 0 auto 6px; border: 1px solid #ccc; }
.scard dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; text-align: left; font-size: .92rem; }
.scard dt { font-weight: 800; color: #8a4b00; } .scard dd { margin: 0; font-weight: 700; }
.item-drop { background: #fffef5; color: var(--ink); border-radius: 18px; padding: 10px 18px; font-size: 1.2rem; font-weight: 700; }
.item-drop span { font-size: 2rem; vertical-align: middle; }

/* my cards */
.card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; width: 100%; }
.cg { aspect-ratio: 1; border-radius: 14px; overflow: hidden; display: grid; place-items: center; }
.cg.on { border: 3px solid var(--gold); background: #fff; padding: 0; cursor: pointer; }
.cg.on .scard { transform: scale(.4); box-shadow: none; }
.cg.off { border: 3px dashed #ffffff88; color: #fff; font-weight: 700; font-size: .85rem; padding: 4px; }

/* my player */
.mp { display: flex; align-items: flex-end; gap: 6px; } .mp .art-explorer { width: 140px; } .mp .art-dog { width: 100px; }
.items { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.item { border-radius: 14px; border: 3px solid #fff; background: #ffffff22; color: #fff; font-weight: 800; padding: 10px 16px; cursor: pointer; font-size: 1.05rem; }
.item.on { background: var(--gold); color: #3b2300; }

/* overlays, toasts */
.ovl { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 60; padding: 16px; }
.ovl-card { background: #fffef8; color: var(--ink); border-radius: 24px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; text-align: center; display: grid; gap: 12px; }
.ovl.bag .ovl-card { width: min(820px, 100%); }
.ovl-card .ghost { color: var(--ink); border-color: var(--ink); }
.howto { text-align: left; font-size: 1.15rem; font-weight: 700; line-height: 1.7; margin: 0; padding-left: 8px; list-style: none; }
.tired-art .art { width: 120px; margin: 0 auto; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #2b2a4c; color: #fff; padding: 10px 20px; border-radius: 999px; font-weight: 800; z-index: 70; animation: pop .25s; }
.toast.bad { background: var(--no); } .toast.good { background: var(--ok); }
@keyframes pop { from { transform: translateX(-50%) scale(.7); } }

/* phones and small tablets */
@media (max-width: 720px) {
  .hub-grid, .welcome-grid, .route-grid, .battle-grid { grid-template-columns: 1fr; }
  .menu { grid-template-columns: 1fr 1fr; }
  .mini-foe { grid-auto-flow: column; justify-content: center; align-items: center; } .mini-foe .art { width: 80px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .foe .m-boss { width: 200px; } .foe .m-medium { width: 160px; }
  .arena { min-height: 220px; } .cast .art-explorer { width: 80px; } .cast .art-dog { width: 60px; }
  .scard { transform-origin: top center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* printing: cards at real size, front and back side by side */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  #app, .proto-badge, .topbar, .ovl, .toast { display: none !important; }
  #print-area { display: block; }
  .print-pair { display: flex; gap: 6mm; margin-bottom: 8mm; break-inside: avoid; }
  .print-pair .scard { width: 3.5in; height: 2.5in; box-shadow: none; border: 1px solid #000; border-radius: 0; }
}

/* speaker on knowledge cards */
.kcard { position: relative; }
.kspk { position: absolute; top: 6px; right: 8px; font-size: 1.3rem; background: #fff; border: 2px solid #ffcf4d; border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; box-shadow: 0 2px 6px #0003; }
.kspk.saying { background: #fff3a8; }

/* mini tasks */
.task-ovl .ovl-card { width: min(620px, 100%); }
.task-q { font-weight: 800; font-size: 1.15rem; margin: 0 0 8px; }
.field { position: relative; height: 260px; background: linear-gradient(#bfe6ff, #e9f7ff); border-radius: 18px; overflow: hidden; }
.snack { position: absolute; top: -50px; font-size: 2.4rem; background: none; border: 0; cursor: pointer; animation: fall linear forwards; padding: 4px; }
@keyframes fall { to { transform: translateY(330px); } }
.flip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fc { aspect-ratio: 1; border-radius: 16px; border: 3px solid #c9b8ff; background: #7b61ff; font-size: 2.6rem; cursor: pointer; }
.fc span { visibility: hidden; } .fc.up { background: #fff; } .fc.up span { visibility: visible; } .fc.got { border-color: var(--ok); background: #d3f9d8; }
.sand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dig { aspect-ratio: 1; font-size: 2rem; border-radius: 14px; border: 2px solid #c9a46a; background: #f1d9a8; cursor: pointer; }
.dig.got { background: #fff3a8; border-color: var(--ok); }
.ghost.free { background: var(--ok); border-color: #fff; }
