/* styles.css — aesthetic: pastel + playful */
/* Base */
/* Popup password screen */
.password-popup {
    position: fixed;
    inset: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: "Comic Relief", sans-serif;
}

.pass-box {
    background: #ffffff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    max-width: 500px;
}

.pass-box h2 {
    margin-bottom: 20px;
    color: #111;
    letter-spacing: 1px;
}

.pass-content {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.pass-img {
    width: 130px;
    height: 130px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pass-input {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#pass-field {
    text-align: center;
    padding: 10px 0;
    font-size: 20px;
    border: 2px solid #ffc8de;
    border-radius: 10px;
    width: 140px;
    background: #fff8fb;
    margin-bottom: 10px;
}

.num-pad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    gap: 8px;
}

.num {
    background: #ffeaf2;
    padding: 10px 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    user-select: none;
}

.num:hover {
    background: #ffcee5;
}

.num.ok {
    background: #b3ffb3;
}

.num.del {
    background: #ffcaca;
}

body {
    background: linear-gradient(180deg, #fff5f9 0%, #ffe9f3 100%);
}

:root {
    --bg: linear-gradient(180deg, #fff7fb 0%, #f2f8ff 100%);
    --card: #fff9fc;
    --muted: #6b7280;
    --glass: rgba(255, 255, 255, 0.7);
    --radius: 14px;
    --shadow: 0 10px 30px rgba(20, 20, 50, 0.08);
    font-synthesis: none;
}

* {
    box-sizing: border-box
}

html,
body,
#app {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 20px;
}

/* layout */
.top {
    text-align: center;
    margin-bottom: 18px;
}

.title {
    margin: 6px 0;
    font-size: clamp(24px, 4vw, 40px);
    letter-spacing: 1px;
}

.subtitle {
    color: var(--muted);
    margin: 0 0 12px 0
}

.controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px
}

.btn {
    border: 0;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    color: black
}

.btn.danger {
    background: #ffefef;
    border: 1px solid #ffd2d2
}

.btn.small {
    padding: 6px 8px;
    font-size: 14px
}

#enableGyroBtn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    padding: 12px 18px;
    background: #ff9dff;
    color: white;
    border-radius: 12px;
    border: none;
    z-index: 999999;
}

/* Floating letter button */
#secret-btn {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: #ff4f92;
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    font-size: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(255, 80, 140, 0.35);
    cursor: pointer;
    animation: floatBtn 2.5s infinite ease-in-out;
    z-index: 9999;
}

@keyframes floatBtn {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* Popup */
#secret-popup {
    position: fixed;
    inset: 0;
    background: rgba(255, 230, 243, 0.75);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

/* Box */
.secret-box {
    width: 85%;
    max-width: 350px;
    background: white;
    padding: 24px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 6px 30px rgba(255, 120, 180, 0.25);
    animation: popupIn 0.35s ease;
}

/* Text */
.secret-text {
    margin-top: 10px;
    color: #8a2e56;
    font-size: 16px;
    line-height: 1.5;
}

/* Close button */
#secret-close {
    margin-top: 18px;
    padding: 10px 18px;
    border: none;
    background: #ff4f92;
    color: white;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
}

/* Shake effect */
@keyframes shake-soft {
    0% {
        transform: translate(-1px, 1px);
    }

    20% {
        transform: translate(2px, -1px);
    }

    40% {
        transform: translate(-2px, 2px);
    }

    60% {
        transform: translate(1px, -2px);
    }

    80% {
        transform: translate(-1px, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.shake-open {
    animation: shake-soft 0.45s ease;
}

/* Falling hearts */
.falling-heart {
    position: absolute;
    top: -20px;
    font-size: 20px;
    animation: heartFall 2.8s linear forwards;
    pointer-events: none;
    opacity: 0.85;
}

@keyframes heartFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(600px) rotate(45deg);
        opacity: 0;
    }
}

/* For typing effect text */
.secret-text {
    white-space: pre-line;
    min-height: 140px;
    /* tránh chữ giật */
}

/* Popup animation */
@keyframes popupIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* main cards */
main {
    max-width: 1100px;
    margin: 18px auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px
}

.card {
    background: var(--card);
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}

/* messages */
.msgs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px
}

