:root {
  color-scheme: light;
  --ink: #173d45;
  --muted: #5f7579;
  --teal: #088f8f;
  --teal-dark: #076866;
  --mint: #e5f8ef;
  --coral: #f36d55;
  --coral-dark: #bd4635;
  --gold: #ffc94d;
  --blue: #4e91d8;
  --paper: rgba(255, 255, 251, .97);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--ink); background: #dff6eb; }
button { color: inherit; font: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 4px solid rgba(4, 89, 134, .34); outline-offset: 4px; }
[hidden] { display: none !important; }

.game { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-width: 900px; min-height: 660px; overflow: hidden; isolation: isolate; }
.world-art { position: absolute; z-index: -4; inset: -18px; width: calc(100% + 36px); height: calc(100% + 36px); object-fit: cover; filter: saturate(.88) blur(1.5px); transform: scale(1.015); }
.world-wash { position: absolute; z-index: -3; inset: 0; background: linear-gradient(105deg, rgba(233,250,243,.78), rgba(255,250,224,.42) 52%, rgba(220,249,241,.76)); }
.world-wash::after { position: absolute; inset: 0; content: ""; background: radial-gradient(circle at 51% 48%, rgba(255,255,255,.18), rgba(21,112,90,.14) 100%); }

.mission-hud { position: absolute; z-index: 15; top: 22px; left: 26px; right: 26px; display: flex; justify-content: space-between; pointer-events: none; }
.mission-chip, .practice-stats { border: 1px solid rgba(39,92,79,.12); background: rgba(255,255,255,.86); box-shadow: 0 10px 30px rgba(28,86,70,.1); backdrop-filter: blur(12px); }
.mission-chip { display: grid; gap: 2px; min-width: 170px; padding: 10px 15px; border-radius: 16px; }
.mission-chip span, .practice-stats span { color: var(--teal-dark); font-size: 10px; font-weight: 950; letter-spacing: .085em; text-transform: uppercase; }
.mission-chip strong { font-size: 14px; }
.practice-stats { display: flex; align-items: stretch; gap: 5px; padding: 6px; border-radius: 18px; }
.practice-stats > div { min-width: 65px; display: grid; place-content: center; padding: 5px 10px; text-align: center; }
.practice-stats > div + div { border-left: 1px solid #d8e8e0; }
.practice-stats span { color: var(--muted); }
.practice-stats strong { display: block; margin-top: 2px; font-size: 20px; line-height: 1; }
.practice-stats .difficulty-stat { width: 150px; text-align: left; }
.difficulty-stat span { display: flex; justify-content: space-between; }
.difficulty-stat i { display: block; height: 7px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #dceae4; }
.difficulty-stat i b { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral)); transition: width 220ms ease-out; }

.play-card { position: relative; z-index: 3; width: min(850px, calc(100% - 390px)); min-width: 680px; min-height: 650px; padding: 34px 48px 28px; overflow: hidden; border: 1px solid rgba(214,233,222,.95); border-radius: 36px; background: var(--paper); box-shadow: 0 28px 85px rgba(24,76,60,.17), inset 0 2px rgba(255,255,255,.8); backdrop-filter: blur(16px); }
.mission-copy { max-width: 670px; margin: 0 auto; text-align: center; }
.phase-label { display: inline-block; margin-bottom: 7px; color: var(--coral-dark); font-size: 11px; font-weight: 950; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(29px, 3vw, 43px); font-weight: 950; line-height: 1.05; letter-spacing: -.038em; text-wrap: balance; }
.mission-copy p { min-height: 23px; margin: 9px 0 0; color: var(--muted); font-size: 15px; font-weight: 700; }

