/*Code written with AI assistance (Claude). Idea and design: Keler Palencia. */

/* Game colors */
:root {
  --space: #070b1d;
  --panel: #121a3a;
  --line: #2b3769;
  --text: #eef1ff;
  --dim: #9aa5d1;
  --accent: #ffd54a;
  --good: #4ade80;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

/* Background: space with stars made of dots */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  background-color: var(--space);
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 120px, #cfd8ff, transparent),
    radial-gradient(1.5px 1.5px at 160px 60px, #fff, transparent),
    radial-gradient(1px 1px at 230px 170px, #ffe9a8, transparent),
    radial-gradient(1px 1px at 300px 90px, #fff, transparent);
  background-size: 340px 220px;
}

/* Main game box */
#game {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

#top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
#top h1 { margin: 0; font-size: 1.6rem; letter-spacing: 4px; color: var(--accent); }
#top span { color: var(--dim); }

h2 { margin: 0 0 8px; font-size: 1.5rem; }
h3 { margin: 8px 0; }
p { margin: 0 0 12px; }
.dim { color: var(--dim); }

/* Each screen is a panel */
.screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  animation: appear 0.35s ease-out;
}
.screen[hidden], #hud[hidden], [hidden] { display: none; }

@keyframes appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Buttons */
button {
  font: inherit;
  color: var(--text);
  background: #24306a;
  border: 1px solid #44539a;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}
button:hover:not(:disabled) { background: #33418a; transform: translateY(-2px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.big {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1400;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 28px;
  margin-top: 12px;
}
button.big:hover:not(:disabled) { background: #ffe07a; }

/* ---------- Meters ---------- */
#hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.meter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.85rem;
}
.m-label { font-weight: 700; }
.m-text { color: var(--dim); float: right; }
.m-bar { height: 10px; background: #0a1030; border-radius: 6px; margin-top: 6px; overflow: hidden; clear: both; }
.m-fill { height: 100%; width: 0; background: var(--good); border-radius: 6px; transition: width 0.3s, background 0.3s; }
.meter.over { border-color: var(--bad); }
.meter.over .m-fill { background: var(--bad); }
.meter.over .m-text { color: var(--bad); font-weight: 700; }

/* ---------- Team ---------- */
#team-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.engineer {
  background: #0d1430;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 6px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, opacity 0.2s;
}
.engineer svg { width: 80px; height: 100px; }
.engineer strong { display: block; }
.engineer small { color: var(--dim); }
.engineer:hover { transform: translateY(-4px); }
.engineer.picked { border-color: var(--accent); transform: translateY(-8px); }
.engineer.left-out { opacity: 0.45; }

/* ---------- Satellite ---------- */
.build-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  margin: 12px 0;
}
#sat-view svg, #scene svg, #start-art svg { width: 100%; max-width: 340px; height: auto; }
.part { cursor: pointer; transition: opacity 0.2s; }
.part:hover { opacity: 0.75; }
.piece {
  text-align: center;
  background: #0d1430;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.piece small { color: var(--dim); display: block; }
.piece button { padding: 6px 10px; font-size: 0.85rem; }
.piece button.on { background: var(--accent); border-color: var(--accent); color: #1a1400; font-weight: 700; }

/* ---------- Mission ---------- */
#phase-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 10px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #0a1030; border: 2px solid var(--line); }
.dot.done { background: var(--good); border-color: var(--good); }
.dot.now { background: var(--accent); border-color: var(--accent); }

#orbit-canvas {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.hint { color: var(--accent); font-style: italic; }
#phase-controls { max-width: 460px; margin: 0 auto; }
#phase-controls > button { display: block; width: 100%; margin-bottom: 8px; }
#phase-controls label { display: block; text-align: left; margin-bottom: 8px; }
#phase-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
#phase-result { font-weight: 700; color: var(--good); margin-top: 12px; }

/* Narrator dialogue, like in a video game */
#dialogue {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  margin-top: 16px;
  background: #0a1030;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  min-height: 96px;
}
#narrator-avatar svg { width: 60px; height: 75px; display: block; }
#narrator-name { color: var(--accent); font-size: 0.9rem; }
#narrator-text { margin: 2px 0 0; }

/* ---------- Menu and Elena's briefings ---------- */
.title { font-size: 2.6rem; letter-spacing: 8px; color: var(--accent); margin: 8px 0; }
#brief-avatar svg { width: 120px; height: 150px; }
#brief-name { display: block; color: var(--accent); margin-bottom: 8px; }
#brief-text { max-width: 520px; min-height: 5.5em; margin: 0 auto 8px; font-size: 1.15rem; }
#btn-lesson { margin-top: 8px; padding: 6px 16px; }
#dialogue > div:last-child { flex: 1; }

/* ---------- Report ---------- */
#report-stars { font-size: 3rem; margin: 0; color: var(--accent); letter-spacing: 6px; }
#report-stars span { display: inline-block; animation: pop 0.4s ease-out backwards; }
#report-stars .empty { color: var(--line); }
@keyframes pop {
  from { transform: scale(0); }
  70% { transform: scale(1.3); }
  to { transform: scale(1); }
}
#report-list { list-style: none; padding: 0; color: var(--dim); }
blockquote {
  margin: 12px auto;
  max-width: 520px;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: #0a1030;
  text-align: left;
  font-style: italic;
}

footer { margin-top: 14px; color: var(--dim); font-size: 0.75rem; text-align: center; }

/* Narrow screens */
@media (max-width: 700px) {
  #team-list { grid-template-columns: repeat(2, 1fr); }
  .build-layout { grid-template-columns: 1fr; }
  #hud { grid-template-columns: 1fr; }
}

/* If the person asked for less motion, animations are removed */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- AI-generated images ---------- */
img.face { width: 96px; height: 96px; border-radius: 16px; display: block; margin: 0 auto 6px; object-fit: cover; }
#narrator-avatar img.face { width: 76px; height: 76px; margin: 0; }
#brief-avatar img.face { width: 190px; height: 190px; margin-bottom: 10px; }
img.hero { width: 100%; max-width: 560px; border-radius: 14px; display: block; margin: 0 auto 12px; }
#piece-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.piece-img { width: 100%; border-radius: 10px; display: block; margin-bottom: 8px; }
.piece button { margin: 6px 3px 0; }
#scene .piece-img { max-width: 420px; margin: 0 auto 12px; }
@media (max-width: 700px) { #piece-list { grid-template-columns: 1fr; } }
