:root {
  --ink: #eef5ff;
  --muted: #91a4bf;
  --panel: rgba(16, 31, 56, 0.88);
  --line: rgba(139, 181, 226, 0.2);
  --cyan: #68e5ff;
  --orange: #ffb44b;
  --red: #ff667d;
  --green: #65f2b0;
  --deep: #071225;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--deep);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 12%, rgba(58, 94, 160, .28), transparent 28rem),
    radial-gradient(circle at 10% 90%, rgba(23, 118, 148, .16), transparent 24rem),
    var(--deep);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 32px);
}

.screen { width: 100%; }
[hidden] { display: none !important; }

.start-screen, .end-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 64px);
}

.hero-card, .result-card {
  width: min(100%, 540px);
  padding: clamp(26px, 5vw, 48px);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(20, 40, 72, .96), rgba(9, 20, 42, .97));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42), inset 0 1px rgba(255,255,255,.04);
  position: relative;
  overflow: hidden;
}

.hero-card::before, .result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.7) .7px, transparent .7px);
  background-size: 37px 37px;
  opacity: .1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .24em;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 5.4rem);
  line-height: .9;
  letter-spacing: -.07em;
  text-transform: uppercase;
}

.hero-card h1 span { color: var(--orange); }

.intro {
  max-width: 420px;
  margin: 24px auto 26px;
  color: var(--muted);
  line-height: 1.65;
  font-size: .98rem;
}

.planet {
  width: 112px;
  height: 112px;
  margin: 0 auto 24px;
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #8ceaff, #3980bd 46%, #162d60 76%);
  box-shadow: 0 0 50px rgba(104, 229, 255, .26);
}

.planet::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-linear-gradient(12deg, transparent 0 13px, rgba(255,255,255,.06) 14px 17px);
}

.planet-ring {
  position: absolute;
  width: 150px;
  height: 42px;
  left: -20px;
  top: 35px;
  border: 6px solid var(--orange);
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-17deg);
  z-index: 2;
}

.planet-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 14px var(--orange);
}

.planet-dot-one { top: 13px; right: 22px; }
.planet-dot-two { bottom: 12px; left: 25px; width: 6px; height: 6px; }

.setup-panel {
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(2, 10, 25, .36);
}

.setup-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

select {
  width: 100%;
  padding: 13px 15px;
  color: var(--ink);
  background: #102646;
  border: 1px solid rgba(104, 229, 255, .38);
  border-radius: 11px;
  outline: none;
  cursor: pointer;
}

.round-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.primary-button, .secondary-button {
  min-height: 50px;
  padding: 0 25px;
  border-radius: 12px;
  border: 0;
  font-weight: 850;
  cursor: pointer;
  transition: transform .15s, filter .15s, box-shadow .15s;
}

.primary-button {
  width: 100%;
  color: #071225;
  background: linear-gradient(100deg, var(--cyan), #8df2d0);
  box-shadow: 0 10px 30px rgba(104, 229, 255, .2);
  font-size: 1.03rem;
}

.primary-button span { margin-left: 8px; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button:active { transform: translateY(0); }

.secondary-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.secondary-button:hover { background: rgba(255,255,255,.06); }
.best-score { min-height: 18px; margin: 16px 0 0; color: var(--muted); font-size: .78rem; }

.game-screen {
  width: min(100%, 1040px);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 850;
  font-size: .8rem;
  letter-spacing: .16em;
}

.mini-orbit {
  width: 17px;
  height: 17px;
  border: 4px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(104,229,255,.4);
}

.stats { display: flex; gap: 8px; }
.stat {
  min-width: 86px;
  padding: 9px 13px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(13, 30, 56, .8);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .13em;
}
.stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
  letter-spacing: .08em;
}
.timer-stat strong { color: var(--orange); }
.timer-stat.danger { border-color: rgba(255, 102, 125, .65); }
.timer-stat.danger strong { color: var(--red); animation: pulse .6s infinite alternate; }

.battlefield {
  height: min(72vh, 680px);
  min-height: 520px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(6, 17, 39, .85), rgba(10, 27, 51, .92)),
    radial-gradient(circle at 50% 20%, rgba(54, 105, 169, .28), transparent 45%);
  box-shadow: 0 24px 70px rgba(0,0,0,.32);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: .45;
  background-image:
    radial-gradient(circle, white 0 1px, transparent 1.5px),
    radial-gradient(circle, var(--cyan) 0 1px, transparent 1.5px);
  background-position: 0 0, 24px 38px;
  background-size: 73px 73px, 109px 109px;
}

.sky-copy {
  position: absolute;
  z-index: 3;
  top: 22px;
  left: 20px;
  right: 20px;
  text-align: center;
}
.sky-copy p {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .2em;
}
.sky-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: -.04em;
  text-shadow: 0 4px 25px rgba(0,0,0,.45);
}

