body {
    margin: 0;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    overflow-x: hidden;
    color: #fff;
    background: linear-gradient(120deg, #ff9a9e, #fad0c4);
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
    0%{background: linear-gradient(120deg, #ff9a9e, #fad0c4);}
    50%{background: linear-gradient(120deg, #a18cd1, #fbc2eb);}
    100%{background: linear-gradient(120deg, #ff9a9e, #fad0c4);}
}

.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 999; /* cho overlay hiệu ứng nổi lên trên */
}

.container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding-top: 50px;
}

.avatars {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #ff66cc;
    object-fit: cover;
    box-shadow: 0 0 15px #ff66cc88;
    animation: float 3s ease-in-out infinite alternate;
    transition: transform 0.1s, box-shadow 0.1s;
    cursor: pointer; /* thêm con trỏ pointer khi hover */
}

.avatar.playing {
    box-shadow: 0 0 40px rgba(255,0,150,0.8), 0 0 60px rgba(255,0,150,0.5);
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px #ff66ccaa;
    transition: 0.3s ease;
}

@keyframes float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-15px); }
}

.title {
    font-size: 2em;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    transition: all 0.5s ease;
}

.title.celebrate {
    animation: bounce 1s ease infinite alternate, glow 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes glow {
    0% { text-shadow: 2px 2px 10px #fff; }
    50% { text-shadow: 4px 4px 20px #ff69b4; }
    100% { text-shadow: 2px 2px 10px #fff; }
}

h1.title {
    font-size: 2em;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    animation: bounceText 2s infinite alternate;
}

@keyframes bounceText {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.countdown h2 {
    font-size: 1.8em;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.3);
    animation: blink 1.5s infinite;
}

.countdown h2.playing {
    text-shadow: 2px 2px 20px rgba(255,255,255,0.8);
}

@keyframes blink {
    0%,50%,100%{opacity:1;}
    25%,75%{opacity:0.7;}
}

.birthday {
    margin-top: 10px;
    font-size: 1.2em;
}

.love-note {
    margin-top: 20px;
    font-size: 1.3em;
    padding: 10px 20px;
    background: linear-gradient(270deg, #ff9a9e, #fad0c4, #a18cd1, #fbc2eb);
    background-size: 800% 800%;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    display: inline-block;
    animation: gradientMove 15s ease infinite;
    transition: opacity 0.5s;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#musicOverlay {
    position: fixed;
    top:0; left:0;
    width:100%; height:100%;
    background: rgba(0,0,0,0.7);
    color:#fff;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:1.8em;
    cursor:pointer;
    z-index: 100;
    text-align:center;
}

#welcomeScreen {
    position: fixed;
    top:0; left:0; right:0; bottom:0;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    animation: fadeIn 1s ease;
}

.welcomeContent h1 {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    line-height: 1.4;
    margin-bottom: 20px;
    text-align: center;
    color: #fff;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    word-break: break-word;
}

#welcomeScreen button {
    padding: 12px 25px;
    font-size: 1.2rem;
    background: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s ease;
    box-shadow: 0 0 0 transparent;
}

#welcomeScreen button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px #ff66cc88;
}

footer {
    position: fixed;
    bottom: 5px;
    width: 100%;
    font-size: 0.9em;
    text-align: center;
    color: #fff;
}

#loveNote {
    font-size: 1.5em;
    margin-top: 10px;
    transition: opacity 0.5s;
}

.emoji {
    position: absolute;
    font-size: 20px;
    pointer-events: none;
    opacity: 0.8;
    animation: floatUpRotate linear forwards;
}

@keyframes floatUpRotate {
    0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 0.8; }
    100% { transform: translateY(-300px) scale(1.5) rotate(360deg); opacity: 0; }
}

@keyframes fadeIn {
    from {opacity:0;}
    to {opacity:1;}
}

h1, p, span {
  text-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.note {
  background: rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 20px;
  display: inline-block;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Particle lung linh bay quanh */
.particle {
    position: absolute;
    pointer-events: none;
    opacity: 0.8;
    font-size: 12px;
    animation: particleMove linear forwards;
}

@keyframes particleMove {
    0% { transform: translateY(0) scale(0.5); opacity: 0.8; }
    100% { transform: translateY(-400px) scale(1.2); opacity: 0; }
}

/* Hiệu ứng glow quanh avatar khi nhạc bật */
.avatar.playing::after {
    content: '';
    position: absolute;
    top: -10px; left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 0, 150, 0.6);
    animation: pulseGlow 1s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 20px rgba(255,0,150,0.6); }
    50% { box-shadow: 0 0 40px rgba(255,0,150,0.8); }
    100% { box-shadow: 0 0 20px rgba(255,0,150,0.6); }
}

/* Lấp lánh milestone */
.title.celebrate::after {
    content: '✨';
    position: absolute;
    font-size: 1.5em;
    animation: sparkle 1s infinite alternate;
}

@keyframes sparkle {
    0% { transform: rotate(0deg) scale(1); opacity: 0.7; }
    50% { transform: rotate(180deg) scale(1.3); opacity: 1; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.7; }
}

/* ===== Message box (ghi lời nhắn) ===== */
/* Container chính cho message */
#messageContainer {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 192, 203, 0.1); /* hồng nhạt */
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.4);
    backdrop-filter: blur(5px);
    font-family: 'Comic Sans MS', cursive, sans-serif;
}

/* Textarea input */
#userMessage {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #ff69b4;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    outline: none;
    resize: none;
}

/* Button lưu */
#saveMessageBtn {
    margin-top: 10px;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}
#saveMessageBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px #ff69b4;
}

/* Status thông báo */
#saveStatus {
    margin-top: 8px;
    font-size: 14px;
    color: #fff;
    min-height: 18px;
}

/* Các message hiển thị */
#messages {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

#messages div {
    padding: 10px 15px;
    margin-bottom: 10px;
    background: rgba(255, 105, 180, 0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    position: relative;
    animation: fadeIn 0.5s ease;
}

/* Hiệu ứng fade-in message mới */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px);}
    to { opacity: 1; transform: translateY(0);}
}

#mainContent {
  display: none; /* Ẩn lúc đầu */
}

/* Hiệu ứng celebrate */
.title.celebrate {
  animation: celebrateAnim 1.2s ease forwards;
}

@keyframes celebrateAnim {
  0% { color: #fff; text-shadow: 2px 2px 10px rgba(0,0,0,0.3); transform: scale(1); }
  50% { color: #ff0; text-shadow: 0 0 20px #ff0, 0 0 30px #ff69b4; transform: scale(1.8); }
  100% { color: #fff; text-shadow: 2px 2px 10px rgba(0,0,0,0.3); transform: scale(1); }
}

/* Ví dụ style cho sparkle */
.sparkle {
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
  animation: sparkleFade 4s linear infinite;
}

@keyframes sparkleFade {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.2); }
}

/* Emoji và particle */
.emoji {
  pointer-events: none;
  user-select: none;
  will-change: transform, top, opacity;
  position: fixed;
  z-index: 9999;
}

.particle {
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
  position: fixed;
  animation-name: floatUp;
  animation-timing-function: linear;
  animation-iteration-count: 1;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-150px);
    opacity: 0;
  }
}