@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg-deep: #06080e;
  --bg-surface: rgba(14, 18, 28, 0.7);
  --bg-card: rgba(20, 26, 40, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-glow: rgba(244, 194, 194, 0.35);
  --text-main: #f0f3f8;
  --text-muted: #8e9bb0;
  --text-faint: #596579;
  --accent-rose: #e2959c;
  --accent-gold: #e5c185;
  --accent-glow: rgba(226, 149, 156, 0.2);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background Atmosphere */
.cosmic-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: 
    radial-gradient(circle at 50% 15%, rgba(226, 149, 156, 0.07) 0%, transparent 55%),
    radial-gradient(circle at 85% 70%, rgba(229, 193, 133, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 15% 80%, rgba(140, 160, 210, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, #06080e 0%, #090c14 50%, #06080e 100%);
}

#star-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Main Container */
.portal-container {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

/* Ambient Romantic Music Floating Button */
.music-toggle-btn {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: rgba(10, 13, 22, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 149, 156, 0.25);
  border-radius: 9999px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.music-toggle-btn:hover {
  color: var(--text-main);
  border-color: rgba(226, 149, 156, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(226, 149, 156, 0.15);
}

.music-toggle-btn.is-playing {
  color: #ffd8df;
  border-color: rgba(226, 149, 156, 0.5);
  background: rgba(24, 15, 25, 0.85);
  box-shadow: 0 0 20px rgba(226, 149, 156, 0.25);
}

.music-icon-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.music-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.sound-bars {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
}

.sound-bars .bar {
  width: 2.5px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
  transition: height 0.2s ease;
}

.music-toggle-btn.is-playing .bar-1 {
  animation: soundBarDance 1.2s ease-in-out infinite alternate;
}

.music-toggle-btn.is-playing .bar-2 {
  animation: soundBarDance 0.85s ease-in-out 0.2s infinite alternate;
}

.music-toggle-btn.is-playing .bar-3 {
  animation: soundBarDance 1.35s ease-in-out 0.4s infinite alternate;
}

@keyframes soundBarDance {
  0% { height: 3px; }
  50% { height: 11px; }
  100% { height: 4px; }
}

/* Glass Card */
.glass-box {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(226, 149, 156, 0.04);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}

/* Intro Stage */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stage.hidden {
  display: none;
  opacity: 0;
  transform: translateY(12px);
}

.stage.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.whisper-emblem {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
  background: radial-gradient(circle, rgba(226, 149, 156, 0.15) 0%, transparent 70%);
  border: 1px solid rgba(226, 149, 156, 0.25);
  color: var(--accent-rose);
  animation: pulse-glow 3.5s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(226, 149, 156, 0.1);
    border-color: rgba(226, 149, 156, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(226, 149, 156, 0.3);
    border-color: rgba(226, 149, 156, 0.45);
  }
}

.intro-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-main);
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  text-wrap: balance;
}

.intro-subtitle {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-serif);
  margin-bottom: 2.25rem;
  letter-spacing: 0.02em;
}

/* Primary Action Buttons */
.btn-mystic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, rgba(226, 149, 156, 0.16) 0%, rgba(229, 193, 133, 0.1) 100%);
  color: #fff;
  border: 1px solid rgba(226, 149, 156, 0.35);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.85rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 48px;
  width: 100%;
}

.btn-mystic:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(226, 149, 156, 0.25) 0%, rgba(229, 193, 133, 0.2) 100%);
  border-color: rgba(226, 149, 156, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(226, 149, 156, 0.18);
}

.btn-mystic:active:not(:disabled) {
  transform: translateY(0);
}

.btn-mystic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Stage 2 - Calendar Reveal */
.prose-block {
  margin-bottom: 1.5rem;
}

.prose-line-1 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.4;
}

.prose-line-2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--text-main);
  line-height: 1.3;
}

.prose-line-3 {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--accent-rose);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}

/* Calendar Interface */
.calendar-wrapper {
  width: 100%;
  background: rgba(10, 13, 20, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 0.9rem;
  margin-bottom: 1.35rem;
  user-select: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.month-year-display {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.month-select,
.month-label {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 0.01em;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
}

.year-select {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
}

.month-select:hover,
.month-select:focus,
.year-select:hover,
.year-select:focus {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.month-select option,
.year-select option {
  background: #0d121c;
  color: #f0f3f8;
}

.cal-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cal-nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 0.6rem;
}

.weekday {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  padding-bottom: 0.25rem;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  min-height: 38px;
  border: 1px solid transparent;
}

.day-cell:hover:not(.empty):not(.disabled) {
  background: rgba(226, 149, 156, 0.12);
  border-color: rgba(226, 149, 156, 0.25);
  color: #fff;
}

.day-cell.empty {
  cursor: default;
}

.day-cell.selected {
  background: linear-gradient(135deg, rgba(226, 149, 156, 0.35) 0%, rgba(229, 193, 133, 0.25) 100%) !important;
  border-color: var(--accent-rose) !important;
  color: #fff !important;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(226, 149, 156, 0.4);
}

.day-cell.today {
  color: var(--accent-gold);
}

.day-cell.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-gold);
}

/* Selected Date Indicator */
.selected-date-preview {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font-serif);
  min-height: 20px;
}

.selected-date-preview span {
  color: var(--accent-rose);
  font-style: normal;
  font-weight: 500;
}

/* Bottom poetic guidance */
.prose-footer {
  margin-bottom: 1.35rem;
}

.prose-footer p:first-child {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 300;
}

.prose-footer p:last-child {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-main);
  font-style: italic;
  font-weight: 400;
}

/* Feedback Messages */
.feedback-box {
  margin-top: 1rem;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.3s ease;
}

.feedback-msg {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-line;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feedback-msg.show {
  opacity: 1;
  transform: translateY(0);
}

.feedback-msg.wrong {
  color: var(--text-muted);
  font-style: italic;
}

.feedback-msg.correct {
  color: var(--accent-rose);
  font-size: 1.15rem;
  font-weight: 500;
  text-shadow: 0 0 12px rgba(226, 149, 156, 0.4);
}

/* Animations */
.shake-subtle {
  animation: gentle-shimmer 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes gentle-shimmer {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.glow-success {
  animation: celestial-glow 1.5s ease forwards;
}

@keyframes celestial-glow {
  0% {
    border-color: var(--border-subtle);
    box-shadow: 0 0 0 rgba(226, 149, 156, 0);
  }
  50% {
    border-color: var(--accent-rose);
    box-shadow: 0 0 35px rgba(226, 149, 156, 0.4);
  }
  100% {
    border-color: var(--accent-gold);
    box-shadow: 0 0 50px rgba(229, 193, 133, 0.3);
  }
}

/* Fullscreen Cinematic Transition Overlay */
.cinematic-veil {
  position: fixed;
  inset: 0;
  background: #06080e;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.cinematic-veil.active {
  opacity: 1;
  pointer-events: all;
}

.cinematic-text {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 300;
  color: var(--text-main);
  letter-spacing: 0.05em;
  opacity: 0;
  transform: translateY(12px);
  transition: all 1s ease 0.3s;
}

.cinematic-veil.active .cinematic-text {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile & Touch Adjustments */
@media (max-width: 480px) {
  .glass-box {
    padding: 1.75rem 1.25rem;
    border-radius: 16px;
  }
  
  .intro-title {
    font-size: 1.75rem;
  }
  
  .prose-line-2 {
    font-size: 1.35rem;
  }
  
  .day-cell {
    font-size: 0.8rem;
    min-height: 36px;
  }
}
