:root {
  color-scheme: dark;
  --bg-deep: #08111f;
  --bg-blue: #102b4a;
  --bg-ink: #07101c;
  --card: rgba(18, 42, 72, 0.72);
  --card-strong: rgba(10, 22, 40, 0.92);
  --line: rgba(0, 212, 255, 0.32);
  --line-strong: rgba(0, 212, 255, 0.72);
  --text: #e8f4ff;
  --muted: #9ab5d6;
  --dim: #6e86a6;
  --cyan: #00d4ff;
  --blue: #4d9fff;
  --pink: #ff6b9d;
  --amber: #ffb347;
  --mint: #5fffb7;
  --violet: #a88cff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 8%, rgba(77, 159, 255, 0.22), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(255, 107, 157, 0.14), transparent 26%),
    linear-gradient(135deg, var(--bg-deep), var(--bg-blue) 55%, #18213d);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  color: var(--mint);
  font-family: var(--mono);
}

#starfield,
.scanline,
.gridveil {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#starfield {
  z-index: -3;
}

.gridveil {
  z-index: -2;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 80%, transparent 100%);
}

.scanline {
  z-index: -1;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0) 2px,
    rgba(0, 212, 255, 0.035) 2px,
    rgba(0, 212, 255, 0.035) 4px
  );
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 14px 18px 8px;
  backdrop-filter: blur(16px);
}

.brandmark {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 0 16px rgba(0, 212, 255, 0.65);
}

.brand-sigil {
  color: var(--cyan);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.72);
  color: var(--text);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.1);
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--cyan);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 26px 18px 72px;
}

.home-view {
  display: grid;
  gap: 22px;
  width: min(100%, 520px);
  margin: 0 auto;
}

.astro-ring {
  position: relative;
  width: 152px;
  height: 152px;
  margin: 6px auto 0;
}

.astro-ring span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0, 212, 255, 0.58);
  border-radius: 50%;
  box-shadow: inset 0 0 26px rgba(0, 212, 255, 0.16), 0 0 34px rgba(0, 212, 255, 0.18);
  animation: spin 18s linear infinite;
}

.astro-ring span:nth-child(2) {
  inset: 18px;
  border-color: rgba(255, 107, 157, 0.42);
  animation-duration: 12s;
  animation-direction: reverse;
}

.astro-ring span:nth-child(3) {
  inset: 48px;
  border-color: rgba(255, 179, 71, 0.5);
  animation-duration: 9s;
}

.astro-ring::before,
.astro-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.7), transparent);
  transform: translate(-50%, -50%) rotate(24deg);
}

.astro-ring::after {
  transform: translate(-50%, -50%) rotate(-57deg);
  background: linear-gradient(90deg, transparent, rgba(255, 107, 157, 0.52), transparent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hero-copy {
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-family: var(--mono);
  font-size: clamp(42px, 10vw, 68px);
  text-shadow: 0 0 22px rgba(0, 212, 255, 0.62), 0 0 42px rgba(77, 159, 255, 0.28);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 15px;
}

.manifesto {
  max-width: 420px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}

.panel,
.module-card,
.phase-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow), 0 0 24px rgba(0, 212, 255, 0.13);
  backdrop-filter: blur(16px) saturate(145%);
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: 20px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 172px;
  padding: 22px;
  border: 2px dashed rgba(0, 212, 255, 0.42);
  border-radius: 8px;
  background: rgba(3, 13, 26, 0.5);
  text-align: center;
  transition: 0.24s ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--cyan);
  background: rgba(0, 212, 255, 0.08);
  box-shadow: inset 0 0 32px rgba(0, 212, 255, 0.12);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(0, 212, 255, 0.4);
  border-radius: 50%;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 28px;
}

.dropzone small,
.microcopy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(95, 255, 183, 0.32);
  border-radius: 8px;
  background: rgba(95, 255, 183, 0.08);
  color: var(--mint);
  font-size: 13px;
}

.chip-action,
.ghost-button {
  border: 1px solid rgba(154, 181, 214, 0.34);
  border-radius: 8px;
  background: rgba(232, 244, 255, 0.06);
  color: var(--text);
}

