/* Hoppitree: Story Grove game styles. Prefix every class with the game id. */

/* ---------- shared: the "why" bar with a Next button ---------- */
.wordbuilder-explain, .storytrail-explain, .mapquest-explain { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 20px; border-left: 7px solid var(--green); padding: 10px 14px; box-shadow: 0 8px 18px rgba(29, 43, 83, .14); max-width: min(760px, 100%); }
.wordbuilder-explain p, .storytrail-explain p, .mapquest-explain p { margin: 0; flex: 1; font-size: clamp(16px, 1.9vw, 21px); font-weight: 500; line-height: 1.3; color: var(--ink); }
.wordbuilder-explain .btn, .storytrail-explain .btn, .mapquest-explain .btn { --c: var(--green); flex-shrink: 0; white-space: nowrap; min-height: 48px; }

/* ---------- Word Builder ---------- */
.wordbuilder-stage { --wbt: clamp(64px, min(11vw, 12.5vh), 96px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 2.2vh, 22px); padding: 12px; background: linear-gradient(180deg, rgba(240, 234, 255, .85), rgba(222, 236, 255, .75)); }
.wordbuilder-top { display: flex; align-items: center; gap: 14px; }
.wordbuilder-pic { position: relative; display: grid; place-items: center; min-width: 150px; min-height: 104px; padding: 8px 30px; border: 0; border-radius: 28px; background: #fff; box-shadow: inset 0 -6px 0 #E4DCFB, 0 10px 20px rgba(29, 43, 83, .14); cursor: pointer; }
.wordbuilder-emo, .wordbuilder-ear { font-size: clamp(52px, 10vh, 92px); line-height: 1.15; white-space: nowrap; }
.wordbuilder-ear { display: none; }
.wordbuilder-listen .wordbuilder-emo { display: none; }
.wordbuilder-listen .wordbuilder-ear { display: block; }
.wordbuilder-hear { position: absolute; top: 6px; right: 9px; font-size: 18px; opacity: .6; }
.wordbuilder-peek { --c: #8A93B5; }
.wordbuilder-slots { display: flex; justify-content: center; gap: clamp(4px, 1vw, 12px); padding: 10px 12px; border-radius: 24px; background: rgba(255, 255, 255, .6); max-width: 100%; transition: gap .3s, background .3s; }
.wordbuilder-slot { display: grid; place-items: center; width: var(--wbt); height: var(--wbt); flex: 0 1 var(--wbt); min-width: 34px; border-radius: 18px; border: 3px dashed #B9A8F5; background: rgba(255, 255, 255, .75); }
.wordbuilder-slot .wordbuilder-tile { min-width: 0; }
.wordbuilder-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 1.2vw, 14px); max-width: min(760px, 100%); }
.wordbuilder-home { display: grid; width: var(--wbt); height: var(--wbt); border-radius: 18px; background: rgba(29, 43, 83, .08); }
.wordbuilder-tile { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 16px; background: linear-gradient(180deg, #fff, #F1ECFF); color: var(--ink); font-family: inherit; font-size: clamp(24px, 3.6vw, 40px); font-weight: 700; box-shadow: inset 0 -5px 0 #CFC2FA, 0 6px 12px rgba(29, 43, 83, .16); cursor: pointer; touch-action: manipulation; }
.wordbuilder-tile:active { transform: translateY(3px); }
.wordbuilder-tile.wordbuilder-ok { background: #DFF7E2; box-shadow: inset 0 -5px 0 #9ADBA4; }
.wordbuilder-tile.wordbuilder-hint { box-shadow: inset 0 -5px 0 #E2B400, 0 0 0 5px var(--yellow); animation: wordbuilder-pulse 1s ease-in-out infinite; }
.wordbuilder-wide .wordbuilder-slot, .wordbuilder-wide .wordbuilder-home { width: auto; flex: 0 1 auto; min-width: clamp(104px, 17vw, 170px); }
.wordbuilder-wide .wordbuilder-tile { padding: 0 14px; font-size: clamp(22px, 3vw, 34px); }
.wordbuilder-done { gap: 2px; background: #DFF7E2; }
.wordbuilder-done .wordbuilder-slot { border-color: transparent; background: none; }
.wordbuilder-done .wordbuilder-tile { background: #fff; box-shadow: inset 0 -5px 0 #9ADBA4; }
.wordbuilder-foot { display: grid; place-items: center; width: 100%; min-height: 68px; }
@keyframes wordbuilder-pulse { 50% { transform: scale(1.1); } }
@media (max-width: 600px) {
  .wordbuilder-pic { min-height: 88px; }
  .wordbuilder-slot .wordbuilder-tile { font-size: clamp(17px, 5.4vw, 26px); border-radius: 10px; }
  .wordbuilder-slot { border-width: 2px; border-radius: 12px; }
  .wordbuilder-wide .wordbuilder-tile { font-size: 21px; padding: 0 8px; }
}
@media (max-height: 560px) {
  .wordbuilder-stage { --wbt: 56px; gap: 6px; }
  .wordbuilder-emo, .wordbuilder-ear { font-size: 40px; }
  .wordbuilder-pic { min-height: 60px; }
}

/* ---------- Story Trail ---------- */
.storytrail-stage { background: linear-gradient(180deg, rgba(255, 248, 226, .9), rgba(226, 246, 240, .8)); }
.storytrail-wrap { position: absolute; inset: 0; display: flex; gap: 14px; padding: clamp(8px, 1.6vw, 16px); }
.storytrail-reading { align-items: center; justify-content: center; }
.storytrail-reading .storytrail-ask { display: none; }
.storytrail-book { display: flex; flex-direction: column; gap: 10px; width: min(840px, 100%); max-height: 100%; min-height: 0; padding: clamp(12px, 2.2vw, 26px); border-radius: 26px; border-left: 10px solid #2EC4B6; background: #FFFDF5; box-shadow: 0 12px 26px rgba(29, 43, 83, .16); }
.storytrail-head { display: flex; align-items: center; gap: 12px; }
.storytrail-head h3 { flex: 1; margin: 0; font-size: clamp(21px, 3vw, 32px); color: var(--ink); }
.storytrail-pic { font-size: clamp(28px, 4.4vw, 46px); white-space: nowrap; }
.storytrail-count { font-size: 14px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.storytrail-text { margin: 0; min-height: 0; overflow-y: auto; font-size: clamp(20px, 2.5vw, 28px); font-weight: 500; line-height: 1.6; color: var(--ink); touch-action: pan-y; }
.storytrail-sent { padding: 2px 3px; border-radius: 8px; cursor: pointer; transition: background .25s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.storytrail-sent.storytrail-now { background: #FFE88A; }
.storytrail-sent.storytrail-proof { background: #C4F0CB; }
.storytrail-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.storytrail-read { --c: #1FA397; min-height: 48px; }
.storytrail-read.storytrail-off { --c: #8A93B5; }
.storytrail-go { --c: var(--orange); }
.storytrail-asking .storytrail-bar { display: none; }
.storytrail-asking .storytrail-book { flex: 1 1 46%; width: auto; align-self: center; padding: clamp(10px, 1.6vw, 18px); }
.storytrail-asking .storytrail-text { font-size: clamp(16px, 1.75vw, 21px); line-height: 1.5; }
.storytrail-asking .storytrail-head h3 { font-size: clamp(18px, 2vw, 24px); }
.storytrail-asking .storytrail-pic { font-size: 26px; }
.storytrail-ask { flex: 1 1 54%; display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0; min-height: 0; overflow-y: auto; padding: 8px; touch-action: pan-y; }
.choices.storytrail-opts { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
.choices.storytrail-opts .choice { min-width: 0; min-height: 64px; padding: 10px 46px 10px 18px; border-radius: 20px; align-items: flex-start; text-align: left; }
.choices.storytrail-opts .choice:hover { transform: translateY(-2px); }
.choices.storytrail-opts.solved .choice:not(.yes) { transform: none; }
.choices.storytrail-opts .choice.yes, .choices.mapquest-opts .choice.yes { animation: none; box-shadow: inset 0 -6px 0 #2EA043, 0 0 0 4px #3BC14A; }
.storytrail-opt { font-size: clamp(17px, 2vw, 22px); font-weight: 600; line-height: 1.25; color: var(--ink); }
.storytrail-opts .mini-speak { top: 50%; margin-top: -17px; font-size: 20px; }
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .storytrail-asking { flex-direction: column; justify-content: center; gap: 8px; }
  .storytrail-asking .storytrail-book { flex: 0 1 auto; align-self: stretch; max-height: 42%; }
  .storytrail-asking .storytrail-text { font-size: clamp(16px, 2.7vw, 24px); }
  .storytrail-ask { flex: 0 1 auto; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .storytrail-count { display: none; }
  .choices.storytrail-opts .choice { min-height: 56px; padding: 8px 42px 8px 14px; }
  .storytrail-bar .btn { font-size: 17px; padding: 10px 14px; }
}

/* ---------- Map Explorer ---------- */
.mapquest-stage { background: linear-gradient(180deg, rgba(255, 244, 222, .85), rgba(224, 242, 255, .8)); }
.mapquest-wrap { position: absolute; inset: 0; display: flex; gap: 12px; padding: clamp(8px, 1.4vw, 14px); }
.mapquest-box { flex: 1; display: grid; place-items: center; min-width: 0; min-height: 0; container-type: size; }
.mapquest-frame { position: relative; display: grid; grid-template: "map" 1fr / 1fr; width: min(100%, 70vh); width: min(100cqw, 124cqh); aspect-ratio: 5 / 4; }
.mapquest-frame.mapquest-grid { grid-template: "corner cols" 24px "rows map" 1fr / 24px 1fr; }
.mapquest-cols { grid-area: cols; display: grid; grid-template-columns: repeat(5, 1fr); }
.mapquest-rows { grid-area: rows; display: grid; grid-template-rows: repeat(4, 1fr); }
.mapquest-cols b, .mapquest-rows b { display: grid; place-items: center; font-size: 17px; color: var(--ink); }
.mapquest-map { grid-area: map; position: relative; overflow: hidden; border: 4px solid #fff; border-radius: 18px; box-shadow: 0 10px 22px rgba(29, 43, 83, .18); container-type: size; }
.mapquest-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mapquest-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(4, 1fr); }
.mapquest-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 1px; border: 0; border-radius: 14px; background: none; font-family: inherit; cursor: pointer; touch-action: manipulation; transition: background .2s; }
.mapquest-grid .mapquest-cell { border-radius: 0; box-shadow: inset 0 0 0 1px rgba(29, 43, 83, .22); }
.mapquest-empty { cursor: default; }
.mapquest-emo { font-size: clamp(22px, 5vh, 46px); font-size: clamp(20px, 11cqh, 56px); line-height: 1.15; filter: drop-shadow(0 2px 2px rgba(29, 43, 83, .25)); }
.mapquest-name { max-width: 100%; padding: 0 5px; border-radius: 8px; background: rgba(255, 255, 255, .88); color: var(--ink); font-size: clamp(9px, 1.5vh, 14px); font-size: clamp(10px, 3.4cqh, 15px); font-weight: 600; line-height: 1.2; text-align: center; }
.mapquest-nolabel .mapquest-name { display: none; }
.mapquest-nolabel .mapquest-emo { font-size: clamp(24px, 14cqh, 64px); }
.mapquest-cell.mapquest-yes { background: rgba(59, 193, 74, .4); box-shadow: inset 0 0 0 4px #3BC14A; border-radius: 14px; }
.mapquest-cell.mapquest-nope { background: rgba(29, 43, 83, .16); }
.mapquest-cell.mapquest-nope > * { opacity: .4; filter: grayscale(1); }
.mapquest-cell.mapquest-glow { background: rgba(255, 210, 63, .5); box-shadow: inset 0 0 0 4px var(--orange); border-radius: 14px; animation: mapquest-glow 1.1s ease-in-out infinite; }
.mapquest-hop { position: absolute; z-index: 3; width: 15%; aspect-ratio: 62 / 72; transform: translate(-50%, -62%); transition: left .4s ease-in-out, top .4s ease-in-out; pointer-events: none; }
.mapquest-hop .clu { width: 100%; height: 100%; }
.mapquest-side { flex: 0 0 clamp(230px, 27vw, 330px); display: flex; flex-direction: column; justify-content: center; gap: 10px; min-height: 0; overflow-y: auto; padding: 6px; touch-action: pan-y; }
.mapquest-info { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-radius: 20px; background: #fff; box-shadow: 0 8px 18px rgba(29, 43, 83, .12); }
.mapquest-info h3 { margin: 0; font-size: 19px; color: var(--ink); }
.mapquest-compass { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.mapquest-rose { flex-shrink: 0; width: 82px; height: 82px; }
.mapquest-key { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 14px; font-weight: 500; color: var(--ink); }
.mapquest-key b { grid-column: 1 / -1; font-size: 16px; }
.mapquest-key span { display: flex; align-items: center; gap: 6px; line-height: 1.15; }
.mapquest-key i { font-style: normal; font-size: 19px; }
.mapquest-steps { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 16px; font-weight: 600; color: var(--ink); }
.mapquest-steps li { padding: 4px 10px; border-radius: 10px; background: #FFF1CF; }
.choices.mapquest-opts { gap: 10px; }
.choices.mapquest-opts .choice { flex: 1 1 40%; min-width: 0; min-height: 64px; padding: 8px; border-radius: 18px; }
.choices.mapquest-opts .choice:hover { transform: translateY(-2px); }
.mapquest-opt { font-size: clamp(18px, 2vw, 23px); font-weight: 700; color: var(--ink); }
.mapquest-explain { flex-wrap: wrap; }
.mapquest-explain p { flex: 1 1 150px; }
@keyframes mapquest-glow { 50% { background: rgba(255, 210, 63, .15); } }
@media (max-aspect-ratio: 1/1) {
  .mapquest-wrap { flex-direction: column; justify-content: center; gap: 10px; }
  .mapquest-box { flex: 0 1 auto; width: 100%; aspect-ratio: 5 / 4; max-height: 58%; }
  .mapquest-side { flex: 0 1 auto; max-height: 48%; justify-content: flex-start; }
  .mapquest-info { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; }
  .mapquest-info h3 { font-size: 17px; }
  .mapquest-rose { width: 60px; height: 60px; }
  .mapquest-compass { flex: 1 1 200px; font-size: 14px; }
  .mapquest-key { flex: 1 1 100%; grid-template-columns: repeat(3, 1fr); }
  .mapquest-steps { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; }
  .choices.mapquest-opts .choice { flex: 1 1 20%; min-height: 56px; }
}
@media (max-width: 600px) {
  .mapquest-key { grid-template-columns: 1fr 1fr; font-size: 13px; }
  .mapquest-steps { font-size: 14px; }
  .mapquest-cols b, .mapquest-rows b { font-size: 14px; }
  .mapquest-frame.mapquest-grid { grid-template: "corner cols" 18px "rows map" 1fr / 18px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .wordbuilder-tile.wordbuilder-hint, .mapquest-cell.mapquest-glow { animation: none; }
  .mapquest-hop { transition: none; }
}
