:root {
  --bg: #080b1d;
  --surface: #121731;
  --surface2: #191f40;
  --text: #f5f6ff;
  --muted: #b7bdd9;
  --accent: #9b87ff;
  --accent2: #54e5ff;
  --border: rgba(255,255,255,.1);
  --success: #71f0bd;
  --danger: #ff8d9b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 85px; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 15% 5%, rgba(88,67,180,.18), transparent 38%),
    radial-gradient(ellipse at 90% 35%, rgba(38,134,195,.12), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent2);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 12px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(8,11,29,.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.logo { font-size: 1.3rem; font-weight: 900; letter-spacing: -.5px; }
.topbar nav { display: flex; gap: 22px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-size: .92rem; }
.topbar nav a:hover { color: var(--accent2); }

.hero {
  min-height: 510px;
  padding: 75px 8%;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: 40px;
  overflow: hidden;
}

.hero-content { max-width: 660px; }
.eyebrow { color: var(--accent2); font-size: .74rem; font-weight: 800; letter-spacing: 2px; }
h1 { font-size: clamp(2.5rem, 5.8vw, 4.8rem); line-height: 1.05; letter-spacing: -2px; margin: 15px 0; }
h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
}
.hero-content > p { max-width: 580px; color: var(--muted); font-size: 1.08rem; margin-bottom: 28px; }
.button, .small-button {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 17px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 750;
  transition: transform .2s, filter .2s, background .2s;
}
.button:hover, .small-button:hover { transform: translateY(-2px); filter: brightness(1.12); }
.primary { color: #0b0c20; background: linear-gradient(120deg, var(--accent), var(--accent2)); border: 0; }
.secondary, .small-button { background: var(--surface2); color: var(--text); }
.hero .button { margin: 0 8px 8px 0; }
.full { width: 100%; }
.small-button { padding: 7px 11px; font-size: .85rem; }

.hero-stats { display: flex; gap: 35px; flex-wrap: wrap; margin-top: 35px; }
.hero-stats div { display: grid; }
.hero-stats strong { font-size: 1.55rem; }
.hero-stats span { color: var(--muted); font-size: .8rem; }

.planet-art { position: relative; height: 350px; display: grid; place-items: center; }
.planet { position: absolute; display: grid; place-items: center; border-radius: 50%; }
.planet-main { font-size: 8rem; filter: drop-shadow(0 0 35px rgba(84,229,255,.25)); animation: float 5s ease-in-out infinite; }
.planet-small { font-size: 3.2rem; top: 35px; right: 12%; animation: float 6s ease-in-out infinite reverse; }
.planet-purple { font-size: 2.4rem; bottom: 45px; left: 12%; }
.orbit { position: absolute; border: 1px solid rgba(166,153,255,.25); border-radius: 50%; width: 260px; height: 260px; }
.orbit-two { width: 330px; height: 330px; border-color: rgba(84,229,255,.16); }
.star { position: absolute; color: var(--accent2); animation: twinkle 2s infinite alternate; }
.star-one { top: 20%; left: 17%; font-size: 1.8rem; }
.star-two { bottom: 20%; right: 12%; font-size: 2rem; }
.star-three { top: 12%; right: 30%; }

.section { padding: 45px 7%; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 25px; }
.section-heading h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 5px 0 0; letter-spacing: -.7px; }
.section-heading > p { color: var(--muted); }
.grid-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
  background: linear-gradient(145deg, rgba(25,31,64,.94), rgba(16,21,45,.96));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 35px rgba(0,0,0,.08);
}
.card h3 { margin: 8px 0; }
.card p { color: var(--muted); }
.big-icon { font-size: 2rem; }
.profile-card { text-align: center; }
.progress-track { height: 9px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; margin: 18px 0 8px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .4s; }
small { color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.badge { font-size: .78rem; padding: 5px 9px; border-radius: 8px; background: rgba(113,240,189,.12); color: var(--success); }
.badge.locked { background: rgba(255,255,255,.06); color: var(--muted); }

.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.game-card { display: flex; flex-direction: column; align-items: flex-start; }
.game-card p { flex: 1; }
.game-icon { font-size: 2.3rem; }
.result { color: var(--accent2) !important; font-size: .9rem; }
.click-button { background: linear-gradient(120deg, #ffbd69, #ff7597); color: #241126; border: 0; }
.game-panel { margin-top: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-heading h3 { font-size: 1.35rem; }
.answer-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 20px 0; }
.answer-button { text-align: left; background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 13px; border-radius: 12px; }
.answer-button:hover { border-color: var(--accent); }
.answer-button.correct { border-color: var(--success); background: rgba(113,240,189,.12); }
.answer-button.wrong { border-color: var(--danger); background: rgba(255,141,155,.12); }
.word-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 15px 0; }
.word-chip { border-radius: 8px; padding: 5px 9px; background: rgba(255,255,255,.07); font-size: .9rem; }
.word-chip.found { color: var(--success); text-decoration: line-through; }
.word-grid { display: grid; grid-template-columns: repeat(10,minmax(0,1fr)); gap: 4px; max-width: 480px; }
.word-cell { aspect-ratio: 1; min-width: 0; border: 1px solid var(--border); border-radius: 6px; background: #0d1230; color: var(--text); padding: 0; font-weight: 800; }
.word-cell.selected { background: var(--accent); color: #080b1d; }
.word-cell.found { background: rgba(113,240,189,.25); border-color: var(--success); color: var(--success); }
.word-cell:disabled { cursor: default; }

.planet-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; }
.planet-card { color: var(--text); text-align: left; cursor: pointer; transition: transform .2s, border-color .2s; }
.planet-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.planet-card span { font-size: 2.3rem; }
.planet-card h3 { margin: 8px 0 0; }
.planet-card p { margin-bottom: 0; font-size: .9rem; }
.planet-info { margin-top: 18px; color: var(--muted); }

.mission-list { display: grid; gap: 12px; }
.mission { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.mission h3, .mission p { margin: 0; }
.mission span { white-space: nowrap; color: var(--accent2); font-weight: 800; }
.fact-card { text-align: center; padding: 35px; }
.fact-card .big-icon { font-size: 3rem; }
.fact-card p { font-size: 1.15rem; }
.shop-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.shop-item { text-align: center; }
.theme-preview { height: 85px; border-radius: 12px; margin-bottom: 16px; }
.theme-preview.purple { background: linear-gradient(135deg,#9b87ff,#ff83d4); }
.theme-preview.ocean { background: linear-gradient(135deg,#007cf0,#54e5ff); }
.theme-preview.sunset { background: linear-gradient(135deg,#ff7b54,#ffc857); }
.secret-card { text-align: center; padding: 40px 20px; }
.secret-card form { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.secret-card input { min-width: 0; width: min(320px,100%); padding: 12px; border-radius: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border); }
#secretReward { margin-top: 20px; color: var(--success); }
footer { text-align: center; padding: 35px 15px; border-top: 1px solid var(--border); color: var(--muted); }
.footer-small { font-size: .8rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

body.light-mode {
  --bg: #edf2ff;
  --surface: #fff;
  --surface2: #e1e7fb;
  --text: #171b3c;
  --muted: #5e6686;
  --border: rgba(24,32,75,.14);
}
body.light-mode .topbar { background: rgba(237,242,255,.9); }
body.light-mode .card { background: linear-gradient(145deg,#fff,#f5f7ff); }
body.light-mode .word-cell { background: #e9edff; color: #171b3c; }

body.theme-purple { --accent: #c084fc; --accent2: #f0abfc; }
body.theme-ocean { --accent: #38bdf8; --accent2: #5eead4; }
body.theme-sunset { --accent: #fb923c; --accent2: #f472b6; }

@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes twinkle { from { opacity: .4; transform: scale(.8); } to { opacity: 1; transform: scale(1.15); } }

@media (max-width: 1000px) {
  .game-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .planet-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hero { padding: 55px 6%; }
  .topbar nav { gap: 12px; }
}
@media (max-width: 700px) {
  .topbar { position: relative; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; justify-content: center; }
  .hero { grid-template-columns: 1fr; padding-top: 45px; text-align: center; }
  .hero-content { margin: auto; }
  .hero-stats { justify-content: center; gap: 25px; }
  .planet-art { height: 270px; }
  .planet-main { font-size: 6rem; }
  .orbit { width: 210px; height: 210px; }
  .orbit-two { width: 260px; height: 260px; }
  .grid-three, .shop-grid { grid-template-columns: 1fr; }
  .section { padding: 32px 5%; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .answer-list { grid-template-columns: 1fr; }
  .word-grid { gap: 3px; }
  .word-cell { border-radius: 4px; font-size: .8rem; }
  .mission { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}