/* ==========================================================================
   A SECRET MEMORY — ROMANTIC DATE AUTHENTICATION & SURPRISE STYLING
   ========================================================================== */

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

:root {
  --bg-deep: #07080e;
  --bg-surface: rgba(18, 20, 32, 0.65);
  --bg-surface-hover: rgba(26, 29, 46, 0.8);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(244, 114, 182, 0.5);
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --rose-glow: rgba(244, 114, 182, 0.35);
  --rose-accent: #f472b6;
  --gold-glow: rgba(251, 191, 36, 0.25);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --ease-cinematic: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Atmosphere & Floating Celestial Canvas */
#celestial-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.ambient-nebula {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transition: opacity 1.5s ease;
}

.nebula-1 {
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 500px;
  background: radial-gradient(circle, rgba(219, 39, 119, 0.25) 0%, rgba(139, 92, 246, 0.15) 50%, transparent 80%);
}

.nebula-2 {
  bottom: 5%;
  right: 10%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, rgba(30, 27, 75, 0.1) 60%, transparent 80%);
}

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

/* Glassmorphic Card */
.mystery-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-subtle);
  border-radius: 1.5rem;
  padding: 2.25rem 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 40px -10px var(--rose-glow);
  position: relative;
  overflow: hidden;
  transition: transform 0.6s var(--ease-cinematic), opacity 0.6s var(--ease-cinematic);
}

.mystery-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* Typography */
.poetic-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 300;
  line-height: 1.35;
  color: #fff;
  letter-spacing: 0.02em;
  text-align: center;
  text-wrap: balance;
}

.poetic-subtitle {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 300;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.5;
  text-wrap: balance;
}

.poetic-whisper {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-subtle);
  text-align: center;
  margin-top: 1rem;
  line-height: 1.4;
}

/* Elegant Buttons */
.btn-ethereal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  transition: all 0.3s var(--ease-cinematic);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn-ethereal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(244, 114, 182, 0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.btn-ethereal:hover {
  border-color: rgba(244, 114, 182, 0.5);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -5px var(--rose-glow);
}

.btn-ethereal:hover::after {
  opacity: 1;
}

.btn-ethereal:active {
  transform: translateY(0) scale(0.98);
}

.btn-ethereal:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.08);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Screen Transitions */
.view-screen {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s var(--ease-cinematic), transform 0.5s var(--ease-cinematic);
}

.view-screen.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(16px);
}

/* Introduction View */
#intro-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.intro-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.15) 0%, transparent 70%);
  border: 1px solid rgba(244, 114, 182, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose-accent);
  box-shadow: 0 0 25px var(--rose-glow);
  animation: gentle-pulse 3s infinite alternate ease-in-out;
}

@keyframes gentle-pulse {
  0% { transform: scale(1); box-shadow: 0 0 15px rgba(244, 114, 182, 0.2); }
  100% { transform: scale(1.06); box-shadow: 0 0 30px var(--rose-glow); }
}

/* Date Selection Calendar */
#date-screen {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.calendar-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  margin-top: 0.5rem;
}

.date-dropdowns-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
}

.select-field {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.custom-date-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  padding: 0.5rem 1.85rem 0.5rem 0.85rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  min-height: 44px;
}

.custom-date-select:hover,
.custom-date-select:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(244, 114, 182, 0.5);
  box-shadow: 0 0 15px rgba(244, 114, 182, 0.2);
}

.custom-date-select option {
  background: #0f111c;
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.select-field::after {
  content: '▾';
  position: absolute;
  right: 0.7rem;
  pointer-events: none;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.cal-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(244, 114, 182, 0.4);
  color: #fff;
}

.cal-nav-btn:active {
  transform: scale(0.92);
}

/* Days of Week Row */
.weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.05em;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Calendar Days Grid */
.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.day-cell {
  position: relative;
  min-height: 44px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s ease;
  user-select: none;
}

.day-cell:hover:not(.empty) {
  background: rgba(244, 114, 182, 0.15);
  border-color: rgba(244, 114, 182, 0.4);
  color: #fff;
  transform: scale(1.05);
}

.day-cell:active:not(.empty) {
  transform: scale(0.95);
}

.day-cell.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}

.day-cell.selected {
  background: radial-gradient(circle, rgba(244, 114, 182, 0.35) 0%, rgba(244, 114, 182, 0.15) 80%);
  border-color: var(--rose-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 20px var(--rose-glow);
  transform: scale(1.08);
}

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

/* Selected Date Indicator */
.selected-date-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #cbd5e1;
  letter-spacing: 0.02em;
  min-height: 38px;
  text-align: center;
}

.selected-date-preview.highlight {
  color: #fbcfe8;
  border-color: rgba(244, 114, 182, 0.25);
  background: rgba(244, 114, 182, 0.05);
}

/* Message Feedback Box */
.feedback-box {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.25rem 0.5rem;
  transition: all 0.3s ease;
}

.feedback-msg {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: #fca5a5;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.3s var(--ease-cinematic);
}

.feedback-sub {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
  line-height: 1.3;
}

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

/* Shiver animation on wrong attempt */
.card-shiver {
  animation: subtle-shiver 0.5s ease-in-out;
}

@keyframes subtle-shiver {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Cinematic Fullscreen Success Overlay */
#success-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1b1629 0%, #07080e 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s var(--ease-cinematic);
}

#success-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.success-bloom {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.25) 0%, transparent 70%);
  filter: blur(50px);
  animation: pulse-bloom 2.5s infinite alternate ease-in-out;
}

@keyframes pulse-bloom {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 1; }
}

.success-content {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.success-headline {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 0.03em;
}

.success-heart {
  color: #f43f5e;
  display: inline-block;
  animation: heartbeat 1.2s infinite ease-in-out;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.success-whisper {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 300;
  color: #cbd5e1;
  line-height: 1.5;
}

.success-loading-bar {
  width: 140px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 1rem;
  position: relative;
}

.success-loading-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #f472b6, #fb7185);
  box-shadow: 0 0 10px var(--rose-accent);
  transition: width 1.6s ease-in-out;
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Mobile & Ergonomic Responsive adjustments */
@media (max-width: 480px) {
  .mystery-card {
    padding: 1.75rem 1.25rem;
    border-radius: 1.25rem;
  }
  
  .poetic-title {
    font-size: 1.65rem;
  }

  .calendar-days-grid {
    gap: 0.25rem;
  }

  .day-cell {
    min-height: 40px;
    font-size: 0.85rem;
  }
}
