:root {
  color-scheme: dark;
  --bg: #060512;
  --panel: rgba(16, 12, 28, 0.86);
  --line: #ff7aa2;
  --text: #fff2f7;
  --subtle: #f2b3c8;
  --error: #ff5c7c;
  --ok: #ffc287;
  --peach: #ffb26a;
  --rose: #ff6fa6;
  --orchid: #ff8bd4;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1c1038 0%, var(--bg) 70%);
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

main {
  width: min(900px, 92vw);
  margin: 2rem auto;
  flex: 1;
}

.stage {
  display: none;
  animation: fadeIn 260ms ease;
  background: linear-gradient(135deg, rgba(26, 14, 43, 0.92), rgba(18, 9, 30, 0.78));
  border: none;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 24px 80px rgba(10, 3, 16, 0.45);
  position: relative;
  overflow: hidden;
}

.stage.active {
  display: block;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 122, 176, 0.18), transparent 60%);
  pointer-events: none;
}

h2 {
  font-family: "Unbounded", "Space Grotesk", sans-serif;
  letter-spacing: 0.03em;
}

.valentine-card {
  max-width: 520px;
  margin: 0 auto;
  background: #f7f0ea;
  color: #2d1c1e;
  border: none;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(20, 10, 18, 0.35);
  overflow: hidden;
}

.valentine-header {
  background: #ea5173;
  color: #fff5f8;
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: none;
}

.valentine-header p {
  margin: 0;
  font-size: 0.95rem;
}

.valentine-header h2 {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.6rem;
  text-transform: lowercase;
  font-family: "Unbounded", "Space Grotesk", sans-serif;
}

.valentine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: transparent;
  padding: 8px;
}

.valentine-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: none;
  cursor: pointer;
  padding: 0;
}

.valentine-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 0;
}

.valentine-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(234, 81, 115, 0.18);
  opacity: 0;
  transition: opacity 150ms ease;
}

.valentine-tile.selected::before {
  opacity: 1;
}

.valentine-tile.selected::after {
  content: "❤";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  color: #ea5173;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.valentine-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem 1rem;
}

.valentine-footer .feedback {
  margin: 0;
  flex: 1;
  color: #5e3a3f;
}

.valentine-footer button {
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  border: none;
  background: #ea5173;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  box-shadow: none;
}

.valentine-footer button:hover,
.valentine-footer button:focus-visible {
  transform: none;
  border-color: #b93959;
  box-shadow: 0 6px 14px rgba(234, 81, 115, 0.35);
}

.command-center-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 5;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  background: rgba(9, 6, 20, 0.65);
  color: var(--text);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.command-center-toggle.visible {
  opacity: 1;
  pointer-events: auto;
}

.command-center-toggle:hover,
.command-center-toggle:focus-visible {
  transform: none;
  border-color: var(--peach);
  box-shadow: 0 8px 18px rgba(255, 111, 166, 0.25);
}

.command-center-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 10, 0.55);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 10;
}

.command-center-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.command-center-panel {
  width: min(520px, 90vw);
  background: rgba(14, 10, 24, 0.7);
  border: none;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  color: var(--text);
}

.command-center-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.command-center-panel h2 {
  margin: 0;
}

.command-center-panel button {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

.panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.panel-list li {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: none;
  background: rgba(12, 9, 20, 0.55);
}

.panel-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  width: 100%;
}

.panel-link:hover,
.panel-link:focus-visible {
  text-decoration: underline;
}

form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

input,
button {
  border-radius: 10px;
  border: none;
  background: rgba(10, 6, 20, 0.9);
  color: var(--text);
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

input {
  flex: 1;
  min-width: 220px;
  box-shadow: inset 0 0 0 1px rgba(255, 122, 176, 0.15);
}

button {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
  background: linear-gradient(135deg, rgba(255, 122, 176, 0.25), rgba(255, 178, 106, 0.25));
  font-weight: 600;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 111, 166, 0.25);
}

.question-card {
  margin-top: 1rem;
}

.answers {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.answers button {
  text-align: left;
  width: 100%;
}

.feedback {
  min-height: 1.3rem;
  margin-top: 0.75rem;
  color: var(--subtle);
}

.feedback.error {
  color: var(--error);
}

.feedback.success {
  color: var(--ok);
}

#stage-reward {
  position: relative;
  padding: 0;
  overflow: hidden;
  min-height: 72vh;
  background: transparent;
  box-shadow: none;
}

.solar-frame {
  width: 100%;
  height: 72vh;
  display: block;
  border: none;
  background: radial-gradient(circle, #1a0a2e 0%, #020108 85%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  main {
    margin-top: 1rem;
  }

  .stage {
    padding: 1rem;
  }

  .solar-frame {
    height: 64vh;
  }
}

body.reward-active main {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100vh;
}

body.reward-active #stage-reward {
  min-height: 100vh;
  height: 100vh;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

body.reward-active .solar-frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: block;
  border: none;
}

.cosmos {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  mix-blend-mode: screen;
}

.nebula-1 {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(255, 111, 166, 0.65), rgba(255, 111, 166, 0));
  animation: drift 18s ease-in-out infinite;
}

.nebula-2 {
  width: 640px;
  height: 640px;
  top: 20%;
  right: -240px;
  background: radial-gradient(circle, rgba(255, 178, 106, 0.6), rgba(255, 178, 106, 0));
  animation: drift 24s ease-in-out infinite reverse;
}

.nebula-3 {
  width: 380px;
  height: 380px;
  bottom: -140px;
  left: 20%;
  background: radial-gradient(circle, rgba(255, 139, 212, 0.55), rgba(255, 139, 212, 0));
  animation: drift 20s ease-in-out infinite;
}

.starfield {
  position: absolute;
  inset: -40%;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 236, 247, 0.9) 0, transparent 45%),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255, 198, 220, 0.85) 0, transparent 45%),
    radial-gradient(1px 1px at 40% 80%, rgba(255, 246, 230, 0.8) 0, transparent 45%),
    radial-gradient(1px 1px at 85% 65%, rgba(255, 214, 180, 0.8) 0, transparent 45%),
    radial-gradient(1.5px 1.5px at 15% 70%, rgba(255, 222, 240, 0.85) 0, transparent 45%);
  opacity: 0.6;
  animation: stars 30s linear infinite;
}

@keyframes drift {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(20px, -30px, 0) scale(1.08);
  }
}

@keyframes stars {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-40px, 40px, 0);
  }
}
