:root {
  --bg: #050507;
  --card: #0d0d14;
  --accent: #8b5cf6;
  --accent-soft: #a78bfa;
  --silver: #c0c0d0;
  --silver-dim: #8a8a9a;
  --glow: 0 0 24px rgba(139, 92, 246, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 800px at 50% -10%, #1a1030 0%, var(--bg) 55%);
  color: var(--silver);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  padding: 16px;
}

.luna-card {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08), rgba(13, 13, 20, 0.9));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--glow);
  max-width: 520px;
  margin: 0 auto 16px;
}

.luna-title {
  color: #e6e6f0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.luna-accent { color: var(--accent-soft); }

.luna-btn {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.luna-btn:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(139, 92, 246, 0.5); }
.luna-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.luna-btn--ghost {
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--accent-soft);
  box-shadow: none;
}

.luna-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  color: #e6e6f0;
  padding: 10px 12px;
  font-size: 15px;
}
.luna-input:focus { outline: none; border-color: var(--accent-soft); }

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

/* Карта дня */
.drawn-card {
  perspective: 800px;
  max-width: 240px;
  margin: 16px auto;
}
.drawn-card__inner {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 5;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.drawn-card.is-flipped .drawn-card__inner { transform: rotateY(180deg); }
.drawn-card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  text-align: center;
}
.drawn-card__back {
  background:
    radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.45), transparent 60%),
    linear-gradient(160deg, #17111f, #0b0910);
  border: 1px solid rgba(139, 92, 246, 0.5);
  font-size: 44px;
  color: var(--accent-soft);
}
.drawn-card__front {
  transform: rotateY(180deg);
  background: linear-gradient(170deg, rgba(139, 92, 246, 0.22), #0d0b14 70%);
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow: var(--glow);
}
.drawn-card.is-shuffling { animation: shuffle 0.45s ease infinite alternate; }
@keyframes shuffle {
  from { transform: rotate(-2deg) translateY(0); }
  to { transform: rotate(2deg) translateY(-6px); }
}

/* Инлайн-валидация форм (без нативных бабблов) */
.luna-field-error {
  display: none;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--silver);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
}
.luna-field-error.is-visible { display: block; }

@keyframes luna-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.luna-shake { animation: luna-shake 0.4s ease; }

.luna-input.is-invalid { border-color: #c084fc; box-shadow: 0 0 12px rgba(139, 92, 246, 0.45); }

label:has(.luna-consent.is-invalid) .luna-consent { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 4px; }


/* Аффордансы карт: дыхание рубашки, hover-lift, искра-подсказка */
@keyframes card-breath {
  0%, 100% { box-shadow: 0 0 16px rgba(139, 92, 246, 0.25), inset 0 0 24px rgba(139, 92, 246, 0.08); }
  50% { box-shadow: 0 0 36px rgba(139, 92, 246, 0.55), inset 0 0 34px rgba(139, 92, 246, 0.18); }
}
.card-breath { animation: card-breath 3.4s ease-in-out infinite; }

.welcome-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(200px, 56vw);
  aspect-ratio: 3 / 5;
  margin: 14px auto 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.45), transparent 60%),
    linear-gradient(160deg, #17111f, #0b0910);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 16px;
  color: var(--accent-soft);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.welcome-card__moon { font-size: 44px; }
.welcome-card__label { font-size: 14px; color: var(--silver); }

@media (hover: hover) and (pointer: fine) {
  .card-lift:hover {
    transform: translateY(-5px);
    border-color: var(--accent-soft);
    box-shadow: 0 0 32px rgba(139, 92, 246, 0.5);
  }
  .scheme-card:hover {
    border-color: rgba(139, 92, 246, 0.6) !important;
    box-shadow: 0 0 22px rgba(139, 92, 246, 0.35);
    transform: translateY(-2px);
  }
  .scheme-card { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
}


/* Bottom-sheet «Луна запомнит тебя ☾» */
.luna-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 6, 0.65);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.luna-sheet {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08), rgba(13, 13, 20, 0.98));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}


/* Подсказка под картой: пульс, серебро с фиолетовым свечением */
.card-hint {
  margin: 12px auto 0;
  font-size: 17px;
  color: #D6D5E0;
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.65), 0 0 18px rgba(139, 92, 246, 0.35);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.card-hint.is-visible { animation: hint-pulse 1.6s ease-in-out infinite; }
@keyframes hint-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Усиленное дыхание на первый показ за сессию */
.card-breath--strong { animation: card-breath-strong 1.8s ease-in-out infinite; }
@keyframes card-breath-strong {
  0%, 100% { box-shadow: 0 0 22px rgba(139, 92, 246, 0.4), inset 0 0 28px rgba(139, 92, 246, 0.14); }
  50% { box-shadow: 0 0 52px rgba(139, 92, 246, 0.75), inset 0 0 44px rgba(139, 92, 246, 0.28); }
}


/* Брендовые SVG-иконки: серебряный штрих, фиолетовое свечение */
.luna-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  color: #D6D5E0;
  filter: drop-shadow(0 0 5px rgba(139, 92, 246, 0.75));
}
.luna-ico svg { width: 100%; height: 100%; display: block; }
.luna-ico--lg { width: 1.25em; height: 1.25em; vertical-align: -0.2em; }
.luna-ico--xl { width: 56px; height: 56px; vertical-align: 0; }
