@font-face {
  font-family: 'Fredoka';
  src: url('../vendor/fonts/Fredoka.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --ink: #2b2250;
  --paper: rgba(255, 255, 255, 0.92);
  --accent: #ff6b6b;
  --accent2: #ffb703;
  --good: #2ec4b6;
  --shadow: 0 8px 0 rgba(0, 0, 0, 0.15), 0 14px 30px rgba(0, 0, 0, 0.2);
  --font: 'Fredoka', 'Baloo 2', 'Nunito', 'Comic Sans MS', 'Chalkboard SE', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd3ff; font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; }

.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.screen.show { display: flex; animation: pop 0.35s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* loading */
#loading { background: linear-gradient(160deg, #8fd3ff, #c2f0c2); }
.loader span { display: inline-block; width: 22px; height: 22px; margin: 6px; border-radius: 50%; background: #ff6b6b; animation: bounce 0.9s infinite ease-in-out; }
.loader span:nth-child(2) { background: #ffb703; animation-delay: 0.15s; }
.loader span:nth-child(3) { background: #2ec4b6; animation-delay: 0.3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }

/* title */
.title-card { text-align: center; background: var(--paper); border-radius: 36px; padding: 28px 36px 24px; box-shadow: var(--shadow); max-width: 520px; width: 100%; }
h1 { margin: 0 0 6px; line-height: 0.95; }
h1 span { display: block; }
.t1 { font-size: clamp(48px, 12vw, 84px); color: #ff6b6b; text-shadow: 0 5px 0 #c94b4b; letter-spacing: 1px; }
.t2 { font-size: clamp(30px, 7vw, 48px); color: #4d96ff; text-shadow: 0 4px 0 #2d6ad1; }
.t3 { display: inline-block !important; margin-top: 8px; font-size: 28px; color: #fff; background: #ffb703; padding: 2px 16px; border-radius: 14px; box-shadow: 0 4px 0 #c98a00; transform: rotate(-4deg); }
.tag { font-size: 20px; margin: 14px 0 18px; }
.big { font-size: 28px; font-weight: 600; padding: 14px 40px; border-radius: 999px; background: linear-gradient(#ff8a5b, #ff5d5d); color: #fff; box-shadow: 0 6px 0 #c33f3f, 0 10px 20px rgba(0, 0, 0, 0.2); transition: transform 0.1s; }
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #c33f3f; }
.big:disabled { filter: grayscale(0.7); opacity: 0.7; }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.pill { font-size: 18px; padding: 10px 18px; border-radius: 999px; background: #fff; box-shadow: 0 4px 0 #d6d0ea; font-weight: 500; }
.pill:active { transform: translateY(3px); box-shadow: 0 1px 0 #d6d0ea; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }
.small-row { margin-top: 18px; }
.link { background: none; text-decoration: underline; font-size: 17px; margin-top: 12px; opacity: 0.8; }

/* panels */
.panel { background: var(--paper); border-radius: 30px; padding: 18px 20px 22px; box-shadow: var(--shadow); width: min(860px, 100%); max-height: calc(100% - 8px); overflow-y: auto; text-align: center; touch-action: pan-y; }
.panel-head { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 30px; }
.icon { width: 52px; height: 52px; border-radius: 50%; background: #fff; font-size: 24px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15); }
.icon.off { opacity: 0.45; }
.stars-total { font-size: 20px; font-weight: 600; white-space: nowrap; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 6px 0 16px; }
.scene-card { position: relative; border-radius: 22px; aspect-ratio: 4 / 3; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 10px; font-size: 18px; font-weight: 600; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18); background-size: cover; background-position: center; overflow: hidden; transition: transform 0.15s; }
.scene-card .emo { position: absolute; top: 12%; font-size: 46px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3)); text-shadow: none; }
.scene-card .st { font-size: 14px; letter-spacing: 2px; color: #ffe066; }
.scene-card .lv { position: absolute; top: 8px; left: 8px; font-size: 14px; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 999px; background: rgba(43, 34, 80, 0.72); color: #fff; text-shadow: none; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.scene-card.sel { outline: 5px solid #ffb703; transform: scale(1.04); }
.scene-card.locked { filter: grayscale(0.85) brightness(0.8); }
.scene-card.locked .emo::after { content: '🔒'; position: absolute; right: -24px; bottom: -8px; font-size: 30px; }
.discs-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.discs-row .label { font-size: 22px; font-weight: 600; }
.disc-picker { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.disc-picker button { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; font-weight: 700; background: #fff; box-shadow: 0 4px 0 #d6d0ea; }
.disc-picker button.sel { background: #4d96ff; color: #fff; box-shadow: 0 4px 0 #2d6ad1; }

/* HUD */
.hud { position: fixed; inset: 0; pointer-events: none; display: none; z-index: 5; }
.hud.show { display: block; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip { background: var(--paper); border-radius: 999px; padding: 8px 16px; font-size: 20px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12); white-space: nowrap; }
.chip b { font-size: 24px; }
.chip .lbl { font-size: 16px; opacity: 0.75; }
.chip .min { font-size: 16px; opacity: 0.6; }
.scene-chip { margin-left: auto; }
.scene-chip b { font-size: inherit; }
.hud-bottom { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 0 10px; }
.tool { background: var(--paper); border-radius: 22px; padding: 8px 16px; font-size: 16px; font-weight: 600; display: flex; flex-direction: column; align-items: center; min-width: 78px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15); }
.tool span { font-size: 26px; line-height: 1.1; }
.tool:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15); }
.tool.on { background: #ffe066; }
.tool:disabled { opacity: 0.45; }
.tip { position: absolute; left: 50%; top: 78px; transform: translateX(-50%) translateY(-10px); background: #fff; border-radius: 20px; padding: 10px 20px; font-size: 19px; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.3s, transform 0.3s; max-width: min(92vw, 560px); text-align: center; pointer-events: none; }
.tip.show { opacity: 1; transform: translateX(-50%); }

/* win */
.win-panel { width: min(520px, 100%); }
.win-panel h2 { font-size: 38px; margin: 6px 0; color: #ff6b6b; }
.win-stars { font-size: 70px; letter-spacing: 6px; }
.win-stars .star { color: #ddd; display: inline-block; transform: scale(0.3); transition: transform 0.4s cubic-bezier(0.3, 1.8, 0.5, 1), color 0.2s; }
.win-stars .star.on { color: #ffc300; transform: scale(1); text-shadow: 0 4px 0 #d49b00; }
.win-stars .star.shown { transform: scale(1); }
#win-stats { font-size: 20px; margin: 6px 0; }
.unlock { font-size: 22px; font-weight: 600; color: #2a9d8f; min-height: 1em; }

.howto { text-align: left; font-size: 20px; line-height: 1.5; padding-left: 28px; }
.fact { background: #fff7d6; border-radius: 16px; padding: 10px 14px; font-size: 17px; }
.settings { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; font-size: 21px; padding: 6px 12px; }
.settings input { width: 24px; height: 24px; vertical-align: middle; }
.settings .num-set input { width: 3.2em; height: 34px; font: inherit; font-size: 19px; text-align: center; border: 2px solid #cfc6ee; border-radius: 10px; margin: 0 4px; }
.settings .num-set small { opacity: 0.6; font-size: 0.75em; }
/* red pulsing screen edge with the off-track warning (works when the sound is off); see flashEdge in main.js */
.alert-edge { position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: 0;
  box-shadow: inset 0 0 40px 14px rgba(255, 30, 30, 0.85), inset 0 0 120px 40px rgba(255, 0, 0, 0.35);
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 0, 0, 0.22) 100%); }
.alert-edge.on { animation: alert-pulse 0.7s ease-in-out 4; }
@keyframes alert-pulse { 0%, 100% { opacity: 0; } 45% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .alert-edge.on { animation: alert-pulse 1.4s ease-in-out 2; } }
/* last-3-moves recap after a pause (see showRecap in main.js) */
/* top-left, under the Moves/time chips (below the progress track on narrow screens); nearly see-through,
   the white halo on the text keeps it readable over any scene */
.recap { position: absolute; left: max(12px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 64px); transform: translateY(-6px); background: rgba(255, 255, 255, 0.1); color: #2b2250; border-radius: 16px; padding: 6px 14px; opacity: 0; transition: opacity 0.35s, transform 0.35s; pointer-events: none !important; font-size: 18px; text-align: left; max-width: calc(100vw - 24px); text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 10px rgba(255, 255, 255, 0.9); }
.recap.show { opacity: 1; transform: none; }
.recap h4 { margin: 0 0 2px; font-size: 15px; opacity: 0.8; font-weight: 600; }
.recap table { border-collapse: collapse; }
.recap th { font-size: 13px; font-weight: 600; opacity: 0.7; text-align: left; padding: 0 10px 1px 0; }
.recap td { padding: 1px 12px 1px 0; line-height: 1.35; white-space: nowrap; }
.recap td:first-child { opacity: 0.7; padding-right: 10px; }
.recap td.disc { font-size: 1.3em; text-align: center; }
.recap th:nth-child(2) { text-align: center; }
.recap tbody tr:last-child td { font-weight: 700; }
@media (max-width: 1080px) { .recap { top: calc(max(10px, env(safe-area-inset-top)) + 100px); } }
@media (max-height: 520px) { .recap { font-size: 15px; top: calc(max(10px, env(safe-area-inset-top)) + 92px); } }
.hold { position: relative; overflow: hidden; }
.hold .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(46, 196, 182, 0.35); width: 0; }
.danger .fill { background: rgba(255, 107, 107, 0.4); }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: #2b2250; color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 19px; opacity: 0; transition: all 0.3s; z-index: 50; pointer-events: none; text-align: center; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 600px) {
  .chip { padding: 6px 12px; font-size: 16px; }
  .chip b { font-size: 19px; }
  .scene-chip .sc-name { display: none; }
  .icon { width: 44px; height: 44px; font-size: 20px; }
  .tool { min-width: 66px; padding: 6px 10px; font-size: 13px; }
  .tool span { font-size: 22px; }
  .tip { top: 66px; font-size: 16px; }
  .scene-grid { grid-template-columns: repeat(2, 1fr); }
  .big { font-size: 22px; padding: 12px 28px; }
  .win-stars { font-size: 56px; }
}

/* ---- win card: see-through so the solved tower and the world stay visible ---- */
#win { align-items: flex-start; padding-top: max(64px, env(safe-area-inset-top)); pointer-events: none; }
#win .win-panel {
  pointer-events: auto; position: relative;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none; border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.45);
  padding: 10px 16px 14px; transition: opacity 0.3s, transform 0.3s;
}
#win .win-panel h2 { color: #fff; font-size: 34px; margin: 2px 0; }
.win-level { font-size: 19px; font-weight: 600; color: #ffe066; }
#win .unlock { color: #9effc7; }
#win .win-stars .star { color: rgba(255, 255, 255, 0.35); }
#win .win-stars .star.on { color: #ffc300; text-shadow: 0 3px 0 #b07f00, 0 0 14px rgba(0, 0, 0, 0.5); }
#win .pill { background: rgba(255, 255, 255, 0.82); color: var(--ink); text-shadow: none; }
#win .big { text-shadow: none; }
#win .link { color: #fff; }
.peek-btn { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; background: rgba(255, 255, 255, 0.82); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); text-shadow: none; z-index: 2; }
/* peek: hide the card except the eye button, so kids can admire the tower */
#win.peek .win-panel { background: transparent; border-color: transparent; }
#win.peek .win-panel > :not(.peek-btn) { visibility: hidden; }
#win.peek .peek-btn { background: #ffe066; }
#win.show ~ .hud .hud-bottom, body:has(#win.show) .hud-bottom { display: none; }

.disc-picker button { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; height: 58px; }
.disc-picker button small { font-size: 11px; font-weight: 600; opacity: 0.7; margin-top: 3px; }
.disc-picker button.locked { opacity: 0.45; font-size: 18px; }
.disc-picker button.bonus:not(.sel) { background: #fff7d6; }
/* split layout: title + stars at the top, buttons at the bottom, tower clear in the middle */
#win { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
#win .win-panel { display: flex; flex-direction: column; align-items: center; height: calc(100% - 4px); max-height: none; overflow: visible; border: 0; background: transparent; }
#win .win-panel .win-top { background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.35); border-radius: 26px; padding: 8px 22px 10px; }
#win .win-panel .win-actions { margin-top: auto; background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.35); border-radius: 26px; padding: 10px 16px 6px; }
#win .win-stars { font-size: 56px; line-height: 1; }
#win #win-stats, #win .unlock { margin: 2px 0; }
/* only the visible boxes catch taps; the empty middle lets kids drag to look around */
#win .win-panel { pointer-events: none; }
#win .win-panel .win-top, #win .win-panel .win-actions, #win .peek-btn { pointer-events: auto; }
#win.peek .win-panel .win-top, #win.peek .win-panel .win-actions { pointer-events: none; }

/* keyboard key choice in Settings */
.keys-set { display: flex; flex-direction: column; gap: 8px; }
.keys-set .row { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.keys-set small { font-size: 15px; opacity: 0.75; }
.keybind kbd { display: inline-block; min-width: 2.2em; margin-left: 6px; padding: 1px 8px; border-radius: 8px; background: rgba(0,0,0,0.12); font: inherit; font-weight: 700; }
.keybind.wait kbd { background: #ffd23f; animation: pulse 1s infinite; }
.keys-set { align-items: flex-start; } .keys-set > span { align-self: flex-start; text-align: left; }

/* special scenes + endless: greyed out until earned, explained by a tooltip */
.scene-card.special.locked { filter: grayscale(1) brightness(0.7); }
.scene-card.special.locked .st { color: #fff; letter-spacing: 0; }
.disc-picker button.endless { font-size: 28px; }
.disc-picker button.endless:not(.sel):not(.locked) { background: linear-gradient(135deg, #e0c3fc, #8ec5fc); }
.disc-picker button.locked.endless { filter: grayscale(1); }
.hover-tip { position: fixed; z-index: 50; pointer-events: none; background: rgba(30, 24, 60, 0.92); color: #fff; font-size: 15px; line-height: 1.35; padding: 9px 13px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); opacity: 0; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s; }
.hover-tip.show { opacity: 1; transform: none; }
.toast { max-width: min(92vw, 520px); text-align: center; border-radius: 22px; }

/* scene picker sections */
.grid-head { grid-column: 1 / -1; margin: 6px 4px -2px; font-size: 19px; color: #5b4b9a; text-align: left; }
.grid-head:first-child { margin-top: 0; }

/* rating + feedback */
.fb-pill { margin-top: 10px; }
.fb-panel { max-width: 560px; text-align: center; }
.fb-q { font-size: 20px; font-weight: 600; margin: 8px 0 4px; }
.fb-stars { display: flex; justify-content: center; gap: 6px; }
.fb-stars button { font-size: 46px; line-height: 1; color: #d9d3ec; background: none; box-shadow: none; padding: 2px 4px; transition: transform 0.12s, color 0.12s; }
.fb-stars button.on { color: #ffc93c; text-shadow: 0 3px 0 #e0a100; transform: scale(1.08); }
.fb-rate-label { min-height: 1.3em; margin: 2px 0 6px; font-size: 17px; opacity: 0.8; }
.fb-kinds { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 10px; }
.fb-kinds button { padding: 8px 14px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 #d6d0ea; font-size: 17px; }
.fb-kinds button.sel { background: #4d96ff; color: #fff; box-shadow: 0 3px 0 #2d6ad1; }
#fb-message { width: 100%; box-sizing: border-box; border-radius: 16px; border: 2px solid #d6d0ea; padding: 10px 12px; font: inherit; font-size: 17px; resize: vertical; }
.fb-email { display: block; text-align: left; font-size: 14px; opacity: 0.85; margin: 10px 0; }
.fb-email input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; border-radius: 12px; border: 2px solid #d6d0ea; padding: 8px 10px; font: inherit; font-size: 16px; }
.fb-status { min-height: 1.2em; margin: 8px 0 0; font-weight: 600; }
.fb-status.ok { color: #16a34a; }
.fb-status.warn { color: #d9480f; }
.fb-avg { font-size: 14px; opacity: 0.7; margin: 4px 0 0; }

/* title: gear, resume */
#title .gear { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 58px; height: 58px; font-size: 30px; z-index: 11; }
.title-btns { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.big.resume { background: linear-gradient(#5be38f, #22b864); box-shadow: 0 6px 0 #178a49, 0 10px 20px rgba(0, 0, 0, 0.2); display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.big.resume small { font-size: 16px; font-weight: 500; opacity: 0.95; margin-top: 3px; }
.title-btns .resume + #btn-play { animation: none; font-size: 22px; padding: 10px 32px; }

/* scene picker: header with Let's go stays visible while scrolling */
.select-head { position: sticky; top: -18px; z-index: 3; background: var(--paper); margin: -18px -20px 6px; padding: 14px 16px 10px; grid-template-columns: 56px 1fr auto; gap: 8px; border-radius: 30px 30px 0 0; box-shadow: 0 6px 10px -8px rgba(0, 0, 0, 0.25); }
.select-title { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.go-top { font-size: 22px; padding: 10px 22px; white-space: nowrap; animation: pulse 1.6s infinite; }
.select-hint { margin: 0 0 4px; font-size: 15px; opacity: 0.7; }
@media (max-width: 600px) {
  .select-head { grid-template-columns: 44px 1fr auto; padding: 12px 10px 8px; }
  .select-head h2 { font-size: 22px; }
  .go-top { font-size: 17px; padding: 9px 14px; }
  .select-title .stars-total { font-size: 16px; }
}

/* settings links, profile, about */
.set-links { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
a.pill { text-decoration: none; color: inherit; display: inline-block; }
.tailenar { background: linear-gradient(135deg, #fff1b8, #ffd6e7); }
.panel.narrow { max-width: 560px; }
.profile-face { font-size: 72px; line-height: 1; margin: 4px 0 8px; }
.pf-name { display: block; text-align: left; font-size: 16px; margin: 0 auto 6px; max-width: 360px; }
.pf-name input { display: block; width: 100%; margin-top: 4px; border-radius: 14px; border: 2px solid #d6d0ea; padding: 10px 12px; font: inherit; font-size: 20px; }
.pf-avatars { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pf-avatars button { font-size: 32px; width: 54px; height: 54px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #d6d0ea; }
.pf-avatars button.sel { background: #ffe066; box-shadow: 0 3px 0 #e0b800; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 14px 0 6px; }
.pf-stats div { background: #f3efff; border-radius: 14px; padding: 8px; font-size: 14px; }
.pf-stats b { display: block; font-size: 24px; }
.pf-note { font-size: 14px; opacity: 0.7; }
.acct-intro { font-size: 17px; margin: 4px 0 12px; }
.acct-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.acct-tabs button { padding: 8px 16px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 #d6d0ea; font-size: 17px; }
.acct-tabs button.sel { background: #4d96ff; color: #fff; box-shadow: 0 3px 0 #2d6ad1; }
.acct form { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.acct form .big { margin-top: 10px; font-size: 24px; padding: 12px 34px; }
.acct-note { font-size: 14px; opacity: 0.75; margin-top: 10px; }
.acct-who { font-size: 20px; margin: 6px 0; }
.acct .row { justify-content: center; }
.about { text-align: left; font-size: 17px; line-height: 1.45; }
.about h3 { margin: 4px 0; font-size: 24px; color: #4d96ff; }
.about .tailenar { margin-top: 6px; }
.about-ver { font-size: 13px; opacity: 0.6; }

/* progress track: a scene buddy crawls to the flag; ? = slips, z = undo series */
.progress { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 64px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px; pointer-events: none; }
.counters { display: flex; flex-direction: column; gap: 4px; flex: none; align-items: flex-start; }
.cnt { background: #fff; color: #2b2250; font-weight: 700; font-size: 15px; padding: 2px 10px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15); white-space: nowrap; }
.cnt b { font-size: 17px; }
.cnt-q { color: #d46b00; }
.cnt-z { color: #3d6bd8; }
.cnt.bump { animation: cnt-bump 0.45s; }
@keyframes cnt-bump { 35% { transform: scale(1.3) rotate(-6deg); } 70% { transform: scale(0.95) rotate(4deg); } }
.track { position: relative; flex: 1; height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.15), 0 3px 0 rgba(0, 0, 0, 0.1); }
.track-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, #8be28f, #34c759); transition: width 0.6s ease; }
.flag { position: absolute; right: -8px; top: 50%; transform: translateY(-62%); font-size: 26px; }
.runner { position: absolute; left: 0; bottom: 2px; width: 40px; margin-left: -20px; text-align: center; transition: left 0.6s cubic-bezier(0.3, 1.3, 0.5, 1); }
.runner .emo { display: inline-block; font-size: 34px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3)); animation: crawl 1.6s ease-in-out infinite; }
.runner.flip .emo { transform: scaleX(-1); }
@keyframes crawl { 50% { translate: 0 -2px; } }
.runner .q { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%) scale(0); font-size: 24px; font-weight: 700; color: #fff; background: #ff9f1c; width: 30px; height: 30px; line-height: 30px; border-radius: 50%; box-shadow: 0 3px 0 #c97800; transition: transform 0.25s cubic-bezier(0.3, 1.8, 0.5, 1); }
.runner.huh .q { transform: translateX(-50%) scale(1); animation: q-wobble 0.6s ease-in-out infinite; }
.runner.huh .emo { animation: huh 0.8s ease-in-out infinite; }
@keyframes q-wobble { 50% { transform: translateX(-50%) scale(1) rotate(12deg); } }
@keyframes huh { 25% { rotate: -12deg; } 75% { rotate: 12deg; } }
.runner .party-bits { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 20px; white-space: nowrap; letter-spacing: 4px; opacity: 0; }
.runner.party .emo { animation: party-hop 0.6s ease-in-out infinite; }
.runner.party .party-bits { animation: party-pop 1.2s ease-out infinite; }
@keyframes party-hop { 0%, 100% { translate: 0 0; rotate: 0deg; } 30% { translate: 0 -16px; rotate: -15deg; } 60% { translate: 0 -8px; rotate: 15deg; } }
@keyframes party-pop { 0% { opacity: 0; transform: translateX(-50%) scale(0.4); } 25% { opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1.2); } 100% { opacity: 0; transform: translateX(-50%) translateY(-26px) scale(1); } }
.hud .tip { top: 146px; }
#win { padding-top: max(124px, env(safe-area-inset-top)); }
@media (max-width: 600px) {
  .progress { top: calc(max(10px, env(safe-area-inset-top)) + 56px); }
  .hud .tip { top: 132px; }
  #win { padding-top: max(112px, env(safe-area-inset-top)); }
}

/* milestones: 💖 save points on the progress track (tap to rewind) */
.milestones { position: absolute; inset: 0; z-index: 1; }
.ms { position: absolute; top: calc(100% + 5px); width: 28px; height: 28px; margin: 0 0 0 -14px; padding: 0; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18); font-size: 16px; line-height: 28px; text-align: center; cursor: pointer; pointer-events: auto; transition: transform 0.15s; }
.ms:hover { transform: scale(1.18); }
.ms:active { transform: scale(0.92); }
.ms.pop { animation: ms-pop 0.6s cubic-bezier(0.3, 1.8, 0.5, 1); }
.ms::before { content: ''; position: absolute; left: 50%; top: -6px; width: 3px; height: 7px; margin-left: -1.5px; background: #fff; border-radius: 2px; }
@keyframes ms-pop { 0% { transform: translateY(-34px) scale(0.3); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.runner { z-index: 2; }
.runner .love { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); font-size: 26px; opacity: 0; pointer-events: none; }
.runner.love .love { animation: love-float 1.4s ease-out; }
.runner.love .emo { animation: party-hop 0.6s ease-in-out 2; }
@keyframes love-float { 0% { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.4); } 25% { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.25); } 70% { opacity: 1; transform: translateX(-50%) translateY(-18px) scale(1); } 100% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.6); } }

/* restart confirmation */
.confirm { position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; background: rgba(43, 34, 80, 0.35); padding: 16px; }
.confirm.show { display: flex; }
.confirm-card { background: var(--paper); border-radius: 26px; padding: 20px 22px 18px; max-width: 380px; text-align: center; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15); animation: confirm-in 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.confirm-emo { font-size: 40px; line-height: 1; }
.confirm-card p { margin: 10px 0 16px; font-size: 20px; font-weight: 600; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes confirm-in { from { transform: scale(0.85); opacity: 0; } }
.confirm-btns { align-items: center; }
.big.confirm-keep { font-size: 20px; padding: 10px 22px; }
.ms.on { box-shadow: 0 0 0 3px #ff5d8f, 0 3px 0 rgba(0, 0, 0, 0.18); transform: scale(1.15); }
.ms.last { background: #e3f0ff; }
.tool.proceed { background: linear-gradient(#5be38f, #22b864); color: #fff; box-shadow: 0 5px 0 #178a49; animation: pulse 1.6s ease-in-out infinite; }

/* random mode button on the title */
.big.random { background: linear-gradient(#b38cff, #7d5cff); box-shadow: 0 6px 0 #5639c4, 0 10px 20px rgba(0, 0, 0, 0.2); display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; font-size: 22px; padding: 10px 32px; }
.big.random small { font-size: 14px; font-weight: 500; opacity: 0.9; margin-top: 3px; }
.big.random:active { box-shadow: 0 2px 0 #5639c4; }
/* the scene picker lets the painted scene show through */
#select .panel { background: rgba(255, 255, 255, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#select .select-head { background: rgba(255, 255, 255, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.big.random.locked { filter: grayscale(0.9); opacity: 0.75; animation: none; }
.disc-picker button.random { font-size: 28px; }
.disc-picker button.random:not(.sel):not(.locked) { background: linear-gradient(135deg, #d9c8ff, #a98bff); }
.disc-picker button.random.sel { background: #7d5cff; box-shadow: 0 4px 0 #5639c4; }
.disc-picker button.locked.random { filter: grayscale(1); }
.disc-picker button.endless .inf { font-size: 34px; line-height: 0.8; font-weight: 700; }

/* music + sound toggles on the title screen (top-left; the gear is top-right) */
.title-audio { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; display: flex; gap: 10px; z-index: 11; }
.title-audio .icon { width: 58px; height: 58px; font-size: 28px; }
@media (max-width: 600px) { .title-audio .icon { width: 48px; height: 48px; font-size: 22px; } }

/* rescue overlay (js/boot-guard.js) */
#rescue { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(43, 34, 80, 0.55); }
.rescue-card { background: #fff; border-radius: 28px; padding: 24px; max-width: 400px; text-align: center; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.15); }
.rescue-emo { font-size: 52px; }
.rescue-card p { font-size: 20px; font-weight: 600; margin: 8px 0 18px; color: #2b2250; }
.rescue-card small { display: block; margin-top: 12px; color: #6a6190; font-size: 15px; }
