:root {
  color-scheme: dark;
  --space: #0d1240;
  --ink: #18204d;
  --paper: #fffdf7;
  --violet: #6d4bd7;
  --violet-dark: #3d2a92;
  --cyan: #56d9e8;
  --mint: #69e2b4;
  --coral: #ff745f;
  --gold: #ffd45f;
  --muted: #66709a;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 1000px; height: 100%; margin: 0; }
body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--space) url("./art/planet-backdrop-01.webp") center / cover no-repeat;
  color: var(--paper);
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
}
body::before { content: ""; position: fixed; inset: 0; background: linear-gradient(90deg, rgba(8,11,45,.48), rgba(15,18,65,.12) 55%, rgba(8,11,45,.5)); }
button { font: inherit; }

.world {
  position: relative;
  display: grid;
  grid-template-columns: minmax(700px, 1fr) 270px;
  gap: 24px;
  width: min(1220px, calc(100vw - 52px));
  height: min(820px, calc(100vh - 42px));
}
.stars { position: fixed; inset: 0; pointer-events: none; background-image: radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 1.7px); background-size: 71px 71px; opacity: .22; animation: drift 18s linear infinite; }

.mission-card, .cockpit { border: 1px solid rgba(255,255,255,.25); box-shadow: 0 24px 70px rgba(5,7,30,.42); backdrop-filter: blur(14px); }
.mission-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto 26px 56px;
  min-height: 0;
  padding: 30px 44px 28px;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(155deg, rgba(25,30,91,.93), rgba(49,35,113,.88));
}
.mission-copy { text-align: center; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 12px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(30px, 3.2vw, 45px); line-height: 1.02; letter-spacing: -.035em; }
.prompt { margin: 9px 0 0; color: #cbd2ff; font-size: 16px; }

.transmitter { position: relative; align-self: center; width: min(760px, 100%); min-height: 245px; margin: 20px auto 12px; padding: 48px 38px 31px; border: 4px solid #8d91d6; border-radius: 28px; background: linear-gradient(#e8ecff, #cbd6f2); box-shadow: 0 13px 0 #343174, inset 0 2px 0 white, 0 24px 45px rgba(4,6,31,.32); color: var(--ink); transition: transform 150ms ease-out, border-color 150ms ease-out; }
.transmitter::before, .transmitter::after { content: ""; position: absolute; top: 21px; width: 12px; height: 12px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 16px var(--mint); }
.transmitter::before { left: 23px; } .transmitter::after { right: 23px; background: var(--coral); box-shadow: 0 0 16px var(--coral); }
.transmitter.is-wrong { animation: shake 300ms ease-out; border-color: var(--coral); }
.transmitter.is-correct { border-color: var(--mint); box-shadow: 0 13px 0 #236b66, inset 0 2px 0 white, 0 0 42px rgba(105,226,180,.4); }
.antenna { position: absolute; top: -38px; left: 50%; width: 160px; height: 60px; transform: translateX(-50%); }
.antenna::before { content: ""; position: absolute; left: 77px; bottom: 0; width: 6px; height: 40px; border-radius: 4px; background: #9397d9; }
.antenna i { position: absolute; left: 50%; top: 0; width: 16px; height: 16px; border: 3px solid var(--cyan); border-radius: 50%; transform: translateX(-50%); animation: ping 1.8s ease-out infinite; }
.antenna i:nth-child(2) { animation-delay: .45s; } .antenna i:nth-child(3) { animation-delay: .9s; }
.transmitter-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 27px; color: #656e9c; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.transmitter-label b { color: var(--violet-dark); }
.sentence { min-height: 70px; text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 3.1vw, 46px); font-weight: 700; line-height: 1.6; letter-spacing: -.02em; }
.slot { display: inline-grid; place-items: center; min-width: 50px; height: 58px; margin: 0 3px; padding: 0 9px; border: 3px dashed #777fc0; border-radius: 14px; color: var(--violet-dark); background: rgba(255,255,255,.6); font-family: ui-rounded, "Avenir Next", sans-serif; font-size: 39px; font-weight: 1000; vertical-align: -.12em; cursor: pointer; transition: 140ms ease-out; }
.slot:hover, .slot.is-active { transform: translateY(-3px); border-color: var(--violet); background: white; box-shadow: 0 7px 0 rgba(67,50,133,.17); }
.slot.is-filled { border-style: solid; border-color: var(--violet); background: #fff5cf; }
.slot:focus-visible, .mark-button:focus-visible, .action-button:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.meaning { min-height: 24px; margin: 20px 0 0; color: #4b557e; text-align: center; font-size: 15px; font-weight: 800; }

.mark-dock { display: flex; justify-content: center; gap: 14px; min-height: 66px; }
.mark-button { display: grid; place-items: center; width: 72px; min-height: 62px; padding: 0; border: 2px solid rgba(255,255,255,.35); border-radius: 19px; color: #222b62; background: var(--gold); box-shadow: 0 7px 0 #b47f29, 0 10px 22px rgba(5,7,30,.25); font-size: 35px; font-weight: 1000; cursor: pointer; transition: 130ms ease-out; }
.mark-button:nth-child(2n) { background: var(--cyan); box-shadow: 0 7px 0 #278ca0, 0 10px 22px rgba(5,7,30,.25); }
.mark-button:nth-child(3n) { background: var(--coral); box-shadow: 0 7px 0 #a93e43, 0 10px 22px rgba(5,7,30,.25); }
.mark-button:hover { transform: translateY(-4px) rotate(-2deg); }
.mark-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #493d80; }
.mark-button[disabled] { opacity: .32; cursor: default; transform: none; }
.feedback { min-height: 26px; margin: 7px 0 0; color: #ffc9bf; text-align: center; font-size: 14px; font-weight: 850; }
.action-button { align-self: end; justify-self: center; min-width: 250px; min-height: 54px; padding: 12px 28px; border: 0; border-radius: 17px; color: #222857; background: var(--mint); box-shadow: 0 7px 0 #27846c; font-size: 16px; font-weight: 1000; cursor: pointer; transition: 130ms ease-out; }
.action-button:hover { transform: translateY(-3px); box-shadow: 0 10px 0 #27846c; }
.action-button:disabled { opacity: .42; cursor: default; transform: none; }
.drone { position: absolute; right: -38px; bottom: 78px; width: 190px; pointer-events: none; filter: drop-shadow(0 14px 18px rgba(4,6,31,.32)); transform: translateX(130%) rotate(6deg); }
.mission-card.is-sent .drone { animation: drone-delivery 950ms cubic-bezier(.2,.9,.25,1) both; }
.burst { position: absolute; left: 50%; bottom: 75px; width: 10px; height: 10px; pointer-events: none; }
.mission-card.is-celebrating .burst { box-shadow: -130px -20px 0 5px var(--gold), -80px -90px 0 4px var(--cyan), 10px -100px 0 6px var(--coral), 110px -55px 0 4px var(--mint), 145px 20px 0 5px var(--gold); animation: burst 650ms ease-out; }

.cockpit { display: flex; flex-direction: column; min-height: 0; padding: 22px 20px; overflow: hidden; border-radius: 30px; background: rgba(18,22,71,.88); }
.mascot-wrap { position: relative; height: 285px; flex: 0 0 auto; }
.mascot { position: absolute; left: 50%; bottom: -7px; width: 245px; transform: translateX(-50%); filter: drop-shadow(0 14px 19px rgba(4,6,31,.42)); transition: transform 180ms ease-out; }
.mascot-wrap.is-happy .mascot { animation: mascot-pop 600ms cubic-bezier(.2,.9,.25,1); }
.mascot-wrap.is-worried .mascot { animation: mascot-wobble 330ms ease-out; }
.speech { position: absolute; z-index: 2; top: 0; left: 3px; width: 205px; padding: 12px 14px; border-radius: 17px 17px 17px 4px; color: var(--ink); background: white; box-shadow: 0 8px 20px rgba(5,7,30,.28); font-size: 13px; font-weight: 800; line-height: 1.35; }
.status-panel { padding: 18px; border: 1px solid rgba(255,255,255,.13); border-radius: 19px; background: rgba(255,255,255,.06); }
.mode-label, .stats span, .difficulty-panel span { display: block; color: #9fa9e9; font-size: 11px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.status-panel strong { display: block; margin-top: 4px; font-size: 21px; }
.mission-pips { display: flex; gap: 7px; margin-top: 14px; }
.mission-pips i { width: 13px; height: 13px; border: 2px solid #777fbd; border-radius: 50%; }
.mission-pips i.is-filled { border-color: var(--mint); background: var(--mint); box-shadow: 0 0 12px rgba(105,226,180,.6); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stats div { padding: 12px 14px; border-radius: 17px; background: rgba(255,255,255,.08); }
.stats strong { display: block; margin-top: 2px; font-size: 27px; }
.difficulty-panel { padding: 13px 4px 0; }
.difficulty-panel > div:first-child { display: flex; align-items: end; justify-content: space-between; }
.difficulty-panel b { font-size: 18px; }
.difficulty-track { height: 8px; margin: 8px 0; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.13); }
.difficulty-track i { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--gold), var(--coral)); transition: width 300ms ease-out; }
.difficulty-panel p { margin: 0; color: #aeb6df; font-size: 12px; line-height: 1.4; }
.crystal-art { height: 100px; margin-top: auto; overflow: hidden; opacity: .82; }
.crystal-art img { display: block; width: 145px; margin: -20px auto 0; filter: drop-shadow(0 8px 12px rgba(4,6,31,.35)); }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 10; padding: 12px 20px; border-radius: 999px; color: var(--ink); background: white; box-shadow: 0 12px 32px rgba(4,6,31,.35); font-weight: 900; opacity: 0; transform: translate(-50%, 15px); transition: 180ms ease-out; pointer-events: none; }
.toast.is-showing { opacity: 1; transform: translate(-50%, 0); }

@keyframes ping { from { opacity: .8; transform: translateX(-50%) scale(.35); } to { opacity: 0; transform: translateX(-50%) scale(3.3); } }
@keyframes shake { 25% { transform: translateX(-9px) rotate(-.5deg); } 75% { transform: translateX(9px) rotate(.5deg); } }
@keyframes mascot-pop { 30% { transform: translateX(-50%) translateY(-18px) rotate(-4deg) scale(1.04); } 65% { transform: translateX(-50%) translateY(2px) rotate(2deg); } }
@keyframes mascot-wobble { 30% { transform: translateX(-50%) rotate(-4deg); } 70% { transform: translateX(-50%) rotate(4deg); } }
@keyframes drone-delivery { 0% { transform: translateX(130%) rotate(8deg); } 45% { transform: translateX(-270px) translateY(-45px) rotate(-5deg); } 100% { transform: translateX(-760px) translateY(-105px) rotate(-12deg); } }
@keyframes burst { from { opacity: 1; transform: scale(.15) rotate(0); } to { opacity: 0; transform: scale(1.25) rotate(18deg); } }
@keyframes drift { to { background-position: 71px 71px; } }

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