/* ORBITCRAFT 2D - style.css */
:root {
  --space: #03040c;
  --cyan: #3de3ff;
  --purple: #8b5cff;
  --orange: #ff9a3d;
  --pink: #ff4fa3;
  --green: #4dffb0;
  --red: #ff5470;
  --text: #e8f0ff;
  --dim: #8fa0cc;
  --glass: rgba(12, 16, 44, .66);
  --line: rgba(120, 160, 255, .28);
  --font: "Bahnschrift", "Orbitron", "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--space); color: var(--text); font-family: var(--font); }
button { font-family: inherit; color: inherit; cursor: pointer; }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#app { position: fixed; inset: 0; z-index: 1; }

/* ---------- screens + smooth transitions ---------- */
.screen {
  position: absolute; inset: 0; padding-bottom: 28px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(1.05); filter: blur(8px);
  transition: opacity .5s ease, transform .5s ease, filter .5s ease, visibility 0s .5s;
}
.screen.active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none; filter: none;
  transition: opacity .5s ease, transform .5s ease, filter .5s ease, visibility 0s;
}
.disclaimer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; text-align: center; font-size: 11px;
  letter-spacing: .06em; color: var(--dim); padding: 6px 10px; pointer-events: none;
  background: linear-gradient(transparent, rgba(2, 3, 12, .8));
}

