:root {
  --ink: #20322f;
  --muted: #65736e;
  --paper: #fbfaf5;
  --coral: #e65f4b;
  --coral-deep: #b93d32;
  --teal: #197c82;
  --teal-deep: #0c5860;
  --gold: #f5b93e;
  --left-force: 36%;
  --right-force: 30%;
  --object-shift: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 1080px;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #eef2e9;
  font-family: ui-rounded, "Avenir Next", "Nunito Sans", system-ui, sans-serif;
}

button { font: inherit; }
button:focus-visible { outline: 4px solid #102e56; outline-offset: 4px; }

.game-shell {
  width: min(1280px, calc(100vw - 54px));
  height: min(822px, calc(100vh - 40px));
  margin: 20px auto;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr) 164px;
  gap: 14px;
}

.game-topline {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  align-items: center;
  padding: 0 10px;
}

.mode-mark { display: flex; flex-direction: column; gap: 2px; }
.mode-mark span, .mission-copy span { color: var(--teal-deep); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.mode-mark strong { font-size: 16px; }

.campaign-pips { display: flex; justify-content: center; gap: 9px; }
.campaign-pips i { width: 34px; height: 7px; border-radius: 99px; background: #cad5ce; transition: transform 160ms ease-out, background 160ms ease-out; }
.campaign-pips i.is-current { background: var(--gold); transform: scaleX(1.15); }
.campaign-pips i.is-done { background: var(--teal); }

.practice-stats { justify-self: end; display: flex; align-items: center; gap: 20px; }
.practice-stats span { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 7px; }
.practice-stats small { color: var(--muted); font-size: 12px; font-weight: 800; }
.practice-stats b { font-size: 20px; }
.practice-stats .rank { width: 142px; display: grid; grid-template-columns: 1fr; gap: 4px; }
.rank i { display: block; height: 7px; overflow: hidden; border-radius: 99px; background: #d8e1db; }
.rank i b { display: block; width: 20%; height: 100%; background: var(--gold); border-radius: inherit; transition: width 180ms ease-out; }

.world { position: relative; overflow: hidden; border-radius: 34px; isolation: isolate; box-shadow: 0 18px 55px rgba(37, 62, 49, .13); }
.backdrop { position: absolute; inset: -18px; z-index: -3; background: url("./assets/woodland-arena-01.webp") center / cover; filter: saturate(.72) blur(2.5px); transform: scale(1.025); }
.sunwash { position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(255,255,255,.36), rgba(249,248,238,.62)); }

.mascot { position: absolute; left: 24px; bottom: 16px; z-index: 5; width: 150px; pointer-events: none; }
.sticker-art { overflow: hidden; padding: 6px; border: 1px solid rgba(32,50,47,.1); border-radius: 25px; background: #fffdf8; box-shadow: 0 9px 24px rgba(29,53,42,.15); transform-origin: 50% 90%; transition: transform 180ms ease-out, filter 180ms ease-out; }
.mascot img { width: 100%; display: block; border-radius: 19px; }
.athlete img { width: 100%; display: block; mix-blend-mode: multiply; -webkit-mask-image: radial-gradient(ellipse 62% 67% at 50% 50%, #000 70%, transparent 98%); mask-image: radial-gradient(ellipse 62% 67% at 50% 50%, #000 70%, transparent 98%); }
.mascot p { position: absolute; left: 108px; bottom: 103px; width: max-content; max-width: 170px; margin: 0; padding: 10px 14px; border-radius: 17px 17px 17px 4px; background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(29,53,42,.12); font-size: 13px; font-weight: 850; }
.mascot.is-happy .sticker-art { transform: translateY(-8px) rotate(-3deg) scale(1.04); }
.mascot.is-miss .sticker-art { animation: mascot-no 300ms ease-out; filter: saturate(.75); }

.arena-card { position: absolute; inset: 42px 116px 42px 116px; border: 1px solid rgba(255,255,255,.72); border-radius: 30px; background: rgba(251,250,245,.82); box-shadow: inset 0 1px 0 #fff, 0 16px 44px rgba(45,70,54,.12); backdrop-filter: blur(8px); }

.force-meter { position: absolute; z-index: 4; top: 112px; left: 12%; right: 12%; height: 52px; display: grid; grid-template-columns: 1fr 18px 1fr; align-items: start; }
.force-zero { width: 3px; height: 31px; margin-top: 21px; justify-self: center; border-radius: 99px; background: rgba(32,50,47,.2); }
.force { display: grid; grid-template-rows: 15px 18px; row-gap: 8px; font-size: 12px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.force span { grid-row: 1; white-space: nowrap; }
.force-left { justify-items: end; color: var(--coral-deep); }
.force-right { justify-items: start; color: var(--teal-deep); }
.force i { position: relative; grid-row: 2; height: 18px; border-radius: 99px; transition: width 300ms cubic-bezier(.2,.8,.2,1), filter 150ms; }
.force-left i { width: var(--left-force); max-width: 100%; background: linear-gradient(90deg, var(--coral-deep), #f2795f); }
.force-right i { width: var(--right-force); max-width: 100%; background: linear-gradient(90deg, #31a7a0, var(--teal-deep)); }
.force-left i::before, .force-right i::after { content: ""; position: absolute; top: -7px; border: 16px solid transparent; }
.force-left i::before { left: -17px; border-right-color: var(--coral-deep); border-left: 0; }
.force-right i::after { right: -17px; border-left-color: var(--teal-deep); border-right: 0; }
.force-meter.is-pulsing .force i { animation: force-pulse 700ms ease-out infinite alternate; }

.playfield { position: absolute; inset: 92px 28px 20px; display: grid; grid-template-columns: 1fr minmax(280px, 39%) 1fr; align-items: end; }
.team { height: 240px; display: flex; align-items: end; justify-content: center; padding-bottom: 42px; }
.team-left { flex-direction: row-reverse; }
.athlete { position: relative; width: clamp(76px, 7.2vw, 108px); margin-inline: -13px; transform-origin: 50% 90%; transition: transform 260ms ease-out, opacity 200ms; }
.athlete img { filter: saturate(.95); }
.athlete .power { position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); display: flex; gap: 3px; padding: 5px 7px; border-radius: 99px; background: rgba(255,255,255,.92); }
.athlete .power i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 1px 0 #ae7614; }
.team.is-focus .athlete { animation: team-focus 650ms ease-out infinite alternate; }

.rope-world, .box-world { position: relative; height: 180px; align-self: center; transform: translateX(var(--object-shift)); transition: transform 850ms cubic-bezier(.17,.67,.2,1); }
.rope { position: absolute; left: -86%; right: -86%; top: 93px; height: 9px; border-radius: 99px; background: repeating-linear-gradient(105deg, #9a643a 0 8px, #d6a56a 8px 16px); box-shadow: 0 3px 0 rgba(82,48,26,.2); }
.flag { position: absolute; left: 50%; top: 48px; width: 4px; height: 63px; transform: translateX(-50%); background: #543f2e; border-radius: 9px; }
.flag i { position: absolute; left: 3px; top: 4px; width: 39px; height: 28px; background: var(--gold); clip-path: polygon(0 0,100% 0,76% 50%,100% 100%,0 100%); filter: drop-shadow(0 3px 2px rgba(74,50,22,.15)); }
.centre-mark { position: absolute; left: 50%; bottom: 0; width: 5px; height: 46px; transform: translateX(-50%); border-radius: 99px; background: rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(32,50,47,.08); }
.crate { position: absolute; left: 50%; top: 54px; width: 130px; height: 98px; transform: translateX(-50%) rotate(-1deg); display: grid; place-items: center; border: 7px solid #78482d; border-radius: 12px; background: linear-gradient(135deg,#c9834f,#a9663e); box-shadow: inset 0 0 0 4px rgba(255,220,157,.22), 0 13px 18px rgba(59,42,27,.18); }
.crate span { color: #fff1d2; font-size: 13px; font-weight: 1000; line-height: 1.05; text-align: center; transform: rotate(1deg); }

.arena-card.is-tensing .athlete { animation: heave 330ms ease-in-out infinite alternate; }
.arena-card.is-tensing .force i { filter: brightness(1.15) drop-shadow(0 0 10px currentColor); }
.arena-card.is-miss { animation: miss-shake 280ms ease-out; }
.impact-word { position: absolute; left: 50%; top: 45%; z-index: 8; transform: translate(-50%,-50%) scale(.7); opacity: 0; color: var(--ink); font-size: 48px; font-weight: 1000; letter-spacing: -.04em; text-shadow: 0 4px 0 #fff; pointer-events: none; }
.impact-word.is-showing { animation: impact 700ms ease-out forwards; }
.spark-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.spark-burst i { position: absolute; left: 50%; top: 51%; width: 11px; height: 22px; border-radius: 3px; background: var(--gold); opacity: 0; }
.spark-burst.is-on i { animation: spark 800ms ease-out forwards; transform: rotate(var(--angle)) translateY(-20px); }

.action-tray { display: grid; grid-template-columns: minmax(290px, .8fr) minmax(560px, 1.7fr); align-items: center; gap: 30px; padding: 24px 30px; border-radius: 28px; background: var(--paper); box-shadow: 0 12px 36px rgba(36,57,47,.11); }
.mission-copy { min-width: 0; }
.mission-copy h1 { margin: 5px 0 0; max-width: 430px; font-size: clamp(24px, 2.1vw, 32px); line-height: 1.05; letter-spacing: -.035em; }
.controls { min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.choice, .primary, .puller-choice { min-height: 64px; border: 0; border-radius: 18px; cursor: pointer; transition: transform 150ms ease-out, box-shadow 150ms ease-out, background 150ms; }
.choice:hover, .primary:hover, .puller-choice:hover { transform: translateY(-3px); }
.choice:active, .primary:active, .puller-choice:active { transform: translateY(1px) scale(.98); }
.choice { min-width: 142px; padding: 12px 18px; display: flex; align-items: center; gap: 12px; color: var(--ink); background: #edf1ec; font-weight: 900; }
.choice .arrow { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #fff; font-size: 23px; }
.choice small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.primary { min-width: 210px; padding: 14px 26px; color: white; background: var(--teal); box-shadow: 0 7px 0 var(--teal-deep); font-size: 17px; font-weight: 950; }
.primary.coral { background: var(--coral); box-shadow: 0 7px 0 var(--coral-deep); }
.primary.gold { color: #51360b; background: var(--gold); box-shadow: 0 7px 0 #bd7d13; }
.feedback { max-width: 350px; font-size: 15px; font-weight: 800; line-height: 1.35; }
.feedback strong { display: block; font-size: 20px; }
.puller-picker { display: flex; align-items: center; gap: 10px; }
.puller-choice { position: relative; width: 82px; padding: 8px; background: #edf1ec; }
.puller-choice.is-selected { background: #d8efec; box-shadow: inset 0 0 0 3px var(--teal); }
.puller-choice b { display: block; font-size: 12px; }
.puller-choice span { display: flex; justify-content: center; gap: 3px; margin-top: 5px; }
.puller-choice i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.explain-choice { min-width: 170px; max-width: 210px; min-height: 70px; padding: 12px 15px; border: 0; border-radius: 17px; background: #edf1ec; color: var(--ink); font-weight: 850; cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes heave { from { transform: rotate(-2deg) translateX(-2px); } to { transform: rotate(3deg) translateX(3px); } }
@keyframes force-pulse { to { filter: brightness(1.18) drop-shadow(0 0 9px currentColor); transform: scaleY(1.16); } }
@keyframes miss-shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
@keyframes mascot-no { 25% { transform: rotate(-5deg); } 65% { transform: rotate(5deg); } }
@keyframes team-focus { to { transform: translateY(-8px); } }
@keyframes impact { 20% { opacity: 1; transform: translate(-50%,-50%) scale(1.1) rotate(-2deg); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-65%) scale(1); } }
@keyframes spark { 15% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--angle)) translateY(-170px) rotate(180deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important; }
}