.sound-stage { display: grid; justify-items: center; gap: 13px; min-height: 146px; padding-top: 18px; }
.sound-tiles { display: flex; align-items: center; justify-content: center; gap: 11px; min-height: 72px; }
.sound-tile, .tray-tile { display: grid; place-items: center; min-width: 68px; height: 66px; padding: 0 15px; border: 2px solid #b6d6cc; border-radius: 18px; background: linear-gradient(#fff, #f1fbf6); box-shadow: 0 5px 0 #cae2d9, 0 11px 20px rgba(26,88,69,.08); color: var(--teal-dark); font-size: 30px; font-weight: 950; line-height: 1; transition: transform 150ms ease-out, background 150ms ease-out, box-shadow 150ms ease-out, color 150ms ease-out; }
.sound-tile.is-playing { color: #7c4100; border-color: #f2aa33; background: #fff1a9; box-shadow: 0 7px 0 #e9b84f, 0 0 0 9px rgba(255,205,77,.18); transform: translateY(-7px) scale(1.08) rotate(-2deg); }
.sound-tile.is-joined { color: #fff; border-color: var(--teal-dark); background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); transform: translateX(var(--join-x, 0)) scale(1.04); }
.blend-ribbon { position: relative; min-width: 245px; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 24px; overflow: hidden; border: 1px solid #087a78; border-radius: 999px; color: white; background: linear-gradient(180deg,#17aaa5,var(--teal)); box-shadow: 0 6px 0 var(--teal-dark), 0 13px 25px rgba(6,126,123,.18); cursor: pointer; transition: transform 130ms ease-out, box-shadow 130ms ease-out; }
.blend-ribbon:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--teal-dark), 0 15px 28px rgba(6,126,123,.2); }
.blend-ribbon:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.blend-ribbon > span { font-size: 21px; }
.blend-ribbon i { position: absolute; inset: auto 0 0; height: 4px; background: rgba(255,255,255,.72); transform: scaleX(0); transform-origin: left; }
.blend-ribbon.is-playing i { animation: ribbonRun 1.6s linear; }

.picture-stage { min-height: 250px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: center; gap: 16px; padding: 12px 8px 2px; }
.picture-card { position: relative; min-height: 218px; display: grid; place-items: center; padding: 10px; overflow: hidden; border: 2px solid #d8e6df; border-radius: 27px; background: #fff; box-shadow: 0 7px 0 #d9e6e0, 0 17px 30px rgba(25,76,61,.09); cursor: pointer; transition: transform 145ms ease-out, box-shadow 145ms ease-out, border-color 145ms ease-out; }
.picture-card:hover { border-color: #77bbb0; transform: translateY(-4px) rotate(-.5deg); box-shadow: 0 11px 0 #cae0d8, 0 21px 34px rgba(25,76,61,.12); }
.picture-card:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 #d0dfda; }
.picture-card:disabled { cursor: default; opacity: .68; filter: saturate(.8); }
.picture-card img { width: 100%; height: 190px; object-fit: contain; border-radius: 20px; background: white; }
.picture-card .emoji-art { font-size: 104px; filter: drop-shadow(0 7px 3px rgba(25,64,50,.12)); }
.picture-card.is-correct { border-color: var(--teal); box-shadow: 0 0 0 7px rgba(8,143,143,.12), 0 8px 0 #80c6b8; transform: translateY(-5px) scale(1.03); }

.build-stage { min-height: 250px; display: grid; grid-template-columns: 205px 1fr; grid-template-rows: 1fr auto; align-items: center; gap: 12px 26px; padding: 8px 22px 2px; }
.target-sticker { grid-row: 1 / 3; min-height: 220px; display: grid; place-items: center; padding: 10px; overflow: hidden; border: 2px solid #d8e6df; border-radius: 27px; background: #fff; box-shadow: 0 7px 0 #d9e6e0, 0 17px 30px rgba(25,76,61,.09); }
.target-sticker img { width: 100%; height: 198px; object-fit: contain; border-radius: 19px; background: white; }
.target-sticker .emoji-art { font-size: 105px; }
.word-slots { min-height: 92px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; }
.word-slot { min-width: 76px; height: 70px; display: grid; place-items: center; border: 3px dashed #9fc8bb; border-radius: 18px; color: var(--teal-dark); background: rgba(231,248,240,.74); font-size: 30px; font-weight: 950; transition: transform 150ms ease-out, background 150ms ease-out; }
.word-slot.is-filled { border-style: solid; border-color: var(--teal); background: #d9f4e9; animation: slotSnap 250ms cubic-bezier(.2,.85,.3,1.2); }
.tile-tray { min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px; border-radius: 22px; background: #f1f8f3; }
.tray-tile { min-width: 68px; height: 58px; border: 0; color: #663b18; background: #ffe799; box-shadow: 0 5px 0 #dfb950; cursor: grab; touch-action: none; }
.tray-tile:hover { transform: translateY(-3px) rotate(-2deg); }
.tray-tile:active, .tray-tile.is-dragging { cursor: grabbing; transform: scale(1.08) rotate(2deg); }
.tray-tile:disabled { opacity: .3; cursor: default; transform: none; }

.feedback { min-height: 24px; margin: 9px auto 0; color: var(--coral-dark); font-size: 14px; font-weight: 850; text-align: center; }
.feedback.is-good { color: var(--teal-dark); }
.action-area { min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 11px; }
.primary, .choice { min-height: 54px; padding: 10px 20px; border-radius: 16px; font-weight: 900; cursor: pointer; transition: transform 130ms ease-out, box-shadow 130ms ease-out; }
.primary { min-width: 245px; border: 1px solid #bd462f; color: white; background: linear-gradient(#ff876a,var(--coral)); box-shadow: 0 6px 0 var(--coral-dark); font-size: 16px; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--coral-dark); }
.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--coral-dark); }
.choice { border: 2px solid #cce0d8; background: white; box-shadow: 0 4px 0 #d4e3dd; color: var(--ink); }
.choice:hover { transform: translateY(-2px); border-color: #74b9ad; box-shadow: 0 6px 0 #c6ddd5; }
.play-card.is-miss { animation: gentleShake 320ms ease-out; }

.mascot { position: absolute; z-index: 5; left: max(20px, calc(50% - 680px)); bottom: 28px; width: 230px; pointer-events: none; transform-origin: 50% 100%; }
.sticker-art { overflow: hidden; padding: 8px; border: 1px solid rgba(31,80,65,.1); border-radius: 30px; background: #fffdf8; box-shadow: 0 15px 34px rgba(25,72,58,.17); }
.sticker-art img { display: block; width: 100%; border-radius: 22px; background: white; }
.mascot p { position: absolute; top: 10px; left: 175px; width: 155px; margin: 0; padding: 11px 13px; border-radius: 16px 16px 16px 5px; color: var(--teal-dark); background: rgba(255,255,255,.96); box-shadow: 0 10px 26px rgba(25,74,59,.13); font-size: 12px; font-weight: 850; line-height: 1.3; }
.mascot.is-happy { animation: mascotPop 600ms cubic-bezier(.2,.85,.25,1.2); }
.mascot.is-listening { animation: mascotListen 900ms ease-in-out 2; }
.mascot.is-sad { animation: mascotNudge 350ms ease-out; }

.pop-word { position: absolute; z-index: 40; left: 50%; top: 49%; padding: 13px 28px; opacity: 0; border-radius: 999px; color: white; background: var(--teal-dark); box-shadow: 0 15px 35px rgba(12,76,67,.25); font-size: 42px; font-weight: 950; text-transform: lowercase; pointer-events: none; transform: translate(-50%,-50%) scale(.45) rotate(-4deg); }
.pop-word.is-showing { animation: wordPop 760ms cubic-bezier(.2,.86,.25,1.15); }
.toast { position: absolute; z-index: 50; left: 50%; top: 23px; max-width: 430px; padding: 11px 18px; opacity: 0; border-radius: 99px; color: white; background: #153f45; box-shadow: 0 13px 32px rgba(18,60,60,.2); font-size: 13px; font-weight: 850; pointer-events: none; transform: translate(-50%,-12px); transition: opacity 160ms ease-out, transform 160ms ease-out; }
.toast.is-showing { opacity: 1; transform: translate(-50%,0); }
.celebration { position: absolute; z-index: 45; inset: 0; overflow: hidden; pointer-events: none; }
.celebration i { position: absolute; left: 50%; top: 54%; opacity: 0; color: var(--gold); font-size: 25px; font-style: normal; }
.celebration.is-showing i { animation: confetti 850ms cubic-bezier(.15,.72,.25,1) forwards; }
.celebration i:nth-child(1){--x:-340px;--y:-230px}.celebration i:nth-child(2){--x:-280px;--y:-315px;color:var(--teal)}.celebration i:nth-child(3){--x:-205px;--y:-250px;color:var(--coral)}.celebration i:nth-child(4){--x:-125px;--y:-335px}.celebration i:nth-child(5){--x:-45px;--y:-260px;color:var(--blue)}.celebration i:nth-child(6){--x:45px;--y:-330px;color:var(--coral)}.celebration i:nth-child(7){--x:120px;--y:-250px}.celebration i:nth-child(8){--x:205px;--y:-320px;color:var(--teal)}.celebration i:nth-child(9){--x:285px;--y:-240px;color:var(--coral)}.celebration i:nth-child(10){--x:350px;--y:-300px;color:var(--blue)}.celebration i:nth-child(11){--x:-370px;--y:-145px;color:var(--blue)}.celebration i:nth-child(12){--x:375px;--y:-150px;color:var(--teal)}

@keyframes ribbonRun { to { transform: scaleX(1); } }
@keyframes slotSnap { 45% { transform: scale(1.13) rotate(-2deg); } }
@keyframes gentleShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px) rotate(-.2deg)} 68%{transform:translateX(6px) rotate(.2deg)} }
@keyframes mascotPop { 0%,100%{transform:none} 36%{transform:translateY(-19px) rotate(-3deg)} 66%{transform:rotate(2deg)} }
@keyframes mascotListen { 50% { transform: rotate(3deg) translateY(-5px); } }
@keyframes mascotNudge { 35%{transform:rotate(-4deg)} 70%{transform:rotate(3deg)} }
@keyframes wordPop { 0%{opacity:0;transform:translate(-50%,-50%) scale(.4) rotate(-5deg)} 28%{opacity:1;transform:translate(-50%,-50%) scale(1.1) rotate(2deg)} 72%{opacity:1;transform:translate(-50%,-50%) scale(1)} 100%{opacity:0;transform:translate(-50%,-72%) scale(1.05)} }
@keyframes confetti { 0%{opacity:0;transform:translate(-50%,-50%) scale(.3)} 12%{opacity:1} 100%{opacity:0;transform:translate(calc(-50% + var(--x)),calc(-50% + var(--y))) rotate(540deg) scale(1.1)} }

@media (max-width: 1210px) {
  .play-card { width: min(800px, calc(100% - 260px)); min-width: 690px; }
  .mascot { left: 12px; width: 145px; }
  .mascot p { top: -28px; left: 8px; width: 145px; border-radius: 16px 16px 5px 16px; }
}
@media (max-height: 760px) {
  .play-card { min-height: 590px; padding-top: 27px; }
  .sound-stage { min-height: 125px; padding-top: 10px; gap: 8px; }
  .picture-stage, .build-stage { min-height: 220px; }
  .picture-card { min-height: 190px; }
  .picture-card img { height: 165px; }
  .target-sticker { min-height: 190px; }
  .target-sticker img { height: 168px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .sound-tile.is-playing { transform: none; box-shadow: 0 0 0 6px rgba(255,205,77,.25); }
}
