/* upgrade.css — responsive liquid-glass layout and eight-animal result experience */
:root { --ink: #383247; --ink-soft: #766c80; --pink-deep: #b75f83; --safe-bottom: env(safe-area-inset-bottom, 0px); }
body { background: #f7eff9; }
.bg { background: linear-gradient(145deg, #fff5ed 0%, #fae9f0 48%, #ece9ff 100%); }
.app { max-width: 690px; padding: calc(18px + var(--safe-t)) 24px calc(36px + var(--safe-b)); gap: 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #5b4b61; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 13px; color: #e56e90; background: rgba(255,255,255,.58); box-shadow: inset 0 1px 0 #fff, 0 6px 18px rgba(123,86,124,.12); }
.brand-mark .ic { width: 18px; height: 18px; }
.topbar-tools { display: flex; align-items: center; gap: 9px; }
.topbar .seg { width: min(300px, 52vw); margin: 0; }
.intro { padding: 10px 4px 0; }
.eyebrow { display: inline-block; margin: 0; color: #a18aa9; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.intro h1 { margin: 8px 0 5px; color: #493c52; font-size: clamp(28px, 6vw, 40px); line-height: 1.18; letter-spacing: -.04em; }
.intro-copy { margin: 0; color: var(--ink-soft); font-size: 15px; }
.progress-row { gap: 12px; }
.track { background: rgba(255,255,255,.45); border-color: rgba(255,255,255,.8); }
.track-fill { background: linear-gradient(90deg, #e8a5bb, #9f91d9); box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 2px 9px rgba(145,113,172,.3); }
.counter { color: #5c5064; }
.counter .ic { color: #d36d94; }
.q-title { min-height: 2.8em; margin: 6px 4px 20px; color: #44394c; font-size: clamp(22px, 5vw, 30px); }
.opts { gap: 12px; }
.opt { min-height: 68px; padding: 14px 17px; border-radius: 23px; box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 9px 22px rgba(103,83,119,.07); }
.opt-text { color: #504657; font-size: 15px; font-weight: 600; }
.notice { margin: 2px 0 0; color: #93879a; font-size: 12px; }
.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px 0; }
.result-count { color: #998ca0; font-size: 11px; }
.page-title { margin: 0; color: #806c8d; font-size: 18px; letter-spacing: .06em; }
.result { overflow: hidden; gap: 10px; padding: 27px clamp(18px, 5vw, 40px) 26px; border-radius: 34px; border-color: rgba(255,255,255,.76); background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34)); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.98), 0 24px 65px rgba(110,83,127,.16); }
.animal-orbit { position: relative; display: grid; place-items: center; width: 206px; height: 190px; margin: 1px 0 2px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.82) 0 48%, rgba(255,255,255,0) 70%); }
.avatar { width: 180px; height: 160px; overflow: visible; filter: drop-shadow(0 9px 13px rgba(132,90,119,.18)); }
.orbit-star { position: absolute; color: #d894b3; font-size: 25px; animation: twinkle 2.8s ease-in-out infinite alternate; }
.star-a { top: 18px; right: 12px; }.star-b { bottom: 17px; left: 13px; animation-delay: .7s; }
@keyframes twinkle { from { opacity: .45; transform: scale(.8) rotate(-10deg); } to { opacity: 1; transform: scale(1.12) rotate(14deg); } }
.result-kicker { margin: 0; color: #a58ba8; font-size: 13px; font-weight: 700; }
.result-name { margin: 1px 0 0; color: #b75f83; font-size: clamp(26px, 6vw, 34px); line-height: 1.25; }
.result-desc { max-width: 520px; margin: 2px 0 10px; color: #726778; font-size: 14px; line-height: 1.85; }
.result-insight { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; width: 100%; margin: 1px 0 9px; text-align: left; }
.result-insight div { min-height: 76px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.78); border-radius: 18px; background: rgba(255,255,255,.44); }
.result-insight span { display: block; margin-bottom: 5px; color: #a18ea6; font-size: 11px; }
.result-insight strong { display: block; color: #63546a; font-size: 13px; line-height: 1.45; }
.result-actions { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 9px; width: 100%; margin-top: 5px; }
.result-actions .btn-primary { min-height: 48px; padding: 12px 14px; border: 0; background: linear-gradient(135deg,#d68aa5,#9e8bc7); box-shadow: 0 10px 22px rgba(150,111,165,.28), inset 0 1px 0 rgba(255,255,255,.64); font-size: 14px; }
.btn-secondary,.btn-quiet { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.84); border-radius: 999px; color: #77687e; background: rgba(255,255,255,.54); font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 5px 14px rgba(110,83,127,.07); transition: transform .2s, background .2s; }
.btn-secondary:active,.btn-quiet:active { transform: scale(.96); }
.btn-quiet { grid-column: 1 / -1; min-height: 40px; border-color: transparent; background: transparent; box-shadow: none; }
.btn-quiet .ic { width: 16px; height: 16px; }
.credits { padding-top: 8px; font-size: 11px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(18px + var(--safe-bottom)); max-width: calc(100% - 40px); padding: 11px 17px; border: 1px solid rgba(255,255,255,.7); border-radius: 999px; color: #fff; background: rgba(66,53,76,.86); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { .app { padding-top: 28px; }.page.is-active#page-quiz { padding: 20px 24px 28px; border: 1px solid rgba(255,255,255,.36); border-radius: 32px; background: rgba(255,255,255,.17); } }
@media (max-width: 560px) {
  .app { padding: calc(13px + var(--safe-t)) 16px calc(26px + var(--safe-bottom)); gap: 21px; }
  .topbar { gap: 8px; }.brand { font-size: 12px; gap: 6px; }.brand-mark { width: 31px; height: 31px; border-radius: 11px; }.brand-mark .ic { width: 16px; height: 16px; }
  .topbar-tools { gap: 5px; }.topbar .seg { flex: 0 0 auto; width: clamp(148px, 43vw, 176px); padding: 3px; }.topbar .seg button { min-width: 0; padding: 8px 0; font-size: 10px; }.seg-thumb { top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); }
  .intro { padding-top: 7px; }.intro h1 { font-size: 29px; }.intro-copy { font-size: 13px; }
  .progress-row { gap: 9px; }.icon-btn { width: 40px; height: 40px; }.track { height: 18px; }.counter { min-width: 48px; font-size: 12px; }
  .q-title { min-height: 0; margin: 4px 3px 17px; font-size: 22px; }.opts { gap: 10px; }.opt { min-height: 62px; gap: 10px; padding: 12px 13px; border-radius: 19px; }.badge { width: 30px; height: 30px; font-size: 12px; }.opt-text { font-size: 14px; }.opt .ic-check { width: 20px; height: 20px; }
  .result-topline { padding-top: 2px; }.result-count { font-size: 10px; }.page-title { font-size: 16px; }.result { padding: 19px 16px 18px; border-radius: 27px; }.animal-orbit { width: 180px; height: 164px; }.avatar { width: 156px; height: 139px; }.result-name { font-size: 26px; }.result-desc { font-size: 13px; line-height: 1.75; }.result-insight { gap: 7px; }.result-insight div { min-height: 70px; padding: 10px 11px; border-radius: 15px; }.result-insight strong { font-size: 12px; }.result-actions { grid-template-columns: 1fr 1fr; gap: 8px; }.result-actions .btn-primary { grid-column: 1 / -1; }.btn-secondary { min-height: 42px; font-size: 12px; }.btn-quiet { grid-column: 1 / -1; }
  .toast { bottom: calc(16px + var(--safe-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .orbit-star { animation: none; } }
/* Strict CSP-safe state styling. */
.seg[data-active-index="0"] .seg-thumb { transform: translateX(0); }
.seg[data-active-index="1"] .seg-thumb { transform: translateX(100%); }
.seg[data-active-index="2"] .seg-thumb { transform: translateX(200%); }
.seg[data-active-index="3"] .seg-thumb { transform: translateX(300%); }
.opt.tint-0 { --tint: #e78eaa; }
.opt.tint-1 { --tint: #dfbb78; }
.opt.tint-2 { --tint: #e89778; }
.opt.tint-3 { --tint: #a695ce; }
.clipboard-fallback { position: fixed; left: -9999px; top: 0; opacity: 0; }

.menu-wrap { position: relative; flex: 0 0 auto; }
.menu-toggle { display: grid; place-content: center; gap: 4px; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255,255,255,.82); border-radius: 13px; color: #75647f; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 5px 14px rgba(110,83,127,.07); }
.menu-toggle span { display: block; width: 16px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .18s ease, opacity .18s ease; }
.menu-toggle.is-open span:first-child { transform: translateY(6px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:last-child { transform: translateY(-6px) rotate(-45deg); }
.main-menu { position: absolute; z-index: 40; top: calc(100% + 9px); right: 0; width: min(270px, calc(100vw - 32px)); padding: 8px; border: 1px solid rgba(255,255,255,.88); border-radius: 18px; background: rgba(255,255,255,.9); box-shadow: 0 16px 38px rgba(83,67,96,.18); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); }
.main-menu[hidden] { display: none; }
.menu-link { display: flex; align-items: center; gap: 11px; min-height: 58px; padding: 9px 11px; border-radius: 13px; color: #63566a; transition: background .18s ease; }
.menu-link:hover, .menu-link:focus-visible { background: rgba(244,230,246,.72); }
.menu-game-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 12px; color: #b75f83; background: #faeaf2; font-size: 21px; font-weight: 800; }
.menu-link-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 3px; }
.menu-link-copy strong { font-size: 13px; }
.menu-link-copy small { color: #96899b; font-size: 10px; }
.menu-arrow { color: #b18bac; font-size: 23px; }
.menu-toggle:focus-visible { outline: 3px solid rgba(183,95,131,.42); outline-offset: 3px; }
.quiz-home-link { display: inline-flex; min-height: 38px; align-items: center; gap: 5px; padding: 0 12px; border: 1px solid rgba(255,255,255,.84); border-radius: 13px; color: #75647f; background: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; white-space: nowrap; }
.quiz-home-link span:first-child { font-size: 19px; line-height: 1; }
.quiz-home-link:focus-visible { outline: 3px solid rgba(183,95,131,.42); outline-offset: 3px; }
@media (max-width: 360px) { .brand > span:last-child { display: none; } .topbar .seg { width: 148px; } }
@media (max-width: 420px) { .quiz-home-link { gap: 3px; padding: 0 8px; font-size: 10px; } }
@media (max-width: 360px) { .quiz-home-link { width: 38px; justify-content: center; padding: 0; }.quiz-home-link span:last-child { display: none; } }

/* Progress widths are explicit selectors to keep the strict no-inline-style CSP. */
.track[data-step="1"] .track-fill { width: 3%; }
.track[data-step="2"] .track-fill { width: 4%; }
.track[data-step="3"] .track-fill { width: 6%; }
.track[data-step="4"] .track-fill { width: 8%; }
.track[data-step="5"] .track-fill { width: 10%; }
.track[data-step="6"] .track-fill { width: 12%; }
.track[data-step="7"] .track-fill { width: 14%; }
.track[data-step="8"] .track-fill { width: 16%; }
.track[data-step="9"] .track-fill { width: 18%; }
.track[data-step="10"] .track-fill { width: 20%; }
.track[data-step="11"] .track-fill { width: 22%; }
.track[data-step="12"] .track-fill { width: 24%; }
.track[data-step="13"] .track-fill { width: 26%; }
.track[data-step="14"] .track-fill { width: 28%; }
.track[data-step="15"] .track-fill { width: 30%; }
.track[data-step="16"] .track-fill { width: 32%; }
.track[data-step="17"] .track-fill { width: 34%; }
.track[data-step="18"] .track-fill { width: 36%; }
.track[data-step="19"] .track-fill { width: 38%; }
.track[data-step="20"] .track-fill { width: 40%; }
.track[data-step="21"] .track-fill { width: 42%; }
.track[data-step="22"] .track-fill { width: 44%; }
.track[data-step="23"] .track-fill { width: 46%; }
.track[data-step="24"] .track-fill { width: 48%; }
.track[data-step="25"] .track-fill { width: 50%; }
.track[data-step="26"] .track-fill { width: 52%; }
.track[data-step="27"] .track-fill { width: 54%; }
.track[data-step="28"] .track-fill { width: 56%; }
.track[data-step="29"] .track-fill { width: 58%; }
.track[data-step="30"] .track-fill { width: 60%; }
.track[data-step="31"] .track-fill { width: 62%; }
.track[data-step="32"] .track-fill { width: 64%; }
.track[data-step="33"] .track-fill { width: 66%; }
.track[data-step="34"] .track-fill { width: 68%; }
.track[data-step="35"] .track-fill { width: 70%; }
.track[data-step="36"] .track-fill { width: 72%; }
.track[data-step="37"] .track-fill { width: 74%; }
.track[data-step="38"] .track-fill { width: 76%; }
.track[data-step="39"] .track-fill { width: 78%; }
.track[data-step="40"] .track-fill { width: 80%; }
.track[data-step="41"] .track-fill { width: 82%; }
.track[data-step="42"] .track-fill { width: 84%; }
.track[data-step="43"] .track-fill { width: 86%; }
.track[data-step="44"] .track-fill { width: 88%; }
.track[data-step="45"] .track-fill { width: 90%; }
.track[data-step="46"] .track-fill { width: 92%; }
.track[data-step="47"] .track-fill { width: 94%; }
.track[data-step="48"] .track-fill { width: 96%; }
.track[data-step="49"] .track-fill { width: 98%; }
.track[data-step="50"] .track-fill { width: 100%; }
