:root {
  color-scheme: light;
  --cream: #FFF1DB;
  --pink: #F83078;
  --pink-soft: #FFD7D9;
  --blue-soft: #BAEAFB;
  --orange: #FF8F31;
  --brown: #6B3012;
  --copy: #81543B;
  --white: #FFFFFF;
  --magenta: #B320A6;
  --green: #5F9E62;
  --card-shadow: 0 12px 30px rgba(107, 48, 18, .12);
  --card-radius: 30px;
  --button-radius: 17px;
  --font-body: "Nunito", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--cream); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--brown);
  background:
    radial-gradient(circle at 7% 20%, rgba(255, 215, 217, .72) 0 48px, transparent 49px),
    radial-gradient(circle at 96% 59%, rgba(186, 234, 251, .78) 0 68px, transparent 69px),
    var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, a { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--magenta); outline-offset: 4px; }
[hidden] { display: none !important; }

.game-shell { width: min(100% - 28px, 760px); margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.back-link { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; color: var(--brown); font-size: .88rem; font-weight: 900; text-decoration: none; }
.back-link span { color: var(--pink); font-size: 1.4rem; line-height: 1; }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.game-header { position: relative; padding: 15px 12px 23px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 10px; color: #B9634C; font-size: .66rem; font-weight: 1000; letter-spacing: .16em; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 4px rgba(248, 48, 120, .12); }
h1 { margin: 0; color: var(--brown); font-family: var(--font-display); font-size: clamp(2.45rem, 9vw, 3.9rem); font-weight: 1000; line-height: .98; letter-spacing: -.055em; }
h1 span { display: block; color: var(--pink); text-shadow: 0 3px 0 rgba(255,255,255,.85); }
.intro { max-width: 430px; margin: 13px auto 0; color: var(--copy); font-size: .96rem; font-weight: 700; line-height: 1.5; }

.game-card { position: relative; overflow: hidden; padding: clamp(17px, 4vw, 30px); border: 2px solid rgba(255,255,255,.86); border-radius: var(--card-radius); background: rgba(255,255,255,.72); box-shadow: var(--card-shadow); isolation: isolate; }
.game-card::before { position: absolute; z-index: -1; top: -78px; right: -70px; width: 172px; height: 172px; border-radius: 50%; background: rgba(255,215,217,.43); content: ""; pointer-events: none; }
.screen { width: 100%; }
.section-kicker { margin: 0 0 5px; color: var(--magenta); font-size: .62rem; font-weight: 1000; letter-spacing: .14em; }

/* Start screen */
.start-mascot-row, .result-mascot-row { display: flex; align-items: center; gap: 17px; max-width: 550px; margin: 0 auto; }
.mascot-frame { display: grid; flex: 0 0 108px; width: 108px; height: 116px; place-items: center; border: 2px solid rgba(255,255,255,.92); border-radius: 28px; background: linear-gradient(145deg, #FFE6E5, #E4F6FB); box-shadow: 0 5px 0 rgba(107,48,18,.055); overflow: hidden; }
.mascot-frame--start { flex-basis: 126px; width: 126px; height: 132px; }
.mascot-frame--result { flex-basis: 126px; width: 126px; height: 132px; }
.mascot-image { display: block; width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.speech-bubble { position: relative; flex: 1; min-width: 0; padding: 15px 17px; border: 1.5px solid rgba(255,143,49,.28); border-radius: 20px; background: #FFF9F1; text-align: left; }
.speech-bubble::before { position: absolute; top: 30px; left: -9px; width: 16px; height: 16px; transform: rotate(45deg); border-bottom: 1.5px solid rgba(255,143,49,.28); border-left: 1.5px solid rgba(255,143,49,.28); background: #FFF9F1; content: ""; }
.speech-kicker { display: block; margin-bottom: 5px; color: var(--orange); font-size: .59rem; font-weight: 1000; letter-spacing: .13em; }
.speech-bubble p { margin: 0; color: var(--brown); font-size: .91rem; font-weight: 800; line-height: 1.42; }
.start-copy { margin: 24px 0 17px; text-align: center; }
.start-copy h2, .result-heading-wrap h2 { margin: 0; color: var(--brown); font-family: var(--font-display); font-size: clamp(1.65rem, 6vw, 2.15rem); line-height: 1.1; }
.start-copy > p:last-child, .result-heading-wrap > p:last-child { max-width: 460px; margin: 9px auto 0; color: var(--copy); font-size: .88rem; font-weight: 700; line-height: 1.5; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 590px; margin: 0 auto; }
.mode-button { display: flex; min-height: 76px; align-items: center; gap: 10px; padding: 12px 13px; border: 2px solid rgba(255,255,255,.95); border-radius: 19px; box-shadow: 0 5px 0 rgba(107,48,18,.08); color: var(--brown); cursor: pointer; text-align: left; transition: transform .16s ease, box-shadow .16s ease; }
.mode-button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(107,48,18,.08); }
.mode-button:active { transform: translateY(2px); }
.mode-button--timed { background: linear-gradient(135deg, #FFD7D9, #FFE8E2); }
.mode-button--relaxed { background: linear-gradient(135deg, #DDF4FB, #EAF8F7); }
.mode-icon { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 13px; background: rgba(255,255,255,.75); color: var(--pink); font-size: 1.2rem; }
.mode-button--relaxed .mode-icon { color: #368BA8; }
.mode-copy { display: grid; gap: 3px; min-width: 0; }
.mode-copy strong { font-size: .85rem; font-weight: 1000; line-height: 1.15; }
.mode-copy small { color: var(--copy); font-size: .68rem; font-weight: 800; line-height: 1.25; }
.mode-arrow { margin-left: auto; color: var(--pink); font-size: 1.25rem; font-weight: 1000; }
.mode-button--relaxed .mode-arrow { color: #368BA8; }
.demo-notice { max-width: 560px; margin: 16px auto 0; padding: 10px 12px; border: 1px solid rgba(255,143,49,.42); border-radius: 12px; background: rgba(255,218,174,.55); color: #78471F; font-size: .72rem; font-weight: 800; line-height: 1.4; text-align: center; }

/* Game toolbar and progress */
.play-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.timer-pill { display: inline-flex; min-height: 43px; align-items: center; gap: 8px; padding: 7px 13px; border: 1.5px solid rgba(255,143,49,.28); border-radius: 15px; background: #FFF7EA; color: var(--brown); }
.timer-icon { color: var(--orange); font-size: 1rem; }
.timer-caption { color: #9A7156; font-size: .57rem; font-weight: 1000; letter-spacing: .1em; }
.timer-value { min-width: 42px; color: var(--brown); font-size: .95rem; font-weight: 1000; font-variant-numeric: tabular-nums; }
.timer-pill.is-relaxed { border-color: rgba(54,139,168,.28); background: #EDF8FA; }
.timer-pill.is-relaxed .timer-icon, .timer-pill.is-relaxed .timer-value { color: #368BA8; }
.timer-pill.is-warning { border-color: rgba(255,143,49,.62); background: #FFF0D6; }
.timer-pill.is-warning .timer-value { color: #B86A1B; }
.timer-pill.is-danger { border-color: rgba(220,55,68,.55); background: #FFE6E6; animation: timer-pulse .8s ease-in-out infinite alternate; }
.timer-pill.is-danger .timer-icon, .timer-pill.is-danger .timer-value, .timer-pill.is-danger .timer-caption { color: #C52C45; }
@keyframes timer-pulse { to { box-shadow: 0 0 0 4px rgba(220,55,68,.1); } }
.exit-game-button { display: inline-flex; min-height: 42px; align-items: center; gap: 7px; padding: 7px 10px; border: 0; border-radius: 12px; background: transparent; color: #92725F; cursor: pointer; font-size: .79rem; font-weight: 900; }
.exit-game-button:hover { background: rgba(255,215,217,.4); color: var(--brown); }
.exit-game-button span { font-size: 1.15rem; }
.progress-area { margin: 0 2px 16px; }
.progress-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: #9A7156; font-size: .58rem; font-weight: 1000; letter-spacing: .1em; }
.progress-label-row span:last-child { color: var(--magenta); text-align: right; }
.progress-track { height: 7px; overflow: hidden; border-radius: 100px; background: #F4E5D9; }
.progress-track span { display: block; width: 33.333%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--orange)); transition: width .3s ease; }
.step-dots { display: flex; justify-content: space-between; margin: 7px 2px 0; }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: #E7D8CC; transition: background .2s ease, transform .2s ease; }
.step-dot.is-done { background: var(--orange); }
.step-dot.is-current { transform: scale(1.35); background: var(--pink); box-shadow: 0 0 0 3px rgba(248,48,120,.12); }
.mascot-strip { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.92); border-radius: 22px; background: linear-gradient(105deg, rgba(255,237,232,.8), rgba(232,247,250,.85)); }
.mascot-strip .mascot-frame { flex-basis: 76px; width: 76px; height: 82px; border-radius: 20px; }
.speech-bubble--compact { padding: 10px 13px; border-radius: 16px; }
.speech-bubble--compact::before { top: 27px; }
.speech-bubble--compact .speech-kicker { margin-bottom: 3px; font-size: .54rem; }
.speech-bubble--compact p { font-size: .8rem; }
.timeout-notice { display: flex; align-items: flex-start; gap: 10px; margin: -5px 0 16px; padding: 11px 13px; border: 1px solid rgba(248,48,120,.2); border-radius: 15px; background: #FFF0F2; color: var(--brown); text-align: left; animation: result-pop .25s ease-out both; }
.timeout-notice > span { color: var(--pink); font-size: 1.15rem; line-height: 1.1; }
.timeout-notice p { margin: 0; font-size: .77rem; font-weight: 700; line-height: 1.42; }

/* Builder */
.builder-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .8fr); align-items: start; gap: 16px; }
.step-content { min-width: 0; }
.step-panel { min-width: 0; }
.step-panel h2 { margin: 0; color: var(--brown); font-family: var(--font-display); font-size: clamp(1.35rem, 4.8vw, 1.8rem); line-height: 1.12; }
.step-description { margin: 7px 0 15px; color: var(--copy); font-size: .81rem; font-weight: 700; line-height: 1.4; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.choice-card { position: relative; display: flex; min-width: 0; min-height: 74px; align-items: center; gap: 9px; padding: 10px 11px; border: 1.5px solid rgba(107,48,18,.1); border-radius: 16px; background: rgba(255,255,255,.84); color: var(--brown); cursor: pointer; text-align: left; transition: border-color .16s ease, background .16s ease, transform .16s ease, box-shadow .16s ease; }
.choice-card:hover { transform: translateY(-1px); border-color: rgba(248,48,120,.35); }
.choice-card[aria-pressed="true"] { border: 2px solid var(--pink); background: #FFF1F4; box-shadow: 0 0 0 3px rgba(248,48,120,.09); }
.choice-card[aria-pressed="true"]::after { position: absolute; top: 7px; right: 8px; display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; background: var(--pink); color: white; content: "✓"; font-size: .7rem; font-weight: 1000; }
.flavor-swatch { flex: 0 0 34px; width: 34px; height: 34px; border: 2px solid rgba(107,48,18,.09); border-radius: 12px 12px 15px 15px; background: var(--swatch, #F6DDA7); box-shadow: inset 0 -5px 0 rgba(107,48,18,.06); }
.choice-copy { display: grid; min-width: 0; gap: 3px; padding-right: 9px; }
.choice-copy strong { overflow-wrap: anywhere; font-size: .77rem; font-weight: 1000; line-height: 1.2; }
.choice-copy small { color: #98735B; font-size: .64rem; font-weight: 700; line-height: 1.2; }
.selection-hint { min-height: 18px; margin: 10px 0 0; color: #9A7A63; font-size: .69rem; font-weight: 700; line-height: 1.4; }
.portion-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.portion-card { display: flex; min-height: 110px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 7px; border: 1.5px solid rgba(107,48,18,.1); border-radius: 18px; background: rgba(255,255,255,.84); color: var(--brown); cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.portion-card:hover { transform: translateY(-2px); }
.portion-card[aria-pressed="true"] { border: 2px solid var(--pink); background: #FFF1F4; box-shadow: 0 0 0 3px rgba(248,48,120,.09); }
.portion-stack { display: flex; height: 47px; flex-direction: column-reverse; align-items: center; justify-content: flex-start; }
.portion-stack span { display: block; width: 27px; height: 22px; margin-top: -6px; border: 2px solid rgba(107,48,18,.08); border-radius: 50% 50% 45% 45%; background: #F6DDA7; }
.portion-stack span:nth-child(2) { background: #FFD7D9; }
.portion-stack span:nth-child(3) { background: #BAEAFB; }
.portion-card strong { font-size: .75rem; font-weight: 1000; }
.topping-group { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.topping-group legend { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--brown); font-size: .82rem; font-weight: 1000; }
.group-number { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 8px; background: #FFE3D0; color: #B76534; font-size: .7rem; }
.group-number--blue { background: #DDF3FA; color: #3586A1; }
.topping-card { min-height: 68px; padding: 9px 10px; }
.topping-symbol { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: #FFF2E8; font-size: 1.15rem; }
.topping-card:nth-child(2) .topping-symbol { background: #F0E8FF; }
.topping-card[aria-pressed="true"] { border-color: #E85C8A; background: #FFF3F6; }
.step-navigation { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 17px; }
.primary-button, .secondary-button, .secondary-link-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 9px; padding: 11px 16px; border-radius: var(--button-radius); cursor: pointer; font-size: .82rem; font-weight: 1000; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.primary-button { flex: 1; border: 2px solid rgba(255,255,255,.95); background: var(--pink); box-shadow: 0 5px 0 #C91F5D; color: white; }
.primary-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 #C91F5D; }
.primary-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 3px 0 #C91F5D; }
.primary-button:disabled { cursor: not-allowed; opacity: .43; box-shadow: 0 3px 0 #C91F5D; }
.secondary-button, .secondary-link-button { border: 1.5px solid rgba(107,48,18,.13); background: #FFF9F1; color: var(--brown); }
.secondary-button:hover, .secondary-link-button:hover { background: white; }

/* Live cone preview */
.preview-card { position: sticky; top: 12px; min-width: 0; padding: 14px 13px 13px; border: 1.5px solid rgba(255,255,255,.95); border-radius: 22px; background: linear-gradient(160deg, #FFF9F0, #FFF0F3); }
.preview-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.preview-heading-row h2 { margin: 0; color: var(--brown); font-family: var(--font-display); font-size: 1.05rem; line-height: 1.15; }
.preview-sparkle { color: var(--orange); font-size: 1.35rem; }
.ice-cream-stage { display: grid; min-height: 190px; place-items: center; padding: 10px 0 0; }
.cone-visual { position: relative; width: 174px; height: 174px; isolation: isolate; }
.cone-shell { position: absolute; z-index: 1; bottom: 0; left: 50%; width: 102px; height: 105px; transform: translateX(-50%); clip-path: polygon(0 0,100% 0,50% 100%); background-color: #D88D45; background-image: repeating-linear-gradient(34deg, transparent 0 9px, rgba(112,62,26,.24) 10px 12px), repeating-linear-gradient(-34deg, transparent 0 9px, rgba(112,62,26,.22) 10px 12px), linear-gradient(90deg,#C77D39,#E7AD68 50%,#C77D39); filter: drop-shadow(0 5px 2px rgba(107,48,18,.1)); }
.cone-mouth-rim { position: absolute; z-index: 2; top: 62px; left: 50%; width: 102px; height: 14px; transform: translateX(-50%); border: 1.5px solid rgba(107,48,18,.2); border-radius: 50%; background: linear-gradient(180deg, #F2C58E 0%, #D58C4C 48%, #B96D35 100%); box-shadow: inset 0 2px 2px rgba(255,255,255,.32), 0 1px 1px rgba(107,48,18,.1); }
.scoop-stack { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scoop-item { position: absolute; left: 50%; display: block; transform: translateX(-50%); overflow: hidden; border: 2px solid rgba(107,48,18,.09); border-radius: 52% 52% 45% 45%; background: var(--scoop-color, #F6DDA7); box-shadow: inset -7px -6px 0 rgba(107,48,18,.06), inset 5px 6px 0 rgba(255,255,255,.25); }
.scoop-shine { position: absolute; z-index: 1; top: 16%; left: 19%; width: 22%; height: 11%; transform: rotate(-26deg); border-radius: 50%; background: rgba(255,255,255,.47); }
.sauce-on-scoop { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sauce-on-scoop path { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.crunch-on-scoop { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.crunch-bit { position: absolute; display: block; width: 8%; height: 4%; border-radius: 4px; background: var(--bit-color, #F83078); box-shadow: 0 1px 1px rgba(107,48,18,.16); }
.crunch-bit.is-peanut { width: 11%; height: 7%; border-radius: 55% 45% 50% 50%; background: #B97836; }
.preview-caption { min-height: 31px; margin: 1px 0 8px; color: #94725D; font-size: .68rem; font-weight: 700; line-height: 1.35; text-align: center; }
.preview-selections { display: grid; gap: 6px; margin: 0; padding: 9px 0 0; border-top: 1px dashed rgba(107,48,18,.15); list-style: none; }
.preview-selections li { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; font-size: .63rem; line-height: 1.3; }
.preview-selections li span { color: #96735B; font-weight: 700; }
.preview-selections li strong { max-width: 60%; overflow-wrap: anywhere; color: var(--brown); font-weight: 1000; text-align: right; }

/* Final screen */
.result-heading-wrap { margin: 21px 0 16px; text-align: center; }
.result-heading-wrap h2 { font-size: clamp(1.55rem, 5.8vw, 2.05rem); }
.result-layout { display: grid; grid-template-columns: minmax(190px,.85fr) minmax(0,1.15fr); align-items: center; gap: 15px; max-width: 570px; margin: 0 auto; padding: 13px; border: 1.5px solid rgba(255,255,255,.95); border-radius: 22px; background: linear-gradient(145deg, #FFF7EC, #FDEBF0); }
.result-cone-stage { display: grid; min-height: 210px; place-items: center; }
.result-cone-stage .cone-visual { transform: scale(1.1); }
.result-details h3 { margin: 0 0 9px; color: var(--brown); font-family: var(--font-display); font-size: 1.08rem; }
.final-summary { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.final-summary li { display: flex; align-items: flex-start; gap: 8px; color: var(--copy); font-size: .76rem; font-weight: 700; line-height: 1.35; }
.final-summary li::before { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 7px; background: #FFE2E8; color: var(--pink); content: "✓"; font-size: .68rem; font-weight: 1000; line-height: 18px; text-align: center; }
.counter-invitation { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px; border: 1px solid rgba(248,48,120,.17); border-radius: 13px; background: rgba(255,255,255,.7); }
.counter-invitation span { color: var(--pink); font-size: 1rem; }
.counter-invitation p { margin: 0; color: var(--brown); font-size: .69rem; font-weight: 700; line-height: 1.4; }
.counter-invitation strong { display: block; margin-bottom: 2px; }
.result-actions { display: flex; max-width: 510px; gap: 10px; margin: 17px auto 0; }
.result-actions > * { flex: 1; }
.game-note { max-width: 520px; margin: 17px auto 0; color: #92725F; font-size: .66rem; line-height: 1.45; text-align: center; }

.game-footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 10px 0; color: #A48670; text-align: center; }
.game-footer span { color: var(--pink); font-size: 1.15rem; }
.game-footer p { margin: 0; font-size: .68rem; font-weight: 700; }
.mascot-is-sad .mascot-image { animation: mascot-sad-in .18s ease-out both; }
@keyframes mascot-sad-in { from { transform: translateY(4px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 650px) {
  .builder-layout { grid-template-columns: 1fr; }
  .preview-card { position: static; display: grid; grid-template-columns: minmax(0,1fr) 150px; column-gap: 10px; align-items: center; }
  .preview-heading-row { grid-column: 1; grid-row: 1; align-self: end; }
  .ice-cream-stage { grid-column: 2; grid-row: 1 / span 3; min-height: 145px; }
  .ice-cream-stage .cone-visual { transform: scale(.82); }
  .preview-caption { grid-column: 1; grid-row: 2; align-self: start; text-align: left; }
  .preview-selections { grid-column: 1 / -1; grid-row: 4; grid-template-columns: 1fr 1fr; column-gap: 13px; }
  .result-layout { grid-template-columns: 180px minmax(0,1fr); }
  .result-cone-stage { min-height: 185px; }
  .result-cone-stage .cone-visual { transform: scale(.95); }
}
@media (max-width: 440px) {
  .game-shell { width: min(100% - 20px, 760px); }
  .game-header { padding: 12px 5px 19px; }
  .game-card { padding: 15px 13px 18px; border-radius: 25px; }
  .start-mascot-row, .result-mascot-row { gap: 11px; }
  .mascot-frame--start, .mascot-frame--result { flex-basis: 98px; width: 98px; height: 105px; border-radius: 23px; }
  .speech-bubble { padding: 11px 12px; border-radius: 16px; }
  .speech-bubble p { font-size: .79rem; }
  .start-copy { margin-top: 20px; }
  .mode-options { grid-template-columns: 1fr; gap: 9px; }
  .mode-button { min-height: 66px; }
  .choice-grid { gap: 7px; }
  .choice-card { min-height: 68px; gap: 7px; padding: 8px; }
  .flavor-swatch, .topping-symbol { flex-basis: 29px; width: 29px; height: 29px; }
  .choice-copy strong { font-size: .71rem; }
  .choice-copy small { font-size: .59rem; }
  .portion-card { min-height: 100px; }
  .mascot-strip { gap: 9px; padding: 8px; }
  .mascot-strip .mascot-frame { flex-basis: 66px; width: 66px; height: 72px; }
  .speech-bubble--compact { padding: 9px 11px; }
  .speech-bubble--compact p { font-size: .73rem; }
  .preview-card { grid-template-columns: minmax(0,1fr) 124px; padding: 11px; }
  .ice-cream-stage { min-height: 132px; }
  .ice-cream-stage .cone-visual { transform: scale(.72); }
  .preview-heading-row h2 { font-size: .96rem; }
  .preview-selections li { font-size: .59rem; }
  .result-layout { grid-template-columns: 1fr; }
  .result-cone-stage { min-height: 190px; }
  .result-cone-stage .cone-visual { transform: scale(1); }
  .result-details { padding: 0 4px 4px; }
  .result-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.empty-options {
  grid-column: 1 / -1;
  margin: 0;
  padding: 13px;
  border: 1px dashed rgba(107,48,18,.22);
  border-radius: 14px;
  background: rgba(255,255,255,.6);
  color: #8B644B;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.4;
}
.summary-label { color: var(--brown); font-weight: 1000; }

/* ==========================================================================
   MÓVIL · Modo juego inmersivo
   Solo aplica en pantallas estrechas y únicamente mientras se juega o se ve
   el resultado (clase `is-in-game` en <html>). Escritorio no se modifica.
   Zonas: superior (nombre + cronómetro) · mascota · central (helado) · inferior (opciones + botón).
   ========================================================================== */
.toolbar-title { display: none; }

@media (max-width: 650px) {
  /* Altura real de la pantalla (dvh; con respaldo por JS para navegadores antiguos) */
  html.is-in-game, html.is-in-game body { height: var(--app-height, 100vh); min-height: 0; overflow: hidden; overscroll-behavior: none; }
  @supports (height: 100dvh) {
    html.is-in-game, html.is-in-game body { height: 100dvh; }
  }

  /* 1 · El encabezado exterior se oculta temporalmente (vuelve al regresar a la selección de modos) */
  html.is-in-game .back-link,
  html.is-in-game .game-header,
  html.is-in-game .game-footer { display: none; }

  html.is-in-game .game-shell {
    display: flex; flex-direction: column; width: 100%; height: 100%;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  html.is-in-game .game-card { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 10px; border-radius: 22px; }
  html.is-in-game .screen:not([hidden]) { display: flex; flex: 1; flex-direction: column; min-height: 0; }

  /* 2 · Pantalla de juego: columna que reparte la altura */
  html.is-in-game .play-screen { gap: 7px; overflow-y: auto; overscroll-behavior: contain; }
  html.is-in-game .builder-layout,
  html.is-in-game .step-content { display: contents; }

  /* Zona superior: nombre del juego + cronómetro */
  html.is-in-game .play-toolbar { order: 1; flex: 0 0 auto; gap: 8px; margin: 0; }
  html.is-in-game .toolbar-title {
    display: block; flex: 1 1 auto; min-width: 0; margin: 0; color: var(--brown);
    font-family: var(--font-display); font-size: .95rem; font-weight: 1000; line-height: 1; letter-spacing: -.03em;
  }
  html.is-in-game .toolbar-title span:last-child { color: var(--pink); }
  html.is-in-game .toolbar-title span { display: block; white-space: nowrap; }
  html.is-in-game .timer-pill { flex: 0 0 auto; min-height: 40px; gap: 6px; padding: 5px 10px; }
  html.is-in-game .exit-game-button { flex: 0 0 auto; min-height: 44px; padding: 6px 8px; font-size: .74rem; }

  html.is-in-game .progress-area { order: 2; flex: 0 0 auto; margin: 0 2px; }
  html.is-in-game .progress-label-row { margin-bottom: 4px; }
  html.is-in-game .step-dots { margin-top: 3px; }

  /* Zona de la mascota */
  html.is-in-game .mascot-strip { order: 3; flex: 0 0 auto; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 16px; }
  html.is-in-game .mascot-strip .mascot-frame { flex-basis: 56px; width: 56px; height: 60px; border-radius: 16px; }
  html.is-in-game .speech-bubble--compact { padding: 6px 10px; border-radius: 13px; }
  html.is-in-game .speech-bubble--compact::before { top: 20px; }
  html.is-in-game .speech-bubble--compact .speech-kicker { margin-bottom: 1px; font-size: .5rem; }
  html.is-in-game .speech-bubble--compact p { font-size: .72rem; line-height: 1.3; }
  html.is-in-game .timeout-notice { order: 4; flex: 0 0 auto; gap: 8px; margin: 0; padding: 7px 10px; border-radius: 13px; }
  html.is-in-game .timeout-notice p { font-size: .68rem; line-height: 1.35; }

  /* Zona central: el helado siempre visible */
  html.is-in-game .preview-card {
    order: 5; position: relative; top: auto; display: grid; flex: 1 0 168px; min-height: auto; margin-bottom: 4px;
    grid-template-columns: minmax(0, 1fr) 46%; grid-template-rows: auto auto minmax(0, 1fr); column-gap: 6px; align-items: stretch;
    padding: 8px 10px; border-radius: 18px;
  }
  html.is-in-game .preview-heading-row { grid-column: 1; grid-row: 1; align-items: flex-start; align-self: start; }
  html.is-in-game .preview-heading-row .section-kicker { margin: 0 0 2px; font-size: .54rem; }
  html.is-in-game .preview-heading-row h2 { font-size: .9rem; }
  html.is-in-game .preview-sparkle { font-size: 1rem; line-height: 1; }
  html.is-in-game .ice-cream-stage,
  html.is-in-game .result-cone-stage { position: relative; display: block; min-height: 0; padding: 0; }
  html.is-in-game .ice-cream-stage { grid-column: 2; grid-row: 1 / -1; }
  html.is-in-game .result-cone-stage { flex: 1 1 0; }
  html.is-in-game .ice-cream-stage .cone-visual,
  html.is-in-game .result-cone-stage .cone-visual {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(var(--cone-scale, .8)); transform-origin: center;
  }
  html.is-in-game .cone-visual.is-placeholder .scoop-item { border-style: dashed; opacity: .5; }
  html.is-in-game .preview-caption { grid-column: 1; grid-row: 2; min-height: 0; margin: 0 0 6px; font-size: .64rem; text-align: left; }
  html.is-in-game .preview-selections { grid-column: 1; grid-row: 3; align-self: end; grid-template-columns: 1fr; gap: 3px; padding-top: 6px; }
  html.is-in-game .preview-selections li { font-size: .62rem; }

  /* Zona inferior: opciones de la etapa + botones (siempre al alcance del pulgar) */
  html.is-in-game .step-panel:not([hidden]) {
    order: 6; display: block; flex: 0 1 auto; min-height: 128px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 2px 2px;
  }
  html.is-in-game .step-panel .section-kicker { display: inline-block; margin: 0 8px 0 0; font-size: .56rem; }
  html.is-in-game .step-panel h2 { display: inline-block; font-size: 1.08rem; }
  html.is-in-game .step-description { margin: 2px 0 8px; font-size: .72rem; line-height: 1.3; }
  html.is-in-game .selection-hint { min-height: 0; margin: 6px 0 0; font-size: .64rem; line-height: 1.3; }

  html.is-in-game .flavor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  html.is-in-game .flavor-choice { flex-direction: column; justify-content: center; gap: 4px; min-height: 62px; padding: 7px 4px 6px; text-align: center; }
  html.is-in-game .flavor-choice .choice-copy { padding-right: 0; }
  html.is-in-game .flavor-choice .flavor-swatch { flex-basis: 26px; width: 26px; height: 26px; }
  html.is-in-game .flavor-choice[aria-pressed="true"]::after { top: 4px; right: 4px; width: 16px; height: 16px; font-size: .6rem; }
  html.is-in-game .choice-copy strong { font-size: .7rem; }

  html.is-in-game .portion-options { gap: 7px; }
  html.is-in-game .portion-card { min-height: 78px; gap: 5px; padding: 8px 4px; }
  html.is-in-game .portion-card strong { font-size: .72rem; }

  html.is-in-game .topping-group { margin: 0 0 7px; }
  html.is-in-game .topping-group legend { margin-bottom: 5px; font-size: .74rem; }
  html.is-in-game .group-number { width: 20px; height: 20px; }
  html.is-in-game .topping-grid { gap: 6px; }
  html.is-in-game .topping-card { min-height: 52px; gap: 6px; padding: 6px 7px; }
  html.is-in-game .topping-card .topping-symbol { flex-basis: 26px; width: 26px; height: 26px; font-size: 1rem; }
  html.is-in-game .topping-card[aria-pressed="true"]::after { top: 4px; right: 4px; width: 16px; height: 16px; font-size: .6rem; }
  html.is-in-game .topping-card .choice-copy { padding-right: 6px; }
  html.is-in-game .topping-card .choice-copy small { font-size: .56rem; }

  html.is-in-game .step-navigation {
    order: 7; position: sticky; bottom: 0; flex: 0 0 auto; margin: 0; padding-top: 2px; background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.72) 30%);
  }
  html.is-in-game .step-navigation .primary-button,
  html.is-in-game .step-navigation .secondary-button { min-height: 50px; }
  html.is-in-game .step-navigation .secondary-button { flex: 0 0 auto; padding-inline: 13px; }

  /* 3 · Resultado final: helado más grande */
  html.is-in-game .result-screen { gap: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  html.is-in-game .result-screen > * { flex-shrink: 0; }
  html.is-in-game .result-mascot-row { gap: 10px; width: 100%; max-width: none; margin: 0; }
  html.is-in-game .mascot-frame--result { flex-basis: 68px; width: 68px; height: 74px; border-radius: 18px; }
  html.is-in-game .result-screen .speech-bubble { padding: 8px 11px; border-radius: 14px; }
  html.is-in-game .result-screen .speech-bubble::before { top: 22px; }
  html.is-in-game .result-screen .speech-bubble p { font-size: .74rem; line-height: 1.35; }
  html.is-in-game .result-heading-wrap { margin: 0; }
  html.is-in-game .result-heading-wrap h2 { font-size: 1.28rem; }
  html.is-in-game .result-heading-wrap > p:last-child { margin-top: 3px; font-size: .74rem; line-height: 1.35; }
  html.is-in-game .result-layout {
    display: flex; flex: 1 0 auto; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; max-width: none; margin: 0; padding: 8px 10px 10px;
  }
  html.is-in-game .result-cone-stage { flex: 1 1 0; min-height: 150px; }
  html.is-in-game .result-details { padding: 0; }
  html.is-in-game .result-details h3 { margin-bottom: 6px; font-size: .95rem; }
  html.is-in-game .final-summary { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  html.is-in-game .final-summary li { min-width: 0; overflow-wrap: break-word; }
  html.is-in-game .final-summary .summary-label { white-space: nowrap; }
  html.is-in-game .final-summary li { font-size: .72rem; }
  html.is-in-game .counter-invitation { margin-top: 8px; padding: 7px 9px; }
  html.is-in-game .counter-invitation p { font-size: .66rem; }
  html.is-in-game .result-actions { flex-direction: row; gap: 8px; width: 100%; max-width: none; margin: 0; }
  html.is-in-game .result-actions > * { min-height: 48px; padding: 8px 10px; font-size: .76rem; }
  html.is-in-game .game-note { margin: 0; font-size: .6rem; line-height: 1.35; }

  /* Teléfonos altos: el helado ocupa todo el ancho y se ve más grande */
  @media (min-height: 740px) {
    html.is-in-game .preview-card { flex-basis: 220px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; }
    html.is-in-game .ice-cream-stage { grid-column: 1; grid-row: 2; }
    html.is-in-game .preview-caption { grid-row: 3; margin: 2px 0 4px; text-align: center; }
    html.is-in-game .preview-selections { grid-row: 4; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
    html.is-in-game .preview-selections li { flex-direction: column; align-items: center; gap: 1px; font-size: .58rem; text-align: center; }
    html.is-in-game .preview-selections li span { font-size: .52rem; }
    html.is-in-game .preview-selections li strong { max-width: 100%; text-align: center; }
  }
}

/* ==========================================================================
   Combinar sabores (paso 2, con 2 o 3 porciones)
   ========================================================================== */
.mix-flavors { margin-top: 12px; }
.mix-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 14px; border: 1.5px dashed rgba(248,48,120,.5); border-radius: 999px; background: rgba(255,255,255,.72); color: var(--pink); font: inherit; font-size: .8rem; font-weight: 1000; cursor: pointer; }
.mix-toggle:hover { background: #FFF1F4; }
.mix-caret { display: inline-block; transition: transform .18s ease; }
.mix-toggle[aria-expanded="true"] .mix-caret { transform: rotate(180deg); }
.mix-panel { margin-top: 10px; padding: 10px; border: 1.5px solid rgba(107,48,18,.1); border-radius: 16px; background: rgba(255,255,255,.72); }
.mix-scoops { display: flex; gap: 6px; }
.mix-scoop { display: flex; flex: 1 1 0; min-width: 0; min-height: 46px; align-items: center; gap: 6px; padding: 6px; border: 1.5px solid rgba(107,48,18,.1); border-radius: 13px; background: rgba(255,255,255,.88); color: var(--brown); font: inherit; text-align: left; cursor: pointer; }
.mix-scoop[aria-pressed="true"] { border: 2px solid var(--pink); background: #FFF1F4; box-shadow: 0 0 0 3px rgba(248,48,120,.09); }
.mix-scoop .flavor-swatch { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; }
.mix-scoop .choice-copy { min-width: 0; }
.mix-scoop strong { display: block; font-size: .7rem; font-weight: 1000; }
.mix-scoop small { display: block; overflow: hidden; color: #96735B; font-size: .6rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mix-help { margin: 9px 0 7px; color: var(--copy); font-size: .72rem; font-weight: 700; line-height: 1.35; }
.mix-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.mix-flavor { display: flex; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 3px; border: 1.5px solid rgba(107,48,18,.1); border-radius: 13px; background: rgba(255,255,255,.9); color: var(--brown); font: inherit; cursor: pointer; }
.mix-flavor[aria-pressed="true"] { border: 2px solid var(--pink); background: #FFF1F4; }
.mix-flavor .flavor-swatch { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; }
.mix-flavor-name { font-size: .62rem; font-weight: 900; line-height: 1.15; text-align: center; overflow-wrap: break-word; }

@media (max-width: 650px) {
  html.is-in-game .mix-flavors { margin-top: 8px; }
  html.is-in-game .mix-panel { margin-top: 7px; padding: 8px; }
  html.is-in-game .mix-scoops { gap: 5px; }
  html.is-in-game .mix-scoop { min-height: 44px; gap: 5px; padding: 5px; }
  html.is-in-game .mix-scoop .flavor-swatch { flex-basis: 16px; width: 16px; height: 16px; }
  html.is-in-game .mix-scoop strong { font-size: .66rem; white-space: nowrap; }
  html.is-in-game .mix-scoop small { font-size: .56rem; }
  html.is-in-game .mix-help { margin: 7px 0 6px; font-size: .66rem; }
  html.is-in-game .mix-palette { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  html.is-in-game .mix-flavor { flex-direction: row; justify-content: flex-start; gap: 5px; min-height: 44px; padding: 5px 5px; }
  html.is-in-game .mix-flavor .flavor-swatch { flex-basis: 18px; width: 18px; height: 18px; }
  html.is-in-game .mix-flavor-name { min-width: 0; font-size: .62rem; text-align: left; }
}

@media (max-width: 340px) {
  html.is-in-game .mix-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Estados de ánimo con una sola imagen de mascota (`html.mood-fx`)
   El ánimo se expresa alrededor de la mascota, sin modificar su dibujo:
   insignia, color del marco y pequeñas animaciones.
   ========================================================================== */
.mascot-frame { position: relative; }
.mood-badge { position: absolute; z-index: 2; top: 5px; right: 5px; display: none; min-width: 24px; height: 24px; padding: 0 3px; place-items: center; border-radius: 999px; background: rgba(255,255,255,.94); box-shadow: 0 2px 0 rgba(107,48,18,.1); font-size: .85rem; line-height: 1; pointer-events: none; }
.mood-fx .mascot-frame:not([data-mood="normal"]) .mood-badge:not(:empty) { display: grid; }

.mood-fx .mascot-frame[data-mood="thinking"] { background: linear-gradient(145deg, #E4F6FB, #F1ECFF); }
.mood-fx .mascot-frame[data-mood="thinking"] .mascot-image { animation: mood-sway 2.8s ease-in-out infinite; }

.mood-fx .mascot-frame[data-mood="happy"] { background: linear-gradient(145deg, #FFE6E5, #FFF3C9); }
.mood-fx .mascot-frame[data-mood="happy"].mood-pop .mascot-image { animation: mood-pop .5s ease-out; }

.mood-fx .mascot-frame[data-mood="celebrating"] { background: linear-gradient(145deg, #FFF3C9, #FFD7D9); }
.mood-fx .mascot-frame[data-mood="celebrating"] .mascot-image { animation: mood-hop 1s ease-in-out infinite; }

.mood-fx .mascot-frame[data-mood="happy"].mood-pop::after,
.mood-fx .mascot-frame[data-mood="celebrating"]::after {
  position: absolute; z-index: 1; inset: 0; content: ""; pointer-events: none;
  background:
    radial-gradient(circle at 14% 20%, #F83078 0 2.5px, transparent 3px),
    radial-gradient(circle at 86% 62%, #25A8C6 0 2.5px, transparent 3px),
    radial-gradient(circle at 80% 90%, #FF8F31 0 2.5px, transparent 3px),
    radial-gradient(circle at 12% 80%, #B320A6 0 2.5px, transparent 3px),
    radial-gradient(circle at 48% 8%, #F2C846 0 2px, transparent 2.5px),
    radial-gradient(circle at 30% 50%, #75A95E 0 2px, transparent 2.5px);
}
.mood-fx .mascot-frame[data-mood="happy"].mood-pop::after { animation: mood-confetti .9s ease-out both; }
.mood-fx .mascot-frame[data-mood="celebrating"]::after { animation: mood-confetti 1.8s ease-out infinite; }

.mood-fx .mascot-frame[data-mood="sad"] { background: linear-gradient(145deg, #E3EAF1, #D6E3EF); }
.mood-fx .mascot-frame[data-mood="sad"] .mascot-image { filter: saturate(.6); rotate: -4deg; translate: 0 2px; }
.mood-fx .mascot-frame[data-mood="sad"] .mood-badge { animation: mood-drip 1.6s ease-in infinite; }

@keyframes mood-sway { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }
@keyframes mood-pop { 0% { scale: .92; } 55% { scale: 1.1; translate: 0 -3px; } 100% { scale: 1; translate: 0 0; } }
@keyframes mood-hop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes mood-confetti { 0% { opacity: 0; translate: 0 -6px; } 25% { opacity: 1; } 100% { opacity: 0; translate: 0 8px; } }
@keyframes mood-drip { 0%, 55% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 9px; } }

@media (max-width: 650px) {
  .mascot-strip .mood-badge { top: 2px; right: 2px; min-width: 19px; height: 19px; font-size: .68rem; }
  .mascot-frame--result .mood-badge { top: 3px; right: 3px; min-width: 21px; height: 21px; font-size: .75rem; }
}

/* Movimiento reducido: se queda la insignia fija, sin animaciones */
@media (prefers-reduced-motion: reduce) {
  .mood-fx .mascot-frame .mascot-image,
  .mood-fx .mascot-frame .mood-badge { animation: none !important; }
  .mood-fx .mascot-frame::after { display: none !important; }
}