/* ---------- buttons, chips, panels ---------- */
.btn {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 20px; font-size: 15px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  background: linear-gradient(180deg, rgba(60, 80, 170, .45), rgba(20, 26, 70, .75));
  box-shadow: 0 0 0 0 rgba(61, 227, 255, 0), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.btn::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: skewX(-20deg); transition: left .5s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--cyan); box-shadow: 0 0 22px rgba(61, 227, 255, .35); }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { border-color: rgba(255, 190, 120, .8); background: linear-gradient(180deg, #ffb347, #ff5f6d); color: #1a0b10; text-shadow: 0 1px 0 rgba(255, 255, 255, .3); }
.btn.primary:hover { box-shadow: 0 0 28px rgba(255, 140, 80, .6); border-color: #fff; }
.btn.big { padding: 15px 34px; font-size: 18px; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.ghost { background: rgba(10, 14, 40, .5); }
.btn.on { border-color: var(--green); box-shadow: 0 0 16px rgba(77, 255, 176, .4); color: var(--green); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.chip, .science-chip {
  display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}
.chip b, .science-chip b { color: var(--orange); font-size: 16px; margin-left: 4px; }
.panel {
  background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
  backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.panel h3 { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin-bottom: 10px; }
.panel h3 small { color: var(--dim); letter-spacing: .05em; text-transform: none; font-weight: 400; margin-left: 6px; }
kbd {
  display: inline-block; min-width: 24px; padding: 1px 7px; border-radius: 6px; text-align: center; font: 600 12px var(--font);
  background: #141a44; border: 1px solid var(--line); border-bottom-width: 3px; color: var(--cyan);
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; height: 70px; }
.topbar h2 { font-size: 22px; letter-spacing: .3em; text-shadow: 0 0 18px rgba(61, 227, 255, .6); }
.scroll { height: calc(100% - 70px); overflow-y: auto; padding: 0 22px 30px; }
.lead { color: var(--dim); text-align: center; margin: 4px 0 18px; }
.coming { max-width: 520px; margin: 12vh auto; text-align: center; display: grid; gap: 16px; }
#toast {
  position: fixed; left: 50%; top: 22px; transform: translate(-50%, -80px); z-index: 50; padding: 10px 22px; border-radius: 999px;
  background: rgba(10, 14, 40, .92); border: 1px solid var(--cyan); box-shadow: 0 0 24px rgba(61, 227, 255, .4);
  transition: transform .35s; pointer-events: none; font-size: 14px;
}
#toast.show { transform: translate(-50%, 0); }

/* ---------- main menu ---------- */
#menu { display: flex; align-items: center; padding-left: 8vw; }
.menu-left { max-width: 900px; position: relative; z-index: 2; }
.eyebrow { color: var(--cyan); letter-spacing: .28em; font-size: 12px; text-transform: uppercase; margin-bottom: 10px; }
.logo {
  font-size: clamp(2.8rem, 8.4vw, 6.6rem); line-height: .95; font-weight: 800; letter-spacing: .06em;
  color: #fff; text-shadow: 0 0 30px rgba(61, 227, 255, .55), 0 4px 0 rgba(30, 40, 110, .9);
}
.logo span { text-shadow: none; background: linear-gradient(90deg, var(--cyan), var(--purple) 55%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(139, 92, 255, .6)); }
.logo em { font-style: normal; font-size: .42em; color: var(--orange); letter-spacing: .12em; text-shadow: 0 0 20px rgba(255, 154, 61, .7); vertical-align: top; }
.tagline { margin: 14px 0 34px; letter-spacing: .32em; font-size: clamp(.8rem, 1.6vw, 1.1rem); color: #cfe0ff; }
.menu-buttons { display: grid; gap: 14px; width: min(340px, 90%); margin-bottom: 26px; }
.menu-buttons .btn { animation: rise .7s both; }
.menu-buttons .btn:nth-child(2) { animation-delay: .12s; }
.menu-buttons .btn:nth-child(3) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.hero-rocket {
  position: absolute; right: 13vw; bottom: 14vh; width: min(22vw, 230px); min-width: 120px; z-index: 1;
  transform: rotate(16deg); animation: float 5s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(255, 140, 60, .45));
}
@keyframes float { 0%, 100% { transform: translateY(0) rotate(16deg); } 50% { transform: translateY(-22px) rotate(13deg); } }
.flame-a { transform-origin: 100px 350px; animation: flick .14s infinite alternate; }
.flame-b { transform-origin: 100px 350px; animation: flick .11s infinite alternate-reverse; }
@keyframes flick { from { transform: scaleY(.85) scaleX(1.05); } to { transform: scaleY(1.15) scaleX(.9); } }

/* ---------- missions ---------- */
#missionList { display: grid; gap: 14px; max-width: 860px; margin: 0 auto; }
.mission-card {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 18px; align-items: center; padding: 16px 20px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(8px);
  transition: transform .2s, border-color .2s;
}
.mission-card:hover { transform: translateY(-3px); border-color: var(--cyan); }
.mission-card.done { border-color: rgba(77, 255, 176, .6); }
.m-icon svg { width: 92px; height: 92px; }
.m-num { font-size: 11px; letter-spacing: .25em; color: var(--orange); }
.m-info h3 { font-size: 22px; letter-spacing: .08em; margin: 2px 0 4px; }
.m-info p { color: #c9d6f7; font-size: 14px; }
.m-learn { color: var(--dim) !important; font-size: 12px !important; margin-top: 4px; }
.m-reward { margin-top: 8px; font-size: 12px; color: var(--orange); letter-spacing: .06em; }
.m-side { display: grid; gap: 10px; justify-items: end; }
.badge { padding: 4px 12px; border-radius: 999px; font-size: 11px; letter-spacing: .15em; border: 1px solid var(--line); color: var(--dim); }
.done .badge { color: var(--green); border-color: var(--green); }

/* ---------- instructions ---------- */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; max-width: 1100px; margin: 0 auto; }
.steps { padding-left: 20px; display: grid; gap: 8px; margin-bottom: 16px; font-size: 14px; line-height: 1.45; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 6px 4px; border-bottom: 1px solid rgba(120, 160, 255, .12); vertical-align: top; }
.keys td:first-child { white-space: nowrap; width: 38%; }
.gloss dt { color: var(--orange); font-size: 13px; letter-spacing: .1em; margin-top: 10px; text-transform: uppercase; }
.gloss dd { font-size: 13px; color: #c9d6f7; line-height: 1.45; }
.simplified { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--orange); background: rgba(255, 154, 61, .08); font-size: 12px; line-height: 1.5; color: #ffd9b0; border-radius: 0 8px 8px 0; }

/* ---------- workshop ---------- */
.ws-grid { display: grid; grid-template-columns: 280px 1fr 340px; gap: 14px; padding: 0 18px; height: calc(100% - 70px - 74px); }
.ws-grid > .panel { overflow-y: auto; }
#palette { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.part-card {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 12px; text-align: center;
  background: rgba(30, 40, 100, .38); border: 1px solid var(--line); transition: transform .15s, border-color .15s, box-shadow .2s;
}
.part-card:hover:not(.locked) { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 0 18px rgba(61, 227, 255, .3); }
.part-card.sel { border-color: var(--green); box-shadow: 0 0 14px rgba(77, 255, 176, .35); }
.part-card svg { width: 42px; height: 56px; }
.part-card b { font-size: 12px; letter-spacing: .04em; }
.part-card small { font-size: 10px; color: var(--dim); }
.part-card.locked { opacity: .45; cursor: not-allowed; }
.part-card .lock { position: absolute; top: 6px; right: 8px; font-size: 10px; color: var(--orange); letter-spacing: .1em; }
.hint { margin-top: 12px; font-size: 12px; color: var(--dim); line-height: 1.4; }
.stage {
  position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 100%, rgba(80, 110, 255, .25), rgba(6, 8, 26, .55) 70%);
}
#wsCanvas { width: 100%; height: 100%; display: block; }
.stage-label { position: absolute; left: 16px; top: 12px; font-size: 12px; letter-spacing: .25em; color: var(--dim); text-transform: uppercase; }
#stackList { list-style: none; display: grid; gap: 4px; margin-bottom: 8px; counter-reset: n; }
#stackList li {
  display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 13px;
  background: rgba(30, 40, 100, .4); border: 1px solid rgba(120, 160, 255, .18);
}
#stackList li button { background: none; border: none; color: var(--red); font-size: 16px; line-height: 1; }
#stackList li.empty { color: var(--dim); justify-content: center; }
.btn-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; margin-bottom: 5px; font-size: 13px; }
.stat span { color: var(--dim); }
.stat b { font-variant-numeric: tabular-nums; }
.stat .bar { grid-column: 1 / 3; }
.bar { height: 6px; border-radius: 4px; background: rgba(120, 160, 255, .15); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--purple)); transition: width .3s; }
.bar.warm i { background: linear-gradient(90deg, #ffd45e, var(--orange), var(--pink)); }
#rating { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 11px; letter-spacing: .06em; border: 1px solid rgba(255, 84, 112, .6); color: var(--red); }
.tag.ok { border-color: rgba(77, 255, 176, .7); color: var(--green); }
.science-card { font-size: 12px; line-height: 1.5; color: #c9d6f7; padding: 10px 12px; border-left: 3px solid var(--cyan); background: rgba(61, 227, 255, .07); border-radius: 0 8px 8px 0; }
.ws-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 76px 12px 22px; height: 74px; }
.mission-line { font-size: 14px; color: var(--dim); }
.mission-line b { color: var(--orange); }

/* ---------- flight screens + HUD ---------- */
.flight { padding: 0; }
.flight .view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; font-size: 13px; }
.hud .panel { pointer-events: auto; padding: 10px 14px; border-radius: 14px; }
.hud-left { position: absolute; left: 14px; top: 14px; display: grid; gap: 10px; width: 236px; }
.hud-right { position: absolute; right: 14px; top: 14px; display: grid; gap: 10px; width: 250px; }
.tl { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; border-bottom: 1px solid rgba(120, 160, 255, .12); }
.tl:last-child { border-bottom: none; }
.tl span { font-size: 10px; letter-spacing: .18em; color: var(--dim); }
.tl b { font-size: 18px; color: #fff; text-shadow: 0 0 10px rgba(61, 227, 255, .5); font-variant-numeric: tabular-nums; }
.tl b.warn { color: var(--orange); }
.tl b.good { color: var(--green); }
.gauge { margin-bottom: 10px; }
.gauge .row { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .18em; color: var(--dim); margin-bottom: 4px; }
.gauge .row b { color: #fff; font-size: 12px; letter-spacing: .04em; }
.gauge .bar { height: 10px; }
.bar.fuel i { background: linear-gradient(90deg, var(--green), #e5ff5e); }
.bar.fuel.low i { background: linear-gradient(90deg, var(--red), var(--orange)); animation: blink .6s infinite alternate; }
@keyframes blink { to { opacity: .35; } }
input[type=range] { width: 100%; accent-color: var(--orange); margin-top: 6px; }
.mini { font-size: 12px; color: var(--dim); }
.mini b { color: #fff; }
.mission-mini small { color: var(--dim); }
.mission-mini .bar { margin: 6px 0; }
.hud-bottom {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  padding: 8px 12px; max-width: 96vw; pointer-events: auto;
}
.hud-bottom .sep { width: 1px; background: var(--line); margin: 0 4px; }
.hud-bottom .btn { padding: 6px 11px; font-size: 11px; }
.coach {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: 46vw; text-align: center; padding: 9px 18px;
  border-radius: 999px; font-size: 13px; background: rgba(10, 14, 40, .8); border: 1px solid var(--line); color: #dce8ff;
}
.coach.alert { border-color: var(--orange); color: var(--orange); animation: blink .5s infinite alternate; }
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(28px, 6vw, 70px); letter-spacing: .3em; font-weight: 800; color: #fff; text-shadow: 0 0 30px var(--cyan); pointer-events: none; }
.teach {
  position: fixed; left: 14px; bottom: 150px; width: min(296px, 80vw); z-index: 20; padding: 12px 16px; border-radius: 14px;
  background: rgba(10, 16, 48, .92); border: 1px solid var(--cyan); box-shadow: 0 0 26px rgba(61, 227, 255, .3);
  transform: translateX(-120%); transition: transform .4s; font-size: 13px; line-height: 1.5; pointer-events: none;
}
.teach.show { transform: none; }
.teach h4 { color: var(--cyan); font-size: 12px; letter-spacing: .2em; margin-bottom: 4px; }
.teach .simp { color: var(--orange); font-size: 11px; display: block; margin-top: 6px; }
.popup { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(2, 3, 14, .6); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.popup.show { opacity: 1; pointer-events: auto; }
.popup .card { width: min(480px, 90vw); text-align: center; padding: 26px 28px; border-radius: 22px; background: rgba(12, 16, 48, .95); border: 1px solid var(--cyan); box-shadow: 0 0 60px rgba(61, 227, 255, .35); transform: scale(.9); transition: transform .3s; }
.popup.show .card { transform: none; }
.popup.bad .card { border-color: var(--red); box-shadow: 0 0 60px rgba(255, 84, 112, .35); }
.popup h2 { letter-spacing: .2em; margin-bottom: 10px; color: var(--green); }
.popup.bad h2 { color: var(--red); }
.popup p { color: #c9d6f7; line-height: 1.5; margin-bottom: 8px; font-size: 14px; }
.popup .btn-row { justify-content: center; margin: 16px 0 0; }

/* ---------- polish ---------- */
.icon-btn { position: fixed; right: 16px; bottom: 34px; z-index: 40; width: 40px; height: 40px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); font-size: 18px; color: var(--cyan); }
.icon-btn.off { color: var(--dim); text-decoration: line-through; }
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; text-align: center; background: #02030a; animation: splashOut 1s 1.5s forwards; pointer-events: none; }
#splash .logo { animation: rise 1s both; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }
.confetti { position: fixed; top: -20px; width: 8px; height: 14px; z-index: 40; border-radius: 2px; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .8; } }
.paused-banner { position: absolute; left: 50%; top: 36%; transform: translateX(-50%); font-size: 54px; letter-spacing: .4em; text-shadow: 0 0 30px var(--cyan); pointer-events: none; }
.hero-rocket { translate: calc(var(--mx, 0) * -18px) calc(var(--my, 0) * -10px); }
@media (prefers-reduced-motion: reduce) { .hero-rocket, .flame-a, .flame-b, .menu-buttons .btn { animation: none; } }

@media (max-width: 900px) {
  #menu { padding-left: 6vw; }
  .help-grid { grid-template-columns: 1fr; }
  .ws-grid { grid-template-columns: 1fr; grid-template-rows: auto 300px auto; overflow-y: auto; height: calc(100% - 144px); }
  .mission-card { grid-template-columns: 1fr; text-align: center; }
  .m-side { justify-items: center; }
}
