@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap');

:root {
  --bg-1: #050a18;
  --bg-2: #0a122a;
  --pink: #ff7eb3; /* More vibrant pink */
  --gold: #ffcc33; /* Pure gold */
  --mint: #00f2fe; /* Icy cyan */
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --card: rgba(255, 255, 255, 0.03); /* Glassmorphism */
  --border: rgba(255, 255, 255, 0.08);
  --glow: 0 0 30px rgba(255, 126, 179, 0.4);
  --radius: 32px;
  font-family: "Baloo 2", "Noto Serif SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-1);
  overflow-x: hidden;
  position: relative;
}

/* Aurora Background */
.aurora {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -3;
  background: linear-gradient(135deg, #060b19 0%, #0e1a35 100%);
  overflow: hidden;
}

.aurora-beam {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: radial-gradient(circle at 50% 50%, 
    rgba(126, 230, 214, 0.15) 0%, 
    rgba(255, 159, 186, 0.1) 30%, 
    transparent 70%);
  filter: blur(80px);
  animation: aurora-rotate 20s linear infinite;
}

@keyframes aurora-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Parallax Snow */
.snow-layer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: -1;
}

.snow-layer.back { opacity: 0.2; animation: snow-fall 15s linear infinite; }
.snow-layer.mid { opacity: 0.4; animation: snow-fall 10s linear infinite; }
.snow-layer.front { opacity: 0.6; animation: snow-fall 7s linear infinite; }

@keyframes snow-fall {
  from { transform: translateY(-100vh); }
  to { transform: translateY(100vh); }
}

.snow-flake {
  position: absolute;
  background: white;
  border-radius: 50%;
  filter: blur(1px);
}

/* Wave Fill for Jar */
.jar-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.jar-fill::before {
  content: "";
  position: absolute;
  top: -20px;
  left: -50%;
  width: 200%;
  height: 40px;
  background: inherit;
  border-radius: 40%;
  animation: wave 3s linear infinite;
  opacity: 0.8;
}

@keyframes wave {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Ripple Effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple-out 0.8s ease-out;
  pointer-events: none;
}

@keyframes ripple-out {
  to { transform: scale(4); opacity: 0; }
}

/* Scene Transitions */
.scene {
  display: none;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.scene.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Recap Styles */
.recap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.recap-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 20px;
  text-align: center;
}

.recap-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
  display: block;
}

.recap-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Handwritten Note */
.note-display {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  line-height: 1.4;
  padding: 20px;
  background: #fff;
  color: #333;
  border-radius: 4px;
  box-shadow: 2px 5px 15px rgba(0,0,0,0.2);
  transform: rotate(-1deg);
  margin-top: 20px;
}

/* Gift Box Upgrade */
.gift-box {
  cursor: pointer;
  transition: transform 0.3s;
}

.gift-box:hover {
  transform: scale(1.05);
}

.gift-box.open .gift-lid {
  animation: lid-pop 0.8s forwards;
}

@keyframes lid-pop {
  0% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-100px) rotate(15deg); opacity: 1; }
  100% { transform: translateY(-200px) rotate(45deg); opacity: 0; }
}


.game { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; display: grid; gap: 24px; }

.game-header { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,143,177,0.32), rgba(255,209,102,0.28)); border: 1px solid rgba(255,143,177,0.55); display: grid; place-items: center; font-size: 22px; box-shadow: var(--glow); }
.brand-title { font-family: "ZCOOL XiaoWei", serif; font-size: 2.1rem; letter-spacing: 2px; }
.brand-sub { color: var(--muted); font-size: 1rem; letter-spacing: 0.5px; }

button { border: none; font: inherit; cursor: pointer; }
.primary, .ghost { padding: 12px 24px; border-radius: 999px; transition: transform 0.2s ease, box-shadow 0.2s ease; font-weight: 700; }
.primary { 
  background: linear-gradient(135deg, var(--pink), #ff4b2b); 
  color: white; 
  box-shadow: 0 10px 25px rgba(255, 75, 43, 0.4);
  border: 1px solid rgba(255,255,255,0.2);
  letter-spacing: 1px;
}

.ghost { 
  background: rgba(255, 255, 255, 0.05); 
  color: var(--text); 
  border: 1px solid rgba(255, 255, 255, 0.2); 
  backdrop-filter: blur(10px);
}

.hint { 
  margin-top: 15px;
  font-style: italic;
  opacity: 0.8;
  font-size: 0.85rem;
  color: var(--pink);
}
.small { padding: 6px 14px; font-size: 0.9rem; }
.primary:hover, .ghost:hover { transform: translateY(-2px) scale(1.01); }
.music-toggle.is-playing { background: rgba(255, 209, 102, 0.2); border-color: rgba(255, 209, 102, 0.6); }
.hidden { display: none !important; }
.music-toggle.icon { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 24px rgba(0,0,0,0.25); display: grid; place-items: center; font-weight: 700; margin-left: auto; position: relative; overflow: hidden; }
.music-toggle .icon-play, .music-toggle .icon-pause { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.music-toggle .icon-play::before { content: ""; border-style: solid; border-width: 8px 0 8px 12px; border-color: transparent transparent transparent var(--text); }
.music-toggle .icon-pause { display: none; }
.music-toggle .icon-pause::before, .music-toggle .icon-pause::after { content: ""; width: 4px; height: 14px; background: var(--text); border-radius: 2px; margin: 0 2px; }
.music-toggle.is-playing .icon-play { display: none; }
.music-toggle.is-playing .icon-pause { display: flex; }

.scene { display: none; animation: fadeUp 0.6s ease both; }
.scene.active { display: block; }
.scene-card { background: var(--card); border-radius: var(--radius); padding: 32px; border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; position: relative; overflow: hidden; }
.scene-card.wide { text-align: left; }
.scene-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 20% 0%, rgba(255,255,255,0.06), transparent 45%), radial-gradient(circle at 80% 10%, rgba(126,230,214,0.08), transparent 45%); }