.chip-action {
  padding: 8px 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gender-card {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 104px;
  border: 1px solid rgba(0, 212, 255, 0.32);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.62);
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gender-card span {
  color: var(--cyan);
  font-size: 30px;
  text-shadow: 0 0 16px rgba(0, 212, 255, 0.7);
}

.gender-card.selected {
  transform: scale(1.03);
  border-color: var(--cyan);
  background: rgba(0, 212, 255, 0.12);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.28);
}

.action-stack {
  display: grid;
  gap: 10px;
  text-align: center;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--blue) 58%, var(--pink));
  color: #03101e;
  font-family: var(--mono);
  font-weight: 800;
  box-shadow: 0 0 28px rgba(0, 212, 255, 0.38);
  transition: transform 0.16s ease, filter 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.08);
}

.primary-button:active:not(:disabled) {
  transform: scale(0.98);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: linear-gradient(135deg, #394b61, #223143);
  color: #94a5b8;
  box-shadow: none;
  opacity: 0.78;
}

.primary-button.compact,
.ghost-button {
  width: auto;
  min-height: 42px;
  padding: 0 16px;
}

.result-layout {
  display: grid;
  gap: 22px;
}

.result-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 17, 31, 0.9), rgba(20, 52, 88, 0.72));
  box-shadow: var(--shadow);
}

.result-hero h1,
.page-title {
  font-size: clamp(28px, 6vw, 44px);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(0, 212, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.08);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.badge.pink {
  border-color: rgba(255, 107, 157, 0.45);
  background: rgba(255, 107, 157, 0.12);
}

.badge.amber {
  border-color: rgba(255, 179, 71, 0.52);
  background: rgba(255, 179, 71, 0.12);
  color: #ffe3b8;
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.module-card {
  min-height: 186px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 32px rgba(0, 212, 255, 0.32);
}

.module-card h2 {
  margin-top: 10px;
  font-size: 21px;
}

.module-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.module-card .arrow {
  margin-top: 18px;
  color: var(--cyan);
  font-family: var(--mono);
}

.result-card {
  padding: 22px;
}

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

.result-content {
  color: var(--text);
  font-size: 15px;
  line-height: 1.78;
}

.result-content.collapsed {
  max-height: 250px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 72%, transparent);
}

.result-content h2,
.result-content h3 {
  margin: 24px 0 10px;
  color: var(--text);
}

.result-content p {
  margin: 0 0 14px;
}

.result-content ul,
.result-content ol {
  padding-left: 22px;
}

.result-content blockquote,
.warning-block {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  background: rgba(255, 179, 71, 0.12);
}

.planet-chip {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border: 1px solid rgba(95, 255, 183, 0.34);
  border-radius: 999px;
  background: rgba(95, 255, 183, 0.09);
  color: #c7ffe5;
  font-family: var(--mono);
  font-size: 12px;
}

.inline-action {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(0, 212, 255, 0.34);
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.08);
  color: var(--cyan);
}

.page-stack {
  display: grid;
  gap: 18px;
}

.phase-list {
  display: grid;
  gap: 16px;
}

.phase-card {
  padding: 20px;
}

.phase-card h2 {
  font-size: 20px;
}

.phase-card p {
  color: var(--muted);
  line-height: 1.7;
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 160px;
  border-radius: 8px;
  background: rgba(232, 244, 255, 0.06);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.18), transparent);
  animation: sweep 1.4s infinite;
}

@keyframes sweep {
  to {
    transform: translateX(100%);
  }
}

.timeline {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 16px currentColor;
}

.timeline-item.serious .timeline-dot {
  background: var(--violet);
}

.timeline-item.official .timeline-dot {
  background: var(--amber);
}

.vision-card {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 32px;
  border: 1px solid rgba(255, 179, 71, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 179, 71, 0.14), transparent),
    linear-gradient(160deg, rgba(8, 17, 31, 0.94), rgba(42, 28, 62, 0.84));
  text-align: center;
}

.vision-card h2 {
  color: #ffe4ba;
  font-size: clamp(24px, 6vw, 40px);
}

.hidden {
  display: none !important;
}

.settings-dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.settings-panel {
  margin: 0;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-radius: 8px;
  background: rgba(2, 9, 18, 0.72);
  color: var(--text);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (min-width: 768px) {
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phase-list.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-content {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-inline: 12px;
  }

  .panel,
  .result-card,
  .phase-card,
  .module-card {
    padding: 16px;
  }

  .result-card header {
    display: grid;
  }
}
