/* Astrobot Mini App — Moonbot design system.
   Source of truth: design tokens from css_style.rtf and Figma screens.
   Mobile-first; canvas reference width 430px. */

:root {
  --bg: #1d1d1d;
  --bg-card: #1b1b1b;
  --bg-card-2: #232323;
  --fg: #f4f7ff;
  --fg-muted: rgba(244, 247, 255, 0.62);
  --fg-dim: rgba(244, 247, 255, 0.42);
  --accent: #4f63fe;
  --accent-glow: rgba(79, 99, 254, 0.5);
  --accent-soft: rgba(79, 99, 254, 0.12);
  --gold: #f0b86e;
  --aura-1: #ff15f3;
  --aura-2: #45ff58;
  --aura-3: #4f63fe;
  --aura-4: #45e9ff;
  --radius-card: 16px;
  --radius-pill: 999px;
  --gap-screen: 16px;
  --pad-screen: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI",
    Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select {
  font-family: inherit;
  color: var(--fg);
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

/* App shell ─────────────────────────────────────────────── */

#root {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--pad-screen);
  padding-bottom: calc(var(--pad-screen) + 96px); /* room for bottom nav */
  gap: var(--gap-screen);
  animation: fadeIn 0.25s ease-out;
}

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

/* Splash ─────────────────────────────────────────────────── */

#screen-splash {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 30vh;
}

.splash-orb {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(79, 99, 254, 0.55),
    rgba(79, 99, 254, 0.05) 60%,
    transparent 70%
  );
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 64px var(--accent-glow);
}

.splash-orb::before,
.splash-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.splash-orb::after {
  inset: -32px;
  border-color: rgba(255, 255, 255, 0.04);
}

.splash-orb svg {
  width: 130px;
  height: 130px;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.splash-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}

.splash-subtitle {
  margin: 0;
  color: var(--fg-muted);
  font-size: 14px;
}

/* Header ─────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
}

.app-header .back {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--fg-muted);
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  flex: 1;
}

/* Card ─────────────────────────────────────────────────── */

.card {
  background: linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.01),
      rgba(255, 255, 255, 0.01)
    ),
    var(--bg-card);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  border-radius: var(--radius-card);
  padding: 20px;
}

.card.flat {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
}

/* Form fields ─────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-label {
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: lowercase;
  letter-spacing: 0.2px;
}

.input {
  appearance: none;
  background: var(--bg-card-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--fg);
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--fg-dim);
}

.input.center {
  text-align: center;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 8px;
}

.field-row.time {
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.field-row .colon {
  font-size: 22px;
  text-align: center;
  color: var(--fg-muted);
}

/* Autocomplete ──────────────────────────────────────────── */

.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 5;
}

.autocomplete-list .item {
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.autocomplete-list .item:last-child {
  border-bottom: none;
}
.autocomplete-list .item:hover,
.autocomplete-list .item.active {
  background: var(--accent-soft);
}
.autocomplete-list .item .secondary {
  color: var(--fg-muted);
  font-size: 13px;
  margin-left: 4px;
}

/* Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 500;
  width: 100%;
  transition: opacity 0.15s, transform 0.05s;
}
.btn:active {
  transform: scale(0.99);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--fg);
  color: #111;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border-radius: 12px;
  font-size: 14px;
  padding: 12px 16px;
  width: auto;
}

/* Help bubble next to input */
.help-bubble {
  background: var(--bg-card-2);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.3;
  max-width: 130px;
}

/* Profile screen ───────────────────────────────────────── */

.profile-name {
  text-align: center;
  margin: 12px 0 4px;
  font-size: 22px;
  font-weight: 600;
}

.profile-signs {
  display: flex;
  justify-content: center;
  gap: 14px;
  color: var(--fg-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.profile-signs span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.section-title {
  margin: 6px 0 10px;
  font-size: 14px;
  color: var(--fg-muted);
  font-weight: 500;
  text-align: center;
}

.birth-data {
  display: grid;
  gap: 14px;
}

.birth-data .row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  font-size: 16px;
  color: var(--fg);
}

.birth-data .row.compact {
  grid-template-columns: 1fr 1fr;
}

.birth-data .row .pill {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 0;
  border-radius: 10px;
}

.aura-block {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--aura-1),
    var(--aura-3) 40%,
    var(--aura-4) 70%,
    var(--aura-2)
  );
  padding-top: 100%;
  position: relative;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

/* Natal home screen ───────────────────────────────────── */

.cta-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  text-align: left;
  width: 100%;
}

.cta-compat {
  background: linear-gradient(
      0deg,
      rgba(240, 184, 110, 0.04),
      rgba(240, 184, 110, 0.04)
    ),
    var(--bg-card);
  border: 1px solid var(--gold);
  box-shadow: 0 0 12px rgba(240, 184, 110, 0.35);
  color: var(--fg);
}

.cta-referral {
  background: linear-gradient(
      0deg,
      rgba(79, 99, 254, 0.04),
      rgba(79, 99, 254, 0.04)
    ),
    var(--bg-card);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  color: var(--fg);
}

.cta-card .icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.cta-card .text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cta-card .title {
  font-size: 15px;
  font-weight: 600;
}

.cta-card .subtitle {
  font-size: 12px;
  color: var(--fg-muted);
}

.section-band {
  margin: 18px 0 10px;
  font-size: 14px;
  color: var(--fg-muted);
  text-align: center;
}

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

.tile-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.tile {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  text-align: left;
  width: 100%;
}

.tile .name {
  font-size: 13px;
  color: var(--fg-muted);
}

.tile .value {
  font-size: 14px;
  font-weight: 500;
  margin-top: auto;
}

.tile.themed {
  border-color: rgba(79, 99, 254, 0.35);
}

/* Themes list & detail ─────────────────────────────────── */

.text-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.text-list .entry {
  background: var(--bg-card-2);
  border-radius: 12px;
  padding: 14px;
}

.text-list .heading {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--fg);
  font-size: 14px;
}

.text-list .body {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

details.block {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg-card);
}
details.block + details.block {
  margin-top: 10px;
}
details.block summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details.block summary::-webkit-details-marker {
  display: none;
}
details.block summary::after {
  content: "›";
  transform: rotate(90deg);
  transition: transform 0.15s;
  color: var(--fg-muted);
}
details.block[open] summary::after {
  transform: rotate(-90deg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.grid .item {
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.grid .item .name {
  font-size: 12px;
  color: var(--fg-muted);
}
.grid .item .value {
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}

/* Loading & errors ─────────────────────────────────────── */

#screen-loading {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
  animation: fadeIn 0.2s ease-out;
}

/* Bottom navigation ────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(29, 29, 29, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 20;
}

.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-muted);
  padding: 6px 0;
}

.bottom-nav button[data-active="true"] {
  color: var(--accent);
}

.bottom-nav button .icon {
  font-size: 22px;
  line-height: 1;
}

.bottom-nav.hidden {
  display: none !important;
}