h1, h2, h3 { margin-top: 0; }
p { color: var(--muted); }
.scene-sub { margin-top: -6px; color: var(--muted); }

.form { margin-top: 18px; display: grid; gap: 14px; }
.form-inline { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 12px; margin-top: 16px; align-items: end; }
.lock-actions { grid-template-columns: auto; justify-content: center; }

label { display: grid; gap: 8px; font-size: 0.95rem; color: var(--muted); }
input, textarea { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(12, 18, 30, 0.9); color: var(--text); font: inherit; }
input:focus, textarea:focus { outline: 2px solid rgba(255, 209, 102, 0.6); }

.hint { min-height: 18px; color: var(--gold); font-size: 0.9rem; }

.lobby-info { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.info-card { padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.info-title { color: var(--muted); font-size: 0.9rem; }
.info-value { font-size: 1.4rem; margin-top: 8px; }

.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 24px 0 18px; }
.player-card { padding: 18px; border-radius: 18px; border: 1px solid var(--border); background: var(--card2); text-align: center; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 18px 32px rgba(0,0,0,0.25); }
.player-card::before { content: ""; position: absolute; inset: -30% -30% auto auto; width: 140px; height: 140px; background: radial-gradient(circle, rgba(255, 159, 186, 0.16), transparent 60%); transform: rotate(18deg); }
.player-avatar { font-size: 48px; margin-top: 6px; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.35)); animation: float 3s ease-in-out infinite; }
.player-label { font-size: 1.08rem; margin-top: 10px; letter-spacing: 1px; }
.player-status { color: var(--gold); margin-top: 4px; font-size: 0.95rem; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ambient-snow, .sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: inherit; }
.sky { mix-blend-mode: screen; }
.snow-particle { position: absolute; top: -10px; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.8); box-shadow: 0 0 12px rgba(255,255,255,0.4); animation: drift 8s linear infinite; }
.fire-heart { position: absolute; color: var(--pink); font-size: 18px; text-shadow: 0 4px 12px rgba(0,0,0,0.3); animation: fire 1.5s ease-out forwards; }

.chapter-head { display: grid; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--border); font-size: 0.9rem; }