.asteroid {
  --fall-duration: 20s;
  position: absolute;
  z-index: 5;
  top: -100px;
  left: 50%;
  width: 76px;
  height: 76px;
  margin-left: -38px;
  animation: fall var(--fall-duration) linear forwards;
  filter: drop-shadow(0 12px 12px rgba(0,0,0,.3));
}
.asteroid-body {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 43% 57% 61% 39% / 49% 39% 61% 51%;
  background: radial-gradient(circle at 30% 25%, #a4afbd, #596574 43%, #283341 77%);
  transform: rotate(-10deg);
  animation: tumble 2.4s ease-in-out infinite alternate;
}
.crater {
  position: absolute;
  border-radius: 50%;
  background: #2d3743;
  box-shadow: inset 3px 3px 4px rgba(0,0,0,.45);
}
.crater-one { width: 18px; height: 14px; top: 16px; left: 19px; }
.crater-two { width: 10px; height: 12px; right: 12px; top: 36px; }
.crater-three { width: 13px; height: 9px; left: 29px; bottom: 11px; }

.answer-grid {
  position: absolute;
  z-index: 8;
  left: 4%;
  right: 4%;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(7px, 1.5vw, 15px);
}

.tower-button {
  min-width: 0;
  min-height: 90px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(104, 229, 255, .35);
  border-radius: 15px;
  color: var(--ink);
  background: linear-gradient(180deg, #17365d, #0a1b38);
  box-shadow: 0 8px 0 #061025, 0 13px 25px rgba(0,0,0,.3);
  cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s;
}
.tower-button::before {
  content: "";
  position: absolute;
  width: 25px;
  height: 7px;
  top: 12px;
  left: calc(50% - 12px);
  border-radius: 3px;
  background: var(--cyan);
  box-shadow: 0 0 15px var(--cyan);
}
.tower-button:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: var(--cyan);
  background: linear-gradient(180deg, #204c76, #102a4c);
}
.tower-button:active:not(:disabled) { transform: translateY(2px); }
.tower-button:disabled { cursor: default; }
.tower-number {
  display: block;
  margin-top: 16px;
  font-size: clamp(1.7rem, 5vw, 2.8rem);
  font-weight: 950;
  line-height: 1;
}
.tower-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 850;
  letter-spacing: .13em;
}
.tower-button.correct {
  border-color: var(--green);
  background: #145f4c;
  box-shadow: 0 0 25px rgba(101,242,176,.4);
}
.tower-button.wrong {
  border-color: var(--red);
  background: #662a3a;
}

.ground {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20px;
  background: repeating-linear-gradient(135deg, #d38a3f 0 10px, #713c26 10px 20px);
  box-shadow: 0 -5px 20px rgba(255,180,75,.25);
}

.shot {
  position: absolute;
  z-index: 9;
  width: 8px;
  height: 45px;
  left: 50%;
  bottom: 98px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--cyan), white);
  box-shadow: 0 0 16px var(--cyan), 0 0 35px var(--cyan);
  opacity: 0;
  pointer-events: none;
}
.shot.fire { animation: shoot .42s ease-out forwards; }

.feedback {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 9px;
  font-size: clamp(.9rem, 3vw, 1.25rem);
  font-weight: 900;
  letter-spacing: .04em;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.feedback.show { animation: feedback 1.2s ease forwards; }
.feedback.good { color: var(--green); background: rgba(7, 36, 38, .9); }
.feedback.bad { color: var(--red); background: rgba(57, 17, 30, .92); }

.result-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border: 1px solid rgba(104, 229, 255, .35);
  border-radius: 50%;
  color: var(--orange);
  background: rgba(104,229,255,.08);
  font-size: 2.3rem;
  box-shadow: 0 0 35px rgba(104,229,255,.14);
}
.result-card h1 { font-size: clamp(2.1rem, 8vw, 3.8rem); }
.result-copy { color: var(--muted); line-height: 1.6; }
.result-score {
  margin: 26px 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
}
.result-score span {
  display: block;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 850;
  letter-spacing: .18em;
}
.result-score strong {
  display: block;
  margin-top: 4px;
  color: var(--orange);
  font-size: 2.5rem;
  letter-spacing: .1em;
}
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@keyframes fall {
  from { top: -100px; }
  to { top: calc(100% - 115px); }
}
@keyframes tumble {
  from { transform: rotate(-10deg); }
  to { transform: rotate(13deg); }
}
@keyframes shoot {
  0% { opacity: 1; bottom: 95px; }
  65% { opacity: 1; }
  100% { opacity: 0; bottom: calc(100% - 110px); }
}
@keyframes feedback {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); }
  15%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}
@keyframes pulse { to { opacity: .45; } }

@media (max-width: 600px) {
  .app-shell { padding: 10px; }
  .game-header { align-items: flex-start; }
  .brand-mini { display: none; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .battlefield { height: 76vh; min-height: 500px; border-radius: 17px; }
  .sky-copy { top: 16px; }
  .answer-grid { left: 3%; right: 3%; bottom: 25px; gap: 6px; }
  .tower-button { min-height: 83px; border-radius: 11px; }
  .tower-label { font-size: .48rem; }
  .asteroid { width: 62px; height: 62px; margin-left: -31px; }
  .result-actions { grid-template-columns: 1fr; }
  .hero-card, .result-card { border-radius: 20px; }
}

@media (max-height: 650px) and (min-width: 601px) {
  .battlefield { min-height: 460px; height: 78vh; }
  .hero-card { padding-top: 25px; padding-bottom: 25px; }
  .planet { width: 70px; height: 70px; margin-bottom: 16px; }
}