:root {
  color-scheme: light;
  --ink: #173841;
  --muted: #60747a;
  --paper: #fffaf0;
  --paper-strong: #fffef9;
  --teal: #167a78;
  --teal-dark: #0b4d50;
  --gold: #f4b942;
  --gold-dark: #9a5b12;
  --coral: #e7684c;
  --coral-dark: #963728;
  --rope: #d89a3e;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; min-width: 900px; min-height: 650px; overflow: hidden; }
body { margin: 0; color: var(--ink); background: #b8e0df; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #075e86; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.lesson { height: 100%; padding: 12px; }
.world { position: relative; height: 100%; min-height: 626px; overflow: hidden; isolation: isolate; border: 1px solid rgba(18,63,70,.23); border-radius: 27px; background: #d7eee9; box-shadow: 0 9px 0 rgba(31,83,87,.16), 0 28px 58px rgba(23,59,66,.2); }
.world-art { position: absolute; z-index: -4; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.8) contrast(.86) brightness(1.08); transform: scale(1.01); }
.world-wash { position: absolute; z-index: -3; inset: 0; background: linear-gradient(90deg,rgba(230,247,244,.9) 0 20%,rgba(240,249,245,.48) 39%,rgba(240,247,239,.74) 100%); }
.world-wash::after { position: absolute; inset: 0; content: ""; background: linear-gradient(180deg,rgba(255,250,231,.14),rgba(17,63,68,.08)); }

.hud { position: absolute; z-index: 30; left: 22px; right: 22px; top: 18px; height: 68px; display: grid; grid-template-columns: 205px minmax(230px,1fr) auto; align-items: center; gap: 18px; }
.mission-chip,.height-meter,.scoreboard { border: 1px solid rgba(23,56,65,.15); background: rgba(255,250,240,.93); box-shadow: 0 5px 0 rgba(44,83,83,.14); backdrop-filter: blur(10px); }
.mission-chip { height: 68px; display: flex; flex-direction: column; justify-content: center; padding: 11px 16px; border-radius: 15px; }
.mission-chip span,.height-meter span,.scoreboard span { color: var(--muted); font-size: 10px; font-weight: 950; letter-spacing: .09em; text-transform: uppercase; }
.mission-chip strong { margin-top: 3px; font-size: 17px; }
.height-meter { justify-self: center; width: min(390px,100%); display: grid; grid-template-columns: 1fr auto; gap: 7px 13px; padding: 10px 15px; border-radius: 15px; }
.height-meter > i { grid-column: 1/-1; height: 9px; overflow: hidden; border-radius: 999px; background: #dce4da; }
.height-meter > i b { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--coral)); transition: width 260ms ease-out; }
.height-meter strong { font-size: 13px; }
.scoreboard { height: 68px; display: flex; padding: 7px; border-radius: 15px; }
.scoreboard > div { min-width: 74px; display: grid; place-content: center; padding: 0 12px; text-align: center; }
.scoreboard > div + div { border-left: 1px solid #d6ded8; }
.scoreboard strong { margin-top: 2px; font-size: 21px; line-height: 1; }
.scoreboard strong:first-letter { color: var(--gold-dark); }

.sticker-art { overflow: hidden; border: 7px solid rgba(255,255,255,.96); border-radius: 28px; background: white; box-shadow: 0 8px 0 rgba(63,82,75,.13), 0 16px 28px rgba(39,69,69,.16); }
.sticker-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mascot { position: absolute; z-index: 18; left: 24px; bottom: 170px; width: 205px; height: 310px; pointer-events: none; transform-origin: 50% 100%; }
.mascot-sticker { position: absolute; left: 0; bottom: 0; width: 190px; height: 220px; border-radius: 52px 52px 64px 64px; }
.mascot-sticker img { object-position: 50% 35%; }
.mascot-speech { position: absolute; z-index: 2; left: 74px; top: 4px; width: 165px; padding: 12px 14px; border: 1px solid rgba(23,56,65,.14); border-radius: 18px 18px 18px 5px; background: rgba(255,254,249,.97); box-shadow: 0 6px 18px rgba(37,72,72,.14); font-size: 12px; font-weight: 900; line-height: 1.3; }
.mascot.is-happy { animation: mascot-pop 480ms ease-out; }
.mascot.is-miss { animation: mascot-shake 340ms ease-out; }

.tower-panel { position: absolute; z-index: 10; left: 255px; right: 330px; top: 100px; bottom: 190px; min-width: 390px; display: grid; grid-template-rows: 32px 1fr 32px; padding: 8px 26px; border: 1px solid rgba(30,69,71,.18); border-radius: 28px; background: rgba(240,248,240,.72); box-shadow: inset 0 0 46px rgba(255,255,255,.44), 0 10px 30px rgba(32,69,70,.13); backdrop-filter: blur(7px); }
.rope { position: absolute; z-index: -1; left: 50%; top: 29px; bottom: 29px; width: 12px; transform: translateX(-50%); border: 2px solid #8c581e; border-radius: 999px; background: repeating-linear-gradient(45deg,#e5aa4c 0 7px,#bd7729 7px 13px); box-shadow: 3px 0 0 rgba(87,53,20,.18); }
.time-cap { z-index: 3; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 10px; font-weight: 1000; letter-spacing: .11em; text-transform: uppercase; }
.time-cap span { padding: 5px 11px; border-radius: 999px; background: var(--teal-dark); box-shadow: 0 3px 0 rgba(15,48,49,.22); }
.time-cap b { color: var(--gold); font-size: 14px; }
.timeline { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; }
.event-card { position: relative; z-index: 2; width: min(350px,88%); min-height: 47px; display: grid; grid-template-columns: 39px 1fr auto; align-items: center; gap: 10px; padding: 7px 13px 7px 9px; border: 2px solid #b9c9c3; border-radius: 14px; background: var(--paper-strong); box-shadow: 0 4px 0 rgba(61,87,79,.18); }
.event-card::before { width: 35px; height: 32px; display: grid; place-items: center; content: attr(data-icon); border-radius: 10px; background: #f8df93; font-size: 18px; }
.event-card strong { min-width: 0; overflow: hidden; font-size: 14px; line-height: 1.12; text-overflow: ellipsis; white-space: nowrap; }
.event-card span { color: var(--teal-dark); font-size: 11px; font-weight: 1000; white-space: nowrap; }
.event-card.new { border-color: var(--gold-dark); background: #fff3c9; box-shadow: 0 4px 0 #d8a23c, 0 0 0 5px rgba(244,185,66,.18); animation: snap-in 300ms cubic-bezier(.2,.9,.25,1.2); }
.drop-slot { position: relative; z-index: 3; width: min(380px,94%); min-height: 26px; padding: 0; border: 2px dashed rgba(18,92,91,.55); border-radius: 11px; color: var(--teal-dark); background: rgba(240,255,248,.58); font-size: 10px; font-weight: 1000; letter-spacing: .05em; text-transform: uppercase; transition: min-height 140ms ease-out, background 140ms ease-out, transform 140ms ease-out; }
.drop-slot::after { content: "Drop here"; }
.drop-slot:hover,.drop-slot.is-over { min-height: 36px; transform: scale(1.02); border-style: solid; background: #d9f3e9; box-shadow: 0 0 0 5px rgba(22,122,120,.12); }

.mission-dock { position: absolute; z-index: 25; left: 244px; right: 22px; bottom: 19px; min-height: 152px; display: grid; grid-template-columns: minmax(240px,.72fr) minmax(240px,1fr) minmax(220px,.78fr); align-items: center; gap: 18px; padding: 17px 20px 17px 24px; border: 1px solid rgba(29,66,68,.17); border-radius: 24px; background: rgba(255,250,240,.96); box-shadow: 0 8px 0 rgba(48,83,78,.13), 0 21px 42px rgba(31,66,67,.18); backdrop-filter: blur(12px); }
.mission-copy span { color: var(--coral-dark); font-size: 9px; font-weight: 1000; letter-spacing: .11em; text-transform: uppercase; }
.mission-copy h1 { margin: 5px 0 4px; font-size: clamp(21px,2.2vw,31px); line-height: 1; letter-spacing: -.04em; }
.mission-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.incoming-wrap { min-height: 108px; display: grid; place-items: center; }
.incoming-card { position: relative; z-index: 40; width: min(330px,100%); min-height: 100px; padding: 13px 18px 12px 49px; touch-action: none; border: 3px solid var(--coral-dark); border-radius: 17px; color: #4e281e; background: linear-gradient(145deg,#fff5da,#ffd986); box-shadow: 0 8px 0 #b74a33, 0 15px 24px rgba(84,55,35,.17); text-align: left; user-select: none; transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
.incoming-card:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 11px 0 #b74a33, 0 20px 28px rgba(84,55,35,.19); }
.incoming-card:active,.incoming-card.is-dragging { transform: translateY(3px) scale(1.03); box-shadow: 0 4px 0 #b74a33, 0 12px 22px rgba(84,55,35,.2); cursor: grabbing; }
.incoming-card.is-wrong { animation: card-wobble 360ms ease-out; }
.incoming-card small,.incoming-card em { display: block; font-style: normal; }
.incoming-card small { color: var(--coral-dark); font-size: 9px; font-weight: 1000; letter-spacing: .1em; text-transform: uppercase; }
.incoming-card strong { display: block; margin: 4px 0 2px; font-size: 21px; line-height: 1.05; }
.incoming-card em { color: #725b43; font-size: 10px; font-weight: 800; }
.grab-mark { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--coral-dark); font-size: 26px; }
.actions { min-height: 88px; display: grid; align-content: center; gap: 9px; }
.primary,.choice { min-height: 55px; border: 2px solid var(--teal-dark); border-radius: 14px; font-weight: 950; transition: transform 140ms ease-out,box-shadow 140ms ease-out; }
.primary { padding: 0 18px; color: white; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); font-size: 14px; }
.primary:hover,.choice:hover { transform: translateY(-2px); }
.primary:active,.choice:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--teal-dark); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choice { padding: 9px 10px; border-color: #b7c8c4; background: white; box-shadow: 0 5px 0 #d5dfdb; font-size: 11px; line-height: 1.2; }
.choice:hover { border-color: var(--teal); }
.feedback { position: absolute; left: 25px; right: 25px; bottom: 7px; min-height: 15px; color: var(--teal-dark); font-size: 11px; font-weight: 900; text-align: center; }
.feedback.error { color: var(--coral-dark); }
.prop-sticker { position: absolute; z-index: 8; right: 24px; top: 113px; width: 270px; height: 270px; opacity: .92; border-radius: 35px; transform: rotate(2deg); }
.prop-sticker img { object-fit: cover; }
.toast { position: absolute; z-index: 70; left: 50%; bottom: 180px; max-width: 560px; padding: 10px 17px; opacity: 0; transform: translate(-50%,10px); border-radius: 999px; color: white; background: var(--ink); pointer-events: none; font-size: 12px; font-weight: 900; transition: opacity 150ms ease-out,transform 150ms ease-out; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast.error { background: var(--coral-dark); }
.celebration { position: absolute; z-index: 60; left: 52%; top: 40%; pointer-events: none; }
.celebration i { position: absolute; width: 14px; height: 14px; opacity: 0; border-radius: 4px; background: var(--gold); }
.world.is-celebrating .celebration i { animation: sparkle 680ms ease-out both; }
.celebration i:nth-child(1){--x:-180px;--y:-100px}.celebration i:nth-child(2){--x:-90px;--y:-175px;animation-delay:40ms}.celebration i:nth-child(3){--x:10px;--y:-190px;animation-delay:80ms}.celebration i:nth-child(4){--x:135px;--y:-145px;animation-delay:120ms}.celebration i:nth-child(5){--x:190px;--y:-30px;animation-delay:160ms}.celebration i:nth-child(6){--x:125px;--y:90px;animation-delay:200ms}.celebration i:nth-child(7){--x:-110px;--y:90px;animation-delay:240ms}.celebration i:nth-child(8){--x:-200px;--y:10px;animation-delay:280ms}

@keyframes snap-in { from { opacity: .3; transform: scale(.7) rotate(-4deg); } 65% { transform: scale(1.06) rotate(1deg); } }
@keyframes card-wobble { 0%,100%{transform:translateX(0) rotate(0)}20%{transform:translateX(-10px) rotate(-3deg)}50%{transform:translateX(9px) rotate(3deg)}75%{transform:translateX(-5px) rotate(-1deg)} }
@keyframes mascot-pop { 0%,100%{transform:scale(1) rotate(0)}45%{transform:scale(1.07) rotate(-3deg)} }
@keyframes mascot-shake { 0%,100%{transform:translateX(0)}30%{transform:translateX(-7px) rotate(-2deg)}70%{transform:translateX(6px) rotate(2deg)} }
@keyframes sparkle { 0%{opacity:0;transform:translate(0,0) rotate(0) scale(.2)}32%{opacity:1}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(190deg) scale(1.2)} }

@media (max-height: 760px) {
  .lesson { padding: 8px; }.world { border-radius: 22px; }.hud { top: 12px; }.tower-panel { top: 89px; bottom: 168px; }.mission-dock { min-height: 137px; bottom: 13px; }.incoming-wrap { min-height: 92px; }.incoming-card { min-height: 86px; }.mascot { bottom: 150px; transform: scale(.87); transform-origin: left bottom; }.prop-sticker { width: 225px; height: 225px; }.event-card { min-height: 42px; }.drop-slot { min-height: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .incoming-card { cursor: pointer; }
}