.rhythm-stage { margin-top: 16px; display: grid; justify-items: center; gap: 16px; }
.beat-track { position: relative; width: min(520px, 90%); height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.beat-dot { position: absolute; left: 0; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); transform: translate(-50%, -50%); box-shadow: 0 0 14px rgba(126, 230, 214, 0.9); }
.tap-btn { width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle at top, #fff6f9, var(--pink)); color: #381019; font-size: 1.12rem; font-weight: 800; box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.6), 0 22px 34px rgba(255, 143, 177, 0.38); position: relative; overflow: visible; }
.tap-btn.pulse { animation: pulse 0.3s ease; }
.tap-burst { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); opacity: 0.9; animation: burst 0.6s ease forwards; }
.meter { width: min(520px, 90%); height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.meter-bar { height: 100%; width: 0%; background: linear-gradient(120deg, var(--gold), var(--pink)); transition: width 0.2s ease; }
.meter-info { display: flex; gap: 20px; color: var(--muted); }
.chapter-hint, .rhythm-hint { text-align: center; color: var(--muted); margin-top: 8px; }
.wish-jar { position: relative; width: 180px; height: 200px; border-radius: 40px 40px 32px 32px; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.06), transparent 60%), rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.16); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 18px 32px rgba(0,0,0,0.24); }
.jar-glow { position: absolute; inset: -12px; background: radial-gradient(circle, rgba(255, 159, 186, 0.18), transparent 60%); filter: blur(12px); }
.jar-fill { position: absolute; bottom: 0; left: 0; right: 0; height: 0%; transition: height 0.3s ease; }
.my-fill { background: linear-gradient(180deg, rgba(255, 159, 186, 0.8), rgba(255, 143, 177, 0.6)); }
.partner-fill { background: linear-gradient(180deg, rgba(126, 230, 214, 0.8), rgba(126, 230, 214, 0.5)); mix-blend-mode: screen; }
.jar-cap { position: absolute; top: 0; left: 10%; right: 10%; height: 12px; background: rgba(255,255,255,0.12); border-radius: 0 0 10px 10px; }
.jar-legend { display: flex; gap: 12px; color: var(--muted); font-size: 0.9rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend-dot.me { background: linear-gradient(120deg, var(--pink), var(--coral)); box-shadow: 0 0 8px rgba(255,143,177,0.6); }
.legend-dot.partner { background: linear-gradient(120deg, var(--mint), #8be8df); box-shadow: 0 0 8px rgba(126,230,214,0.6); }

.star-stage { display: grid; gap: 14px; justify-items: center; margin-top: 10px; }
.star-field { position: relative; width: 100%; height: 320px; border-radius: 18px; border: 1px solid var(--border); background: radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.05), transparent 60%), rgba(12,18,30,0.8); overflow: hidden; }
.star { position: absolute; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #1a1020; box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.star.me { background: var(--pink); }
.star.partner { background: var(--mint); }
.star-buckets { display: flex; gap: 12px; justify-content: center; }
.bucket { padding: 10px 16px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,0.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.star-score { color: var(--muted); }

.path-stage { margin-top: 12px; display: grid; gap: 12px; }
.path-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: min(420px, 90%); margin: 0 auto; }
.path-cell { width: 100%; padding-top: 100%; position: relative; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); cursor: pointer; overflow: hidden; }
.path-cell.active::after { content: ""; position: absolute; inset: 12%; border-radius: 10px; background: linear-gradient(145deg, var(--pink), var(--gold)); box-shadow: 0 0 18px rgba(255,143,177,0.5); }
.path-hint { text-align: center; color: var(--muted); }

.gift-box { position: relative; width: 140px; height: 140px; margin: 18px auto; font-size: 64px; }
.gift-lid { position: absolute; inset: 0; display: grid; place-items: center; animation: float 2.2s ease-in-out infinite; }
.gift-body { position: absolute; inset: 0; display: grid; place-items: center; transform: translateY(10px); }
.gift-glow { position: absolute; inset: -24px; background: radial-gradient(circle, rgba(255, 209, 102, 0.36), transparent 60%); filter: blur(12px); opacity: 0.9; }
.message-area { margin-top: 6px; display: grid; gap: 12px; }
.note-display { padding: 14px; border-radius: 16px; border: 1px dashed rgba(255, 209, 102, 0.6); background: rgba(255, 209, 102, 0.12); }

.token-box { margin-top: 20px; display: grid; gap: 10px; text-align: left; }
.token-output { background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 12px; display: grid; gap: 8px; }
.token-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
code { font-family: "Courier New", monospace; background: rgba(0, 0, 0, 0.35); padding: 8px; border-radius: 10px; word-break: break-all; }
.decoded { margin-top: 10px; padding: 12px; border-radius: 16px; border: 1px solid rgba(125, 212, 255, 0.4); background: rgba(125, 212, 255, 0.1); }
.snow-stage { position: relative; height: 120px; margin-top: 12px; border-radius: 20px; border: 1px dashed rgba(255, 255, 255, 0.12); overflow: hidden; }
.snowflake { position: absolute; top: -10px; color: #f8f5f1; font-size: 18px; opacity: 0.9; animation: fall 4s linear forwards; }

.heartbeat { display: grid; gap: 16px; justify-items: center; margin-top: 20px; }
.heart-field { position: relative; width: min(520px, 90%); height: 180px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); overflow: hidden; }
.heart { position: absolute; font-size: 20px; color: var(--pink); animation: rise 2.4s ease-out forwards; }
.end-actions { margin-top: 14px; text-align: center; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px);} to { opacity: 1; transform: translateY(0);} }
@keyframes pulse { 0% { transform: scale(1);} 50% { transform: scale(1.08);} 100% { transform: scale(1);} }
@keyframes burst { from { transform: scale(1); opacity: 0.9;} to { transform: scale(2.6); opacity: 0;} }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }
@keyframes fall { to { transform: translateY(160px) rotate(160deg); opacity: 0.2;} }
@keyframes rise { 0% { transform: translateY(0) scale(0.8); opacity: 0;} 20% { opacity: 1;} 100% { transform: translateY(-160px) scale(1.4); opacity: 0;} }
@keyframes drift { 0% { transform: translateY(0) translateX(0) scale(1); opacity: 0.9;} 100% { transform: translateY(160px) translateX(-20px) scale(0.9); opacity: 0;} }
@keyframes fire { 0% { transform: translateY(0) scale(0.7); opacity: 1;} 60% { opacity: 1;} 100% { transform: translateY(-160px) scale(1.6); opacity: 0;} }

@media (max-width: 900px) { .form-inline { grid-template-columns: 1fr; } .meter-info { flex-direction: column; gap: 6px; } .path-grid { width: 100%; } }
@media (max-width: 640px) { .tap-btn { width: 160px; height: 160px; } }
