@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;600;700&family=Inter:wght@300;400;500;700&display=swap');

:root {
  --amber: #fbbf24;
  --amber-light: #fde68a;
  --sky: #38bdf8;
  --sky-light: #7dd3fc;
  --lavender: #c4b5fd;
  --lilac: #a78bfa;
  --mint: #34d399;
  --aurora-1: #fbbf24;
  --aurora-2: #a78bfa;
  --aurora-3: #38bdf8;
  --aurora-4: #34d399;
  --bg-deep: #080f1e;
  --text: #f0f4ff;
  --text-soft: rgba(240, 244, 255, 0.7);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glow: 0 0 30px rgba(251, 191, 36, 0.12);
  --accent: var(--amber);
  --accent-light: var(--amber-light);
}

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

html {
  scroll-behavior: smooth;
  font-size: 14.5px;
}

body {
  font-family: 'Inter', 'Noto Serif SC', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  max-width: 100vw;
}

/* ===== Splash Screen ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.splash-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  animation: splashFadeIn 1.5s ease-out both;
}

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

.splash-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.1), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  filter: blur(30px);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -60%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
}

.splash-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: envelopeFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.3));
}

@keyframes envelopeFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

.splash-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--amber-light), var(--amber), var(--sky-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
}

.splash-desc {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 3rem;
  opacity: 0.7;
}

.splash-btn {
  position: relative;
  background: transparent;
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  border-radius: 3rem;
  padding: 0.9rem 2.5rem;
  color: var(--amber-light);
  font-family: 'Noto Serif SC', serif;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s;
  overflow: visible;
}

.splash-btn:active {
  transform: scale(0.95);
  border-color: var(--amber);
}

.splash-btn-ring {
  position: absolute;
  inset: -8px;
  border-radius: 3rem;
  border: 1px solid rgba(251, 191, 36, 0.2);
  animation: ringExpand 2.5s ease-out infinite;
}

@keyframes ringExpand {
  0% { inset: -4px; opacity: 0.6; }
  100% { inset: -20px; opacity: 0; }
}

/* ===== Main Page ===== */
.main-page {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.main-page.active {
  opacity: 1;
}

/* ===== Starfield ===== */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--dur) ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.1; transform: scale(0.6); }
  100% { opacity: var(--max-o, 0.7); transform: scale(1.1); }
}

/* ===== Aurora ===== */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora::before,
.aurora::after {
  content: '';
  position: absolute;
  width: 200%;
  height: 50%;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.08;
  animation: auroraShift 10s ease-in-out infinite alternate;
}

.aurora::before {
  background: radial-gradient(ellipse, var(--aurora-1), var(--aurora-2), transparent 70%);
  top: -15%;
  left: -50%;
}

.aurora::after {
  background: radial-gradient(ellipse, var(--aurora-3), var(--aurora-4), transparent 70%);
  bottom: -20%;
  right: -50%;
  animation-delay: -5s;
  animation-direction: alternate-reverse;
}

@keyframes auroraShift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4%, 3%) scale(1.05); }
  100% { transform: translate(-3%, -2%) scale(0.98); }
}

/* ===== Floating Sparkles ===== */
.floating-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.heart {
  position: absolute;
  color: var(--amber);
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.3));
  animation: floatUp var(--float-dur, 7s) ease-in infinite;
  opacity: 0;
}

@keyframes floatUp {
  0% { transform: translateY(100vh) rotate(0deg) scale(0.3); opacity: 0; }
  15% { opacity: var(--peak-o, 0.35); }
  85% { opacity: var(--peak-o, 0.35); }
  100% { transform: translateY(-10vh) rotate(30deg) scale(0.9); opacity: 0; }
}

/* ===== Page Wrapper (mobile-first) ===== */
.page-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 1.2rem 2rem;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}

/* ===== Hero Section ===== */
.hero {
  width: 100%;
  min-height: 92vh;
  min-height: 92dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 0.5rem;
  position: relative;
}

.hero-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  position: relative;
  animation: ringPulse 4s ease-in-out infinite;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.06), transparent 70%);
}

.hero-ring::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--amber), var(--sky), var(--lilac), var(--amber));
  opacity: 0.2;
  animation: ringRotate 8s linear infinite;
  z-index: -1;
  filter: blur(3px);
}

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

@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 25px rgba(251, 191, 36, 0.06); }
  50% { box-shadow: 0 0 45px rgba(251, 191, 36, 0.14); }
}

.hero-emoji {
  font-size: 3.5rem;
  animation: friendBounce 2s ease-in-out infinite;
}

@keyframes friendBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.hero-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--amber-light), var(--amber), var(--sky-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeSlideUp 1s ease-out both;
}

.hero-subtitle {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-soft);
  margin-bottom: 2rem;
  letter-spacing: 1px;
  animation: fadeSlideUp 1s ease-out 0.25s both;
}

.hero-date {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--sky-light);
  opacity: 0.5;
  animation: fadeSlideUp 1s ease-out 0.5s both;
}

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

.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.7rem;
  letter-spacing: 2px;
  animation: fadeSlideUp 1s ease-out 0.8s both;
}

.scroll-arrow {
  width: 16px;
  height: 16px;
  border-right: 1.5px solid var(--amber);
  border-bottom: 1.5px solid var(--amber);
  transform: rotate(45deg);
  animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.3; }
  50% { transform: rotate(45deg) translateY(5px); opacity: 1; }
}

