:root {
  --deep: #041a33;
  --mid: #0a3a66;
  --shallow: #0f6aa8;
  --ink: #eaf6ff;
  --muted: #9cc3e0;
  --card: rgba(6, 30, 58, .82);
  --line: rgba(126, 224, 255, .25);
  --glow: #7ee0ff;
  --spark: #ffb020;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--deep);
  color: var(--ink);
  font: 16px/1.5 Nunito, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: Bungee, Nunito, sans-serif; font-weight: 400; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .5px; }
h1 { font-size: clamp(28px, 7vw, 44px); }
h2 { font-size: clamp(22px, 5.5vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
button { font: inherit; cursor: pointer; }
a { color: var(--glow); }

/* ocean background */
.ocean { position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--shallow) 0%, var(--mid) 35%, var(--deep) 100%); overflow: hidden; }
.rays { position: absolute; inset: -20% -10% 40%; background: repeating-linear-gradient(100deg, rgba(255,255,255,.06) 0 40px, transparent 40px 110px); filter: blur(6px); animation: sway 9s ease-in-out infinite alternate; }
@keyframes sway { from { transform: skewX(-4deg); } to { transform: skewX(4deg); } }
.bubbles span { position: absolute; bottom: -20px; border-radius: 50%; border: 1.5px solid rgba(200,240,255,.45); animation: rise linear infinite; }
@keyframes rise { to { transform: translateY(-110vh) translateX(20px); opacity: 0; } }

.ribbon { position: fixed; top: 10px; right: -34px; transform: rotate(35deg); background: var(--spark); color: #2b1a00; font-weight: 800; font-size: 12px; padding: 4px 40px; z-index: 50; pointer-events: none; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; min-height: 100vh; }
.screen { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(6px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.eyebrow { color: var(--glow); font-weight: 800; text-transform: uppercase; letter-spacing: 2px; font-size: 12px; margin-bottom: 6px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 800; font-size: 17px; background: var(--spark); color: #2b1a00; box-shadow: 0 6px 0 #b87500; transition: transform .1s, box-shadow .1s; text-decoration: none; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b87500; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.small { padding: 9px 16px; font-size: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }

input[type=text] { width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line); background: rgba(0,0,0,.25); color: var(--ink); font: inherit; font-size: 18px; }
input[type=text]:focus { outline: none; border-color: var(--glow); }

/* welcome */
.welcome { text-align: center; }
.welcome .hero-wrap { margin: 8px auto 0; display: flex; justify-content: center; }
.welcome .lead { font-size: 18px; }
.creator-tag { display: inline-block; background: rgba(255,176,32,.15); color: var(--spark); border: 1px solid rgba(255,176,32,.4); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 14px; margin-bottom: 12px; }

.hero .flame { animation: flicker .18s infinite alternate; }
@keyframes flicker { to { opacity: .6; } }
.hero-img { position: relative; margin: 0 auto; }
.hero-img img { width: 100%; border-radius: var(--radius); display: block; }
.gear-badges { position: absolute; bottom: -10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gear-badge { background: var(--deep); border: 2px solid var(--spark); border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px; }

/* hub */
.hub-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 16px; }
.hub-top .mini-hero { width: 96px; }
.progress { height: 12px; border-radius: 999px; background: rgba(0,0,0,.3); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--glow), var(--spark)); transition: width .6s; }
.gear-strip { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.gear-slot { width: 34px; height: 34px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 18px; }
.gear-slot.on { border: 2px solid var(--spark); background: rgba(255,176,32,.12); }

.map { position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, #0c4b80, #062547 70%, #04192f); }
@media (min-width: 640px) { .map { aspect-ratio: 16 / 11; } }
.map svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.station { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 110px; }
.station .node { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: radial-gradient(circle at 35% 30%, #1d7fc4, #0a355f); border: 3px solid var(--glow); box-shadow: 0 0 0 6px rgba(126,224,255,.15), 0 0 24px rgba(126,224,255,.5); animation: pulse 2.2s ease-in-out infinite; }
.station.done .node { border-color: var(--good); box-shadow: 0 0 0 6px rgba(61,220,151,.15); animation: none; }
.station .label { font-weight: 800; font-size: 13px; background: rgba(4,26,51,.85); padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.station .check { position: absolute; top: -4px; right: 18px; background: var(--good); color: #003b22; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; font-weight: 800; display: grid; place-items: center; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(126,224,255,.05), 0 0 30px rgba(126,224,255,.7); } }
.station:focus-visible .node { outline: 3px solid var(--spark); outline-offset: 4px; }
.hub-hint { text-align: center; margin-top: 12px; }

/* mission */
.mission-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back { background: none; border: 0; color: var(--muted); font-weight: 800; padding: 6px 0; }
.partner-chip { display: inline-block; font-size: 13px; font-weight: 800; color: var(--glow); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin-bottom: 10px; }

.weld-wrap { position: relative; margin: 6px -4px 0; touch-action: none; }
.weld-wrap canvas { width: 100%; display: block; border-radius: 14px; background: #1a1f26; touch-action: none; }
.weld-hud { display: flex; justify-content: space-between; font-weight: 800; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--ink); border-radius: 999px; padding: 10px 16px; font-weight: 700; }
.chip.on { border-color: var(--spark); background: rgba(255,176,32,.15); color: #ffe2a6; }

.quiz-q { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.opt { display: block; width: 100%; text-align: left; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--ink); border-radius: 14px; padding: 14px 16px; font-weight: 700; margin-bottom: 10px; }
.opt.right { border-color: var(--good); background: rgba(61,220,151,.15); }
.opt.wrong { border-color: var(--bad); background: rgba(255,107,107,.12); }
.why { border-left: 4px solid var(--glow); padding: 6px 12px; background: rgba(126,224,255,.08); border-radius: 0 10px 10px 0; }

.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.gear-item { border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--ink); border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; }
.gear-item .ic { font-size: 34px; }
.gear-item.on { border-color: var(--spark); background: rgba(255,176,32,.15); }
.gear-item.wrong { border-color: var(--bad); animation: shake .35s; }

.steps { list-style: none; padding: 0; margin: 0; }
.step-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--ink); border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-bottom: 10px; }
.step-btn .n { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; font-weight: 800; }
.step-btn.placed { border-color: var(--good); background: rgba(61,220,151,.12); }
.step-btn.placed .n { border: 0; background: var(--good); color: #003b22; }
.step-btn.wrong { border-color: var(--bad); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.reward { text-align: center; }
.reward .burst { font-size: 64px; animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.facts { display: grid; gap: 10px; margin: 16px 0; text-align: left; }
.fact { background: rgba(0,0,0,.2); border-radius: 12px; padding: 10px 14px; }
.fact b { display: block; color: var(--glow); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.tracks li { margin-bottom: 6px; }

/* finale */
.choices { display: grid; gap: 10px; }
.choice { text-align: left; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: var(--ink); border-radius: 14px; padding: 14px 16px; font-weight: 700; display: flex; gap: 12px; align-items: center; }
.choice.on { border-color: var(--spark); background: rgba(255,176,32,.15); }
.choice .ic { font-size: 24px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--spark); color: #2b1a00; font-weight: 800; padding: 10px 20px; border-radius: 999px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.3); }

.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 40; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
