:root {
  color-scheme: dark;
  --bg: #04040b;
  --bg-2: #11041f;
  --panel: rgba(16, 4, 35, 0.92);
  --glow: rgba(182, 97, 255, 0.18);
  --accent: #c76cff;
  --accent2: #ff70b7;
  --gold: #f8d17c;
  --text: #f5f5ff;
  --soft: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 80px rgba(3, 2, 14, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Cairo', sans-serif;
  background: radial-gradient(circle at top, rgba(118, 75, 255, 0.18), transparent 24%),
              radial-gradient(circle at right, rgba(255, 111, 178, 0.12), transparent 20%),
              var(--bg);
  color: var(--text);
  overflow-x: hidden;
  touch-action: manipulation;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 50%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px 40px;
}

#starsBackdrop {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 20%),
              radial-gradient(circle at 20% 20%, rgba(173, 116, 255, 0.12), transparent 8%),
              radial-gradient(circle at 85% 10%, rgba(255, 111, 178, 0.12), transparent 12%);
}

#particleLayer {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.screen {
  position: relative;
  z-index: 1;
  width: min(1000px, 100%);
  max-width: 980px;
  margin: auto;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}

.screen-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.glass-card {
  position: relative;
  background: rgba(14, 5, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 32px;
}

.entrance-card {
  text-align: center;
  overflow: hidden;
}

.gift-stage {
  display: grid;
  gap: 22px;
  align-items: center;
}

.gift-box {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
  border-radius: 24px;
  background: linear-gradient(180deg, #210135, #3e0a5a);
  box-shadow: 0 0 30px rgba(199, 108, 255, 0.45);
  transition: transform 0.5s ease;
}

.gift-box.open {
  transform: translateY(-10px) scale(1.03);
}

.gift-top {
  position: absolute;
  top: -20px;
  left: 20px;
  width: 80px;
  height: 42px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #ff61c8, #c078ff);
  transition: transform 0.45s ease;
}

.gift-box.open .gift-top {
  transform: translateY(-18px) rotate(-6deg);
}

.gift-ribbon {
  position: absolute;
  inset: 24px auto auto 0;
  width: 22px;
  height: 72px;
  background: linear-gradient(180deg, #ff61c8, #e166ff);
  border-radius: 12px;
  left: 48px;
  transform: rotate(10deg);
}

.gift-top {
  position: absolute;
  top: -20px;
  left: 20px;
  width: 80px;
  height: 42px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #ff61c8, #c078ff);
}

.intro-text {
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.5;
}

.tone-choice {
  display: grid;
  gap: 12px;
  margin: 0 auto;
  max-width: 360px;
}

.tone-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.tone-button {
  flex: 1 1 130px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.tone-button.active,
.tone-button:hover {
  background: rgba(199, 108, 255, 0.34);
  transform: translateY(-1px);
}

.story-banner {
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
}

.secret-message {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.97rem;
  line-height: 1.6;
  min-height: 48px;
}

.main-button, .secondary-button {
  border: none;
  outline: none;
  border-radius: 999px;
  padding: 14px 28px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 14px 30px rgba(169, 107, 255, 0.28);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.main-button:hover, .secondary-button:hover {
  transform: translateY(-2px) scale(1.01);
}

.mini-badge {
  margin-top: 18px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
}

.scene-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 34px;
}

.label-box {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--gold);
  padding: 10px 16px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.daily-text {
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  max-width: 760px;
  line-height: 1.5;
}

.hero-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 42px;
}

@media (max-width: 920px) {
  .hero-block { grid-template-columns: 1fr; }
}

.hero-intro {
  display: grid;
  gap: 10px;
}

.hero-title {
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  text-shadow: 0 0 30px rgba(199, 108, 255, 0.42);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.78);
}

.pulse-card {
  position: relative;
  width: min(240px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 36px;
  background: radial-gradient(circle at top, rgba(255, 111, 178, 0.14), transparent 40%),
              rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.04);
  padding: 20px;
  display: grid;
  place-items: center;
}

.heart-ring {
  position: absolute;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 30px rgba(255, 111, 178, 0.25);
  animation: pulseGlow 2.2s ease-in-out infinite;
}

.heart-core {
  font-size: 2.4rem;
  z-index: 1;
  animation: beat 1s ease-in-out infinite;
}

.pulse-text {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 190px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(0.96); opacity: 0.64; }
  50% { transform: scale(1.1); opacity: 0.92; }
}

.stars-area {
  margin-bottom: 36px;
}

.stars-title {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.star-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

@media (max-width: 760px) {
  .star-grid { grid-template-columns: 1fr; }
}

.star-item {
  padding: 18px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.star-item:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 111, 178, 0.45);
}

.star-label {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.98rem;
  font-weight: 700;
}

.star-emoji {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.message-card {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(2, 1, 10, 0.75);
}

.message-card.visible {
  display: flex;
}

.message-popup {
  width: min(420px, 92%);
  background: rgba(12, 4, 42, 0.96);
  border-radius: 28px;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.message-popup p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 22px;
}

.gift-reveal {
  display: grid;
  gap: 18px;
  justify-items: center;
  margin-top: 10px;
}

.gift-content {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  display: grid;
  gap: 18px;
  max-width: 760px;
  width: 100%;
  text-align: center;
}

.gift-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-title.reveal {
  animation: titleGlow 1s ease both;
}

.gift-header {
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.typewriter {
  min-height: 120px;
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.2rem, 2vw, 2rem);
  line-height: 1.5;
  color: #fff;
  text-align: center;
  white-space: pre-wrap;
}

.final-note {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.84);
  animation: glowText 2.5s ease-in-out infinite alternate;
}

.final-note.final-glow {
  animation: glowText 1.5s ease-in-out infinite alternate;
}

.final-note.fade-out {
  animation: fadeOut 3s ease forwards;
}

@keyframes glowText {
  from { text-shadow: 0 0 16px rgba(255, 112, 191, 0.4); }
  to { text-shadow: 0 0 28px rgba(255, 222, 123, 0.65); }
}

@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0.05; transform: translateY(-8px); }
}

