/* Gatotkoco Space Adventure — cute sci-fi, mobile-friendly */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700&family=Nunito:wght@600;700;800&display=swap');

:root {
  --space: #0a0e27;
  --space-mid: #1a1f4a;
  --neon-blue: #4fc3f7;
  --neon-pink: #ff6bcb;
  --neon-green: #69db7c;
  --gold: #ffd43b;
  --orange: #ff922b;
  --cream: #f8f9fa;
  --panel: rgba(20, 28, 60, 0.92);
  --border: #5c7cfa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Nunito', sans-serif;
  background: radial-gradient(ellipse at 50% 0%, #2d3561 0%, var(--space) 55%, #050810 100%);
  min-height: 100vh;
  color: var(--cream);
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem;
  text-align: center;
}

.top-bar { margin-bottom: 0.5rem; }

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.header-text { flex: 1; text-align: center; }

.lang-switch { display: flex; gap: 4px; flex-shrink: 0; }

.lang-btn {
  padding: 6px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
  cursor: pointer;
  font-family: inherit;
}

.lang-btn.active {
  background: var(--neon-blue);
  color: var(--space);
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1rem, 4vw, 1.5rem);
  color: var(--neon-blue);
  text-shadow: 0 0 12px rgba(79, 195, 247, 0.5);
}

.tagline { font-size: 0.8rem; opacity: 0.85; margin-top: 0.25rem; }

.game-area {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 2px var(--border);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--space);
  vertical-align: top;
  pointer-events: none;
}

#gameCanvas.is-playing {
  pointer-events: auto;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(5, 8, 20, 0.88);
  z-index: 20;
  overflow-y: auto;
  pointer-events: auto;
}

.screen.hidden { display: none; pointer-events: none; }
.screen.active { display: flex; pointer-events: auto; }

.screen .panel,
.screen .btn {
  pointer-events: auto;
  cursor: pointer;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 1.25rem;
  max-width: 420px;
  width: 100%;
  max-height: 95%;
  overflow-y: auto;
  box-shadow: 0 0 24px rgba(92, 124, 250, 0.25);
}

.scroll-panel { max-width: 480px; }

.menu-panel .hero { font-size: 2.5rem; margin-bottom: 0.5rem; }

.menu-panel h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.subtitle { font-size: 0.8rem; opacity: 0.9; margin-bottom: 0.75rem; }

.menu-stats { font-size: 0.75rem; margin-bottom: 1rem; color: var(--neon-blue); }

.btn {
  display: block;
  width: 100%;
  margin: 0.35rem 0;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  min-height: 48px;
}

.btn.primary {
  background: linear-gradient(180deg, var(--neon-blue), #228be6);
  color: #fff;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--cream);
  border: 2px solid var(--border);
}

.btn:active { transform: scale(0.97); }

.sound-toggle {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.help-list {
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 1rem 0;
  padding-left: 1.2rem;
}

/* HUD */
.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 5;
  pointer-events: none;
}

.hud.hidden { display: none; }

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(10, 14, 39, 0.85);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
}

.hud-item { display: flex; align-items: center; gap: 4px; }
.hud-item.wide { grid-column: span 2; justify-content: center; }

.bar {
  flex: 1;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  min-width: 50px;
}

