/* Game screen: full-window 3D view with overlays. */
html, body.game-page { height: 100%; }
body.game-page { overflow: hidden; background: var(--c-sky); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---- HUD ---- */
.hud { position: fixed; inset: 0; pointer-events: none; padding: max(var(--space-3), env(safe-area-inset-top)) var(--space-3) 0; }
/* Top bar: player, coins and speed sit in one row at the top left; the goal sits on its own row below, so nothing overlaps. */
.hud-left { position: absolute; left: var(--space-3); top: max(var(--space-3), env(safe-area-inset-top)); display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100% - 340px); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.94); color: var(--c-navy); border-radius: 999px; padding: 0 14px 0 8px; min-height: 40px; font-weight: 700; font-size: 18px; line-height: 1; box-shadow: var(--shadow); width: max-content; white-space: nowrap; }
.chip b { font-size: 20px; font-weight: 800; }
.chip.who { padding-left: 6px; font-weight: 800; }
.chip.who #hudName { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.dot { display: inline-block; flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.14); }
.coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe680, var(--c-gold) 60%, #d68a00); box-shadow: inset 0 0 0 2px #e9a300; }
.chip.boost { background: #ffe680; color: #6b4600; box-shadow: var(--shadow), inset 0 0 0 2px #e9a300; }
.chip.boost b { color: #6b4600; }
.hud-goal { position: absolute; left: 50%; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 64px); transform: translateX(-50%); background: var(--c-navy); color: var(--c-white); font-weight: 700; font-size: 18px; padding: 6px 18px; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100% - 24px); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { position: absolute; right: var(--space-3); top: max(var(--space-3), env(safe-area-inset-top)); display: flex; gap: 8px; pointer-events: auto; }
.icon-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--c-white); color: var(--c-navy); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); padding: 0; }
.icon-btn svg { width: 28px; height: 28px; }
.icon-btn:active { transform: translateY(2px); }
#btnSound .cross { display: none; }
#btnSound.muted .wave { display: none; }
#btnSound.muted .cross { display: inline; }
.bar { height: 12px; border-radius: 999px; background: #dfeaf3; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--c-moss); border-radius: 999px; transition: width 0.15s linear, background-color 0.3s; }
.bar.big { height: 18px; margin: var(--space-2) 0; }
.bar.big i { background: var(--c-blue); }

.toast { position: fixed; left: 0; top: 0; background: #fffdf2; color: var(--c-navy); font-weight: 700; font-size: 18px; line-height: 1.3; padding: 9px 16px 9px 40px; border-radius: var(--r-xl); box-shadow: var(--shadow), 0 0 0 3px #ffe9a8; width: max-content; max-width: min(360px, calc(100vw - 24px)); text-align: left; pointer-events: none; animation: fadein 0.25s ease-out; z-index: 5; }
.toast::before { content: ""; position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #ffffff, #ffe27a 55%, #ffb3d9); box-shadow: 0 0 8px 3px rgba(255, 226, 122, 0.8); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.bubble { position: fixed; left: 0; top: 0; transform: translate(-50%, -100%); background: var(--c-white); color: var(--c-ink); font-weight: 700; font-size: 17px; padding: 6px 14px; border-radius: var(--r-xl); box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; z-index: 4; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: var(--c-white); }
.prompt { position: fixed; left: 0; top: 0; transform: translate(-50%, -100%); background: var(--c-navy); color: var(--c-white); font-weight: 700; font-size: 16px; padding: 4px 12px; border-radius: 999px; pointer-events: none; z-index: 3; white-space: nowrap; }
.coin-pop { position: fixed; left: 0; top: 0; transform: translate(-50%, -100%); pointer-events: none; z-index: 3; font-weight: 800; font-size: 22px; color: #8a5a00; background: #ffe680; border: 2px solid #e9a300; border-radius: 999px; padding: 2px 12px; box-shadow: var(--shadow); white-space: nowrap; }
.coin-pop.go { animation: coinrise 1.3s ease-out forwards; }
@keyframes coinrise { from { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } to { opacity: 0; margin-top: -40px; } }
.q-luck { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--c-text); }
.reveal-card.perfect canvas { border-radius: 50%; box-shadow: 0 0 0 6px #ffe680, 0 0 28px 10px rgba(255, 214, 90, 0.75); animation: twinkle 1.4s ease-in-out infinite; }
@keyframes twinkle { 50% { box-shadow: 0 0 0 8px #fff3b0, 0 0 36px 16px rgba(255, 214, 90, 0.9); } }
@keyframes pop { from { transform: translateX(-50%) scale(0.85); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---- touch controls: the joystick appears wherever a thumb holds the game view ---- */
.touch { position: fixed; left: 0; right: 0; bottom: 0; height: 0; z-index: 2; }
.joy-float { position: fixed; left: 0; top: 0; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); border: 3px solid rgba(255, 255, 255, 0.85); display: grid; place-items: center; pointer-events: none; }
.touch-help { position: fixed; left: max(18px, env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); color: var(--c-navy); font-weight: 700; font-size: 14px; pointer-events: none; }
.joy-knob { width: 66px; height: 66px; border-radius: 50%; background: var(--c-white); box-shadow: var(--shadow); pointer-events: none; }
.touch-buttons { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.tbtn { width: 96px; height: 96px; border-radius: 50%; border: 0; font-size: 20px; font-weight: 800; color: var(--c-white); touch-action: none; box-shadow: var(--shadow); }
.tbtn.jump { background: var(--c-blue); }
.tbtn.grab { background: var(--c-moss); width: 84px; height: 84px; margin-right: 60px; }
.tbtn.dodge { background: #f08a2b; width: 88px; height: 88px; margin-right: 100px; margin-bottom: -60px; }
.tbtn.grab.bop { background: #e0609a; }
.tbtn.grab.long { font-size: 15px; letter-spacing: -0.2px; }
.tbtn.grab.ready { background: var(--c-gold); color: var(--c-navy); }

/* ---- screens and modals ---- */
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.start { background: linear-gradient(180deg, rgba(190, 220, 246, 0.82), rgba(232, 244, 252, 0.92)); display: flex; flex-direction: column; align-items: center; padding: 0 0 56px; }
.start-head { width: 100%; background: var(--c-lime); padding: 0; }
.start-brand { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3); }
.start-brand .brand-mark { flex: none; }
.start-name { display: block; width: 340px; height: 36px; overflow: visible; }
.start-name text { font-family: var(--font-display); font-weight: 800; font-size: 40px; fill: var(--c-white); stroke: rgba(64, 101, 15, 0.35); stroke-width: 1.5px; paint-order: stroke; }
.start-head .eyebrow { color: var(--c-moss-ink); }
.start-sub { font-size: 20px; margin: var(--space-4) 0 var(--space-2); }
.start-text { margin: 0 auto var(--space-3); max-width: 600px; color: var(--c-ink); }
.game-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; display: flex; justify-content: center; flex-wrap: wrap; gap: 0 var(--space-3); padding: var(--space-3) 0; color: var(--c-navy); font-weight: 700; font-size: 13px; background: rgba(190, 220, 246, 0.95); }
.game-footer p { margin: 0; }
.start-card { background: var(--c-white); border-radius: var(--r-lg); box-shadow: var(--shadow); width: calc(100% - 20px); max-width: 760px; padding: var(--space-4) var(--space-4) var(--space-3); text-align: center; margin: var(--space-4) var(--space-3) 0; }
.eyebrow { margin: 0; font-weight: 700; color: var(--c-moss-ink); font-size: 15px; }
.start h1 { font-size: 20px; margin: 0; color: var(--c-navy); }
.lead { margin: 4px auto var(--space-3); max-width: 560px; }
.pick-title { font-size: 22px; margin: var(--space-2) 0; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.level { border: 3px solid #d6e7f4; background: var(--c-sky-light); border-radius: var(--r-xl); padding: var(--space-3); cursor: pointer; text-align: center; color: var(--c-navy); min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.level .lv-name { font-weight: 800; font-size: 20px; line-height: 1.1; }
.level .lv-ages { font-size: 15px; color: var(--c-text); }
.level .lv-sample { font-weight: 800; font-size: 24px; color: var(--c-moss-ink); }
.level[aria-checked="true"] { border-color: var(--c-moss); background: #eef6d2; box-shadow: 0 0 0 3px rgba(181, 205, 33, 0.5); }
.btn-play { min-width: 220px; min-height: 60px; border: 0; border-radius: var(--r-xl); background: var(--c-blue); color: var(--c-white); font-size: 26px; font-weight: 800; cursor: pointer; box-shadow: 0 5px 0 #1f7fb8; padding: 0 var(--space-5); }
.btn-play:active { transform: translateY(3px); box-shadow: 0 2px 0 #1f7fb8; }
.btn-play:disabled { background: var(--c-blue); opacity: 0.55; cursor: default; }
.btn-soft { margin-top: var(--space-2); background: none; border: 0; color: var(--c-navy); font-size: 17px; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 44px; }
.progress-line { margin: var(--space-3) 0 0; font-weight: 700; color: var(--c-navy); }
.keys-help { list-style: none; padding: 0; margin: 0 0 var(--space-3); font-size: 15px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; color: var(--c-ink); }
.keys-help b { color: #000000; }
.btn-records { margin-top: var(--space-3); min-height: 48px; padding: 0 22px; border-radius: 999px; border: 2px solid #c6d9ea; background: var(--c-white); color: var(--c-navy); font-size: 17px; font-weight: 800; cursor: pointer; }

/* ---- players on the start screen ---- */
.players { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: var(--space-3) 0 0; }
.players-empty { margin: 0; color: var(--c-text); }
.pchip { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 10px; border-radius: 999px; border: 3px solid #d6e7f4; background: var(--c-sky-light); color: var(--c-navy); font-size: 19px; font-weight: 800; cursor: pointer; }
.pchip[aria-checked="true"] { border-color: var(--c-moss); background: #eef6d2; box-shadow: 0 0 0 3px rgba(181, 205, 33, 0.5); }
.player-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--space-4); }

/* ---- times-table picker ---- */
.tables-box { background: var(--c-sky-light); border-radius: var(--r-xl); padding: var(--space-3); margin: calc(-1 * var(--space-2)) 0 var(--space-4); }
.tables-title { margin: 0 0 var(--space-2); font-weight: 800; font-size: 18px; color: var(--c-navy); }
.tables { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.tchip { min-width: 52px; min-height: 52px; padding: 0 10px; border-radius: 14px; border: 3px solid #c6d9ea; background: var(--c-white); color: var(--c-navy); font-size: 22px; font-weight: 800; cursor: pointer; }
.tchip.all { font-size: 18px; padding: 0 16px; }
.tchip[aria-pressed="true"] { background: var(--c-moss); border-color: var(--c-moss); color: var(--c-white); }
.tables-note { margin: var(--space-2) 0 0; font-size: 15px; color: var(--c-ink); }

/* ---- add or change a player ---- */
.field-label { display: block; text-align: left; margin: var(--space-4) 0 6px; font-weight: 800; font-size: 17px; color: var(--c-navy); }
.name-row { display: flex; gap: var(--space-2); }
.name-show { margin: 0 0 8px; padding: 10px 12px; border-radius: 14px; background: #eef6fd; text-align: center; font-size: 24px; font-weight: 800; color: var(--c-navy); }
.name-parts { display: grid; gap: 8px; margin-bottom: 8px; }
.name-part { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; gap: 8px; }
.name-part b { text-align: center; font-size: 20px; color: var(--c-navy); }
.name-part button { min-height: 54px; border-radius: 14px; border: 0; background: #e7f1fb; color: var(--c-navy); font-size: 26px; font-weight: 800; cursor: pointer; touch-action: manipulation; box-shadow: 0 4px 0 #c3d6ea; }
.name-parts + .btn-surprise { width: 100%; }
.look-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.look-preview { flex: none; width: 110px; height: 125px; border-radius: 14px; background: linear-gradient(#cfeaf7, #f3fbff); }
.look-parts { flex: 1; min-width: 0; margin: 0; }
.look-parts .name-part { grid-template-columns: 44px 1fr 44px; }
.look-parts .name-part b { font-size: 17px; }
.look-parts .name-part button { min-height: 44px; font-size: 22px; }
.name-row input { flex: 1; min-width: 0; min-height: 54px; padding: 0 14px; border-radius: 14px; border: 3px solid #c6d9ea; font: inherit; font-size: 22px; font-weight: 700; color: var(--c-navy); user-select: text; -webkit-user-select: text; }
.name-row input:focus { outline: none; border-color: var(--c-blue); }
.btn-surprise { flex: none; min-height: 54px; padding: 0 16px; border-radius: 14px; border: 0; background: var(--c-lime); color: var(--c-navy); font-size: 17px; font-weight: 800; cursor: pointer; }
.name-msg { min-height: 26px; margin: 6px 0 0; text-align: left; font-weight: 700; font-size: 17px; color: var(--c-navy); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 50px; height: 50px; border-radius: 50%; border: 4px solid var(--c-white); box-shadow: 0 0 0 2px #c6d9ea; cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 4px var(--c-navy); }
#pSave { margin-top: var(--space-4); }

/* ---- records ---- */
.rec-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: var(--space-3) 0 var(--space-2); }
.rec-tabs [role="tab"] { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 2px solid #c6d9ea; background: var(--c-white); color: var(--c-navy); font-size: 16px; font-weight: 800; cursor: pointer; }
.rec-tabs [aria-selected="true"] { background: var(--c-navy); border-color: var(--c-navy); color: var(--c-white); }
.rec-desc { margin: 0 0 var(--space-3); color: var(--c-ink); }
/* one board at a time with big arrows; the tabs become small dots */
.rec-cycle { display: flex; align-items: center; justify-content: center; gap: 12px; margin: var(--space-3) 0 var(--space-1); }
.rec-arrow { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--c-navy); color: var(--c-white); cursor: pointer; display: grid; place-items: center; }
.rec-arrow svg { width: 28px; height: 28px; }
.rec-arrow:active { transform: scale(0.94); }
.rec-name-big { flex: 1; max-width: 360px; margin: 0; font-size: 24px; font-weight: 900; color: var(--c-navy); }
.rec-tabs.dots { gap: 8px; margin: 0 0 var(--space-2); }
.rec-tabs.dots [role="tab"] { min-height: 0; width: 14px; height: 14px; padding: 0; border-radius: 50%; font-size: 0; overflow: hidden; }
.rec-rows ol { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; }
.rec-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px; margin-bottom: 6px; border-radius: 14px; background: var(--c-sky-light); color: var(--c-navy); font-size: 18px; font-weight: 700; text-align: left; }
.rec-row.me { background: #fff0c2; box-shadow: inset 0 0 0 3px var(--c-gold); }
.rec-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.rec-you { flex: none; padding: 2px 8px; border-radius: 999px; background: var(--c-navy); color: var(--c-white); font-size: 13px; font-weight: 800; }
.rec-val { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; }
.medal { flex: none; width: 22px; height: 22px; border-radius: 50%; }
.medal.gold { background: var(--c-gold); box-shadow: inset 0 0 0 3px #d68a00; }
.medal.silver { background: #d3dbe2; box-shadow: inset 0 0 0 3px #9aa8b4; }
.medal.bronze { background: #e3a56b; box-shadow: inset 0 0 0 3px #b8743a; }
.rec-empty { margin: var(--space-4) 0; font-weight: 700; color: var(--c-navy); }
.rec-foot { margin: var(--space-3) 0 0; font-size: 14px; color: var(--c-text); }
.news { margin: var(--space-2) 0 var(--space-3); padding: 8px 12px; border-radius: 14px; background: var(--c-sky-light); color: var(--c-navy); font-weight: 800; font-size: 18px; }
.news.best { background: #fff0c2; box-shadow: inset 0 0 0 3px var(--c-gold); }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(14, 60, 103, 0.35); display: flex; justify-content: center; align-items: center; padding: var(--space-3); overflow-y: auto; touch-action: pan-y; }
.modal-card { background: var(--c-white); border-radius: var(--r-xl); box-shadow: var(--shadow); width: 100%; max-width: 520px; padding: var(--space-4); text-align: center; animation: rise 0.25s ease-out; max-height: 100%; overflow-y: auto; }
.modal-card.wide { max-width: 860px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.modal-head h2 { margin: 0; font-size: 28px; }
.close { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid #c6d9ea; background: var(--c-white); color: var(--c-navy); font-weight: 800; font-size: 16px; cursor: pointer; }
.q-title { margin: 0; font-weight: 800; color: var(--c-moss-ink); font-size: 20px; }
.q-text { margin: 0; font-size: 56px; font-weight: 800; color: var(--c-navy); line-height: 1.1; }
.q-visual, .q-hint-visual { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: var(--space-2) auto; max-width: 420px; }
.q-visual:empty { display: none; }
.q-pic { width: min(240px, 56vw); aspect-ratio: 1; border-radius: 16px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18); background: #dff0fb; object-fit: cover; }
.egg-dot { width: 26px; height: 33px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: #f6efd9; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.08), 0 0 0 2px #e3cf9c; }
.egg-dot.b { background: #bfe9c9; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.08), 0 0 0 2px #6cbf86; }
.egg-dot.gone { opacity: 0.3; }
.egg-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.q-plus { font-size: 32px; font-weight: 800; color: var(--c-navy); margin: 0 6px; }
.dot-grid { display: grid; gap: 3px; justify-content: center; margin: 6px auto; }
.dot-grid span { width: 12px; height: 12px; border-radius: 50%; background: var(--c-blue); }
.dot-grid span.gone { background: #d6e3ee; }
.dot-group { display: flex; gap: 3px; padding: 3px 5px; border-radius: 999px; background: var(--c-sky-light); }
.q-hint { margin: 4px 0; font-weight: 700; color: var(--c-moss-ink); font-size: 18px; }
.q-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
.choice { min-height: 72px; border-radius: var(--r-xl); border: 3px solid #c6d9ea; background: var(--c-sky-light); color: var(--c-navy); font-size: 34px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 #c6d9ea; }
.choice:active { transform: translateY(2px); box-shadow: 0 2px 0 #c6d9ea; }
.choice.tried { opacity: 0.4; }
.choice.right { background: #e3f3c0; border-color: var(--c-moss); color: var(--c-moss-ink); }
.choice.glow { animation: glow 1.1s ease-in-out infinite; border-color: var(--c-gold); }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(245, 184, 46, 0.45); } }
.q-feedback { min-height: 30px; margin: var(--space-3) 0 0; font-weight: 800; font-size: 22px; color: var(--c-navy); }

.reveal-card canvas { width: 180px; height: 180px; display: block; margin: var(--space-2) auto; }
.reveal-card h2 { font-size: 36px; margin: 0; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.bcard { background: var(--c-sky-light); border-radius: var(--r-lg); padding: var(--space-2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bcard canvas { width: 96px; height: 96px; }
.bcard.shiny { box-shadow: inset 0 0 0 3px #ffc21a; background: #fff6d6; }
.reveal-card.shiny canvas { border-radius: 50%; box-shadow: 0 0 0 6px #ffc21a, 0 0 32px 12px rgba(255, 194, 26, 0.8); animation: twinkle 1.1s ease-in-out infinite; }
.bcard .bname { font-weight: 800; color: var(--c-navy); font-size: 17px; line-height: 1.1; }
.bcard .bcount { font-size: 14px; }
.shop-item { background: var(--c-sky-light); border-radius: var(--r-lg); padding: var(--space-3) var(--space-4); margin-top: var(--space-3); }
.shop-item.locked { background: #eef1f4; }
.shop-name { font-size: 24px; font-weight: 800; color: var(--c-navy); margin: 0; }
.shop-item p { margin: 4px 0; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 22px; text-align: center; padding: 20px; color: var(--c-navy); }

/* Narrower screens: buttons on the first row, player/coins/speed on the second, goal on the third. */
@media (max-width: 900px) {
  .hud-left { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); right: var(--space-3); max-width: none; gap: 6px; }
  .hud-goal { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 102px); font-size: 16px; white-space: normal; padding: 4px 14px; }
}
@media (max-width: 720px) {
  .icon-btn { width: 46px; height: 46px; }
  .icon-btn svg { width: 24px; height: 24px; }
  .hud-right { gap: 6px; }
  .hud-left { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 54px); }
  .chip { font-size: 16px; min-height: 36px; padding: 0 12px 0 6px; }
  .chip .lbl { display: none; }
  .chip.who #hudName { max-width: 130px; }
  .start-name { width: 270px; height: 29px; }
  .rec-row { font-size: 16px; padding: 6px 10px; gap: 8px; }
  .rec-tabs [role="tab"] { font-size: 15px; padding: 0 12px; }
  .btn-surprise { padding: 0 12px; font-size: 16px; }
  .swatch { width: 46px; height: 46px; }
  .levels { grid-template-columns: 1fr; }
  .level { min-height: 0; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; padding: var(--space-2) var(--space-3); }
  .level .lv-sample { font-size: 20px; }
  .q-text { font-size: 46px; }
  .choice { font-size: 30px; min-height: 66px; }
  .toast { font-size: 17px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .bcard canvas { width: 76px; height: 76px; }
}
@media (max-width: 420px) {
  .icon-btn { width: 44px; height: 44px; }
  .hud-right { gap: 5px; }
}
@media (max-height: 520px) {
  .q-text { font-size: 38px; }
  .choice { min-height: 54px; }
  .modal-card { padding: var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .modal-card, .coin-pop.go, .reveal-card.perfect canvas { animation: none; }
  .coin-pop.go { opacity: 1; }
  .choice.glow { animation: none; box-shadow: 0 0 0 6px rgba(245, 184, 46, 0.45); }
}

/* ---- fights ---- */
.fight-hud { position: absolute; left: 50%; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 70px); transform: translateX(-50%); width: min(520px, calc(100% - 24px)); background: rgba(255, 255, 255, 0.95); border-radius: var(--r-lg); padding: 8px 14px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.fbar { display: flex; flex-direction: column; gap: 3px; }
.fname { font-weight: 800; color: var(--c-navy); font-size: 16px; }
.fbar.boss { text-align: right; }
.fbar .bar { height: 14px; }
.fbar.me .bar i { background: #3fae5a; }
.fbar.boss .bar i { background: #e0609a; margin-left: auto; }
.fight-hint { grid-column: 1 / -1; margin: 2px 0 0; text-align: center; font-weight: 700; font-size: 15px; color: var(--c-text); }
.boss-alert { position: fixed; left: 0; top: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 800 46px/1 var(--font-display); color: #ffffff; background: #f08a2b; box-shadow: 0 0 0 5px #ffffff, var(--shadow); pointer-events: none; z-index: 4; animation: alertpulse 0.5s ease-in-out infinite alternate; }
@keyframes alertpulse { to { box-shadow: 0 0 0 9px #ffffff, 0 0 24px 8px rgba(240, 138, 43, 0.7); } }
.bop-pop { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 4; font: 800 30px/1 var(--font-display); color: #ffffff; -webkit-text-stroke: 2px #e0609a; text-shadow: 0 3px 0 #e0609a; white-space: nowrap; }
.bop-pop.go { animation: boprise 0.6s ease-out forwards; }
@keyframes boprise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -40px; } }

/* ---- items (potion, smoke bomb) ---- */
.items { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 3; }
.item-btn { position: relative; width: 74px; min-height: 74px; border-radius: 20px; border: 3px solid #ffffff; background: rgba(255, 255, 255, 0.92); color: var(--c-navy); font-weight: 800; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; box-shadow: var(--shadow); touch-action: none; padding: 4px; }
.item-btn[hidden] { display: none; }
.item-btn .ico { width: 30px; height: 30px; border-radius: 50% 50% 45% 45%; }
.item-btn.potion .ico { background: radial-gradient(circle at 40% 35%, #ffd6ec, #e0609a 70%); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12); }
.item-btn.smoke .ico { background: radial-gradient(circle at 40% 35%, #ffffff, #aab4c0 70%); border-radius: 50%; }
.item-btn .badge { position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; border-radius: 999px; background: var(--c-navy); color: #ffffff; font-size: 15px; display: grid; place-items: center; padding: 0 6px; }
.item-btn.pulse { animation: itempulse 0.8s ease-in-out infinite alternate; border-color: var(--c-gold); }
@keyframes itempulse { to { box-shadow: 0 0 0 8px rgba(245, 184, 46, 0.55), var(--shadow); transform: scale(1.06); } }
body.touch-mode .items { top: auto; bottom: calc(264px + env(safe-area-inset-bottom)); transform: none; flex-direction: row; }

/* ---- the shop panel on the left edge ---- */
.shop-panel { position: fixed; left: max(12px, env(safe-area-inset-left)); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 54px); width: 262px; max-height: calc(100% - 140px); display: flex; flex-direction: column; z-index: 3; background: rgba(255, 255, 255, 0.96); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.shop-panel.closed { width: auto; }
.shop-tab { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; border: 0; background: var(--c-navy); color: #ffffff; padding: 0 14px; font-weight: 800; font-size: 18px; cursor: pointer; text-align: left; }
.shop-tab::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 3px solid #ffffff; border-bottom: 3px solid #ffffff; transform: rotate(-135deg); margin-top: 5px; }
.shop-panel.closed .shop-tab::after { transform: rotate(45deg); margin-top: -5px; }
.shop-timer { font-size: 13px; font-weight: 700; opacity: 0.9; }
.shop-body { overflow-y: auto; padding: 8px 10px 10px; touch-action: pan-y; }
.shop-panel.closed .shop-body { display: none; }
.shop-h { margin: 10px 0 4px; font-weight: 800; color: var(--c-navy); font-size: 15px; }
.sitem { display: grid; grid-template-columns: 8px 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 8px 6px 0; border-radius: 12px; background: var(--c-sky-light); margin-bottom: 6px; overflow: hidden; }
.sitem .stripe { grid-row: 1 / span 4; align-self: stretch; box-shadow: inset 0 0 0 1px rgba(14, 60, 103, 0.2); }
.sitem .sname { font-weight: 800; color: var(--c-navy); font-size: 15px; line-height: 1.15; }
.sitem .sstat { font-size: 13px; color: var(--c-text); line-height: 1.2; }
.sitem .scmp { font-size: 13px; font-weight: 800; color: #2f8c48; }
.sitem .scmp.worse { color: var(--c-text); font-weight: 700; }
.sitem button { grid-column: 3; grid-row: 1 / span 4; min-width: 64px; min-height: 40px; border-radius: 12px; border: 0; background: var(--c-blue); color: #ffffff; font-weight: 800; font-size: 14px; cursor: pointer; padding: 0 8px; line-height: 1.1; }
.sitem button:disabled { background: #c6d3df; color: #5b6b7a; cursor: default; }
.sitem.sold { opacity: 0.55; }
.dur { height: 7px; border-radius: 999px; background: #dfe7ee; overflow: hidden; margin-top: 2px; }
.dur i { display: block; height: 100%; background: #3fae5a; border-radius: 999px; }
.dur.low i { background: #f5b82e; }
.dur.out i { background: #e0609a; }
.shop-note { margin: 6px 0 0; font-size: 13px; color: var(--c-text); }
@media (max-width: 900px) {
  .shop-panel { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 166px); max-height: calc(100% - 346px); min-height: 0; }
  .fight-hud { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 102px); }
}
@media (max-width: 520px) {
  .shop-panel { width: calc(100% - 24px); max-width: 320px; z-index: 4; }
  .shop-panel.closed { width: auto; }
  .shop-tab { font-size: 16px; min-height: 40px; }
  .fbar .fname { font-size: 14px; }
  .item-btn { width: 64px; min-height: 64px; }
}

/* ---- challenge prompt and the fairy's moment ---- */
.power-row { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin: var(--space-3) 0; }
.power { display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--c-sky-light); color: var(--c-navy); font-weight: 700; }
.power b { font-size: 40px; font-weight: 800; line-height: 1.1; }
.power.boss { background: #fde3ef; }
.vs { font-weight: 800; font-size: 22px; color: var(--c-text); }
.btn-row { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: var(--space-3); }
.fairy-card p { font-size: 18px; color: var(--c-ink); margin: 8px 0; }
.fairy-card .fm-tip { background: #fff7d6; border-radius: 14px; padding: 10px 12px; color: var(--c-navy); font-weight: 700; }
.fairy-pic { display: block; width: 76px; height: 76px; margin: 0 auto 4px; border-radius: 50%; background: radial-gradient(circle at 45% 40%, #ffffff, #ffe27a 45%, rgba(255, 179, 217, 0.6) 70%, rgba(255, 255, 255, 0) 72%); position: relative; animation: fairybob 2s ease-in-out infinite alternate; }
.fairy-pic i { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #ffe2c9; box-shadow: -22px -6px 0 -4px #d6f1ff, 22px -6px 0 -4px #d6f1ff; }
@keyframes fairybob { to { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .boss-alert, .item-btn.pulse, .fairy-pic, .bop-pop.go { animation: none; }
  .bop-pop.go { opacity: 1; }
}

/* Fight HUD (owner): health bars in the top-left (player) and top-right (boss), the hint in the middle. */
.fight-hud { position: absolute; inset: 0; transform: none; width: auto; background: none; box-shadow: none; padding: 0; display: block; pointer-events: none; }
.fight-hud .fbar { position: absolute; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); width: min(300px, 42vw); background: rgba(255, 255, 255, 0.95); border-radius: var(--r-lg); padding: 6px 12px; box-shadow: var(--shadow); }
.fight-hud .fbar.me { left: max(10px, env(safe-area-inset-left)); }
.fight-hud .fbar.boss { right: max(10px, env(safe-area-inset-right)); }
.fight-hud .fbar .bar { height: 16px; }
.fight-hud .fight-hint { position: absolute; left: 50%; transform: translateX(-50%); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 122px); width: max-content; max-width: min(560px, calc(100% - 24px)); background: rgba(255, 255, 255, 0.9); border-radius: var(--r-lg); padding: 5px 12px; font-size: 14px; }
@media (max-width: 520px) {
  .fight-hud .fbar { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); width: 44vw; padding: 5px 9px; }
  .fight-hud .fight-hint { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 112px); font-size: 13px; }
}
.fight-hud .hearts { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.fight-hud .heart { width: 22px; height: 22px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.15)); }
@media (max-width: 520px) { .fight-hud .heart { width: 17px; height: 17px; } }
.fight-hud .fbar.boss { width: auto; max-width: 44vw; }
.fight-hud .fmood { font-weight: 700; font-size: 14px; color: #b8395a; }

/* ---- HUD layout (owner): fairy hints top-left, weapon + coins top-centre, hearts top-right ---- */
.hud-left { left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); justify-content: center; flex-wrap: nowrap; }
.chip.weapon { padding-left: 6px; }
.chip.weapon .wicon { width: 28px; height: 28px; display: inline-flex; color: #c9ced6; }
.chip.weapon .wicon svg { width: 100%; height: 100%; }
.hud-hearts { position: absolute; right: var(--space-3); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 60px); max-width: min(300px, 40vw); justify-content: flex-end; background: rgba(255, 255, 255, 0.9); border-radius: var(--r-lg); padding: 4px 8px; box-shadow: var(--shadow); }
.hearts { display: flex; flex-wrap: wrap; gap: 2px; }
/* hearts grow with gear levels (2026-11-08): a long row gets smaller hearts */
.hearts.many .heart { width: 15px; height: 15px; }
.heart { width: 22px; height: 22px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.15)); }
.toast { position: fixed; max-width: min(340px, calc(100vw - 24px)); padding-left: 48px; min-height: 44px; }
.toast::before { width: 26px; height: 26px; margin-top: -13px; left: 12px; }
.hud-left { right: auto; }
/* fight: boss name + mood in the centre under the chips, controls hint under it */
.fight-hud .fbar.boss { position: absolute; left: 50%; right: auto; transform: translateX(-50%); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); width: max-content; max-width: calc(100% - 24px); text-align: center; flex-direction: row; gap: 8px; align-items: baseline; padding: 5px 14px; }
.fight-hud .fight-hint { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 100px); }
@media (min-width: 901px) {
  .fight-hud .fbar.boss, .fight-hud .fight-hint { max-width: calc(100% - 760px); min-width: 220px; }
}
@media (max-width: 900px) {
  .hud-left { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); }
  .hud-hearts { left: var(--space-3); right: auto; top: max(var(--space-3), env(safe-area-inset-top)); max-width: calc(100% - 250px); justify-content: flex-start; }
  .fight-hud .fbar.boss { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 104px); }
  .fight-hud .fight-hint { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 196px); }
}
@media (max-width: 520px) {
  .heart { width: 17px; height: 17px; }
  .chip.who { display: none; }
  .hud-hearts { max-width: calc(100% - 214px); }
}

/* ---- gear + backpack (owner 2026-11-08): buttons under the hearts, panel on the right ---- */
.hud-dock { position: absolute; right: var(--space-3); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 104px); display: flex; gap: 8px; pointer-events: auto; }
.bag-panel { position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 160px); width: 280px; max-height: calc(100% - 200px); display: flex; flex-direction: column; z-index: 4; background: rgba(255, 255, 255, 0.97); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.bag-panel[hidden] { display: none; }
.bag-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 0; }
.bag-tabs { display: flex; gap: 4px; }
.bag-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: #eef2f7; color: var(--c-navy); font-weight: 800; font-size: 15px; border-radius: 12px; padding: 6px 10px; cursor: pointer; }
.bag-tabs button svg { width: 20px; height: 20px; }
.bag-tabs button[aria-selected="true"] { background: var(--c-navy); color: #fff; }
.bag-close { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--c-navy); cursor: pointer; padding: 2px 8px; }
.bag-body { overflow: auto; padding: 8px 10px 10px; }
.bag-body[hidden] { display: none; }
.bag-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eef2f7; }
.bag-ico svg { width: 38px; height: 38px; }
.bag-txt small { display: block; color: var(--c-text); font-size: 13px; line-height: 1.25; }
.bag-n { font-weight: 800; color: #b8395a; }
.btn-use { border: 0; border-radius: 10px; background: var(--c-navy); color: #fff; font-weight: 800; padding: 6px 12px; cursor: pointer; }
.btn-use:disabled { opacity: 0.4; cursor: default; }
.item-btn .ico { width: 34px; height: 34px; border-radius: 0; background: none !important; box-shadow: none !important; }
.item-btn .ico svg { width: 100%; height: 100%; }
.shop-panel { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 118px); max-height: calc(100% - 200px); }
@media (max-width: 900px) {
  .hud-dock { flex-direction: column; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 58px); }
  .bag-panel { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 60px); right: 64px; width: min(280px, calc(100% - 80px)); }
}
.bag-n { white-space: nowrap; }
@media (min-width: 901px) { .shop-panel { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 150px); max-height: calc(100% - 170px); } }
@media (max-width: 900px) { .bag-panel { z-index: 6; } }

/* ---- the pen list (owner 2026-11-08) ---- */
.pen-full { background: #ffe1ea; color: #8a1f40; font-weight: 700; border-radius: 12px; padding: 8px 12px; margin: 4px 0 8px; }
.pen-space { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #eef6ff; border-radius: 12px; padding: 8px 12px; margin: 6px 0 10px; font-weight: 700; color: var(--c-navy); }
.pen-list { display: flex; flex-direction: column; gap: 6px; max-height: min(56vh, 520px); overflow: auto; }
.pen-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; background: #f7f9fc; border-radius: 14px; padding: 6px 10px 6px 6px; }
.pen-row.resting { opacity: 0.6; }
.pen-row canvas { width: 64px; height: 64px; border-radius: 12px; background: #fff; }
.pen-txt b { display: block; font-size: 18px; color: var(--c-navy); }
.pen-txt .tag { display: inline-block; font-size: 13px; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin: 2px 0; }
.pen-txt small { display: block; font-size: 14px; font-weight: 700; color: #2f7a3f; }
.pen-row.resting small { color: #8a1f40; }
.pen-sell { background: #e8edf4; color: var(--c-navy); white-space: nowrap; }
.pen-btns { display: flex; flex-direction: column; gap: 4px; }
.pen-zoo { background: #2fa58c; color: #fff; white-space: nowrap; }
.pen-zoo:disabled { opacity: 0.5; }
.pen-tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 var(--space-2); }
.pen-tabs [role="tab"] { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 2px solid #c6d9ea; background: #fff; color: var(--c-navy); font-size: 17px; font-weight: 800; cursor: pointer; }
.pen-tabs [aria-selected="true"] { background: #2fa58c; border-color: #2fa58c; color: #fff; }
.zoo-h { margin: var(--space-2) 0 4px; font-size: 19px; color: var(--c-navy); }
.zoo-decor { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: var(--space-2); }
.zoo-decor button { min-height: 56px; border-radius: 14px; border: 0; background: #e8f6f1; color: var(--c-navy); font-weight: 800; font-size: 15px; cursor: pointer; padding: 4px 8px; }
.zoo-decor button small { display: block; font-weight: 700; color: #2f7a3f; }
.zoo-decor button:disabled { opacity: 0.55; cursor: default; }
.pen-sell.sure { background: #b8395a; color: #fff; }
.pen-txt { text-align: left; } .pen-space { text-align: left; } .pen-full { text-align: left; }

/* ---- picture explanations (owner 2026-11-08) ---- */
.q-how { background: #f3faf2; border: 2px solid #bfe3c4; border-radius: 16px; padding: 10px 12px; margin: 8px 0; }
.q-how[hidden] { display: none; }
.q-how-pic { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.q-how-say { font-weight: 700; color: #22553a; font-size: 17px; margin: 8px 0 4px; line-height: 1.35; }
.q-how-next { margin-top: 4px; font-size: 18px; padding: 10px 22px; }
#qHow { margin-top: 6px; }
#qHow[hidden] { display: none; }
.how-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.how-cell small { font-weight: 800; font-size: 13px; color: #33445a; }
.egg-dot.crossed { position: relative; }
.egg-dot.crossed::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 3px; background: #e0609a; transform: rotate(-35deg); border-radius: 2px; }
.how-grid { display: flex; flex-direction: column; gap: 3px; }
.how-grid-row { display: flex; align-items: center; gap: 3px; }
.how-grid-row b { margin-left: 8px; font-size: 14px; color: #3d8fe0; min-width: 26px; }
.how-dot { width: 12px; height: 12px; border-radius: 50%; background: #37a7e9; display: inline-block; }
.how-dot.egg { width: 13px; height: 16px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: #f6efd9; box-shadow: 0 0 0 2px #e3cf9c; }
.how-nests { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.how-nest { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; max-width: 90px; padding: 8px 10px; border-radius: 40% 40% 50% 50%; background: #c99a5e; box-shadow: inset 0 -5px 0 rgba(0,0,0,.15); position: relative; }
.how-nest b { position: absolute; bottom: -10px; right: -6px; background: #fff; color: #7a4b2a; border-radius: 999px; padding: 0 6px; font-size: 13px; box-shadow: var(--shadow); }
.ruler-svg { max-width: 380px; }

/* ---- number pad (owner 2026-11-08: typed answers) ---- */
.q-entry { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 64px; margin: 6px auto; padding: 4px 18px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 3px #cfe0f2; max-width: 220px; }
.q-typed { font-size: 46px; font-weight: 800; color: var(--c-navy); letter-spacing: 2px; }
.q-unit { font-size: 20px; font-weight: 700; color: #5d7590; }
.q-entry.right { box-shadow: inset 0 0 0 3px #3fae5a; background: #ecf9ee; }
.q-entry.fix { box-shadow: inset 0 0 0 3px #f5b82e; background: #fff8e1; }
.q-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 6px auto; }
.pad-key { min-height: 58px; border-radius: 14px; border: 0; background: #e7f1fb; color: var(--c-navy); font-size: 28px; font-weight: 800; box-shadow: 0 4px 0 #c3d6ea; cursor: pointer; touch-action: manipulation; }
.pad-key:active { transform: translateY(2px); box-shadow: 0 2px 0 #c3d6ea; }
.pad-key.back { background: #f1f3f6; font-size: 24px; }
.pad-key.check { background: var(--c-navy); color: #fff; font-size: 20px; box-shadow: 0 4px 0 #07243f; }
.pad-key:disabled { opacity: 0.5; }
@media (max-height: 700px) { .pad-key { min-height: 46px; font-size: 24px; } .q-typed { font-size: 38px; } .q-entry { min-height: 52px; } }
/* ---- treasure chest ---- */
.chest-card { text-align: center; max-width: 380px; }
.chest-art { position: relative; width: 150px; margin: 0 auto 4px; }
.chest-art svg { position: relative; z-index: 1; width: 150px; animation: chestpop 0.6s ease-out; }
.chest-glow { position: absolute; inset: -30px; border-radius: 50%; z-index: 0; }
.chest-item { font-size: 24px; font-weight: 800; margin: 4px 0; }
.chest-cmp { font-weight: 700; color: #2f7a3f; }
.chest-btns { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
@keyframes chestpop { 0% { transform: scale(0.6) rotate(-6deg); } 60% { transform: scale(1.08) rotate(3deg); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .chest-art svg { animation: none; } }

/* ---- Diablo-style equipment + backpack (owner 2026-11-08) ---- */
.bag-title { margin: 4px 8px; font-size: 18px; color: var(--c-navy); }
.bag-tabs[hidden] { display: none; }
.bag-panel { width: 300px; }
.doll, .inv { background: linear-gradient(#3a302a, #241d19); border: 3px solid #8a6a3a; border-radius: 12px; box-shadow: inset 0 0 0 2px #1a1411, inset 0 0 24px rgba(0,0,0,.5); }
.doll { position: relative; display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 76px); grid-template-areas: ". hat ." "weapon body charm" ". boots ."; justify-content: center; gap: 6px; padding: 10px 6px; }
.doll-penny { position: absolute; left: 50%; top: 8px; height: calc(100% - 16px); transform: translateX(-50%); opacity: .9; pointer-events: none; }
.da-hat { grid-area: hat; } .da-weapon { grid-area: weapon; } .da-body { grid-area: body; } .da-charm { grid-area: charm; } .da-boots { grid-area: boots; }
.doll > div { display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.dslot { position: relative; width: 64px; height: 64px; border-radius: 8px; border: 2px solid #5a4a3a; background: rgba(16, 12, 10, .85); color: #6b5b4d; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; cursor: pointer; touch-action: manipulation; }
.dslot.has { border-color: var(--tc, #c9a24a); color: var(--tc, #c9a24a); box-shadow: inset 0 0 14px color-mix(in srgb, var(--tc, #c9a24a) 35%, transparent); }
.dslot.supply { --tc: #ff7aa2; }
.dslot .dico svg { width: 38px; height: 38px; display: block; }
.dslot small { font-size: 11px; font-weight: 700; color: #8a7a6a; }
.dslot:not(.has) .dico { opacity: .35; }
.dslot.sel { outline: 3px solid #ffd23f; outline-offset: 1px; }
.dslot.low { background: rgba(80, 64, 10, .85); }
.dslot.out { background: rgba(110, 18, 24, .88); }
.dslot.out .dico { opacity: .6; }
.dslot .dn { position: absolute; right: 3px; bottom: 1px; font-size: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
/* item level badge (Diablo-style gear levels, 2026-11-08) */
.dslot .dlv { position: absolute; left: 3px; top: 1px; font-size: 11px; line-height: 1; color: #fff; background: rgba(0, 0, 0, .55); border-radius: 4px; padding: 1px 3px; }
.dname .dlvt { font-size: .75em; color: #e9dcc6; font-weight: 600; }
.dslot.empty { cursor: default; }
.dbar { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 5px; border-radius: 3px; background: #1a1411; overflow: hidden; }
.dbar i { display: block; height: 100%; background: #4cc96a; }
.dbar.low i { background: #f5c22e; }
.dbar.out i { background: #e0303a; }
.inv { display: grid; grid-template-columns: repeat(4, 60px); gap: 5px; justify-content: center; padding: 8px; }
.inv .dslot { width: 60px; height: 60px; }
.dinfo { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #241d19; color: #e8dcc8; border: 2px solid #8a6a3a; }
.dname { display: block; font-size: 17px; color: #fff; }
.dline { display: block; font-size: 14px; line-height: 1.3; }
.dur-line.low { color: #f5c22e; } .dur-line.out { color: #ff6a6a; font-weight: 700; }
.dline.cmp { color: #7fe08e; font-weight: 700; } .dline.cmp.worse { color: #c8b8a8; font-weight: 400; }
.dbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dbtns button { flex: 1 1 auto; min-height: 40px; border-radius: 10px; border: 0; background: #e7d3a6; color: #2b2018; font-weight: 800; font-size: 15px; cursor: pointer; }
.dbtns button:disabled { opacity: .45; cursor: default; }
.dbtns .sell { background: #ffd23f; }
.dbtns .sell.ask { background: #ff9a3c; color: #fff; }
.dhint { font-size: 14px; color: var(--c-text); margin: 8px 2px 0; }
@media (max-width: 900px) { .bag-panel { width: min(300px, calc(100% - 80px)); } .doll { grid-template-columns: repeat(3, 66px); grid-template-rows: repeat(3, 70px); } .dslot { width: 60px; height: 60px; } .inv { grid-template-columns: repeat(4, 54px); } .inv .dslot { width: 54px; height: 54px; } }

/* boomerang button (fights only) */
.tbtn.boom { background: #8a5a2e; width: 66px; height: 66px; margin-right: 150px; margin-bottom: -40px; display: flex; align-items: center; justify-content: center; }
.tbtn.boom[hidden] { display: none; }
.tbtn.boom svg { width: 38px; height: 38px; }
.tbtn.boom.cool { opacity: .45; }

/* ---- zone teachers (owner 2026-11-08) ---- */
.teacher-card { text-align: center; max-width: 460px; }
.t-pic svg { display: block; margin: 0 auto; }
.t-method { font-weight: 700; color: #7a4b2a; background: #fff4df; border-radius: 12px; padding: 6px 10px; }
.t-lesson { background: #f3faf2; border: 2px solid #bfe3c4; border-radius: 16px; padding: 8px 10px; margin: 8px 0 12px; }
.t-example { font-weight: 800; font-size: 20px; color: var(--c-navy); margin: 2px 0 6px; }
.q-how-who { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 4px; color: #7a4b2a; }
.tf-svg { max-width: 300px; }
.nl-svg { max-width: 400px; }

/* ---- parkour run clock (owner 2026-11-08) ---- */
.course-clock { position: absolute; left: 50%; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 106px); transform: translateX(-50%); background: #f5b82e; color: var(--c-navy); font-weight: 800; font-size: 22px; padding: 4px 16px; border-radius: 999px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.course-clock.done { background: #3fae5a; color: #ffffff; }
@media (max-width: 640px) { .course-clock { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 150px); font-size: 18px; } }

/* math gates open the question box over the pen */
#question { z-index: 25; }

/* ---- epic challenge fight (owner 2026-11-08: "more epic, full screen" vs a catch fight) ---- */
.letterbox { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity 0.4s; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(20, 8, 40, 0.55) 100%); }
.letterbox::before, .letterbox::after { content: ''; position: absolute; left: 0; right: 0; height: 6vh; background: #0b0716; transition: transform 0.45s ease-out; }
.letterbox::before { top: 0; transform: translateY(-100%); }
.letterbox::after { bottom: 0; transform: translateY(100%); }
body.epic-fight .letterbox { opacity: 1; }
body.epic-fight .letterbox::before, body.epic-fight .letterbox::after { transform: none; }
body.epic-fight .hud-left, body.epic-fight .hud-right, body.epic-fight .hud-goal { display: none !important; }
/* in any fight only the gear and backpack buttons stay, to swap out or repair broken gear (owner 2026-11-10) */
body.fighting #hudDock > :not(#btnGear):not(#btnBag) { display: none !important; }
body.epic-fight .fight-hud .fbar.boss { left: 50%; right: auto; transform: translateX(-50%); top: calc(6vh + 8px); width: min(560px, 90vw); max-width: none; text-align: center; background: linear-gradient(90deg, #2a0f3d, #5b1f4f, #2a0f3d); color: #fff4d6; border: 2px solid #f5b82e; }
body.epic-fight .fight-hud .fbar.boss .fname { font-size: 26px; letter-spacing: 2px; text-transform: uppercase; color: #ffd86b; text-shadow: 0 2px 0 #000; }
body.epic-fight .fight-hud .fmood { color: #ffd0e2; }
body.epic-fight .hud-hearts { top: calc(6vh + 84px); right: max(10px, env(safe-area-inset-right)); left: auto; justify-content: flex-end; }
body.epic-fight .fight-hud .fight-hint { top: calc(6vh + 84px); }
body.epic-fight.flash .letterbox { background: radial-gradient(ellipse at center, rgba(255, 60, 60, 0.15) 30%, rgba(160, 0, 30, 0.6) 100%); }
.vs-splash { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: linear-gradient(115deg, #13306b 0 49.6%, #f5b82e 49.6% 50.4%, #5b1f4f 50.4% 100%); color: #ffffff; overflow: hidden; pointer-events: none; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; }
.vs-side b { font-size: clamp(30px, 6vw, 64px); letter-spacing: 2px; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.vs-side small { font-size: clamp(14px, 2vw, 20px); font-weight: 700; opacity: 0.9; text-align: center; }
.vs-pic svg { width: clamp(120px, 22vw, 240px); height: auto; filter: drop-shadow(0 8px 0 rgba(0,0,0,0.3)); }
.vs-mid { justify-self: center; text-align: center; font-size: clamp(60px, 12vw, 150px); font-weight: 900; color: #ffd86b; text-shadow: 0 6px 0 #a3410b, 0 0 30px rgba(255, 216, 107, 0.8); font-style: italic; }
.vs-count { position: absolute; left: 0; right: 0; bottom: 10vh; text-align: center; font-size: clamp(48px, 10vw, 110px); font-weight: 900; color: #ffffff; text-shadow: 0 5px 0 #13306b; }
.vs-splash.go .vs-side.me { animation: vsin-l 0.45s cubic-bezier(.2,1.4,.4,1) both; }
.vs-splash.go .vs-side.boss { animation: vsin-r 0.45s cubic-bezier(.2,1.4,.4,1) 0.15s both; }
.vs-splash.go .vs-mid { animation: vspop 0.5s cubic-bezier(.2,1.6,.4,1) 0.45s both, vsshake 0.12s linear 1s 4; }
.vs-splash.go .vs-count.pop { animation: vspop 0.35s cubic-bezier(.2,1.6,.4,1) both; }
.vs-splash.out { animation: vsout 0.35s ease-in forwards; }
@keyframes vsin-l { from { transform: translateX(-60vw); } }
@keyframes vsin-r { from { transform: translateX(60vw); } }
@keyframes vspop { from { transform: scale(3); opacity: 0; } }
@keyframes vsshake { 50% { transform: translate(4px, -3px) rotate(-2deg); } }
@keyframes vsout { to { opacity: 0; transform: scale(1.15); } }
@media (max-width: 640px) { .vs-splash { grid-template-columns: 1fr; grid-template-rows: 1fr auto 1fr; background: linear-gradient(170deg, #13306b 0 49.4%, #f5b82e 49.4% 50.6%, #5b1f4f 50.6% 100%); } .vs-count { bottom: 4vh; } }
.epic-banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 30; pointer-events: none; font-size: clamp(36px, 8vw, 92px); font-weight: 900; font-style: italic; color: #ffd86b; text-shadow: 0 5px 0 #a3410b, 0 0 24px rgba(0,0,0,0.5); white-space: nowrap; text-align: center; }
.epic-banner small { display: block; font-size: 0.32em; font-style: normal; color: #ffffff; text-shadow: 0 2px 0 #13306b; white-space: normal; }
.epic-banner.go { animation: vspop 0.45s cubic-bezier(.2,1.6,.4,1) both; }
/* the race results (owner 2026-11-13: "when finishing a race, should show on screen ranking, flags and fireworks") */
.race-results { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 31; width: min(440px, 92vw); padding: 14px 18px 16px; background: #fffaf0; border: var(--toon-line); border-radius: 22px; box-shadow: 0 6px 0 var(--toon-ink), 0 0 40px rgba(0,0,0,0.35); text-align: center; font-family: var(--font-display); pointer-events: auto; animation: vspop 0.45s cubic-bezier(.2,1.6,.4,1) both; }
.race-results[hidden] { display: none; }
.race-results .rr-title { font-size: clamp(30px, 7vw, 48px); font-weight: 900; font-style: italic; color: #ffd86b; text-shadow: 0 4px 0 #a3410b; white-space: nowrap; }
.race-results .rr-track { color: #13306b; font-weight: 800; font-size: 15px; margin: 2px 0 8px; }
.race-results ol { list-style: none; margin: 0 0 8px; padding: 0; }
.race-results li { display: flex; align-items: center; gap: 10px; padding: 5px 10px; margin: 4px 0; border-radius: 12px; background: #eef4ff; color: #13306b; font-weight: 800; font-size: 17px; }
.race-results li.me { background: #ffe58a; box-shadow: inset 0 0 0 3px #ffb627; }
.race-results .rr-pl { width: 2.6em; text-align: left; }
.race-results .rr-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #13306b; flex: none; }
.race-results .rr-name { flex: 1; text-align: left; }
.race-results .rr-t { font-variant-numeric: tabular-nums; }
.fx-coins { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 32; pointer-events: none; }
.race-results .rr-prize { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 2px; font-size: clamp(34px, 8vw, 54px); font-weight: 900; color: #ffd23f; text-shadow: 0 4px 0 #a3650b, 0 0 18px rgba(255, 190, 40, 0.8); animation: rrpulse 0.7s ease-in-out infinite alternate; }
.race-results .rr-coin { width: 0.8em; height: 0.8em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c0 0 18%, #ffd23f 20% 62%, #e8a417 64%); border: 3px solid #a3650b; flex: none; }
@keyframes rrpulse { from { transform: scale(1); } to { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .race-results .rr-prize { animation: none; } }
.race-results .rr-note { color: #2f7a3a; font-weight: 800; font-size: 16px; min-height: 1.2em; }
.race-results button { margin-top: 8px; }
/* a waving checkered flag on a pole (the race's final lap) */
.cflag { display: inline-block; position: relative; width: 1.1em; height: 0.75em; margin: 0 0.25em; vertical-align: 0.05em; border: 3px solid #13306b; border-radius: 4px;
  background: repeating-conic-gradient(#13306b 0 25%, #ffffff 0 50%) 0 0 / 0.25em 0.25em; transform-origin: left center; animation: cflag-wave 0.5s ease-in-out infinite alternate; }
.cflag::before { content: ''; position: absolute; left: -0.12em; top: -3px; width: 0.08em; height: 1.35em; background: #5a3a1a; border-radius: 2px; }
@keyframes cflag-wave { from { transform: skewY(-6deg) scaleX(1); } to { transform: skewY(6deg) scaleX(0.92); } }
@media (prefers-reduced-motion: reduce) { .cflag { animation: none; } }
@media (prefers-reduced-motion: reduce) { .vs-splash.go *, .vs-splash.out, .epic-banner.go { animation: none !important; } .letterbox::before, .letterbox::after { transition: none; } }
@media (max-width: 640px) { body.epic-fight .fight-hud .fight-hint { top: calc(6vh + 128px); } body.epic-fight .fight-hud .fbar.boss .fname { font-size: 22px; } }
.course-clock.luck { background: linear-gradient(90deg, #8455c9, #d9730b); color: #ffffff; }
.item-btn .key { position: absolute; left: -6px; top: -6px; min-width: 22px; height: 22px; border-radius: 6px; background: var(--c-navy); color: #ffffff; font: 800 13px/22px inherit; text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,0.25); }
body.touch-mode .item-btn .key { display: none; }
.item-btn { width: 88px; }
.item-btn .lbl { font-size: 13px; line-height: 1.1; text-align: center; }

/* ---- fight bar (owner 2026-11-08: Diablo-style number slots in boss fights; keyboard only) ---- */
.fight-bar { display: none; }
body.fighting:not(.touch-mode) .fight-bar { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; z-index: 6; }
body.fighting:not(.touch-mode) .items { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); right: auto; left: calc(50% - 152px); transform: translateX(-100%); flex-direction: row; z-index: 6; }
.item-btn.slot { overflow: hidden; }
.item-btn.slot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: conic-gradient(rgba(14, 60, 103, 0.55) var(--cd, 0%), transparent 0); }
.item-btn.slot .key { left: 4px; top: 4px; }
.item-btn.slot.locked { opacity: 0.45; }
.run-clock { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 152px); background: linear-gradient(90deg, #2b85c6, #13306b); color: #ffffff; }
.run-clock.done { background: #3fae5a; }
@media (max-width: 640px) { .run-clock { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 192px); } }

/* unit swaps (owner 2026-11-09): one block per big unit, showing the small units inside */
.how-units { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.how-unit { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 8px; border-radius: 10px; background: #e3f1ff; border: 2px solid #9cc6ee; color: var(--c-navy); }
.how-unit b { font-size: 15px; }
.how-unit small { font-size: 12px; font-weight: 700; color: #2f5f9a; }

/* pet card (owner 2026-11-09): tap a beast to see it; closes on a tap elsewhere or when Penny walks away */
.pet-card { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 18px; padding: 12px 16px; box-shadow: 0 8px 28px rgba(14,60,103,.25); border: 3px solid #d6e7f4; max-width: min(440px, 94vw); }
.pet-card.shiny { border-color: #f2c94c; }
.pet-card canvas { width: 96px; height: 96px; border-radius: 50%; background: #eef6ff; flex: none; }
.pet-info { min-width: 0; flex: 1; }
.pet-name { font-weight: 800; font-size: 20px; color: var(--c-navy); margin: 0; line-height: 1.1; }
.pet-kind { margin: 0; font-size: 14px; color: var(--c-text); }
.pet-stars { margin: 4px 0; display: flex; gap: 2px; }
.pet-stars i { width: 16px; height: 16px; background: #d6e1ea; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.pet-stars i.on { background: #f2b233; }
.pet-bar { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--c-navy); }
.pet-bar i { flex: 1; height: 8px; border-radius: 99px; background: #e6eef5; overflow: hidden; }
.pet-bar b { display: block; height: 100%; width: 0; background: #7cc56b; border-radius: 99px; transition: width .3s; }
.pet-line { margin: 3px 0 0; font-size: 14px; color: var(--c-text); }
.pet-btns { display: flex; gap: 8px; margin-top: 8px; }
.pet-btns .btn { padding: 6px 14px; font-size: 15px; min-height: 0; }
.pet-x { position: absolute; top: 4px; right: 8px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--c-navy); cursor: pointer; }

/* age picker (owner 2026-11-09) */
.ages { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.ages .tchip[aria-checked="true"] { background: var(--c-moss); color: #fff; border-color: var(--c-moss); }
.level.dim { opacity: .55; }
#lostBox { margin: var(--space-3) 0; padding: var(--space-3); background: #fff0f0; border: 2px solid #f2a0a0; border-radius: var(--r-xl); }
#lostBox .zoo-h { color: #c0392b; }
.pen-row.lost { background: #ffe3e3; border-left: 5px solid #e04848; border-radius: 12px; }
.pen-row.lost .lost-note { display: block; color: #c0392b; font-weight: 800; }
/* keep the answer pad on screen for shape and word questions (owner 2026-11-09: "the enter ended being off screen") */
.shape-svg { max-height: min(150px, 20vh); width: auto; max-width: 100%; }
.shape-svg.chart-svg { max-height: min(240px, 34vh); }
.q-text.long { font-size: 30px; line-height: 1.15; }
@media (max-height: 780px) {
  .q-text { font-size: 40px; }
  .q-text.long { font-size: 24px; }
  .shape-svg, .ruler-svg { max-height: 16vh; }
}
@media (max-height: 480px) {
  .q-luck { display: none; }
  .q-title { font-size: 15px; }
  .q-text { font-size: 28px; }
  .q-text.long { font-size: 19px; }
  .shape-svg, .ruler-svg { max-height: 15vh; }
  .q-visual { margin: 2px auto; }
  .q-entry { min-height: 38px; }
  .q-typed { font-size: 28px; }
  .q-pad { gap: 5px; margin: 3px auto; }
  .pad-key { min-height: 33px; font-size: 19px; }
}

/* word problems read like a sentence */
.q-text.story { font-size: 24px; line-height: 1.3; font-weight: 700; max-width: 560px; margin: 0 auto; }
@media (max-height: 480px) { .q-text.story { font-size: 17px; } }

/* ---------------- beast trading card (owner 2026-11-09) ---------------- */
.tcard { --tc: #8d949c; --tcs: #e6e9ec; position: relative; width: min(360px, 92vw); max-height: 94vh; overflow-y: auto; margin: auto; padding: 12px; border-radius: 22px;
  background: linear-gradient(160deg, #fff8d8, #ffe58a 45%, #f5c542); box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 6px var(--rc, #8d949c); }
.tcard.shiny { background: linear-gradient(135deg, #fff5c2, #ffd76a 30%, #fff0b0 50%, #ffc94a 70%, #fff5c2); box-shadow: 0 0 24px #ffd23f, inset 0 0 0 6px var(--rc, #e0a800); }
.tc-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; }
.tc-name { margin: 0; flex: 1; font-size: 24px; font-weight: 800; color: var(--c-navy); line-height: 1.1; }
.tc-type { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.tc-close { min-width: 36px; padding: 2px 8px; font-size: 20px; }
.tc-art { border-radius: 14px; border: 4px solid #c9a227; background: radial-gradient(circle at 50% 60%, #fff, var(--tcs)); display: flex; justify-content: center; }
.tc-art canvas { width: 200px; height: 200px; }
.tc-sub { margin: 6px 4px 4px; font-size: 13px; font-weight: 700; color: #6b5a1e; font-style: italic; }
.tc-attacks { background: rgba(255,255,255,.7); border-radius: 12px; padding: 4px 10px; }
.tc-atk { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-weight: 800; color: var(--c-navy); font-size: 16px; }
.tc-atk + .tc-atk { border-top: 1px solid #e6d9a8; }
.tc-stars { display: inline-flex; gap: 3px; }
.tc-star { width: 14px; height: 14px; background: #d8cfa8; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.tc-star.on { background: #f2a516; }
.tc-about { margin: 8px 4px; font-size: 14px; line-height: 1.35; color: #3d3a2a; }
.tc-stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; background: rgba(255,255,255,.7); border-radius: 12px; padding: 8px 10px; }
.tc-stats span { font-size: 14px; font-weight: 800; color: var(--c-navy); }
.tc-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.tc-bar i { height: 10px; border-radius: 4px; background: #e6dfc4; }
.tc-bar i.on { background: var(--tc); }
.tc-earn { display: flex; align-items: center; justify-content: space-between; margin: 8px 4px 2px; font-weight: 800; color: var(--c-navy); }
.tc-coins { display: inline-flex; gap: 4px; }
.tc-coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a8, #f5b81c 60%, #c98a00); box-shadow: inset 0 0 0 2px #b07800; }
.bcard.found { cursor: pointer; }
.bcard.found:hover { transform: translateY(-2px); }
#beastCard { display: flex; align-items: center; justify-content: center; }
#beastCard[hidden] { display: none; }

/* ---- My beasts as mini trading cards (owner 2026-11-09: "should already look like pokemon cards, with color
   outlines on the rarities"; "if shiny, sparkles around it") ---- */
.bcard { --rc: #8d949c; --tc: #c9d2da; --tcs: #eef2f5; position: relative; overflow: visible; padding: 6px 6px 8px; border-radius: 14px;
  background: linear-gradient(160deg, #fff8d8, #ffe58a 50%, #f5c542); box-shadow: inset 0 0 0 4px var(--rc), inset 0 0 0 5px rgba(0,0,0,.18), 0 3px 8px rgba(0,0,0,.18); }
.bcard .bart { width: 100%; display: flex; justify-content: center; border-radius: 8px; border: 2px solid #c9a227; background: radial-gradient(circle at 50% 60%, #fff, var(--tcs)); }
.bcard .bname { margin-top: 3px; }
.bcard .btype { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: var(--tc); color: #fff; }
.bcard.locked { background: linear-gradient(160deg, #eef1f4, #d5dbe1); }
.bcard.locked .btype { background: #b4bec8; }
.bcard.locked .bart { border-color: #b4bec8; background: #e9eef2; }
.bcard.shiny { background: linear-gradient(135deg, #fff5c2, #ffd76a 30%, #fff0b0 50%, #ffc94a 70%, #fff5c2); box-shadow: inset 0 0 0 4px var(--rc), inset 0 0 0 5px rgba(0,0,0,.18), 0 0 14px #ffd23f; }
/* sparkles: little four-point stars that twinkle around a shiny card */
.sparkles { position: absolute; inset: -6px; pointer-events: none; z-index: 2; }
.sparkles i { position: absolute; width: 14px; height: 14px; background: #fff7b0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 3px #ffcc00); animation: twinkle 1.6s ease-in-out infinite; }
.sparkles i:nth-child(1) { top: 2%; left: 6%; }
.sparkles i:nth-child(2) { top: 10%; right: 4%; width: 10px; height: 10px; animation-delay: .4s; }
.sparkles i:nth-child(3) { top: 46%; left: -2%; width: 9px; height: 9px; animation-delay: .9s; }
.sparkles i:nth-child(4) { bottom: 18%; right: -1%; animation-delay: 1.2s; }
.sparkles i:nth-child(5) { bottom: 0; left: 30%; width: 10px; height: 10px; animation-delay: .7s; }
.sparkles i:nth-child(6) { top: 30%; right: 18%; width: 8px; height: 8px; animation-delay: 1.4s; }
@keyframes twinkle { 0%, 100% { transform: scale(.2) rotate(0deg); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sparkles i { animation: none; opacity: .9; } }
.tcard .sparkles { inset: 0; }
.tcard .sparkles i { width: 20px; height: 20px; }

/* Metal card finish by rarity (owner 2026-11-09: "the inner parts of the card are gold which is misleading; make the
   colour area look metallic with shining streaks"). Gold is only for shiny. */
.bcard, .tcard { --m1: #eef1f4; --m2: #b9c2cb; --m3: #8d969f; }
.bcard[data-r="grey"], .tcard[data-r="grey"] { --m1: #f2f4f6; --m2: #b9c0c8; --m3: #8a929b; }
.bcard[data-r="white"], .tcard[data-r="white"] { --m1: #ffffff; --m2: #e4e9ef; --m3: #c3ccd6; }
.bcard[data-r="green"], .tcard[data-r="green"] { --m1: #d9f7de; --m2: #6cc47e; --m3: #2f8a45; }
.bcard[data-r="blue"], .tcard[data-r="blue"] { --m1: #dcefff; --m2: #6aaee8; --m3: #2668b0; }
.bcard[data-r="purple"], .tcard[data-r="purple"] { --m1: #efe2ff; --m2: #a77ee0; --m3: #6a3fb0; }
.bcard[data-r="orange"], .tcard[data-r="orange"] { --m1: #ffe6cc; --m2: #e8924a; --m3: #a8561c; }
.bcard:not(.locked):not(.shiny), .tcard:not(.shiny) {
  background:
    linear-gradient(115deg, transparent 0 22%, rgba(255,255,255,.55) 26%, transparent 31%, transparent 52%, rgba(255,255,255,.35) 55%, transparent 59%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, rgba(0,0,0,.04) 2px 4px),
    linear-gradient(160deg, var(--m1), var(--m2) 45%, var(--m3) 75%, var(--m2));
}
/* a slow shine sweeping across the big card */
.tcard::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.45) 48%, transparent 60%); background-size: 250% 100%;
  animation: cardShine 4s ease-in-out infinite; }
@keyframes cardShine { 0% { background-position: 150% 0; } 60%, 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .tcard::after { animation: none; opacity: 0; } }
.tcard .tc-sub { color: var(--c-navy); }
.bcard .bart, .tc-art { border-color: rgba(0,0,0,.25); }
.tc-types { display: inline-flex; gap: 4px; }
.bcard .btypes { display: inline-flex; gap: 3px; flex-wrap: wrap; justify-content: center; }

/* Compact start screen (owner 2026-11-09: "make the age area smaller so we can fit more", "the cards for each subject
   can be a little smaller so we can fit more") */
.ages { gap: 4px; margin-bottom: var(--space-2); }
.ages .tchip { min-width: 0; min-height: 34px; padding: 2px 10px; font-size: 15px; }
.start-sub { margin: 6px 0 4px; font-size: 18px; }
.levels { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: var(--space-3); }
.level { min-height: 72px; padding: 6px 8px; border-width: 2px; border-radius: 14px; }
.level .lv-name { font-size: 16px; }
.level .lv-ages { font-size: 12px; }
.level .lv-sample { font-size: 17px; }
@media (max-width: 720px) {
  .levels { grid-template-columns: repeat(2, 1fr); }
  .level { flex-direction: column; flex-wrap: nowrap; gap: 0; padding: 5px 6px; min-height: 60px; }
  .level .lv-sample { font-size: 15px; }
}
/* look rows say what they change (Character, Skin, Hair, Clothes/Fur, Eyes, Hat) */
.look-parts .name-part { position: relative; }
.look-parts .name-part::before { content: attr(data-label); position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: var(--c-text); background: #fff; padding: 0 4px; border-radius: 6px; white-space: nowrap; }
.look-parts { row-gap: 12px; padding-top: 6px; }
/* Twinkle's tip and the goal line float beside the fairy and let the world show through (owner 2026-11-09) */
/* the fairy's words: more see-through (owner 2026-11-11), a light glow keeps the text readable on any ground */
.toast { background: rgba(255, 253, 242, 0.42); -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); box-shadow: 0 0 0 2px rgba(255, 233, 168, 0.5), 0 4px 14px rgba(0, 0, 0, 0.08); text-shadow: 0 0 4px rgba(255, 255, 255, 0.95), 0 0 2px rgba(255, 255, 255, 0.95); }
.hud-goal { position: fixed; background: rgba(14, 60, 103, 0.66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); max-width: min(360px, calc(100vw - 24px)); white-space: normal; text-align: left; font-size: 16px; z-index: 5; pointer-events: none; }
/* Owner 2026-11-09: "bigger scroll bar needed for when checking the pen, its hard to scroll down".
   A wide, easy-to-grab scroll bar on the pen lists (and the modal card around them). */
.pen-list, .modal-card { overscroll-behavior: contain; }
/* Chrome ignores the ::-webkit-scrollbar styles when scrollbar-color is set, so the standard props are for Firefox only */
@supports not selector(::-webkit-scrollbar) { .pen-list, .modal-card { scrollbar-width: auto; scrollbar-color: #2b85c6 #e4eef8; } }
.pen-list { padding-right: 6px; }
.pen-list::-webkit-scrollbar, .modal-card::-webkit-scrollbar { width: 20px; }
.pen-list::-webkit-scrollbar-track, .modal-card::-webkit-scrollbar-track { background: #e4eef8; border-radius: 10px; }
.pen-list::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb { background: #2b85c6; border-radius: 10px; border: 3px solid #e4eef8; min-height: 48px; }
.pen-list::-webkit-scrollbar-thumb:hover, .modal-card::-webkit-scrollbar-thumb:hover { background: #0e3c67; }

/* chest: buy +10 spaces row above the grid; the grid scrolls when the chest is big */
.chest-buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-weight: 700; color: var(--c-navy); }
.chest-buy button { border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 800; background: #ffd23f; color: #0e3c67; cursor: pointer; }
.chest-buy button:disabled { opacity: 0.5; cursor: default; }
#bagChestBody .inv { max-height: min(46vh, 420px); overflow: auto; padding-right: 4px; }
#bagChestBody .inv::-webkit-scrollbar { width: 16px; }
#bagChestBody .inv::-webkit-scrollbar-thumb { background: #c9a24a; border-radius: 8px; border: 3px solid #2a1f14; }

#bagChestBody .inv { overflow-x: hidden; grid-template-columns: repeat(4, 54px); }
#bagChestBody .inv .dslot { width: 54px; height: 54px; }

/* pen and roaming rows: tap a beast to feed or pet it */
.pen-row.care { cursor: pointer; }
.pen-row.care:hover { box-shadow: 0 0 0 3px #bfe3a8 inset; }

/* egg blanket chip: eggs warm up faster */
.chip.blanket { background: #ffe8f2; color: #8a2e5a; }
.chip.blanket b { color: #c8407a; }

/* toys wear out: a bar per toy and a repair button (no numbers for kids) */
.zoo-toys { margin: 10px 0 4px; }
.zoo-toys-title { font-weight: 800; color: var(--c-navy); margin: 0 0 6px; text-align: center; }
.toy-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 12px; background: #f4f8fb; margin-bottom: 6px; font-weight: 700; color: var(--c-navy); }
.toy-row.broken { background: #fde8e4; }
.toy-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.toy-row.stored { background: #eef0f6; }
.toy-bar { display: block; height: 10px; border-radius: 6px; background: #dde6ee; overflow: hidden; }
.toy-bar b { display: block; height: 100%; border-radius: 6px; }

/* coloured HUD icons (owner 2026-11-10: "make the symbols for the backpack, trophy, inventory better looking") */
.icon-btn svg[viewBox="0 0 32 32"] { width: 32px; height: 32px; }
@media (max-width: 900px) { .icon-btn svg[viewBox="0 0 32 32"] { width: 28px; height: 28px; } }

/* the shop and the chest are places in the world now (owner 2026-11-11): no chest button in the dock */
#btnChest { display: none !important; }
.chest-pack { font-weight: 800; color: var(--c-navy); margin: 10px 0 4px; }

/* chest pages (owner 2026-11-11) */
.chest-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0; font-weight: 800; color: var(--c-navy); }
.chest-pages button { width: 40px; height: 36px; border-radius: 10px; border: 0; background: var(--c-navy); color: #fff; font-size: 22px; font-weight: 800; cursor: pointer; line-height: 1; }
.chest-pages button:disabled { opacity: 0.3; cursor: default; }

/* ---- the full-screen shop and the smith (owner 2026-11-11: "think of it like diablo 2 game") ---- */
.shop-modal { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: rgba(10, 14, 30, 0.55); }
.shop-modal .shop-card { width: 100%; max-width: 980px; height: 100%; max-height: 640px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(#2b2440, #1d1a2e); border: 3px solid #c9a24a; border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.5), inset 0 0 0 2px #4b3d22; padding: 14px; color: #f4ecd8; animation: rise 0.2s ease-out; }
.shop-top { display: flex; align-items: center; gap: 12px; }
.shop-who { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-right: auto; text-align: left; }
.shop-who h2 { margin: 0; font-size: 22px; color: #ffd98a; letter-spacing: .5px; }
.shop-modal .shop-timer { font-size: 13px; color: #cfc4ad; opacity: 1; }
.shop-coins { font-weight: 800; font-size: 17px; color: #ffd23f; background: rgba(0,0,0,.3); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.shop-close { min-height: 40px; padding: 0 16px; border-radius: 12px; border: 2px solid #c9a24a; background: #7a2f2f; color: #fff; font-weight: 800; font-size: 17px; cursor: pointer; }
.shop-close:hover { background: #943a3a; }
.shop-cats { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.shop-cats::-webkit-scrollbar { display: none; }
.shop-cats button { min-height: 38px; padding: 0 14px; white-space: nowrap; border-radius: 10px 10px 4px 4px; border: 2px solid #5a4a2a; background: #3a3150; color: #e8dcc0; font-weight: 800; font-size: 16px; cursor: pointer; }
.shop-cats button[aria-selected="true"] { background: #c9a24a; color: #1d1a2e; border-color: #ffd98a; }
.shop-cats button .n { font-size: 12px; opacity: .8; margin-left: 4px; }
.shop-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 290px; gap: 10px; }
.shop-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(136px, 1fr); gap: 8px; padding: 8px; background: rgba(0,0,0,.35); border-radius: 12px; border: 2px solid #4b3d22; align-content: start; touch-action: pan-y; }
.gtile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; padding: 6px 4px 6px; border-radius: 10px; border: 2px solid var(--tc, #888); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--tc, #888) 35%, transparent), rgba(20,18,34,.9) 70%); color: #f4ecd8; cursor: pointer; font: inherit; }
.gtile:hover { filter: brightness(1.15); }
.gtile.sel { outline: 3px solid #ffd98a; outline-offset: 1px; }
.gtile.sold { opacity: .35; }
.gtile .pic { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.gtile .pic img { max-width: 88px; max-height: 88px; image-rendering: auto; }
.gtile .nmn { font-size: 13px; font-weight: 800; color: #f4ecd8; line-height: 1.1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtile .pic svg { width: 72px; height: 72px; color: var(--tc, #888); filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.gtile .lv { position: absolute; top: 4px; left: 6px; font-size: 12px; font-weight: 800; background: rgba(0,0,0,.55); border-radius: 6px; padding: 0 5px; }
.gtile .up { position: absolute; top: 4px; right: 6px; font-size: 12px; font-weight: 800; color: #7fe08a; }
.gtile .pr { font-weight: 800; font-size: 14px; color: #ffd23f; }
.gtile .pr.no { color: #ff8a8a; }
.shop-info { overflow-y: auto; background: rgba(0,0,0,.35); border-radius: 12px; border: 2px solid #4b3d22; padding: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.shop-info .big { display: flex; justify-content: center; align-items: center; height: 150px; border-radius: 12px; background: radial-gradient(circle, color-mix(in srgb, var(--tc, #888) 40%, transparent), transparent 70%); }
.shop-info .big img { max-width: 150px; max-height: 150px; }
.shop-info .big svg { width: 110px; height: 110px; color: var(--tc, #888); }
.shop-info .nm { font-size: 22px; font-weight: 800; }
.shop-info .ln { font-size: 15px; color: #e8dcc0; }
.shop-info .cmp { font-weight: 700; color: #7fe08a; }
.shop-info .cmp.worse { color: #ffb36b; }
.shop-info .buy { margin-top: auto; min-height: 52px; border-radius: 12px; border: 2px solid #ffd98a; background: #3f8f3f; color: #fff; font-weight: 800; font-size: 19px; cursor: pointer; }
.shop-info .buy.ask { background: #b8572a; }
.shop-info .buy:disabled { background: #555; border-color: #777; cursor: default; }
.shop-info .empty { margin: auto; color: #cfc4ad; text-align: center; }
.shop-modal .shop-note { margin: 0; font-size: 14px; color: #cfc4ad; text-align: left; }
.smith-modal .shop-card { max-width: 760px; max-height: 640px; }
.smith-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(0,0,0,.35); border-radius: 12px; border: 2px solid #4b3d22; }
.srow { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--tc, #888); background: rgba(20,18,34,.8); text-align: left; }
.srow .pic { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.srow .pic img { max-width: 64px; max-height: 64px; }
.srow .pic svg { width: 48px; height: 48px; color: var(--tc, #888); }
.srow .nm { font-weight: 800; }
.srow .where { font-size: 12px; color: #cfc4ad; font-weight: 700; }
.srow .dbar { display: block; height: 8px; border-radius: 4px; background: #00000080; margin-top: 4px; overflow: hidden; }
.srow .dbar i { display: block; height: 100%; background: #6fd36f; }
.srow .dbar.low i { background: #ffb33f; }
.srow .dbar.out i { background: #ff5b5b; }
.srow button, .smith-all { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 2px solid #ffd98a; background: #8a5a2a; color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; }
.srow button:disabled, .smith-all:disabled { background: #555; border-color: #777; cursor: default; }
.srow .ok { color: #7fe08a; font-weight: 800; }
.smith-all { align-self: flex-end; }
@media (max-width: 760px) {
  /* phones: everything about half size (owner 2026-11-14: "for phone interface, make design for it half size") */
  .shop-modal { padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .shop-modal .shop-card { padding: 8px; gap: 6px; border-radius: 14px; }
  .shop-top { gap: 6px; }
  .shop-who { gap: 2px 6px; }
  .shop-who h2 { font-size: 15px; }
  .shop-modal .shop-timer { font-size: 10px; }
  .shop-modal .shop-reroll { font-size: 10px; padding: 2px 7px; margin-left: 0; }
  .shop-coins { font-size: 13px; padding: 3px 9px; }
  .shop-close { min-height: 30px; padding: 0 10px; font-size: 12px; }
  .shop-cats { flex-wrap: wrap; overflow: visible; gap: 4px; }
  .shop-cats button { min-height: 30px; padding: 0 9px; font-size: 12px; border-radius: 8px 8px 3px 3px; }
  .shop-cats button .n { font-size: 10px; margin-left: 3px; }
  .shop-main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; gap: 6px; }
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 92px; gap: 5px; padding: 5px; border-radius: 8px; }
  .gtile { padding: 3px 2px 3px; border-radius: 7px; gap: 0; }
  .gtile .pic img { max-width: 54px; max-height: 54px; }
  .gtile .pic svg { width: 40px; height: 40px; }
  .gtile .lv { font-size: 9px; top: 2px; left: 3px; padding: 0 3px; }
  .gtile .up { font-size: 9px; top: 2px; right: 3px; }
  .gtile .nmn { font-size: 10px; }
  .gtile .pr { font-size: 11px; }
  .shop-info { max-height: 34vh; padding: 8px; gap: 4px; border-radius: 8px; }
  .shop-info .big { height: 56px; }
  .shop-info .big img { max-width: 56px; max-height: 56px; }
  .shop-info .big svg { width: 44px; height: 44px; }
  .shop-info .nm { font-size: 14px; }
  .shop-info .ln { font-size: 11px; }
  .shop-info .buy { min-height: 36px; font-size: 14px; border-radius: 9px; }
  .shop-modal .shop-note { font-size: 10px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .shop-modal .shop-card { padding: 6px 8px; gap: 5px; }
  .shop-cats { flex-wrap: nowrap; overflow-x: auto; }
  .shop-main { grid-template-columns: 1fr 200px; grid-template-rows: 1fr; gap: 6px; }
  .shop-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(82px, 1fr); }
  .gtile .nmn { font-size: 9px; }
  .gtile .pr { font-size: 11px; }
  .gtile .pic img { max-width: 46px; max-height: 46px; }
  .shop-info { max-height: none; }
  .shop-info .big { height: 44px; }
  .shop-modal .shop-note { display: none; }
}
}

/* rarer gear stands out (owner 2026-11-11: "make it look cooler for the legendary stuff") */
.dico img { width: 100%; height: 100%; object-fit: contain; }
.gtile.r3 { box-shadow: 0 0 8px rgba(111, 182, 255, .35); }
.gtile.r4 { box-shadow: 0 0 12px rgba(196, 139, 255, .6); }
.gtile.r5 { box-shadow: 0 0 16px rgba(255, 180, 60, .8); animation: legend 1.6s ease-in-out infinite; border-color: #ffc24a; }
.gtile.r5::after { content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none; background: linear-gradient(115deg, transparent 35%, rgba(255, 236, 170, .35) 50%, transparent 65%); background-size: 250% 100%; animation: shine 2.4s linear infinite; }
@keyframes legend { 50% { box-shadow: 0 0 26px rgba(255, 190, 70, 1); } }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .gtile.r5, .gtile.r5::after { animation: none; } }

/* subject bonus (owner 2026-11-11) */
.level { position: relative; }
/* owner 2026-11-12: "the coin bonus is covering the words, make them smaller in the top right of the card": a small
   tag tucked in the corner, and cards with a bonus leave room above the name */
.level .lv-bonus { position: absolute; top: 4px; right: 5px; font-size: 10.5px; line-height: 1.3; font-weight: 800; color: #7a4a00; background: #ffd23f; border-radius: 999px; padding: 1px 6px; }
.level:has(.lv-bonus) { padding-top: calc(var(--space-3) + 12px); }

/* Penny's stats in the equipment panel (owner 2026-11-11) */
.pstats { margin-top: 10px; padding: 10px 12px; background: #f4f8ff; border-radius: 12px; }
.pst-h { margin: 4px 0 6px; font-weight: 800; color: var(--c-text, #0e3c67); font-size: 15px; }
.pstat { display: grid; grid-template-columns: 78px 1fr 92px; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.pst-l { font-weight: 700; }
.pst-bar { height: 10px; background: #dde6f2; border-radius: 6px; overflow: hidden; }
.pst-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6fd06a, #3fa8e8); border-radius: 6px; }
.pstat.warn .pst-bar i { background: #ff9b4a; }
.pstat.warn .pst-w { color: #c25400; font-weight: 700; }
.pstat.ok .pst-w { color: #2f8a3a; font-weight: 700; }
.pst-w { font-size: 12px; text-align: right; }
.pst-hearts { grid-column: 2 / 4; color: #ff4d7a; font-size: 16px; letter-spacing: 1px; }
.pst-hearts .half { opacity: 0.45; }

/* Play together (owner 2026-11-11) */
#btnMp.on { box-shadow: 0 0 0 3px #7fd36b; }
.mp-card { text-align: left; }
.mp-label { margin: var(--space-3) 0 var(--space-1); font-weight: 800; color: var(--c-navy); }
.mp-num { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: 4px; color: var(--c-navy); text-align: center; }
.mp-note { margin: var(--space-1) 0; color: var(--c-navy); }
.mp-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: 4px 0; border-bottom: 1px solid #e4eef8; }
.mp-who { font-weight: 700; color: var(--c-navy); }
.mp-join-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
#mpFriend { flex: 1; min-width: 160px; min-height: 52px; font-size: 26px; font-weight: 800; letter-spacing: 3px; padding: 0 12px; border: 2px solid #9cc4e8; border-radius: 14px; color: var(--c-navy); }
.mp-knock, .mp-leave { min-width: 140px; min-height: 52px; font-size: 22px; }
.mp-status { min-height: 1.4em; color: var(--c-navy); font-weight: 700; }
.mp-say-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mp-say { min-height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: #e4f1ff; color: var(--c-navy); font-size: 17px; font-weight: 800; cursor: pointer; }
.knock-card { position: fixed; z-index: 40; top: 12px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); background: var(--c-white); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: var(--space-3); text-align: center; border: 3px solid #7fd36b; }
.knock-card p { margin: 0 0 var(--space-2); font-size: 20px; font-weight: 800; color: var(--c-navy); }
.knock-btns { display: flex; gap: var(--space-2); justify-content: center; align-items: center; flex-wrap: wrap; }
.knock-btns .btn-soft { margin-top: 0; }
.tr-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-slot { width: 100%; min-height: 96px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; border: 3px dashed #9bb8d6; border-radius: 16px; background: #f4f9ff; color: #5a6f88; font: inherit; font-size: 15px; text-align: center; }
.tr-slot.filled { border-style: solid; border-color: #f4c430; background: #fff8dc; color: var(--c-navy); font-size: 17px; }
button.tr-slot { cursor: pointer; }
.tr-ok { min-height: 22px; margin: 4px 0 0; text-align: center; font-weight: 800; color: #2e8b3e; }
.tr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 30vh; overflow-y: auto; margin-bottom: 10px; }
.tr-thing { min-height: 72px; padding: 6px 8px; border: 0; border-radius: 14px; background: #e4f1ff; color: var(--c-navy); font: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.tr-thing.picked { background: var(--c-navy); color: #fff; }
.tr-pic { flex: 0 0 60px; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; }
.tr-pic canvas, .tr-pic img, .tr-pic svg { width: 56px; height: 56px; }
.tr-txt { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.tr-txt b { font-size: 15px; }
.tr-txt span { font-size: 13px; font-weight: 700; }
.tr-txt small { font-size: 13px; font-weight: 800; color: #2e6fb5; }
.tr-thing.picked .tr-txt small, .tr-thing.picked .tr-txt span { color: #fff !important; }
.tr-tabs { display: flex; gap: 8px; margin: 6px 0 8px; }
.tr-tab { flex: 1; min-height: 44px; border: 0; border-radius: 22px; background: #e4f1ff; color: var(--c-navy); font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; }
.tr-tab.on { background: var(--c-navy); color: #fff; }
.tr-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.mp-dot { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: #c3ccd8; margin-right: 8px; }
.mp-dot.on { background: #3cc35a; }
.mp-friend-tag { padding: 4px 12px; border-radius: 14px; background: #e3f7e6; color: #2e8b3e; font-weight: 800; }
.mp-row .btn-use { min-height: 42px; padding: 0 20px; font-size: 17px; }
/* the storage chest at home: a wide panel, chest left, backpack right (owner 2026-11-12) */
.bag-panel.wide { width: min(640px, calc(100% - 90px)); max-height: calc(100% - 180px); }
.bag-panel.wide .chest-cols { display: flex; gap: 14px; align-items: flex-start; }
.bag-panel.wide .chest-col { flex: 1 1 0; min-width: 0; }
.bag-panel.wide .chest-pack { margin-top: 0; min-height: 36px; display: flex; align-items: center; }
.bag-panel.wide #bagChestBody .inv { max-height: calc(100vh - 380px); min-height: 140px; }
@media (max-width: 600px) { .bag-panel.wide .chest-cols { flex-direction: column; } }
/* a friend's beast: look only, no feeding or petting */
.pet-card.friend .pet-bar, .pet-card.friend #petFeed, .pet-card.friend #petPet { display: none; }
/* multiple-choice answers (expanding and factoring with x) */
.q-pad.picks { grid-template-columns: repeat(2, 1fr); max-width: 420px; }
.pick-key { min-height: 58px; border-radius: 14px; border: 0; background: #e7f1fb; color: var(--c-navy); font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 #c3d6ea; cursor: pointer; touch-action: manipulation; padding: 6px 8px; }
.pick-key:active { transform: translateY(2px); box-shadow: 0 2px 0 #c3d6ea; }
.pick-key.chosen { background: #cfe4fb; }
.q-pad .pick-key.right { background: linear-gradient(180deg, #d8f7d0, #8fe08a) !important; box-shadow: 0 4px 0 #2f7a35; }
.q-pad .pick-key.fix { outline: 4px solid #f0a51c; outline-offset: 3px; }
.pick-key.longtxt { font-size: 17px; line-height: 1.2; padding: 4px 6px; }
/* Beginner / Novice / Expert tag in the question box (owner 2026-11-12) */
.q-rank { display: inline-block; margin-top: 2px; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 9px; background: #e3f3d0; color: #3c6b12; }
.q-rank[data-rank="1"] { background: #dcebfb; color: #1d4f86; }
.q-rank[data-rank="2"] { background: #ffe7a8; color: #7a4a00; }
/* column sums: digits lined up, ones under ones (owner 2026-11-12) */
.col-sum { display: inline-grid; font-size: 34px; font-weight: 800; color: var(--c-navy); line-height: 1.15; font-variant-numeric: tabular-nums; text-align: center; margin: 0 auto; }
.col-cell.mark { font-size: 15px; color: #d2452c; line-height: 1; min-height: 16px; align-self: end; }
.col-cell.op { color: var(--c-moss-ink); }
.col-cell.line { border-top: 3px solid var(--c-navy); height: 4px; }
.col-cell.blank { color: #b8cbe0; }
.q-how-pic .col-sum, #qHowPic .col-sum { font-size: 26px; }
/* link to the parent report on the start screen (owner 2026-11-12) */
.parent-link { display: block; margin: 10px auto 0; text-align: center; font-weight: 700; color: var(--c-navy); text-decoration: underline; }

/* ---------- cartoon look (owner 2026-11-12: "make the menu and interface more cartoony ... attract more kids") ----------
   chunky dark outlines, big round corners, candy colors, a solid drop under every button, bouncy pops */
:root { --toon-ink: #173a5e; --toon-line: 3px solid var(--toon-ink); --toon-drop: 0 5px 0 var(--toon-ink); }
.start { background: linear-gradient(180deg, rgba(150, 210, 250, 0.85), rgba(232, 244, 252, 0.92)); }
.start-head { background: linear-gradient(180deg, #ffd23f, #ffb627); border-bottom: 5px solid var(--toon-ink); border-radius: 0 0 36px 36px; box-shadow: 0 6px 0 rgba(23, 58, 94, 0.25); }
.start-name { width: 420px; height: 46px; }
.start-name text { font-size: 44px; fill: #ffffff; stroke: var(--toon-ink); stroke-width: 7px; stroke-linejoin: round; paint-order: stroke; }
.start-head .eyebrow { color: var(--toon-ink); font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.start-brand .brand-mark { width: 62px; height: 62px; border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); animation: toon-bob 2.4s ease-in-out infinite; }
.start-brand .brand-mark i { width: 28px; height: 36px; background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, #ffcf3a 19% 100%); border: 2px solid var(--toon-ink); }
.start-card { border: 4px solid var(--toon-ink); border-radius: 30px; box-shadow: 0 8px 0 var(--toon-ink), 0 18px 40px rgba(14, 60, 103, 0.2); }
.start h1, .start-sub { font-family: var(--font-display); font-size: 26px; color: var(--toon-ink); letter-spacing: 0.3px; }
.start-sub::before, .start-sub::after { content: ""; display: inline-block; width: 12px; height: 12px; margin: 0 10px 3px; border-radius: 50%; background: #ffb627; border: 2px solid var(--toon-ink); vertical-align: middle; }
/* subject cards: each its own candy color, tilts a little when picked */
.level { border: var(--toon-line); border-radius: 22px; box-shadow: var(--toon-drop); transition: transform 0.15s cubic-bezier(.3, 1.6, .5, 1); background: #e8f4fc; }
.level:nth-child(8n+1) { background: #ffe1e6; }
.level:nth-child(8n+2) { background: #fff1c2; }
.level:nth-child(8n+3) { background: #dff6d5; }
.level:nth-child(8n+4) { background: #dcecff; }
.level:nth-child(8n+5) { background: #eee0ff; }
.level:nth-child(8n+6) { background: #ffe4cc; }
.level:nth-child(8n+7) { background: #d6f5f2; }
.level:nth-child(8n+8) { background: #ffe0f4; }
.level:hover { transform: translateY(-3px) rotate(-1deg); }
.level .lv-name, .level b { font-family: var(--font-display); }
.level .lv-sample { color: var(--toon-ink); font-family: var(--font-display); }
.level[aria-checked="true"] { border-color: var(--toon-ink); box-shadow: 0 5px 0 var(--toon-ink), 0 0 0 5px #ffd23f; transform: rotate(-1.5deg) scale(1.03); position: relative; }
.level[aria-checked="true"]::after { content: ""; position: absolute; left: -10px; top: -10px; width: 30px; height: 30px; border-radius: 50%; background: #5fd35f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px no-repeat; border: var(--toon-line); }
.level .lv-bonus { border: 2px solid var(--toon-ink); }
.tchip, .pchip { border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); font-family: var(--font-display); }
.tchip:active, .pchip:active, .level:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--toon-ink); }
.ages .tchip { border-radius: 50%; min-width: 48px; background: #fff7d6; }
.ages .tchip[aria-checked="true"], .tchip[aria-pressed="true"] { background: #5fd35f; border-color: var(--toon-ink); color: #fff; transform: scale(1.12); }
.pchip[aria-checked="true"] { border-color: var(--toon-ink); background: #fff1c2; box-shadow: 0 4px 0 var(--toon-ink), 0 0 0 4px #ffd23f; }
/* the big Play button: green, chunky, gently breathing */
.btn-play { background: linear-gradient(180deg, #6ee36e, #3cbf47); color: #fff; border: 4px solid var(--toon-ink); border-radius: 999px; box-shadow: 0 7px 0 var(--toon-ink); font-size: 30px; text-shadow: 0 3px 0 rgba(23, 58, 94, 0.45); }
/* only the start screen's Play calls out: a ring pulses round it (the button itself stays still, so taps land at once) */
#btnPlay { position: relative; }
#btnPlay:not(:disabled)::after { content: ""; position: absolute; inset: -9px; border-radius: 999px; border: 4px solid #6ee36e; pointer-events: none; animation: toon-ring 1.6s ease-out infinite; }
@keyframes toon-ring { 0% { transform: scale(0.96); opacity: 0.9; } 100% { transform: scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #btnPlay:not(:disabled)::after { animation: none; opacity: 0; } }
.btn-play:hover { filter: brightness(1.06); }
.btn-play:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--toon-ink); animation: none; }
.btn-play:disabled { background: #b9c6d2; animation: none; text-shadow: none; }
.btn-records { border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); background: #fff1c2; font-family: var(--font-display); font-size: 19px; }
.btn-soft { font-family: var(--font-display); font-size: 19px; }
.btn, .btn-use { border: var(--toon-line); box-shadow: 0 5px 0 var(--toon-ink); border-radius: 18px; }
/* every pop-up card: thick outline, round, springs in */
.modal-card { border: 4px solid var(--toon-ink); border-radius: 30px; box-shadow: 0 8px 0 var(--toon-ink), 0 20px 44px rgba(14, 60, 103, 0.25); animation: toon-pop 0.32s cubic-bezier(.3, 1.6, .5, 1); }
.modal-head h2, .modal-card h2 { font-family: var(--font-display); color: var(--toon-ink); }
.close, .shop-close { border: var(--toon-line) !important; box-shadow: 0 4px 0 var(--toon-ink); border-radius: 999px; font-family: var(--font-display); }
/* the question: a big friendly title, rainbow number keys, a green Check */
.q-title { font-family: var(--font-display); font-size: 22px; }
.q-text { font-size: 46px; color: var(--toon-ink); text-shadow: 0 3px 0 #ffd23f; }
.q-entry { border: var(--toon-line) !important; border-radius: 18px !important; background: #fffbea; }
.pad-key, .pick-key { border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); border-radius: 18px; font-family: var(--font-display); color: var(--toon-ink); }
.pad-key:active, .pick-key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--toon-ink); }
.q-pad .pad-key:nth-child(3n+1) { background: #ffe1e6; }
.q-pad .pad-key:nth-child(3n+2) { background: #fff1c2; }
.q-pad .pad-key:nth-child(3n+3) { background: #dcecff; }
.q-pad .pad-key.back { background: #eef1f5; }
.q-pad .pad-key.check { background: linear-gradient(180deg, #6ee36e, #3cbf47); color: #fff; text-shadow: 0 2px 0 rgba(23, 58, 94, 0.45); }
.pick-key:nth-child(4n+1) { background: #ffe1e6; }
.pick-key:nth-child(4n+2) { background: #fff1c2; }
.pick-key:nth-child(4n+3) { background: #dff6d5; }
.pick-key:nth-child(4n+4) { background: #dcecff; }
.q-feedback { font-family: var(--font-display); font-size: 22px; color: var(--toon-ink); }
/* the game's top bar: white bubbles with a dark outline */
.chip { border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); font-family: var(--font-display); }
.icon-btn { border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--toon-ink); }
.hud-goal { border: 3px solid rgba(255, 255, 255, 0.6); box-shadow: 0 4px 0 rgba(42, 26, 12, 0.35); font-family: var(--font-display); background: rgba(200, 70, 31, 0.3); backdrop-filter: none; -webkit-backdrop-filter: none;
  text-shadow: 0 1px 0 rgba(42, 26, 12, 0.8), 0 0 5px rgba(42, 26, 12, 0.8), 0 0 2px rgba(42, 26, 12, 0.9); } /* see-through, the forest shows through the fairy's words (owner 2026-11-14: "the twinkle message that follows should be somewhat see through") */
.toast { background: rgba(255, 253, 242, 0.38); }
.toast { border: var(--toon-line); box-shadow: 0 5px 0 var(--toon-ink); font-family: var(--font-display); }
.tbtn { border: 4px solid var(--toon-ink); box-shadow: 0 5px 0 var(--toon-ink); font-family: var(--font-display); }
.game-footer { background: #ffd23f; border-top: var(--toon-line); color: var(--toon-ink); }
/* fireworks sit over everything and never take a tap */
.fx-fireworks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
@keyframes toon-pop { 0% { transform: scale(0.7); opacity: 0; } 70% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@keyframes toon-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(4deg); } }
@keyframes toon-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .modal-card, .btn-play, .start-brand .brand-mark { animation: none; }
  .level, .level:hover, .level[aria-checked="true"] { transition: none; transform: none; }
}
@media (max-width: 520px) {
  .start-name { width: 300px; height: 34px; }
  .q-text { font-size: 36px; }
}

/* speed boost (owner 2026-11-12): an on/off button with the shoes' multiplier and a fuel gauge (where Dash was) */
.boost-box { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 8px; pointer-events: auto; z-index: 4; }
.boost-btn { position: relative; width: 78px; height: 78px; border-radius: 50%; border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); background: linear-gradient(180deg, #ff9f4a, #ff5d2e); color: #fff; font-family: var(--font-display); font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; text-shadow: 0 2px 0 rgba(23, 58, 94, 0.45); }
.boost-btn .boost-x { font-size: 0; line-height: 0; display: block; } /* a running shoe with speed streaks (owner 2026-11-14: "the boost icon should be a shoe with streaks") */
.boost-btn .boost-x svg { width: 46px; height: 31px; display: block; }
.boost-btn .streaks path { opacity: 0.22; transition: opacity 0.3s; }
.boost-btn[data-stars="1"] .s1, .boost-btn[data-stars="2"] :is(.s1, .s2), .boost-btn[data-stars="3"] :is(.s1, .s2, .s3), .boost-btn[data-stars="4"] :is(.s1, .s2, .s3, .s4), .boost-btn[data-stars="5"] .streaks path { opacity: 1; }
.boost-btn.on .streaks path { stroke-dasharray: 5 4; animation: streak 0.4s linear infinite; }
@keyframes streak { to { stroke-dashoffset: -9; } }
.boost-btn .boost-key { font-size: 12px; opacity: 0.95; }
.boost-btn.on { background: linear-gradient(180deg, #ffe14d, #ffb627); color: var(--toon-ink); text-shadow: none; transform: translateY(3px); box-shadow: 0 1px 0 var(--toon-ink); }
.boost-btn.empty { filter: saturate(0.3); }
.fuel { width: 16px; height: 78px; border-radius: 999px; border: var(--toon-line); background: #fff; overflow: hidden; display: flex; align-items: flex-end; box-shadow: 0 3px 0 var(--toon-ink); }
.fuel i { display: block; width: 100%; height: 100%; background: linear-gradient(0deg, #ff5d2e, #ffd23f); transition: height 0.15s linear; }
.fuel.low i { background: #e2483d; }
body.touch-mode .boost-btn .boost-key { display: none; }

/* the question box: light blue, and every word in the round cartoon font (owner 2026-11-12: "a light blue color for the
   question area and more cartoon like fonts") */
.modal-card.q-card { background: #dff1ff; }
/* a race's question arch: a small panel at the top, the race keeps going round it */
.modal.race-q { inset: auto; top: 64px; left: 50%; transform: translateX(-50%); width: min(420px, 94vw); background: none; padding: 0; display: block; pointer-events: none; overflow: visible; }
.modal.race-q .q-card { pointer-events: auto; padding: 10px 14px; animation: none; max-height: 70vh; transform: scale(0.82); transform-origin: top center; }
.modal.race-q .q-pad.picks { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.modal.race-q .q-title { margin: 0 0 2px; font-size: 16px; }
.modal.race-q .q-text { margin: 2px 0 8px; }
.rp-cell { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.rp-cell .pick-key { width: 100%; }
.rp-key { display: inline-block; align-self: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; text-align: center; cursor: pointer; letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ff4d4d, #ff9f1c, #f2c200, #3cbf4a, #2b9bff, #8a5bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pick-key .hk { display: inline-block; min-width: 1.3em; margin-right: 6px; padding: 0 4px; border-radius: 8px; background: var(--toon-ink, #173a5e); color: #fff; font-size: 0.75em; line-height: 1.4; vertical-align: middle; }
.modal.race-q #qHow, .modal.race-q #qLater, .modal.race-q .q-luck, .modal.race-q .q-hint { display: none; }
.q-card, .q-card p, .q-card button, .q-card .q-how-say, .q-card .q-feedback, .q-card .q-hint, .q-card .q-luck { font-family: var(--font-display); }
.q-card .q-how { background: #f4fbff; border-color: #9fd0f2; }
.q-card .q-how-say { color: var(--toon-ink); font-size: 18px; }
.q-card .q-title { color: var(--toon-ink); }
.q-card .btn-soft { color: var(--toon-ink); }
.q-card .q-luck { color: var(--toon-ink); }

/* compass (owner 2026-11-12: "lets add a compass, with home being North"): N always points to your pen */
.compass { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: calc(196px + env(safe-area-inset-bottom)); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.compass[hidden] { display: none; }
.compass-dial { position: relative; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffffff, #e3f1ff 70%); border: 4px solid var(--toon-ink, #173a5e); box-shadow: 0 4px 0 var(--toon-ink, #173a5e); font-family: var(--font-display, inherit); font-weight: 800; color: #173a5e; }
.compass-dial span { position: absolute; left: 50%; top: 50%; font-size: 14px; line-height: 1; }
.compass-dial .cp-n { color: #e0503a; font-size: 18px; transform: translate(-50%, -50%) translateY(-24px); }
.compass-dial .cp-s { transform: translate(-50%, -50%) translateY(25px); }
.compass-dial .cp-e { transform: translate(-50%, -50%) translateX(25px); }
.compass-dial .cp-w { transform: translate(-50%, -50%) translateX(-25px); }
.compass-dial .cp-needle { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 18px solid #e0503a; transform: translate(-50%, -100%); }
.compass-word { background: #e0503a; color: #fff; font-family: var(--font-display, inherit); font-weight: 800; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 2px solid var(--toon-ink, #173a5e); }

/* boost on the right by the action buttons (owner 2026-11-12: "put the boost button on the right near the action item"),
   the way-home help button above it (owner: "a help button on the right above to show a glowing path back home") */
body.touch-mode .boost-box { bottom: calc(340px + env(safe-area-inset-bottom)); }
.home-btn { pointer-events: auto; position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(118px + env(safe-area-inset-bottom)); width: 66px; height: 66px; border-radius: 50%; border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); background: linear-gradient(180deg, #bff3ff, #6fd3ff); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer; z-index: 4; padding: 0; font-family: var(--font-display); font-weight: 800; color: var(--toon-ink); }
.home-btn[hidden] { display: none; }
.home-btn svg { width: 32px; height: 32px; }
.home-btn .home-key { font-size: 11px; line-height: 1; }
.home-btn.on { background: linear-gradient(180deg, #fff3b0, #ffd23f); }
body.touch-mode .home-btn { bottom: calc(436px + env(safe-area-inset-bottom)); }
body.touch-mode .home-btn .home-key { display: none; }
/* the compass sits on the right above the Home button (owner: "move compass to the right also") */
body.touch-mode .compass { bottom: calc(512px + env(safe-area-inset-bottom)); }

/* the player's name top left (owner 2026-11-12: "lets put name in top left, in battle, hearts stay in top right") */
.hud-name { position: absolute; left: max(var(--space-3), env(safe-area-inset-left)); top: max(var(--space-3), env(safe-area-inset-top)); z-index: 2; }
@media (max-width: 900px) {
  .hud-hearts { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 48px); }
}
body.fighting .hud-hearts { left: auto; right: max(10px, env(safe-area-inset-right)); justify-content: flex-end; }

/* race park HUD (owner 2026-11-12: "map on the left side of the track and player positions") */
.race-hud { position: fixed; left: max(14px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.race-hud[hidden] { display: none; }
.race-clock, .race-place { background: #fff; border: var(--toon-line); border-radius: 999px; box-shadow: 0 3px 0 var(--toon-ink); padding: 2px 14px; font-family: var(--font-display); font-weight: 800; color: var(--toon-ink); font-size: 22px; }
.race-place { font-size: 16px; }
/* the cartoon race timer (racectl.js drawClock) */
.race-clock { display: flex; align-items: baseline; gap: 1px; padding: 0 14px 2px; background: linear-gradient(#3a6fd8, #173a8e); font-size: 34px; line-height: 1.15; }
.race-clock .rc-d, .race-clock .rc-p { font-weight: 900; -webkit-text-stroke: 2px #173a5e; paint-order: stroke fill; text-shadow: 0 3px 0 #173a5e; display: inline-block; }
.race-clock .rc-p { color: #ffffff; font-size: 0.7em; }
.race-clock .rc-d:nth-child(odd) { transform: rotate(-4deg); }
.race-clock .rc-d:nth-child(even) { transform: rotate(4deg) translateY(-1px); }
.race-clock.bump { animation: rcbump 0.3s cubic-bezier(.2,1.8,.4,1); }
.race-clock.counting { font-size: 56px; }
@keyframes rcbump { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .race-clock.bump { animation: none; } }
.race-place:empty { display: none; }
.race-map { width: 180px; height: 180px; border-radius: 18px; background: rgba(255, 255, 255, 0.85); border: var(--toon-line); box-shadow: 0 4px 0 var(--toon-ink); }
body.touch-mode .race-hud { top: calc(80px + env(safe-area-inset-top)); transform: none; }
body.touch-mode .race-map { width: 130px; height: 130px; }
.race-hp { width: 180px; height: 16px; border-radius: 999px; background: #173a5e; border: var(--toon-line); overflow: hidden; }
.race-bar-t { margin-bottom: -5px; font-family: var(--font-display); font-weight: 800; font-size: 13px; color: #fff; text-shadow: 0 1px 0 #173a5e, 0 0 4px #173a5e; }
/* the boost gauge on the left in a race (owner 2026-11-13: "on the left side we put the boost gage"), under health */
.race-fuel .race-hp-fill { background: linear-gradient(#ffd23f, #ff7a2e); }
.race-fuel.low .race-hp-fill { background: #e2483d; }
.race-hp-fill { height: 100%; width: 100%; background: linear-gradient(#7dff9a, #2fcf5a); transition: width 0.2s; }
.race-leave { pointer-events: auto; background: #ffffff; color: var(--toon-ink); border: var(--toon-line); border-radius: 999px; box-shadow: 0 3px 0 var(--toon-ink); padding: 5px 12px; font-family: var(--font-display); font-weight: 800; font-size: 14px; cursor: pointer; }
.race-item { pointer-events: auto; background: #ff6bd5; color: #fff; border: var(--toon-line); border-radius: 999px; box-shadow: 0 3px 0 var(--toon-ink); padding: 6px 14px; font-family: var(--font-display); font-weight: 800; font-size: 16px; cursor: pointer; }
.race-item[hidden] { display: none; }
.race-item2 { background: #7a5bff; margin-left: 6px; }
/* the ink splat (racectl.js inkSplat draws the blobs): splats on at once, then wipes away slowly */
.race-blind { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity 3.5s ease-in; }
.race-blind.on { opacity: 1; transition: opacity 0.08s; }
.race-item { display: inline-flex; align-items: center; gap: 6px; }
.race-item .ri-ico { display: inline-flex; width: 26px; height: 26px; background: #fff; border-radius: 8px; padding: 2px; }
.race-item .ri-ico svg { width: 100%; height: 100%; }
.race-item.rolling { background: #ffb627; animation: rrpulse 0.15s ease-in-out infinite alternate; }
body.touch-mode .race-hp { width: 130px; }

/* hearts top left, under the name chip, in play and in every fight (owner 2026-11-12: "keep the hearts in the top
   left area for both regular and battles") */
.hud-hearts,
body.fighting .hud-hearts,
body.epic-fight .hud-hearts,
body.touch-mode .hud-hearts,
body.touch-mode.fighting .hud-hearts {
  left: max(var(--space-3), env(safe-area-inset-left)); right: auto;
  top: calc(max(var(--space-3), env(safe-area-inset-top)) + 54px);
  justify-content: flex-start; max-width: min(300px, 45vw);
}

/* the race track list */
.rp-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.rp-track { font: inherit; font-weight: 800; font-size: 1.05rem; padding: 14px 10px; border-radius: 14px; border: 3px solid var(--tc); background: #141b2e; color: #fff; box-shadow: 0 0 12px var(--tc); cursor: pointer; }
.rp-track:hover, .rp-track:focus-visible { background: #1f2a47; }

/* pay for new shop items now */
.shop-reroll { font: inherit; font-size: 12px; font-weight: 800; margin-left: 8px; padding: 4px 10px; border-radius: 999px; border: 2px solid #ffd23f; background: #3a2f17; color: #ffe9a8; cursor: pointer; }
.shop-reroll:hover, .shop-reroll:focus-visible { background: #4d3d1c; }
.shop-reroll.poor { opacity: 0.55; }

/* Look around (owner goal: "make it very Scenic that players can just appreciate the beauty"): the HUD and Twinkle's
   tips step aside while the camera drifts round; a small note says how to come back */
body.scenic-view #hud, body.scenic-view #toast { visibility: hidden; }
.scenic-note { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(14, 60, 103, 0.55); color: #ffffff; font-weight: 700; font-size: 16px; padding: 6px 16px; border-radius: 999px; pointer-events: none; z-index: 30; }

/* Chunky 3D HUD buttons (owner 2026-11-13: "Chunky & Rounded 3D Buttons ... molded plastic or carved stone look with
   thick borders, subtle inner shadows, and a playful drop shadow", "Themed Containers: wrap each icon in a thematic
   frame"). Each button gets a frame colour (--f1 light, --f2 dark): a domed face, a thick coloured rim, a shine on top,
   an inner shadow at the bottom and a chunky drop shadow that squashes when pressed. */
.icon-btn {
  --f1: #f4f8ff; --f2: #9fb3cc;
  position: relative;
  border: 4px solid var(--f2);
  outline: 2.5px solid var(--toon-ink, #0e3c67);
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, var(--f1) 55%, color-mix(in srgb, var(--f1) 70%, var(--f2)) 100%);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12), inset 0 3px 0 rgba(255, 255, 255, 0.9), 0 5px 0 var(--toon-ink, #0e3c67), 0 9px 10px rgba(14, 60, 103, 0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.icon-btn::after { /* the shine */
  content: ''; position: absolute; left: 18%; top: 8%; width: 40%; height: 22%; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75); filter: blur(0.5px); pointer-events: none; transform: rotate(-18deg);
}
.icon-btn svg { position: relative; z-index: 1; filter: drop-shadow(0 1.5px 0 rgba(14, 60, 103, 0.25)); }
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn:active { transform: translateY(4px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 3px 0 rgba(255, 255, 255, 0.9), 0 1px 0 var(--toon-ink, #0e3c67), 0 2px 4px rgba(14, 60, 103, 0.3); }
/* the themed frames */
#btnView { --f1: #e4f7d2; --f2: #5fae6a; }    /* leafy meadow */
#btnPen { --f1: #fbe7cc; --f2: #b97a40; }     /* wooden fence */
#btnGear { --f1: #e0eeff; --f2: #3f8de0; }    /* blue armour */
#btnChest { --f1: #fff2c4; --f2: #e0a21a; }   /* treasure gold */
#btnBag { --f1: #ffe3d4; --f2: #e8673a; }     /* leather pack */
#btnMp { --f1: #ffe6ef; --f2: #ff7aa2; }      /* friendly pink */
#btnRecords { --f1: #fff4cf; --f2: #f0b323; } /* trophy gold */
#btnBook { --f1: #efe3ff; --f2: #9b6be0; }    /* beast book purple */
#btnSound, #btnMenu { --f1: #eef1f4; --f2: #8f9aa6; } /* carved stone */

/* hearts without the white panel (owner 2026-11-13), the low-health red glow and the hit shake + flash */
.hud-hearts { background: none !important; box-shadow: none !important; padding: 2px 0 !important; }
.hud-hearts .heart { width: 26px; height: 26px; filter: drop-shadow(0 2px 0 rgba(42, 12, 20, 0.45)) drop-shadow(0 0 4px rgba(255, 60, 100, 0.35)); }
body.low-hp .hud-hearts .heart { animation: heartbeat 0.8s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity 0.4s;
  box-shadow: inset 0 0 90px 30px rgba(220, 20, 50, 0.75); }
body.low-hp::after { opacity: 1; animation: lowglow 1.1s ease-in-out infinite; }
@keyframes lowglow { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
#hurtFlash { position: fixed; inset: 0; pointer-events: none; z-index: 41; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 0, 40, 0) 45%, rgba(255, 0, 40, 0.55) 100%); }
#hurtFlash.on { animation: hurtflash 0.45s ease-out; }
@keyframes hurtflash { 0% { opacity: 1; } 100% { opacity: 0; } }
#scene.shake { animation: screenshake 0.35s linear; }
@keyframes screenshake {
  0% { transform: translate(0, 0); } 15% { transform: translate(calc(var(--shake) * -1), calc(var(--shake) * 0.5)); }
  30% { transform: translate(var(--shake), calc(var(--shake) * -0.6)); } 45% { transform: translate(calc(var(--shake) * -0.7), calc(var(--shake) * -0.3)); }
  60% { transform: translate(calc(var(--shake) * 0.5), calc(var(--shake) * 0.4)); } 80% { transform: translate(calc(var(--shake) * -0.25), 0); } 100% { transform: translate(0, 0); }
}

/* The question as a wizard's challenge scroll (owner 2026-11-13: "frame the math challenge inside a weathered parchment
   scroll", style "wizards, mythical steam punk"): parchment with a soft burnt edge, wooden rollers with brass caps top and
   bottom, brass corner rivets; bouncing coloured numbers; chunky arcade keys; a glowing gold Check stamp. */
.modal-card.q-card {
  position: relative; overflow: visible;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 255, 255, 0.55), transparent 45%),
    radial-gradient(ellipse at 80% 90%, rgba(160, 110, 50, 0.18), transparent 50%),
    linear-gradient(180deg, #fbefcf 0%, #f3dfae 55%, #ecd29a 100%);
  border: 3px solid #8a5a22;
  box-shadow: inset 0 0 0 4px rgba(255, 246, 220, 0.6), inset 0 0 38px rgba(140, 86, 30, 0.45), 0 14px 30px rgba(20, 12, 4, 0.45);
  border-radius: 10px;
}
.modal-card.q-card::before, .modal-card.q-card::after { /* the rollers */
  content: ''; position: absolute; left: -16px; right: -16px; height: 20px; border-radius: 10px; pointer-events: none;
  background:
    radial-gradient(circle at 8px 50%, #ffd76a 0 5px, #b8862a 6px 8px, transparent 9px),
    radial-gradient(circle at calc(100% - 8px) 50%, #ffd76a 0 5px, #b8862a 6px 8px, transparent 9px),
    linear-gradient(180deg, #a8693a, #6e3f1c 60%, #4a2a12);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 220, 170, 0.45);
}
.modal-card.q-card::before { top: -12px; }
.modal-card.q-card::after { bottom: -12px; }
.q-card .q-title { color: #6b3f16 !important; letter-spacing: 0.02em; }
.q-card .q-rank { background: linear-gradient(180deg, #ffe08a, #d39b32); color: #4a2a0c; border: 2px solid #7a4a14; box-shadow: 0 2px 0 #7a4a14, inset 0 1px 0 #fff4c4; border-radius: 999px; padding: 2px 12px; font-weight: 800; }
.q-card .q-text { color: #3a2410; text-shadow: 0 2px 0 rgba(255, 245, 215, 0.9); }
.q-text .qn, .q-text .qo, .q-text .qe, .q-text .qq { display: inline-block; font-weight: 900; animation: qbounce 0.55s cubic-bezier(.3, 1.6, .5, 1) both; -webkit-text-stroke: 1.5px #3a2410; paint-order: stroke fill; padding: 0 0.04em; }
.q-text .qn { color: #ff8a1f; font-size: 1.12em; }
.q-text .qo { color: #c04ad8; }
.q-text .qe { color: #22b8ff; font-size: 1.12em; }
.q-text .qq { color: #ffd23f; }
@keyframes qbounce { 0% { transform: translateY(-14px) scale(0.6); opacity: 0; } 70% { transform: translateY(2px) scale(1.08); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .q-text .qn, .q-text .qo, .q-text .qe, .q-text .qq { animation: none; } }
.q-card .q-entry { background: #fffaf0; border: 3px solid #8a5a22; box-shadow: inset 0 3px 6px rgba(120, 70, 20, 0.25); }
/* arcade keys: a thick coloured base, glossy top, they sink when pressed */
.q-pad .pad-key { border: 3px solid #2a1a0c; border-radius: 16px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.14), inset 0 3px 0 rgba(255, 255, 255, 0.75), 0 6px 0 #2a1a0c, 0 9px 10px rgba(40, 20, 4, 0.3); transition: transform 0.06s, box-shadow 0.06s; position: relative; }
.q-pad .pad-key::after { content: ''; position: absolute; left: 14%; right: 14%; top: 6px; height: 28%; border-radius: 10px; background: rgba(255, 255, 255, 0.45); pointer-events: none; }
.q-pad .pad-key:active, .q-pad .pad-key.pressed { transform: translateY(5px); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14), inset 0 3px 0 rgba(255, 255, 255, 0.75), 0 1px 0 #2a1a0c, 0 2px 4px rgba(40, 20, 4, 0.3); }
.q-pad .pad-key:nth-child(3n+1) { background: linear-gradient(180deg, #ffd0d9, #ff9fb4); }
.q-pad .pad-key:nth-child(3n+2) { background: linear-gradient(180deg, #fff1b8, #ffd45c); }
.q-pad .pad-key:nth-child(3n+3) { background: linear-gradient(180deg, #d6ecff, #8fc8ff); }
.q-pad .pad-key.back { background: linear-gradient(180deg, #e9e3d8, #c9bfae); }
.q-pad .pad-key.check { background: linear-gradient(180deg, #fff1a0 0%, #ffd23f 45%, #f0a51c 100%); color: #4a2a0c; text-shadow: 0 1px 0 rgba(255, 250, 220, 0.8);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; animation: checkglow 1.6s ease-in-out infinite; }
.q-pad .pad-key.check .chk-ico { width: 26px; height: 26px; color: #2f9a3a; filter: drop-shadow(0 1px 0 #fff6c8); }
@keyframes checkglow { 0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 200, 40, 0.55)); } 50% { filter: drop-shadow(0 0 12px rgba(255, 200, 40, 0.95)); } }

/* Miss Mei's mental-math shortcut box */
.mm-box { background: linear-gradient(180deg, #2a2350, #1b1638); border: 3px solid #d39b32; border-radius: 14px; padding: 10px 14px; box-shadow: inset 0 0 18px rgba(140, 110, 255, 0.35), 0 4px 0 #7a4a14; text-align: left; max-width: 420px; margin: 0 auto; }
.mm-title { font-family: var(--font-display); font-weight: 900; font-size: 20px; color: #ffd23f; text-shadow: 0 0 8px rgba(255, 210, 63, 0.6); margin-bottom: 6px; text-align: center; }
.mm-step { font-family: var(--font-display); font-weight: 800; font-size: 18px; padding: 4px 8px; margin: 4px 0; border-radius: 8px; color: #fff; }
.mm-s0 { background: rgba(255, 138, 31, 0.28); border-left: 5px solid #ff8a1f; }
.mm-s1 { background: rgba(34, 184, 255, 0.25); border-left: 5px solid #22b8ff; }
.mm-s2 { background: rgba(110, 227, 110, 0.25); border-left: 5px solid #6ee36e; }

/* Ask Twinkle (owner 2026-11-13): the hint button right under the problem, and the fairy's step-by-step box there too */
.q-ask { display: inline-flex; align-items: center; gap: 8px; margin: 2px auto 6px; padding: 6px 16px 6px 10px; border-radius: 999px; border: 3px solid #7a4a14;
  background: linear-gradient(180deg, #fff6c8, #ffd96a); color: #4a2a0c; font-family: var(--font-display); font-weight: 900; font-size: 16px; cursor: pointer;
  box-shadow: 0 4px 0 #7a4a14, 0 0 14px rgba(255, 220, 90, 0.7); }
.q-ask:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a4a14; }
/* Read it to me (speech.js): round speaker buttons at the end of the question and either side of the answers */
.q-say { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 3px solid var(--toon-ink, #173a5e); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ffffff 0 18%, #8fd3ff 19% 100%); box-shadow: 0 4px 0 var(--toon-ink, #173a5e), 0 0 12px rgba(120, 200, 255, 0.6); touch-action: manipulation; }
.q-say:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--toon-ink, #173a5e); }
.q-text .q-say-end { width: 36px; height: 36px; margin-left: 10px; vertical-align: middle; }
/* the question counter (top right) and rank (top left) are small pills in the card's corners (owner 2026-11-14:
   "Only keep the 2 of 5 in the top right ... it should all fit in a standard box") */
.modal-card.q-card { position: relative; padding-top: 44px; }
.q-card .q-title { position: absolute; top: 10px; right: 14px; margin: 0; font-size: 15px; line-height: 1.2; padding: 3px 11px; border-radius: 999px; background: #fff3b0; border: 2px solid var(--toon-ink); color: var(--toon-ink); }
.q-card .q-rank { position: absolute; top: 11px; left: 14px; margin: 0; font-size: 13px; padding: 3px 10px; border: 2px solid rgba(23, 58, 94, 0.35); }
.modal.race-q .q-title { top: 6px; right: 8px; font-size: 13px; }
.modal.race-q .q-card { padding-top: 32px; }
/* One big question card, the same size for every question (owner 2026-11-14: "i still see scroll -- ie question area
   resizing -- from each question, we should set a large almost full screen question to give us plenty of room") */
.modal-card.q-card { width: min(96vw, 1180px); max-width: none; height: min(94vh, 900px); max-height: 94vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 50px 28px 18px; }
.modal-card.q-card > * { flex: 0 0 auto; max-width: 100%; }
.q-card .q-text { font-size: clamp(26px, 4.2vh, 44px); line-height: 1.25; max-width: 92%; }
.q-card .q-pic { width: min(300px, 34vh); }
.q-card .q-pad.picks { max-width: 760px; }
.q-card .pick-key { min-height: 68px; font-size: 24px; }
.q-card .pick-key.longtxt { font-size: 19px; }
.q-card .pad-key { min-height: 60px; font-size: 28px; }
.modal.race-q .q-card { height: auto; max-height: 94vh; width: min(96vw, 900px); padding-top: 36px; }
@media (max-height: 760px) {
  .modal { padding: 8px; }
  .modal-card.q-card { padding: 40px 14px 8px; }
  .q-card .pad-key { min-height: 46px; font-size: 24px; }
  .q-card .pick-key { min-height: 50px; font-size: 20px; }
  .q-pad { gap: 6px; margin: 4px auto; }
  .q-entry { min-height: 50px; margin: 4px auto; }
  .q-typed { font-size: 36px; }
  .q-feedback { margin-top: 4px; min-height: 24px; font-size: 19px; }
  .q-card .btn-soft { min-height: 32px; margin-top: 0; font-size: 17px; }
  .q-ask { margin: 0 auto 4px; padding: 4px 14px 4px 8px; font-size: 15px; }
  .q-visual { margin: 4px auto; }
  .q-pic { width: min(170px, 44vw); }
  .q-card .pick-key.longtxt { font-size: 15px; min-height: 44px; }
  .q-text.story { font-size: 21px; line-height: 1.25; }
  .q-luck { display: none; }
}
/* one speaker per answer, beside its box and clear of it: left column to the left, right column to the right */
.pick-key { position: relative; }
.q-pad.picks { padding: 0 48px; max-width: 520px; }
.q-say-opt { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; z-index: 1; }
.q-say-opt:active { transform: translateY(-50%) translateY(3px); }
.picks .pick-key:nth-child(odd) .q-say-opt { left: -48px; }
.picks .pick-key:nth-child(even) .q-say-opt { right: -48px; }
.race-picks { padding: 0 0 0 40px; gap: 8px 44px !important; }
.race-picks .rp-cell { position: relative; }
.race-picks .rp-cell .q-say-opt { left: -42px; right: auto; width: 34px; height: 34px; }
.no-voice .q-say { display: none; }
@media (max-width: 480px) { .q-pad.picks { padding: 0 40px; } .q-say-opt { width: 34px; height: 34px; } .picks .pick-key:nth-child(odd) .q-say-opt { left: -40px; } .picks .pick-key:nth-child(even) .q-say-opt { right: -40px; } .q-text .q-say-end { width: 32px; height: 32px; margin-left: 6px; } }
.q-say .spk { width: 74%; height: 74%; display: block; overflow: visible; }
.q-say .spk-w { transform-origin: 26px 24px; }
.q-say.talking .spk-w { animation: horntalk 0.45s ease-in-out infinite alternate; }
@keyframes horntalk { from { transform: scale(0.85); opacity: 0.6; } to { transform: scale(1.12); opacity: 1; } }
.ask-fairy, .how-fairy { display: inline-block; width: 22px; height: 22px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 40% 40%, #fff 0 25%, #fff3a0 45%, rgba(255, 200, 80, 0.2) 75%, transparent 76%);
  box-shadow: 0 0 10px 3px rgba(255, 230, 120, 0.85); }
.ask-fairy::before, .ask-fairy::after, .how-fairy::before, .how-fairy::after { content: ''; position: absolute; top: -4px; width: 11px; height: 14px; border-radius: 60% 60% 50% 50%;
  background: rgba(200, 240, 255, 0.85); border: 1px solid rgba(120, 190, 230, 0.9); animation: flutter 0.18s ease-in-out infinite alternate; }
.ask-fairy::before, .how-fairy::before { left: -8px; transform-origin: right bottom; }
.ask-fairy::after, .how-fairy::after { right: -8px; transform-origin: left bottom; }
@keyframes flutter { from { transform: rotate(-18deg) scaleY(1); } to { transform: rotate(14deg) scaleY(0.8); } }
.q-ask .ask-fairy { animation: fairybob 1.4s ease-in-out infinite; }
@keyframes fairybob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.q-card .q-how { position: relative; margin: 4px 0 8px; background: linear-gradient(180deg, #fffdf3, #fdf1cf); border: 3px dashed #c99a4a; border-radius: 14px; }
.q-card .q-how-who { font-family: var(--font-display); color: #6b3f16; }
/* the fairy flies a loop round the box, then settles by the title */
.how-fairy { position: absolute; left: 10px; top: 8px; z-index: 3; width: 20px; height: 20px; }
.q-how.play .how-fairy { animation: fairyfly 1.6s ease-in-out both, fairybob 1.4s 1.6s ease-in-out infinite; }
@keyframes fairyfly { 0% { transform: translate(260px, -40px) scale(0.4); opacity: 0; } 20% { opacity: 1; } 40% { transform: translate(300px, 120px) scale(1.2); }
  70% { transform: translate(60px, 160px) scale(1); } 100% { transform: translate(0, 0) scale(1); } }
/* sketched in: lines draw themselves, fills fade in, steps slide in, then her words pop up in a bubble */
.q-how.play .q-how-pic svg :is(line, rect, circle, path, polygon, ellipse) { stroke-dasharray: 700; stroke-dashoffset: 700; animation: drawon 1.1s ease-out forwards, fillin 0.6s 0.7s ease-out both; }
.q-how.play .q-how-pic svg text { animation: fillin 0.5s 0.9s ease-out both; }
@keyframes drawon { to { stroke-dashoffset: 0; } }
@keyframes fillin { from { fill-opacity: 0; opacity: 0.3; } to { fill-opacity: 1; opacity: 1; } }
.q-how.play .mm-step { animation: stepin 0.45s ease-out both; }
@keyframes stepin { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.q-card .q-how-say { position: relative; background: #fff; border: 3px solid #2a1a0c; border-radius: 16px; padding: 8px 12px; margin: 10px 6px 4px; box-shadow: 0 4px 0 rgba(42, 26, 12, 0.35); }
.q-card .q-how-say::before { content: ''; position: absolute; left: 22px; top: -12px; border: 10px solid transparent; border-bottom-color: #2a1a0c; border-top: 0; }
.q-how.play .q-how-say { animation: bubblepop 0.4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes bubblepop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .q-how.play *, .q-how.play .how-fairy { animation: none !important; stroke-dashoffset: 0 !important; } }
/* column sums: the column you're on glows; your digits land in place */
.col-sum .col-cell.col-now { background: rgba(255, 214, 80, 0.55); box-shadow: 0 0 10px rgba(255, 200, 40, 0.8); border-radius: 6px; }
.col-sum .col-cell.blank.filled { color: #ff8a1f; font-weight: 900; }

/* Twinkle's pop-up words over the question, and "Show me another way" */
.q-fairy { position: absolute; right: 14px; top: 34px; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: 62%; padding: 8px 12px;
  background: #fff; border: 3px solid #2a1a0c; border-radius: 16px; box-shadow: 0 4px 0 rgba(42, 26, 12, 0.35), 0 0 16px rgba(255, 230, 120, 0.8);
  font-family: var(--font-display); font-weight: 800; color: #4a2a0c; font-size: 15px; pointer-events: none; }
.q-fairy.pop { animation: fairypop 2.6s ease both; }
@keyframes fairypop { 0% { opacity: 0; transform: translate(40px, -20px) scale(0.5); } 12% { opacity: 1; transform: none; } 85% { opacity: 1; transform: translateY(-2px); } 100% { opacity: 0; transform: translateY(-14px); } }
.q-alt { margin-top: 8px; font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .q-fairy.pop { animation: none; } }
/* training / gate titles are long: keep them small */
.q-card .q-title.small { font-size: 14px !important; line-height: 1.25; }

/* Twinkle's help floats over the card (no layout push) and works column sums right on the problem */
.q-card { position: relative; }
/* the box itself never clips (Twinkle perches above its top edge, owner 2026-11-14: "the fairy is getting cut off");
   a long explanation scrolls inside the picture area instead */
.q-card .q-how { position: absolute; left: 14px; right: 14px; z-index: 6; margin: 0; max-height: 64%; overflow: visible; display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 10px 28px rgba(42, 26, 12, 0.45), 0 0 0 4px rgba(255, 230, 140, 0.6); border-style: solid; }
.q-card .q-how > * { flex: 0 0 auto; max-width: 100%; }
.q-card .q-how .q-how-pic { flex: 0 1 auto; min-height: 0; overflow: auto; width: 100%; }
.q-got { margin: 6px auto 2px; font-size: 15px; }
.col-sum { position: relative; }
.tw-box { position: absolute; border: 4px dashed #ff8a1f; border-radius: 12px; background: rgba(255, 214, 80, 0.28);
  box-shadow: 0 0 14px rgba(255, 170, 40, 0.8); transition: left 0.5s ease, top 0.5s ease, width 0.5s ease, height 0.5s ease; pointer-events: none; animation: twdraw 0.5s ease-out; }
@keyframes twdraw { from { transform: scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
.tw-fairy { position: absolute !important; top: -26px; transition: left 0.5s ease; z-index: 2; }
.col-sum .col-cell.tw-mark { color: #d2452c; font-weight: 900; animation: twwrite 0.5s ease-out; }
.col-sum .col-cell.tw-write { color: #c04ad8; font-weight: 900; animation: twwrite 0.5s ease-out; }
@keyframes twwrite { from { transform: scale(2); opacity: 0; } to { transform: none; opacity: 1; } }
.q-how-say.tw-pop { animation: bubblepop 0.4s cubic-bezier(.3, 1.6, .5, 1) both !important; }
@media (prefers-reduced-motion: reduce) { .tw-box, .tw-fairy, .tw-mark, .tw-write { animation: none !important; transition: none !important; } }
/* Twinkle flies in bigger and lands on the help box's top edge, clear of the words */
.q-card .how-fairy { width: 30px; height: 30px; top: -16px; left: 18px; }
.q-card .how-fairy::before, .q-card .how-fairy::after { width: 16px; height: 20px; top: -7px; }
.q-card .how-fairy::before { left: -12px; } .q-card .how-fairy::after { right: -12px; }
/* Twinkle rings the numbers in the question that each step is about */
#qText { position: relative; }
#qText .tw-ring { position: relative; }
#qText .tw-ring::after { content: ''; position: absolute; inset: -6px -8px; border: 4px dashed #ff8a1f; border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 170, 40, 0.8); animation: twdraw 0.45s ease-out; pointer-events: none; }
#qText .tw-fairy { top: -22px; }
.mm-step.tw-now { outline: 3px solid #ffd23a; box-shadow: 0 0 14px rgba(255, 210, 60, 0.9); }
.q-how .mm-step.tw-later { opacity: 0.3 !important; animation: none !important; }

/* PRESS TO TRAIN: an arcade prompt that bounces and glows */
.prompt.train { background: linear-gradient(180deg, #ffe45a, #ff9f1a); color: #3a1c00; border: 3px solid #3a1c00; font-family: var(--font-display);
  font-weight: 900; font-size: 20px; letter-spacing: 0.04em; padding: 6px 16px; box-shadow: 0 5px 0 #3a1c00, 0 0 18px rgba(255, 200, 40, 0.9);
  animation: trainbob 0.7s ease-in-out infinite alternate; }
@keyframes trainbob { from { margin-top: 0; } to { margin-top: -10px; } }
@media (prefers-reduced-motion: reduce) { .prompt.train { animation: none; } }

/* Twinkle drawn as an inked cartoon fairy (owner 2026-11-13: "twinkle needs a better outline"): dark ink outline,
   wings, mint dress, star wand; the old glow-dot wings are switched off */
.ask-fairy, .how-fairy, .tw-fairy { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke='%232a1a0c' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'%3E%3Cellipse cx='17' cy='24' rx='13' ry='9' transform='rotate(-30 17 24)' fill='%23c8f0ff'/%3E%3Cellipse cx='47' cy='24' rx='13' ry='9' transform='rotate(30 47 24)' fill='%23c8f0ff'/%3E%3Cellipse cx='19' cy='38' rx='9' ry='6' transform='rotate(20 19 38)' fill='%23e2d0ff'/%3E%3Cellipse cx='45' cy='38' rx='9' ry='6' transform='rotate(-20 45 38)' fill='%23e2d0ff'/%3E%3Cpath d='M32 30 L22 54 Q32 58 42 54 Z' fill='%237ee0a8'/%3E%3Ccircle cx='32' cy='22' r='10' fill='%23ffe2c4'/%3E%3Cpath d='M22 21 Q24 10 32 11 Q41 10 42 21 Q37 15 32 17 Q27 15 22 21 Z' fill='%23ffd23a'/%3E%3Cpath d='M42 34 L52 26' fill='none'/%3E%3C/g%3E%3Cpath d='M52 20 l1.6 3.6 3.9.4-2.9 2.6.9 3.8-3.5-2-3.4 2 .8-3.8-2.9-2.6 3.9-.4z' fill='%23ffe45a' stroke='%232a1a0c' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='28.5' cy='23' r='1.8' fill='%232a1a0c'/%3E%3Ccircle cx='35.5' cy='23' r='1.8' fill='%232a1a0c'/%3E%3Cpath d='M29 27 Q32 30 35 27' fill='none' stroke='%232a1a0c' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='26' cy='26' r='1.8' fill='%23ff9aa8'/%3E%3Ccircle cx='38' cy='26' r='1.8' fill='%23ff9aa8'/%3E%3C/svg%3E") center / contain no-repeat !important; border-radius: 0 !important;
  box-shadow: none !important; filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 6px rgba(255, 230, 120, 0.95)); }
.ask-fairy::before, .ask-fairy::after, .how-fairy::before, .how-fairy::after, .tw-fairy::before, .tw-fairy::after { display: none !important; }
.q-ask .ask-fairy { width: 30px; height: 30px; }
.q-card .how-fairy { width: 40px; height: 40px; top: -24px; }
.tw-fairy { width: 40px !important; height: 40px !important; }
#qText .tw-fairy { top: -36px; }
.ask-fairy, .how-fairy, .tw-fairy { animation-name: fairybob; animation-duration: 1.2s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.q-how.play .how-fairy { animation: fairyfly 1.6s ease-in-out both, fairybob 1.2s 1.6s ease-in-out infinite; }

/* Beast book overhaul (owner 2026-11-13: monster-collector look): a wooden banner with brass bolts, badge-shaped filter
   tabs, element-coloured cards with rarity frames (slate, silver, bronze, polished, holo, flame foil; shiny = gold
   foil), stone tablets for beasts not found yet, a lore line under each name */
.book-banner { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px auto 8px; padding: 8px 26px; width: fit-content;
  background: repeating-linear-gradient(90deg, #8a5523 0 46px, #7a4a1c 46px 48px), linear-gradient(#a8692c, #6b3f16); background-blend-mode: multiply;
  border: 4px solid #3a1f08; border-radius: 12px; box-shadow: inset 0 3px 0 rgba(255, 220, 160, 0.4), 0 5px 0 #3a1f08; }
.book-banner b { font-family: var(--font-display); font-size: 22px; color: #fff4d6; text-shadow: 0 2px 0 #3a1f08; letter-spacing: 0.02em; }
.bb-bolt { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b0, #d9a530 55%, #7a5210); border: 2px solid #3a1f08; }
.book-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 6px; }
.book-tabs button { font-family: var(--font-display); font-weight: 900; font-size: 15px; padding: 6px 16px 8px; border: 3px solid #2a1a0c; cursor: pointer;
  border-radius: 14px 14px 22px 22px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); box-shadow: 0 4px 0 #2a1a0c; background: #8a7a68; }
.book-tabs [data-f="all"] { background: linear-gradient(#b89a6a, #7a5a32); }
.book-tabs [data-f="leaf"] { background: linear-gradient(#6fd36a, #2f8a3e); }
.book-tabs [data-f="fire"] { background: linear-gradient(#ffa25a, #d84a1a); }
.book-tabs [data-f="water"] { background: linear-gradient(#7fd0ff, #2a7ac8); }
.book-tabs [data-f="sky"] { background: linear-gradient(#c0d6ff, #6a8ae0); }
.book-tabs [data-f="shiny"] { background: linear-gradient(#fff08a, #e0a418); color: #4a2a00; text-shadow: none; }
.book-tabs button.on { transform: translateY(3px); box-shadow: 0 1px 0 #2a1a0c, 0 0 0 3px #fff, 0 0 14px rgba(255, 230, 120, 0.9); }
.book-note { font-size: 13px; text-align: center; }
/* the card: element colour inside, rarity frame outside */
.bcard { position: relative; border: 5px solid #8d949c; border-radius: 16px; padding: 8px 6px 8px;
  background: radial-gradient(circle at 50% 30%, var(--tcs, #f1efe8) 0 40%, color-mix(in srgb, var(--tc, #a8a290) 35%, #fff) 100%);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.6); overflow: hidden; }
.bcard .bart { position: relative; border-radius: 12px; background: radial-gradient(circle, rgba(255, 255, 255, 0.85), color-mix(in srgb, var(--tc, #aaa) 40%, transparent) 75%);
  border: 3px solid rgba(42, 26, 12, 0.55); padding: 2px; }
.bcard .bname { font-family: var(--font-display); font-weight: 900; font-size: 17px; color: #2a1a0c; text-shadow: 0 1px 0 #fff; margin-top: 2px; }
.bcard .rtitle { font-size: 11px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: #2a1a0c; color: #fff4d6; }
.bcard .lore { font-size: 12px; font-style: italic; color: #4a3a2a; line-height: 1.2; text-align: center; min-height: 2.4em; }
.bchip { position: absolute; right: -4px; top: -4px; background: #2a1a0c; color: #ffe45a; font-weight: 900; font-size: 12px; padding: 1px 6px; border-radius: 999px; border: 2px solid #ffe45a; }
.bcard[data-tier="grey"] { border-color: #6f767e; }
.bcard[data-tier="white"] { border-color: #c9d2dc; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25), inset 0 0 0 2px #fff, 0 0 0 2px #8a96a4; }
.bcard[data-tier="green"] { border-color: #b07a3c; border-image: linear-gradient(135deg, #e3a868, #8a5523, #e3a868, #6b3f16) 1; border-radius: 0; }
.bcard[data-tier="blue"] { border-color: #b8c4d0; border-image: linear-gradient(135deg, #ffffff, #8ea4b8, #f2f6fa, #6f8296) 1; border-radius: 0; }
.bcard[data-tier="purple"] { border-image: linear-gradient(135deg, #ff8ad8, #8ad0ff, #b48aff, #8affc8, #ff8ad8) 1; border-radius: 0; }
.bcard[data-tier="orange"] { border-image: linear-gradient(135deg, #ffe45a, #ff7a1a, #d8301a, #ffb02e, #ffe45a) 1; border-radius: 0; }
/* holo / flame foil sheen that sweeps across epic and legendary cards */
.bcard[data-tier="purple"]::after, .bcard[data-tier="orange"]::after, .bcard[data-shiny]::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.55) 45%, rgba(255, 200, 255, 0.35) 50%, transparent 62%);
  background-size: 260% 100%; animation: foil 3.2s linear infinite; mix-blend-mode: screen; }
.bcard[data-tier="orange"]::after { background-image: linear-gradient(115deg, transparent 30%, rgba(255, 240, 160, 0.6) 45%, rgba(255, 120, 40, 0.35) 52%, transparent 62%); }
.bcard[data-shiny] { border-image: linear-gradient(135deg, #fff6b0, #e0a418, #fff6b0, #b07a10, #fff6b0) 1 !important; border-radius: 0; background: radial-gradient(circle at 50% 30%, #fff8d6, #f5d36a) !important; }
.bcard[data-shiny]::after { background-image: linear-gradient(115deg, transparent 30%, rgba(255, 255, 220, 0.8) 46%, rgba(255, 215, 80, 0.5) 52%, transparent 62%); animation-duration: 2.2s; }
@keyframes foil { from { background-position: 130% 0; } to { background-position: -130% 0; } }
/* not found yet: a carved stone tablet */
.bcard.locked { border-image: none !important; border: 5px solid #5a5a5e; border-radius: 16px;
  background: repeating-linear-gradient(30deg, rgba(255, 255, 255, 0.04) 0 6px, rgba(0, 0, 0, 0.05) 6px 12px), linear-gradient(#9a9aa0, #6e6e74) !important; }
.bcard.locked::after { display: none; }
.bcard.locked .bart { background: rgba(0, 0, 0, 0.18); border-color: #444; }
.bcard.locked .bname { color: #e8e8ea; text-shadow: 0 2px 0 #333; }
.bcard.locked .lore { color: #e0e0e4; }
.bcard.locked .rtitle { background: #444; color: #ccc; }
@media (prefers-reduced-motion: reduce) { .bcard::after { animation: none !important; } }
.bcard.found .lore { background: rgba(255, 248, 225, 0.92); border: 2px solid rgba(107, 63, 22, 0.45); border-radius: 8px; padding: 2px 6px; color: #3a2a1a; }

/* Hatch card (owner 2026-11-13): chunky name, a lore line, the pay in a green pill with a coin; rare and shiny hatches
   get the legendary reveal: spinning rays in the rarity colour, the card shakes in, the portrait pops, confetti */
.reveal-card h2 { font-family: var(--font-display); font-weight: 900; letter-spacing: 0.01em; }
.r-lore { margin: 0 0 6px; font-style: italic; color: #6b4a2a; font-size: 15px; }
.r-pay { display: inline-flex; align-items: center; gap: 8px; margin: 6px auto 12px; padding: 6px 16px; border-radius: 999px;
  background: linear-gradient(#6fdc6a, #2f9a3e); color: #fff; font-family: var(--font-display); font-weight: 900; font-size: 17px;
  border: 3px solid #1d5a24; box-shadow: 0 4px 0 #1d5a24; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.r-coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc21a 55%, #b07a10); border: 2px solid #6b4600; }
.r-stage { position: relative; width: 200px; height: 200px; margin: 6px auto; display: grid; place-items: center; }
.r-stage canvas { position: relative; z-index: 1; margin: 0 !important; }
.r-rays { position: absolute; inset: -60px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, var(--rc, #ffd23a) 0 10deg, transparent 10deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%); }
.reveal-card.legend .r-rays { opacity: 0.9; animation: rays 6s linear infinite; }
.reveal-card.legend { animation: legendshake 0.6s cubic-bezier(.36, .07, .19, .97) both; box-shadow: 0 0 0 5px var(--rc), 0 0 40px 8px var(--rc); }
.reveal-card.legend canvas { animation: legendpop 0.7s 0.15s cubic-bezier(.3, 1.6, .5, 1) both; filter: drop-shadow(0 0 14px var(--rc)); }
.reveal-card.legend h2 { color: var(--rc); -webkit-text-stroke: 1.5px #2a1a0c; text-shadow: 0 3px 0 #2a1a0c; }
@keyframes rays { to { transform: rotate(360deg); } }
@keyframes legendshake { 0% { transform: scale(0.6); } 30% { transform: scale(1.08) rotate(-2deg); } 45% { transform: translateX(-10px) rotate(2deg); }
  60% { transform: translateX(8px) rotate(-1deg); } 75% { transform: translateX(-4px); } 100% { transform: none; } }
@keyframes legendpop { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reveal-card.legend, .reveal-card.legend canvas, .reveal-card.legend .r-rays { animation: none; } }

/* Beast detail card (owner 2026-11-13): element-themed header, a big showcase window with elemental energy, glowing
   crystal gem stat pips, move badges as element chips */
.tcard .tc-head { margin: -12px -12px 8px; padding: 10px 12px; border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 80%, #fff), var(--tc)); border-bottom: 4px solid rgba(42, 26, 12, 0.6); }
.tcard .tc-name { font-family: var(--font-display); font-weight: 900; font-size: 26px; color: #fff; -webkit-text-stroke: 1px #2a1a0c; text-shadow: 0 3px 0 #2a1a0c; }
.tcard .tc-type { border: 2px solid #2a1a0c; box-shadow: 0 2px 0 #2a1a0c; }
.tcard .tc-art { position: relative; overflow: hidden; border: 5px solid #2a1a0c; border-radius: 18px; height: 230px; align-items: center;
  background: radial-gradient(circle at 50% 55%, #fff 0 18%, color-mix(in srgb, var(--tc) 55%, #fff) 45%, color-mix(in srgb, var(--tc) 70%, #000) 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35), 0 0 0 3px #e8b53a; }
.tcard .tc-art::before { content: ''; position: absolute; inset: -40%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.35) 0 8deg, transparent 8deg 24deg);
  animation: rays 14s linear infinite; }
.tcard .tc-art::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
  radial-gradient(circle at 75% 30%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px), radial-gradient(circle at 60% 85%, rgba(255, 255, 255, 0.6) 0 3px, transparent 4px),
  radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px); animation: motesup 4s ease-in-out infinite alternate; }
@keyframes motesup { from { transform: translateY(6px); opacity: 0.6; } to { transform: translateY(-10px); opacity: 1; } }
.tcard .tc-art canvas { position: relative; z-index: 1; width: 220px; height: 220px; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35)); }
.tcard .tc-sub { font-family: var(--font-display); font-style: italic; text-align: center; }
/* move chips */
.tc-move { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px; border-radius: 999px; background: var(--tc); color: #fff;
  border: 2px solid #2a1a0c; box-shadow: 0 2px 0 #2a1a0c; }
.tc-move b { font-family: var(--font-display); font-size: 15px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.tc-mico { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #2a1a0c; position: relative; }
.tc-mico::after { content: ''; position: absolute; inset: 2px; background: var(--tc);
  clip-path: polygon(50% 0, 61% 32%, 100% 22%, 72% 52%, 96% 84%, 58% 70%, 50% 100%, 40% 70%, 4% 84%, 28% 52%, 0 22%, 39% 32%); }
/* crystal gem stat pips */
.tcard .tc-bar { gap: 6px; }
.tcard .tc-bar i { height: 16px; border-radius: 3px; transform: skewX(-12deg); background: linear-gradient(135deg, #8a8270, #5a5444); border: 2px solid #2a1a0c; }
.tcard .tc-bar i.on { background: linear-gradient(135deg, #fff 0 12%, color-mix(in srgb, var(--tc) 60%, #fff) 30%, var(--tc) 65%, color-mix(in srgb, var(--tc) 60%, #000) 100%);
  box-shadow: 0 0 8px var(--tc), inset 0 0 0 1px rgba(255, 255, 255, 0.6); }
.tcard .tc-stats span { font-family: var(--font-display); text-transform: capitalize; }
@media (prefers-reduced-motion: reduce) { .tcard .tc-art::before, .tcard .tc-art::after { animation: none; } }
.tcard .tc-about { background: rgba(255, 250, 235, 0.94); border: 2px solid rgba(107, 63, 22, 0.4); border-radius: 12px; padding: 8px 10px; color: #2a1a0c; }
.tcard .tc-sub { background: rgba(255, 250, 235, 0.9); border-radius: 10px; padding: 3px 8px; color: #4a2a0c; }
/* the boost gauge runs up the left side of the screen (owner 2026-11-13: "the boost metter should fill up the left side
   of the screen"): a tall glowing tube under the hearts */
.boost-box .fuel { position: fixed; left: max(12px, env(safe-area-inset-left)); top: 120px; bottom: calc(150px + env(safe-area-inset-bottom)); height: auto;
  width: 22px; border: 3px solid #2a1a0c; background: rgba(255, 255, 255, 0.75); box-shadow: 0 3px 0 #2a1a0c, 0 0 12px rgba(255, 170, 40, 0.55); }
.boost-box .fuel i { background: linear-gradient(0deg, #ff5d2e, #ffb21a 55%, #ffe45a); box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.7); }
.boost-box .fuel.low i { background: #e2483d; }
body.touch-mode .boost-box .fuel { bottom: calc(260px + env(safe-area-inset-bottom)); }

/* the boost gauge pulses yellow as it gets low, then red (owner 2026-11-13: "pulsing yellow and pulsing red meters as it
   gets low") */
.boost-box .fuel.mid { animation: fuelmid 1s ease-in-out infinite; }
.boost-box .fuel.mid i { background: linear-gradient(0deg, #ffb21a, #ffe45a); }
.boost-box .fuel.low { animation: fuellow 0.55s ease-in-out infinite; }
.boost-box .fuel.low i { background: linear-gradient(0deg, #c8231b, #ff5a4a); }
/* boosting: lightning glow round the gauge and the shoe (owner 2026-11-14: "during boost, lets have lighting effects
   around the meter and the shoes") */
.boost-box.boosting .fuel { animation: boostglow 0.45s ease-in-out infinite alternate; border-color: #fff3b0; }
.boost-box.boosting .fuel i { box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.95); filter: brightness(1.15); }
.boost-box.boosting .boost-btn { animation: boostshoe 0.45s ease-in-out infinite alternate; }
.boost-box.boosting .boost-btn::before, .boost-box.boosting .boost-btn::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, rgba(255, 240, 150, 0) 0 20%, rgba(255, 244, 170, 0.95) 23%, rgba(255, 240, 150, 0) 27%, rgba(255, 240, 150, 0) 48%, rgba(255, 244, 170, 0.95) 51%, rgba(255, 240, 150, 0) 55%, rgba(255, 240, 150, 0) 73%, rgba(255, 244, 170, 0.95) 76%, rgba(255, 240, 150, 0) 80%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%, #000 78%, transparent 82%); mask: radial-gradient(circle, transparent 58%, #000 60%, #000 78%, transparent 82%);
  animation: boostspin 0.7s linear infinite; }
.boost-box.boosting .boost-btn::after { inset: -22px; animation-duration: 1.1s; animation-direction: reverse; opacity: 0.6; }
@keyframes boostglow { from { box-shadow: 0 3px 0 #2a1a0c, 0 0 14px 3px rgba(255, 220, 90, 0.7); } to { box-shadow: 0 3px 0 #2a1a0c, 0 0 30px 10px rgba(255, 236, 140, 0.95), 0 0 50px 16px rgba(255, 180, 40, 0.5); } }
@keyframes boostshoe { from { box-shadow: 0 1px 0 var(--toon-ink), 0 0 12px 2px rgba(255, 230, 110, 0.7); } to { box-shadow: 0 1px 0 var(--toon-ink), 0 0 28px 10px rgba(255, 240, 150, 0.95); } }
@keyframes boostspin { to { transform: rotate(360deg); } }
@keyframes fuelmid { 50% { box-shadow: 0 3px 0 #2a1a0c, 0 0 22px 6px rgba(255, 210, 40, 0.95); border-color: #b07a00; } }
@keyframes fuellow { 50% { box-shadow: 0 3px 0 #2a1a0c, 0 0 24px 8px rgba(255, 50, 40, 1); border-color: #8a0f08; } }
@media (prefers-reduced-motion: reduce) { .boost-box .fuel.mid, .boost-box .fuel.low { animation: none; } }
/* Expert questions switch on the start screen */
.expert-switch { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 var(--space-3); padding: 10px 14px; border-radius: 16px;
  border: var(--toon-line); background: #fff; box-shadow: 0 3px 0 var(--toon-ink); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.expert-switch .ex-knob { flex: none; position: relative; width: 52px; height: 30px; border-radius: 999px; background: #c9c3b8; border: 3px solid var(--toon-ink); transition: background 0.15s; }
.expert-switch .ex-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--toon-ink); transition: left 0.15s; }
.expert-switch[aria-checked="true"] { background: linear-gradient(#fff6c8, #ffe38a); }
.expert-switch[aria-checked="true"] .ex-knob { background: #ffb21a; }
.expert-switch[aria-checked="true"] .ex-knob::after { left: 24px; }
.expert-switch .ex-text { display: flex; flex-direction: column; line-height: 1.2; }
.expert-switch .ex-text small { color: #6b4a2a; font-weight: 700; }

/* Loading screen between Play and the game */
.loading { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 40%, #fff6d6, #ffd98a 55%, #f0a94a); color: #4a2a0c; font-family: var(--font-display); font-weight: 900; font-size: 26px; }
.loading[hidden] { display: none; }
.loading p { margin: 0; text-shadow: 0 2px 0 #fff; }
.ld-egg { width: 70px; height: 90px; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; background: radial-gradient(circle at 35% 30%, #fff, #bfe6ff 45%, #6fb8f0);
  border: 4px solid #2a1a0c; box-shadow: 0 6px 0 #2a1a0c; animation: ldwob 0.6s ease-in-out infinite alternate; transform-origin: 50% 90%; }
.ld-bar { width: 220px; height: 16px; border-radius: 999px; border: 3px solid #2a1a0c; background: #fff; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, #ff9f1a, #ffe45a); animation: ldrun 1s ease-in-out infinite; }
@keyframes ldwob { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes ldrun { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .ld-egg, .ld-bar i { animation: none; } }
.expert-switch[hidden] { display: none; }

/* Compact subject tiles (owner 2026-11-13: "on the main menu page of subjects, lets reduce vertical height ... so we get
   more stuff to fit, since i want to put the subjects in a Tab"): name on top, ages and the example on one line under
   it, the coin badge riding on the tile's top edge instead of adding a row. */
.levels { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 8px; padding-top: 6px; }
.level, .level:has(.lv-bonus) { position: relative; min-height: 0; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 8px; padding: 7px 8px 6px; }
.level .lv-name { flex: 0 0 100%; font-size: 15px; line-height: 1.15; }
.level .lv-ages { font-size: 12px; }
.level .lv-sample { font-size: 15px; }
.level .lv-bonus { top: -9px; right: 6px; font-size: 10px; padding: 0 5px; }
@media (max-width: 720px) {
  .levels { grid-template-columns: repeat(2, 1fr); }
  .level, .level:has(.lv-bonus) { padding: 7px 5px 5px; }
  .level .lv-name { font-size: 14px; }
  .level .lv-sample { font-size: 14px; }
}

/* Subject tabs on the start screen: one row that scrolls sideways on a phone */
.subj-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 4px 2px 8px; margin: 4px 0 2px; }
.subj-tabs [role="tab"] { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--toon-ink); background: #fff;
  color: var(--toon-ink); font-family: var(--font-display); font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 var(--toon-ink); }
.subj-tabs [role="tab"].soon { background: #f1ede6; color: #6b5a48; }
.subj-tabs [role="tab"][aria-selected="true"] { background: linear-gradient(#fff6c8, #ffd23f); color: var(--toon-ink); transform: translateY(2px); box-shadow: 0 1px 0 var(--toon-ink); }
.subj-tabs [role="tab"]:focus-visible { outline: 3px solid #3a8be0; outline-offset: 2px; }
.subj-panel[hidden] { display: none; }
.subj-soon { margin: 6px 0 var(--space-3); padding: 18px 16px; border-radius: 16px; border: 2px dashed #c9b89c; background: #fffaf0; text-align: center; font-weight: 700; color: #4a3a28; }
.subj-soon p { margin: 0; }
.expert-switch.subj-off { display: none; }

/* how many topics are picked in a tab */
.subj-tabs .tab-n:empty { display: none; }
.subj-tabs .tab-n { display: inline-block; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--toon-ink); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center; vertical-align: 1px; }

/* "Who is playing?" higher up (owner 2026-11-13: "on the menu, move who is playing higher up"): a slimmer title bar,
   the card starts right under it, and the player links sit on one line */
.start-brand { padding: 6px var(--space-3); }
.start-brand .brand-mark { width: 50px; height: 50px; }
.start-name { width: 380px; height: 40px; }
.start-name text { font-size: 39px; }
.start-card { margin-top: 10px; padding-top: 10px; }
.start-card h1#startTitle { margin: 0; font-size: 24px; }
.start-card .players { margin-top: 6px; }
.start-card .player-actions { gap: 0 var(--space-3); }
.start-card .player-actions .btn-soft { min-height: 36px; }
.start-card #ageTitle { margin-top: 8px; }
@media (max-width: 720px) {
  .start-name { width: 270px; height: 29px; }
  .start-card .player-actions { flex-wrap: nowrap; }
  .start-card .player-actions .btn-soft { font-size: 14px; padding: 0 4px; }
}

/* The emote wheel (emotes.js; owner 2026-11-14: "it should be like fortnite"): a ring of eight slots round the middle
   of the screen, a page button in the centre, page chips under it. Floats over the world, never pauses play. */
.emote-wheel { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  pointer-events: none; z-index: 7; --ew: min(78vw, 58vh, 400px); --slot-w: min(104px, calc(var(--ew) * 0.3)); --slot-h: min(58px, calc(var(--ew) * 0.17)); }
.emote-wheel[hidden] { display: none; }
.emote-wheel > * { pointer-events: auto; }
.ew-ring { position: relative; width: var(--ew); height: var(--ew); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 253, 242, 0) 0 23%, rgba(255, 253, 242, 0.55) 24% 62%, rgba(255, 253, 242, 0) 63%);
  animation: ew-pop 0.22s cubic-bezier(.3, 1.5, .5, 1); }
.ew-slot { position: absolute; left: 50%; top: 50%; width: var(--slot-w); height: var(--slot-h); margin: calc(var(--slot-h) / -2) 0 0 calc(var(--slot-w) / -2);
  transform: translate(calc(var(--sx) * var(--ew) * 0.42), calc(var(--sy) * var(--ew) * 0.42));
  border: 3px solid var(--toon-ink, #0e3c67); border-radius: 999px; padding: 3px 8px; font-family: var(--font-display); font-size: clamp(11px, calc(var(--ew) * 0.04), 14px); font-weight: 800; line-height: 1.1;
  color: var(--toon-ink, #0e3c67); cursor: pointer; box-shadow: 0 4px 0 var(--toon-ink, #0e3c67); display: grid; place-items: center; text-align: center; opacity: 0.92; }
.ew-slot.is-emote { background: linear-gradient(180deg, #fff7c2, #ffd95c); }
.ew-slot.is-phrase { background: linear-gradient(180deg, #e9f6ff, #b9e0ff); }
.ew-slot.hot, .ew-slot:hover { opacity: 1; background: linear-gradient(180deg, #fff3b0, #ffb627); transform: translate(calc(var(--sx) * var(--ew) * 0.42), calc(var(--sy) * var(--ew) * 0.42)) scale(1.12); z-index: 1; }
.ew-slot:active { box-shadow: 0 1px 0 var(--toon-ink, #0e3c67); }
.ew-centre { position: absolute; left: 50%; top: 50%; width: calc(var(--ew) * 0.4); height: calc(var(--ew) * 0.4); margin: calc(var(--ew) * -0.2) 0 0 calc(var(--ew) * -0.2); border-radius: 50%;
  border: 4px solid var(--toon-ink, #0e3c67); background: rgba(255, 253, 242, 0.92); box-shadow: 0 5px 0 var(--toon-ink, #0e3c67); display: grid; place-items: center; align-content: center; gap: 2px;
  font-family: var(--font-display); color: var(--toon-ink, #0e3c67); cursor: pointer; padding: 6px; }
.ew-centre .ew-name { font-size: 17px; font-weight: 900; line-height: 1.1; }
.ew-centre .ew-hint { font-size: 11px; font-weight: 700; opacity: 0.7; }
.ew-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 6px 8px; border-radius: 999px; background: rgba(255, 253, 242, 0.7); max-width: 96vw; }
.ew-tab { border: 2px solid var(--toon-ink, #0e3c67); border-radius: 999px; padding: 4px 10px; background: #fff; color: var(--toon-ink, #0e3c67); font-family: var(--font-display); font-size: 13px; font-weight: 800; cursor: pointer; }
.ew-tab[aria-pressed="true"] { background: #ffd95c; }
@keyframes ew-pop { from { transform: scale(0.7); opacity: 0; } }
@media (max-width: 520px) { .ew-centre .ew-name { font-size: 14px; } .ew-tab { font-size: 12px; padding: 3px 8px; } }
@media (orientation: landscape) and (max-height: 520px) { .emote-wheel { --ew: min(64vh, 300px); flex-direction: row; gap: 14px; } .ew-tabs { flex-direction: column; border-radius: 22px; } }
@media (prefers-reduced-motion: reduce) { .ew-ring { animation: none; } }
body.epic-fight .emote-wheel { display: none !important; }

/* Phone layout in touch mode (owner 2026-11-14: "Phone portrait interface looks awful too", "Rearrange the phone
   layouts, so they are intuitive, fun"). Thumb zones: run with the left thumb, Jump / Grab / Dodge under the right
   thumb, Boost and Home just above them. The top row is only Sound, Tools and Pause; every other button lives in the
   toolbox that the Tools button pops open (big labelled tiles). The emote smiley stands alone at the bottom middle and
   the compass sits bottom-left under the boost gauge, so the middle of the picture stays clear. */
.tools-btn, .icon-btn .lbl { display: none; }
body.touch-mode .tools-btn { display: grid; }
body.touch-mode .tools-btn[aria-expanded="true"] { background: #fff3b0; transform: translateY(2px); box-shadow: 0 2px 0 var(--toon-ink, #0e3c67); }
body.touch-mode .hud-dock { display: none; position: fixed; right: max(10px, env(safe-area-inset-right)); top: calc(max(var(--space-3), env(safe-area-inset-top)) + 60px);
  width: min(calc(100vw - 20px), 400px); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px; border-radius: 24px; z-index: 8;
  background: rgba(255, 253, 242, 0.97); border: 4px solid var(--toon-ink, #0e3c67); box-shadow: 0 6px 0 var(--toon-ink, #0e3c67), 0 14px 30px rgba(14, 60, 103, 0.3); }
body.touch-mode.tools-open .hud-dock { display: grid; animation: toon-pop 0.28s cubic-bezier(.3, 1.6, .5, 1); }
body.touch-mode .hud-dock .icon-btn { width: auto; height: auto; min-height: 72px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 4px 6px; }
body.touch-mode .hud-dock .icon-btn svg { width: 30px; height: 30px; }
body.touch-mode .hud-dock .icon-btn .lbl { display: block; font-family: var(--font-display); font-size: 12px; font-weight: 800; line-height: 1; color: var(--toon-ink, #0e3c67); }
body.touch-mode .hud-dock .icon-btn::after { display: none; }
body.touch-mode .hud-dock .icon-btn[hidden] { display: none; }
/* the smiley: one tap, in the right column just above Home (owner 2026-11-14: "move the emote over the home") */
body.touch-mode #btnEmote { position: fixed; right: max(19px, calc(env(safe-area-inset-right) + 1px)); bottom: calc(434px + env(safe-area-inset-bottom)); width: 64px; height: 64px; pointer-events: auto; z-index: 4; }
body.touch-mode #btnEmote svg { width: 36px; height: 36px; }
body.touch-mode .hud { z-index: 6; } /* the HUD (toolbox, emote dock, smiley) paints above the touch buttons and the roaming goal pill */
/* the first-time thumbs hint sits up under the coin chips, where nothing else lives */
body.touch-mode .touch-help { max-width: calc(100% - 40px); font-size: 14px; line-height: 1.25; left: 50%; right: auto; bottom: auto; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 140px); transform: translateX(-50%); text-align: center; padding: 4px 12px; }
/* right thumb column: Jump, Dodge, Grab, then Boost and Home above them */
body.touch-mode .boost-box { bottom: calc(270px + env(safe-area-inset-bottom)); }
body.touch-mode .home-btn { bottom: calc(358px + env(safe-area-inset-bottom)); }
/* compass top centre, see-through, letters outlined so they read over sky or grass (owner 2026-11-14: "compass in the
   middle top, make it see through but make the letters outlined correctly") */
body.touch-mode .compass { left: 50%; right: auto; bottom: auto; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 2px); transform: translateX(-50%); gap: 0; }
body.touch-mode .compass-dial { width: 60px; height: 60px; background: rgba(255, 255, 255, 0.16); border: 3px solid rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 1.5px rgba(42, 26, 12, 0.7), inset 0 0 0 1px rgba(42, 26, 12, 0.35); }
body.touch-mode .compass-dial span { color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 13px; -webkit-text-stroke: 0.6px #2a1a0c;
  text-shadow: -1.4px 0 #2a1a0c, 1.4px 0 #2a1a0c, 0 -1.4px #2a1a0c, 0 1.4px #2a1a0c, -1px -1px #2a1a0c, 1px 1px #2a1a0c, -1px 1px #2a1a0c, 1px -1px #2a1a0c; }
body.touch-mode .compass-dial .cp-n { color: #ff7a5c; font-size: 17px; transform: translate(-50%, -50%) translateY(-18px); }
body.touch-mode .compass-dial .cp-s { transform: translate(-50%, -50%) translateY(19px); }
body.touch-mode .compass-dial .cp-e { transform: translate(-50%, -50%) translateX(19px); }
body.touch-mode .compass-dial .cp-w { transform: translate(-50%, -50%) translateX(-19px); }
body.touch-mode .compass-dial .cp-needle { border-bottom-width: 14px; border-left-width: 5px; border-right-width: 5px; text-shadow: none; filter: drop-shadow(0 0 1px #2a1a0c) drop-shadow(0 0 1px #2a1a0c); }
body.touch-mode .compass-word { margin-top: -6px; font-size: 11px; padding: 0 7px; }
body.touch-mode .hud-left { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 92px); }
body.touch-mode .boost-box .fuel { top: 110px; bottom: calc(262px + env(safe-area-inset-bottom)); }
body.epic-fight #btnEmote { display: none !important; }
/* small phones (owner 2026-11-14: "Resize buttons as needed but still usable"): everything a step smaller, nothing under 44px */
@media (orientation: portrait) and (max-height: 720px) {
  body.touch-mode .tbtn.jump { width: 80px; height: 80px; font-size: 17px; }
  body.touch-mode .tbtn.dodge { width: 72px; height: 72px; font-size: 16px; margin-right: 84px; margin-bottom: -50px; }
  body.touch-mode .tbtn.grab { width: 70px; height: 70px; font-size: 16px; margin-right: 50px; }
  body.touch-mode .touch-buttons { gap: 10px; }
  body.touch-mode .boost-btn { width: 62px; height: 62px; }
  body.touch-mode .boost-box { bottom: calc(224px + env(safe-area-inset-bottom)); }
  body.touch-mode .home-btn { width: 54px; height: 54px; bottom: calc(296px + env(safe-area-inset-bottom)); }
  body.touch-mode .home-btn svg { width: 26px; height: 26px; }
  body.touch-mode #btnEmote { width: 54px; height: 54px; bottom: calc(360px + env(safe-area-inset-bottom)); }
  body.touch-mode #btnEmote svg { width: 30px; height: 30px; }
  body.touch-mode .boost-box .fuel { top: 104px; bottom: calc(222px + env(safe-area-inset-bottom)); width: 18px; }
  body.touch-mode .hud-dock .icon-btn { min-height: 62px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body.touch-mode .hud-dock { top: calc(max(var(--space-3), env(safe-area-inset-top)) + 56px); width: min(calc(100vw - 20px), 520px); grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; padding: 8px; }
  body.touch-mode .hud-dock .icon-btn { min-height: 60px; padding: 6px 2px 4px; }
  body.touch-mode .hud-dock .icon-btn svg { width: 24px; height: 24px; }
  body.touch-mode .hud-dock .icon-btn .lbl { font-size: 11px; }
  body.touch-mode .boost-box { bottom: calc(22px + env(safe-area-inset-bottom)); right: calc(max(18px, env(safe-area-inset-right)) + 230px); }
  body.touch-mode .home-btn { bottom: calc(112px + env(safe-area-inset-bottom)); right: calc(max(18px, env(safe-area-inset-right)) + 236px); }
  body.touch-mode .boost-box .fuel { top: 104px; bottom: calc(60px + env(safe-area-inset-bottom)); }
  body.touch-mode #btnEmote { right: calc(max(18px, env(safe-area-inset-right)) + 239px); bottom: calc(188px + env(safe-area-inset-bottom)); width: 60px; height: 60px; }
  body.touch-mode .touch-help { max-width: 34%; left: max(18px, env(safe-area-inset-left)); transform: none; text-align: left; top: calc(max(var(--space-3), env(safe-area-inset-top)) + 108px); }
}

/* every on-screen button a little see-through, the forest shows through (owner 2026-11-14: "all the buttons should be a
   little see through also"); pressed / lit states stay solid so a kid sees them light up */
.tbtn, .icon-btn, .boost-btn, .home-btn, .tools-btn, #btnEmote { opacity: 0.82; }
.tbtn:active, .tbtn.ready, .boost-btn.on, .boost-box.boosting .fuel, .icon-btn[aria-expanded="true"], .tools-btn[aria-expanded="true"] { opacity: 1; }
body.touch-mode .hud-dock .icon-btn { opacity: 1; } /* the open toolbox is a sheet, its tiles stay solid */

/* The new-pet card on short screens (owner 2026-11-14: "on full screen, and hatching pen, that interface dont fit right,
   needed to scroll, ie seeing the new pet, to click on keep playing"): smaller portrait and type, Keep playing sticks to
   the bottom of the card, and in landscape the portrait sits beside the words. */
.reveal-card #rOk { position: sticky; bottom: 0; }
@media (max-height: 720px) {
  .reveal-card { padding: 10px 14px; }
  .reveal-card .r-stage { width: 130px; height: 130px; margin: 0 auto; }
  .reveal-card canvas { width: 120px; height: 120px; }
  .reveal-card h2 { font-size: 26px; }
  .reveal-card .q-title { font-size: 20px; margin: 0 0 2px; }
  .reveal-card .r-lore { font-size: 13px; margin: 0 0 4px; }
  .reveal-card .tag, .reveal-card .muted { margin: 2px 0; font-size: 14px; }
  .reveal-card .r-pay { margin: 4px auto 8px; font-size: 15px; padding: 4px 12px; }
  .reveal-card .btn-play { min-height: 48px; font-size: 22px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .reveal-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); grid-template-areas: "title title" "stage name" "stage lore" "stage tag" "stage info" "stage news" "stage pay" "ok ok";
    column-gap: 14px; align-items: center; align-content: center; text-align: left; max-width: 600px; padding: 8px 14px; }
  .reveal-card .q-title { grid-area: title; text-align: center; }
  .reveal-card .r-stage { grid-area: stage; align-self: start; }
  .reveal-card h2 { grid-area: name; }
  .reveal-card .r-lore { grid-area: lore; }
  .reveal-card .tag { grid-area: tag; justify-self: start; }
  .reveal-card #rInfo { grid-area: info; margin: 2px 0; }
  .reveal-card #rNews { grid-area: news; }
  .reveal-card .r-pay { grid-area: pay; justify-self: start; margin: 4px 0 6px; }
  .reveal-card #rOk { grid-area: ok; justify-self: center; min-height: 44px; min-width: 180px; font-size: 20px; }
}