@keyframes titleGlow {
  from { text-shadow: 0 0 10px rgba(199, 108, 255, 0.35); }
  to { text-shadow: 0 0 40px rgba(255, 111, 178, 0.85); }
}

.tap-helper {
  margin-top: 18px;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.76);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) scale(0.98);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 18px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

@media (max-width: 760px) {
  .page-shell {
    padding: 22px 14px 38px;
  }
  .hero-block { grid-template-columns: 1fr; }
  .hero-title { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .hero-subtitle { font-size: 1rem; }
  .main-button, .secondary-button, .tone-button {
    width: 100%;
  }
  .tone-buttons { flex-direction: column; gap: 10px; }
  .pulse-card { width: 100%; }
  .glass-card { padding: 28px 20px; }
  .tap-helper { margin-top: 12px; }
}

@media (max-width: 520px) {
  .page-shell { padding: 18px 12px 28px; }
  .glass-card { padding: 22px 14px; }
  .star-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 3.4rem; }
  .hero-subtitle { font-size: 1rem; }
  .gift-box { width: 90px; height: 90px; }
  .gift-top { width: 64px; left: 14px; }
  .message-popup { padding: 20px; }
  .daily-text { font-size: 1rem; }
  .star-item { min-height: 140px; padding: 20px 18px; }
  .tap-helper { font-size: 0.95rem; margin-top: 10px; }
  .intro-text { font-size: 1rem; }
  .main-button, .secondary-button, .tone-button { min-height: 54px; }
  .gift-content { padding: 0 10px; }
  .message-popup { width: calc(100% - 20px); }
  .toast { bottom: 18px; }
}