.bar .fill { height: 100%; transition: width 0.2s; border-radius: 4px; }
.fill.oxygen { background: linear-gradient(90deg, #4dabf7, #69db7c); }
.fill.energy { background: linear-gradient(90deg, #ffd43b, #ff922b); }

.hud-mission, .hud-planet {
  font-size: 0.65rem;
  margin-top: 4px;
  text-align: left;
  opacity: 0.9;
}

/* Solar map */
.map-panel { max-width: 520px; }

.map-hint { font-size: 0.8rem; margin-bottom: 0.75rem; }

.solar-map {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.planet-btn {
  padding: 0.5rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-family: inherit;
  color: var(--cream);
  font-size: 0.65rem;
  min-height: 72px;
  transition: transform 0.15s;
}

.planet-btn .p-icon { font-size: 1.6rem; display: block; }
.planet-btn.done { border-color: var(--neon-green); }
.planet-btn.locked { opacity: 0.45; cursor: not-allowed; }
.planet-btn:not(.locked):hover { transform: scale(1.05); border-color: var(--neon-blue); }

.level-list { text-align: left; font-size: 0.8rem; margin-bottom: 1rem; }
.level-row {
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.level-row.locked { opacity: 0.4; pointer-events: none; }
.level-row.done::after { content: ' ✓'; color: var(--neon-green); }

/* Edu panels */
.edu-panel { max-width: 440px; }
.edu-panel h2 { font-family: 'Orbitron', sans-serif; color: var(--neon-blue); font-size: 1rem; margin-bottom: 0.5rem; }
.edu-progress, .edu-hint { font-size: 0.8rem; margin-bottom: 0.5rem; }
.edu-question { font-size: 1.1rem; font-weight: 700; margin: 1rem 0; line-height: 1.4; }
.edu-answers { display: flex; flex-direction: column; gap: 8px; }
.edu-btn {
  padding: 0.75rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  min-height: 48px;
}
.edu-btn:hover { background: rgba(79, 195, 247, 0.2); }
.edu-feedback { min-height: 1.5rem; margin-top: 0.75rem; font-weight: 700; font-size: 0.9rem; }

/* Planet fact */
.fact-panel { text-align: center; }
.fact-icon { font-size: 4rem; margin: 0.5rem 0; }
.fact-text { font-size: 0.95rem; line-height: 1.6; margin: 1rem 0; text-align: left; }

/* Gravity */
.gravity-panel { max-width: 440px; }
.gravity-explain { font-size: 0.85rem; margin-bottom: 0.5rem; text-align: left; }
.gravity-hint { font-size: 0.75rem; margin-bottom: 0.5rem; opacity: 0.9; }
#gravityCanvas {
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  background: #0d1230;
  display: block;
  margin: 0 auto;
}

/* Vocab */
.vocab-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 1rem 0;
  text-align: left;
}
.vocab-card {
  padding: 0.65rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 0.8rem;
  min-height: 48px;
}
.vocab-card.selected { border-color: var(--gold); background: rgba(255, 212, 59, 0.15); }
.vocab-card.matched { opacity: 0.4; pointer-events: none; border-color: var(--neon-green); }

/* Guide */
.guide-list { text-align: left; font-size: 0.85rem; }
.guide-item {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--neon-blue);
}
.guide-item.locked { opacity: 0.5; }

/* Badges */
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 1rem 0; }
.badge-pill {
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  background: rgba(255, 212, 59, 0.2);
  border: 1px solid var(--gold);
  font-size: 0.75rem;
}

.big-num { font-size: 1.5rem; font-weight: 800; color: var(--gold); margin: 0.5rem 0; }
.stat-line { font-size: 0.85rem; margin: 0.25rem 0; }
.sad { color: var(--neon-pink); }
.win { color: var(--neon-green); font-size: 1rem; }

.report-body { text-align: left; font-size: 0.85rem; line-height: 1.6; }
.report-body h3 { font-size: 0.9rem; color: var(--neon-blue); margin: 1rem 0 0.5rem; }
.report-body ul { padding-left: 1.2rem; margin: 0.5rem 0; }

.challenge-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  background: rgba(255, 107, 203, 0.9);
  padding: 1rem 1.5rem;
  border-radius: 16px;
  pointer-events: none;
  text-align: center;
}
.challenge-banner.hidden { display: none; }
.challenge-banner p { font-weight: 700; }

/* Touch */
.touch-controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 6;
  pointer-events: none;
}
.touch-controls.hidden { display: none; }
.touch-controls .tbtn, .touch-controls .boost { pointer-events: auto; }

.dpad { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dpad-mid { display: flex; gap: 4px; }

.tbtn, .boost {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: rgba(20, 28, 60, 0.9);
  color: var(--cream);
  font-size: 1.2rem;
  cursor: pointer;
}
.boost { width: 64px; background: rgba(255, 146, 43, 0.4); font-size: 0.85rem; font-weight: 700; }

.footer {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.75rem;
}

/* v2 */
.version-badge {
  font-size: 0.55em;
  color: var(--gold);
  vertical-align: super;
}

.map-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  border: 2px solid var(--border);
  display: block;
}

.planet-animate {
  animation: planetPulse 2.2s ease-in-out infinite;
}

@keyframes planetPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(79, 195, 247, 0); }
  50% { transform: scale(1.04); box-shadow: 0 0 14px rgba(79, 195, 247, 0.35); }
}

.fact-progress { font-size: 0.8rem; opacity: 0.85; margin-bottom: 0.5rem; }
.fact-nav { display: flex; gap: 8px; justify-content: center; margin: 0.75rem 0; }

.ency-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  text-align: left;
  margin: 1rem 0;
}

.ency-card {
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--border);
}

.ency-card.locked { opacity: 0.55; }
.ency-head { display: flex; align-items: center; gap: 8px; margin-bottom: 0.35rem; }
.ency-icon { font-size: 1.5rem; }
.ency-tag { font-size: 0.8rem; color: var(--neon-blue); margin-bottom: 0.5rem; }
.ency-facts { padding-left: 1.1rem; font-size: 0.8rem; line-height: 1.5; }
.ency-stat { font-size: 0.75rem; opacity: 0.8; margin-top: 0.5rem; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 1rem 0;
}

.dash-card {
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(79, 195, 247, 0.12);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dash-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
}

.topic-bars { margin: 0.5rem 0 1rem; }
.topic-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 0.75rem;
}

.topic-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.topic-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-green));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.badge-pill.locked {
  opacity: 0.45;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 600px) {
  .solar-map { grid-template-columns: repeat(2, 1fr); }
  .hud-grid { font-size: 0.65rem; }
}