.msg {
    padding: 10px;
    border-radius: 10px;
    background: linear-gradient(90deg, #c22c77, #c22c77);
    border: 1px solid rgba(0, 0, 0, 0.03)
}

.msg-form {
    display: flex;
    gap: 8px;
    margin-top: 10px
}

.msg-form input {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eee
}

/* gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px
}

.photo {
    height: 100px;
    border-radius: 10px;
    background: linear-gradient(90deg, #fff, #fff7fb);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ffe6f2;
    color: #ff6b9a;
    font-weight: 700
}

/* wishes area */
.wish-area {
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    background: #fff8fb;
    color: #6b2147;
    min-height: 48px;
    transition: background 0.4s, color 0.4s;
}

body.dark .wish-area {
    background: rgba(255, 160, 255, 0.08);
    color: #ffdfff;
    border: 1px solid rgba(255, 130, 255, 0.3);
}

/* generator output */
.generated {
    margin-top: 12px;
    max-height: 320px;
    overflow: auto;
    border-radius: 10px;
    padding: 10px;
    background: linear-gradient(180deg, #fff, #fcfcff)
}

.generated .line {
    padding: 6px;
    border-bottom: 1px dashed #eee;
    font-family: monospace;
    font-size: 13px
}

/* footer */
footer {
    text-align: center;
    margin-top: 18px;
    color: var(--muted)
}

/* responsiveness */
@media (max-width:800px) {
    .hero-card {
        flex-direction: column;
        align-items: stretch
    }

    .hero-left {
        width: 100%
    }
}

.candle::after {
    animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {
    from {
        transform: translateX(-50%) scale(1) rotate(1deg);
        opacity: 0.9;
    }

    to {
        transform: translateX(-50%) scale(1.1) rotate(-2deg);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* Heart rain effect */
.heart {
    position: fixed;
    top: -10px;
    font-size: 18px;
    color: #ff5c8d;
    opacity: 0.8;
    animation: fall 4s linear forwards;
    pointer-events: none;
    z-index: 999;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

#daily-wish {
    text-align: center;
    background: linear-gradient(180deg, #fff5fa, #ffe9f3);
    color: #832657;
    transition: background 0.4s, color 0.4s;
}

body.dark #daily-wish {
    background: rgba(255, 160, 255, 0.08);
    color: #ffdfff;
    border: 1px solid rgba(255, 130, 255, 0.3);
}

#daily-wish h3 {
    color: #ff4f92;
    font-weight: 700;
    letter-spacing: 0.5px;
}

body.dark #daily-wish h3 {
    color: #ffb6ff;
}

#time-greet {
    font-size: 17px;
    margin-top: 8px;
    font-weight: 600;
}

/* Countdown Section */
.countdown-card {
    text-align: center;
    background: linear-gradient(180deg, #fff7fb, #ffe9f3);
    color: #832657;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.time-box {
    background: #fff;
    border-radius: 14px;
    padding: 10px 18px;
    box-shadow: 0 4px 10px rgba(255, 100, 150, 0.15);
    min-width: 70px;
}

.time-box span {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #ff4f92;
    font-family: 'Comic Relief', cursive;
}

.time-box p {
    margin: 4px 0 0;
    font-size: 14px;
    color: #a34d78;
}

.birthday-msg {
    margin-top: 14px;
    font-weight: 600;
    color: #ff4f92;
    font-size: 18px;
    animation: fadein 1s ease-in-out;
}

@keyframes fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card {
    position: relative;
    overflow: visible;
    transform-style: preserve-3d;
    will-change: transform;
}


/* Cấu trúc chung cho tim */
.heart-frame {
    position: absolute;
    font-size: 20px;
    color: #ff4f92;
    animation: pulse 1.6s infinite ease-in-out;
    opacity: 0.9;
}

/* Mỗi tim ở 1 góc khác nhau */
.heart-top-left {
    top: 10px;
    left: 14px;
    animation-delay: 0s;
}

.heart-top-right {
    top: 10px;
    right: 14px;
    animation-delay: 0.4s;
}

.heart-bottom-left {
    bottom: 10px;
    left: 14px;
    animation-delay: 0.8s;
}

.heart-bottom-right {
    bottom: 10px;
    right: 14px;
    animation-delay: 1.2s;
}

/* Hiệu ứng tim đập */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Nút toggle */
.dark-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ecb4ff;
    border: none;
    padding: 12px 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: 0.3s;
    box-shadow: 0 0 12px rgba(255, 182, 255, 0.6);
    z-index: 9999;
}

.dark-btn:hover {
    transform: scale(1.1);
}

/* --- DARK MODE --- */
body.dark {
    background: linear-gradient(180deg, #18001a, #2d0033 60%, #3c0047);
    color: #ffdfff;
    transition: background 0.5s ease, color 0.3s ease;
}

/* Màu cho các thẻ (card) */
body.dark .card,
body.dark .memory-box,
body.dark .secret-box,
body.dark .popup-box body .dark .message-box {
    background: rgba(255, 160, 255, 0.08);
    border: 1px solid rgba(255, 130, 255, 0.3);
    box-shadow: 0 0 18px rgba(255, 100, 255, 0.2);
    transition: 0.4s;
}

/* Dark mode cho wish-area */
body.dark .wish-area {
    background: rgba(255, 160, 255, 0.08);
    color: #ffdfff;
    border: 1px solid rgba(255, 130, 255, 0.3);
}

/* Heading đổi màu */
body.dark h1,
body.dark h2,
body.dark h3 {
    color: #ffb6ff;
}

/* Link / icon / button */
body.dark a,
body.dark i {
    color: #ff9dff !important;
}

body.dark button {
    background: #ff74d9 !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 0 12px rgba(255, 140, 255, 0.4);
}

/* Soft fade */
#heartCanvas {
    width: 400px;
    height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

#sparkleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

@keyframes glowPulse {
    0% {
        filter: brightness(0.95) saturate(1.1);
    }

    50% {
        filter: brightness(1.15) saturate(1.3);
    }

    100% {
        filter: brightness(0.95) saturate(1.1);
    }
}

body.glow-mode {
    animation: glowPulse 6s ease-in-out infinite;
}

body {
    background: linear-gradient(120deg, #ffb7ff, #d696ff, #a06bff, #c793ff);
    background-size: 250% 250%;
    transition: background 1s ease;
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body.gradient-mode {
    animation: dreamyGradient 15s ease infinite;
}

.light-trail {
    position: fixed;
    width: 15px;
    height: 15px;
    background: radial-gradient(circle, rgba(255, 180, 255, 1), rgba(255, 180, 255, 0));
    border-radius: 50%;
    pointer-events: none;
    opacity: 1;
    transform: translate(-50%, -50%);
    animation: fadeOut 0.6s linear forwards;
    z-index: 999999;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
}

#settingsPanel {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(255, 210, 255, 0.85);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 999999;
}

#openSettings {
    position: fixed;
    top: 20px;
    right: 70px;
    border: none;
    background: #ffb3ff;
    padding: 12px 15px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 999999;
    transition: transform 0.2s ease;
}

#openSettings:active {
    transform: scale(0.9);
}

/* Animation trượt xuống */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#settingsPanel.show {
    display: flex !important;
    animation: slideDown 0.25s ease-out;
}

.tilt-card {
    transition: transform 0.2s ease;
    transform-style: preserve-3d;
}

button {
    position: relative;
    overflow: hidden;
    /* để ripple không tràn */
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 150, 255, 0.6);
    /* hồng pastel */
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ANIMATION */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* icon */
#chat-toggle {
    position: fixed;
    top: 20px;
    right: 130px;
    background: #ff4da6;
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    z-index: 999999999;
}

/* box */
#chat-box {
    position: absolute;
    top: 72px;
    right: 20px;
    width: 300px;
    height: 400px;
    background: #1e1e1e;
    color: white;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999999;
}

/* ẩn */
.hidden {
    display: none;
}

/* header */
.chat-header {
    background: #ff4da6;
    padding: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

/* messages */
#chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

/* input */
.chat-input {
    display: flex;
}

.chat-input input {
    flex: 1;
    padding: 8px;
    border: none;
}

.chat-input button {
    background: #ff4da6;
    border: none;
    color: white;
    padding: 8px;
}