/* ===== Sections ===== */
.section {
  width: 100%;
  padding: 2.5rem 0;
}

.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--sky-light);
  opacity: 0.45;
  margin-bottom: 0.6rem;
}

.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text), var(--amber-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Timer ===== */
.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.timer-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.2rem 0.3rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.timer-card:active {
  transform: scale(0.96);
  border-color: rgba(251, 191, 36, 0.3);
}

.timer-number {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  display: block;
  background: linear-gradient(180deg, var(--text), var(--amber-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.timer-unit {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--amber);
  opacity: 0.65;
}

/* ===== Message Card ===== */
.letter-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.2rem;
  padding: 1.8rem 1.4rem;
  position: relative;
  overflow: hidden;
}

.letter-card::before {
  content: '"';
  position: absolute;
  top: -8px;
  left: 12px;
  font-family: 'Georgia', serif;
  font-size: 5rem;
  color: var(--amber);
  opacity: 0.06;
  line-height: 1;
}

.letter-line {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.92rem;
  line-height: 2.2;
  color: var(--text-soft);
  position: relative;
  z-index: 1;
}

.letter-line strong {
  color: var(--amber-light);
  font-weight: 600;
}

.letter-line em {
  color: var(--sky-light);
  font-style: normal;
}

.letter-signature {
  margin-top: 1.5rem;
  text-align: right;
  font-family: 'Noto Serif SC', serif;
  font-style: italic;
  color: var(--amber);
  opacity: 0.55;
  font-size: 0.85rem;
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--amber), var(--sky), transparent);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.2rem;
  padding: 1.2rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 0.9rem;
  transition: all 0.3s ease;
}

.timeline-item:active {
  background: var(--glass-hover);
  transform: translateX(4px);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.72rem;
  top: 1.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
  border: 2px solid var(--bg-deep);
}

.timeline-date {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 2px;
  color: var(--sky-light);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-date::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--glass-border), transparent);
}

.timeline-text {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.timeline-emoji {
  font-size: 1.1rem;
  margin-right: 0.3rem;
}

/* ===== Wishes ===== */
.wishes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.wish-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.4rem 0.8rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.wish-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transform: rotate(45deg);
  animation: shimmer 6s infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% { transform: translate(-100%, -100%) rotate(45deg); }
  20%, 100% { transform: translate(100%, 100%) rotate(45deg); }
}

.wish-card:active {
  transform: scale(0.96);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.wish-icon {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
  display: block;
}

.wish-text {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.5;
}

/* ===== Footer ===== */
.page-footer {
  width: 100%;
  text-align: center;
  padding: 3rem 0 2rem;
  color: var(--text-soft);
  opacity: 0.35;
  font-size: 0.7rem;
  letter-spacing: 2px;
}

.footer-heart {
  display: inline-block;
  color: var(--amber);
  animation: friendBounce 2s ease-in-out infinite;
  margin: 0 0.2rem;
}

/* ===== Message Board ===== */
.msg-input-card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.2rem;
  padding: 1.4rem;
  margin-bottom: 1.5rem;
}

.msg-input-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  align-items: center;
}

.msg-input-name {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 0.7rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.3s;
}

.msg-input-name:focus {
  border-color: var(--amber);
}

.msg-input-name::placeholder,
.msg-textarea::placeholder {
  color: rgba(240, 244, 255, 0.3);
}

.emoji-picker-wrap {
  position: relative;
}

.emoji-btn {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 0.7rem;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.emoji-btn:active {
  transform: scale(0.92);
  border-color: var(--amber);
}

.emoji-dropdown {
  position: absolute;
  bottom: 50px;
  right: 0;
  background: rgba(20, 15, 40, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 0.8rem;
  padding: 0.5rem;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  z-index: 10;
}

.emoji-dropdown.show {
  display: grid;
}

.emoji-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.emoji-option:active {
  background: rgba(255, 255, 255, 0.1);
}

.msg-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 0.7rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Inter', 'Noto Serif SC', sans-serif;
  outline: none;
  resize: none;
  margin-bottom: 0.8rem;
  transition: border-color 0.3s;
  line-height: 1.6;
}

.msg-textarea:focus {
  border-color: var(--amber);
}

.msg-submit-btn {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--amber), var(--sky));
  border: none;
  border-radius: 0.8rem;
  color: var(--bg-deep);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 1px;
}

.msg-submit-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.msg-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Message List */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.msg-loading,
.msg-empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding: 2rem 0;
  opacity: 0.5;
}

.msg-bubble {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  transition: all 0.3s;
}

.msg-bubble:active {
  background: var(--glass-hover);
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.msg-emoji {
  font-size: 1rem;
}

.msg-author {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber-light);
}

.msg-time {
  font-size: 0.65rem;
  color: var(--text-soft);
  opacity: 0.5;
  margin-left: auto;
}

.msg-content {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.7;
  word-break: break-word;
}

.msg-delete-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  opacity: 0.3;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  margin-left: auto;
  transition: all 0.2s;
  line-height: 1;
}

.msg-delete-btn:active {
  opacity: 1;
  color: #ff6b6b;
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 0; display: none; }

/* ===== Selection ===== */
::selection {
  background: rgba(251, 191, 36, 0.3);
  color: var(--text);
}
