:root {
    --title-face: #ff5c84;
    --title-side: #c9184a;
    --blob-1: #ffc2d1;
    --blob-2: #ffd6a5;
    --blob-3: #e0c3fc;

    color-scheme: light;
    --bg-gradient: linear-gradient(135deg, #fff0f3 0%, #ffe5ec 45%, #ffd6e0 100%);
    --text-gradient: linear-gradient(135deg, #a4133c 0%, #c9184a 35%, #ff4d6d 75%, #ff758f 100%);
    --heart-color: #ff4d6d;
    --accent-glow: rgba(255, 77, 109, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.75);
    --pill-border: rgba(255, 179, 193, 0.55);
    --pill-text: #800f2f;
    --ribbon-color: #ff758f;
    --theme-active-ring: #ff4d6d;
    --swatch-shadow: rgba(255, 77, 109, 0.35);
}

[data-theme="lavender"] {
    --title-face: #a45ee5;
    --title-side: #6a2bb0;
    --blob-1: #e0c3fc;
    --blob-2: #ffc2e2;
    --blob-3: #c3d8ff;

    --bg-gradient: linear-gradient(135deg, #fbf8ff 0%, #f3ebfc 45%, #e8dff5 100%);
    --text-gradient: linear-gradient(135deg, #5a189a 0%, #7b2cbf 35%, #9d4edd 75%, #c77dff 100%);
    --heart-color: #9d4edd;
    --accent-glow: rgba(157, 78, 221, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.75);
    --pill-border: rgba(216, 187, 245, 0.55);
    --pill-text: #4a154b;
    --ribbon-color: #b5838d;
    --theme-active-ring: #9d4edd;
    --swatch-shadow: rgba(157, 78, 221, 0.35);
}

[data-theme="blue"] {
    --title-face: #2eaee0;
    --title-side: #0369a1;
    --blob-1: #bde7ff;
    --blob-2: #ffd1ec;
    --blob-3: #d6ccff;

    --bg-gradient: linear-gradient(135deg, #f0f8ff 0%, #e2f0fc 45%, #d0e6fb 100%);
    --text-gradient: linear-gradient(135deg, #023e8a 0%, #0077b6 35%, #0096c7 75%, #48cae4 100%);
    --heart-color: #0096c7;
    --accent-glow: rgba(0, 150, 199, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.75);
    --pill-border: rgba(162, 210, 255, 0.55);
    --pill-text: #03045e;
    --ribbon-color: #48cae4;
    --theme-active-ring: #0096c7;
    --swatch-shadow: rgba(0, 150, 199, 0.35);
}

[data-theme="peach"] {
    --title-face: #f2784b;
    --title-side: #b5452a;
    --blob-1: #ffd6a5;
    --blob-2: #ffc2d1;
    --blob-3: #fff1a8;

    --bg-gradient: linear-gradient(135deg, #fff5eb 0%, #ffe8d6 45%, #fdd1b6 100%);
    --text-gradient: linear-gradient(135deg, #bc4749 0%, #e76f51 35%, #f4a261 75%, #e9c46a 100%);
    --heart-color: #e76f51;
    --accent-glow: rgba(231, 111, 81, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.75);
    --pill-border: rgba(244, 162, 97, 0.55);
    --pill-text: #6b2d18;
    --ribbon-color: #f4a261;
    --theme-active-ring: #e76f51;
    --swatch-shadow: rgba(231, 111, 81, 0.35);
}

[data-theme="matcha"] {
    --title-face: #48a77a;
    --title-side: #2d6a4f;
    --blob-1: #c7f0d8;
    --blob-2: #ffd6e0;
    --blob-3: #fdf3b8;

    --bg-gradient: linear-gradient(135deg, #f4f9f4 0%, #e8f5e9 45%, #d8ebd8 100%);
    --text-gradient: linear-gradient(135deg, #1b4332 0%, #2d6a4f 35%, #40916c 75%, #52b788 100%);
    --heart-color: #40916c;
    --accent-glow: rgba(64, 145, 108, 0.45);
    --pill-bg: rgba(255, 255, 255, 0.75);
    --pill-border: rgba(149, 213, 178, 0.55);
    --pill-text: #1b4332;
    --ribbon-color: #52b788;
    --theme-active-ring: #40916c;
    --swatch-shadow: rgba(64, 145, 108, 0.35);
}

[data-theme="dark"] {
    --title-face: #ff5c84;
    --title-side: #8a0f2e;
    --blob-1: #5c1a3a;
    --blob-2: #3a1a5c;
    --blob-3: #5c1a2a;

    --bg-gradient: linear-gradient(135deg, #0d0b0f 0%, #16121a 45%, #221827 100%);
    --text-gradient: linear-gradient(135deg, #ff4d6d 0%, #ff758f 35%, #ffb3c1 75%, #ffffff 100%);
    --heart-color: #ff4d6d;
    --accent-glow: rgba(255, 77, 109, 0.65);
    --pill-bg: rgba(30, 24, 38, 0.75);
    --pill-border: rgba(255, 77, 109, 0.35);
    --pill-text: #ffd6e0;
    --ribbon-color: #ff758f;
    --theme-active-ring: #ff4d6d;
    --swatch-shadow: rgba(255, 77, 109, 0.55);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    color-scheme: light;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: #fff0f3;
    font-family: 'Fredoka', 'Quicksand', -apple-system, sans-serif;
    position: relative;
}

.bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.bg-layer.active {
    opacity: 1;
}

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

.top-bar {
    position: relative;
    z-index: 20;
    padding-top: 28px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.center-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    margin: auto 0;
    overflow: visible;
}

.subtle-quote {
    font-family: 'Quicksand', -apple-system, sans-serif;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    color: var(--pill-text);
    opacity: 0.62;
    letter-spacing: 0.3px;
    margin-top: 14px;
    max-width: 90vw;
    line-height: 1.5;
    transition: opacity 0.35s ease, color 0.6s ease;
    cursor: default;
}

.subtle-quote:hover {
    opacity: 0.95;
}

.bottom-bar {
    position: relative;
    z-index: 20;
    padding-bottom: 28px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ============ ౨ৎ cute 3D layer ౨ৎ ============ */

#heartCanvas { z-index: 2; }

.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.blob {
    position: absolute;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    transition: background 0.9s ease;
    animation: blobFloat 18s ease-in-out infinite alternate;
}
.b1 { background: var(--blob-1); top: -14vmax; left: -12vmax; }
.b2 { background: var(--blob-2); bottom: -18vmax; right: -14vmax; animation-duration: 22s; animation-delay: -6s; }
.b3 { background: var(--blob-3); top: 30%; left: 55%; width: 30vmax; height: 30vmax; animation-duration: 26s; animation-delay: -12s; }
[data-theme="dark"] .blob { opacity: 0.4; }

@keyframes blobFloat {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(6vw, 4vh) scale(1.12); }
    100% { transform: translate(-4vw, 8vh) scale(0.94); }
}

#fxLayer {
    position: fixed;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    overflow: hidden;
}

/* --- music button equalizer --- */
/* --- 3D tilt stage --- */
.center-content {
    --rx: 0deg;
    --ry: 0deg;
    transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
    transform-style: preserve-3d;
    gap: 2px;
}

/* --- hero heart slot (3D heart is rendered by WebGL right here) --- */
.hero-slot {
    position: relative;
    width: clamp(140px, 25vh, 250px);
    height: clamp(140px, 25vh, 250px);
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transform: translateZ(30px);
    margin-bottom: -6px;
    outline: none;
}
.hero-slot:focus-visible { box-shadow: 0 0 0 3px var(--theme-active-ring); }
.hero-glow {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
    filter: blur(12px);
    animation: glowPulse 1.8s ease-in-out infinite;
    z-index: -1;
}
.hero-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px dashed var(--pill-border);
    opacity: 0;
    transform: scale(0.8);
}
.hero-slot.pulse .hero-ring { animation: ringOut 0.7s ease-out; }
.hero-hint {
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%) rotate(-4deg);
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--pill-text);
    opacity: 0.75;
    white-space: nowrap;
    animation: hintBob 2.2s ease-in-out infinite;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.hero-hint.gone { opacity: 0; }

@keyframes glowPulse {
    0%, 100% { transform: scale(0.92); opacity: 0.75; }
    14% { transform: scale(1.06); opacity: 1; }
    42% { transform: scale(1.03); opacity: 0.95; }
}
@keyframes ringOut {
    0% { opacity: 0.9; transform: scale(0.7); }
    100% { opacity: 0; transform: scale(1.35); }
}
@keyframes hintBob {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(-4deg); }
    50% { transform: translateX(-50%) translateY(-5px) rotate(3deg); }
}

/* --- puffy 3D title --- */
.main-title {
    font-family: 'Fredoka', 'Quicksand', sans-serif;
    font-size: clamp(3.6rem, 13vw, 8.6rem);
    font-weight: 700;
    line-height: 1.15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.16em;
    padding: 0 20px 0.12em;
    transform: translateZ(60px);
    transform-style: preserve-3d;
}
.title-text { display: inline-flex; letter-spacing: -0.01em; }
.l {
    display: inline-block;
    animation: bob 2.6s ease-in-out infinite;
    animation-delay: calc(var(--i) * -0.18s);
}
.lc {
    position: relative;
    display: inline-block;
    color: var(--title-face);
    cursor: pointer;
    transition: color 0.6s ease;
    text-shadow:
        0 1px 0 var(--title-side), 0 2px 0 var(--title-side), 0 3px 0 var(--title-side),
        0 4px 0 var(--title-side), 0 5px 0 var(--title-side), 0 6px 0 var(--title-side),
        0 7px 0 var(--title-side), 0 8px 0 var(--title-side),
        0 12px 10px rgba(0, 0, 0, 0.12), 0 18px 34px var(--accent-glow);
}
.lc::before {
    content: attr(data-c);
    position: absolute;
    inset: 0;
    color: transparent;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.15) 34%, rgba(255, 255, 255, 0) 46%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
    pointer-events: none;
}
.lc.jelly { animation: jelly 0.75s cubic-bezier(0.34, 1.56, 0.64, 1); }

.heart-icon {
    display: inline-block;
    font-size: 0.72em;
    animation: heartbeat 1.8s ease-in-out infinite;
    transform-origin: center;
}

@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-0.06em) rotate(-3deg); }
    75% { transform: translateY(0.03em) rotate(2deg); }
}
@keyframes jelly {
    0% { transform: scale(1, 1); }
    25% { transform: scale(1.28, 0.74) translateY(0.06em); }
    45% { transform: scale(0.82, 1.24) translateY(-0.14em); }
    65% { transform: scale(1.1, 0.92); }
    82% { transform: scale(0.97, 1.04); }
    100% { transform: scale(1, 1); }
}
@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.18); }
    28% { transform: scale(1); }
    42% { transform: scale(1.14); }
    70% { transform: scale(1); }
}

.subtle-quote { transform: translateZ(25px); margin-top: 6px; }

/* --- kiss counter --- */
/* --- floating love popups --- */
.pop {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    color: var(--title-face);
    text-shadow: 0 2px 0 #fff, 0 6px 18px var(--accent-glow);
    white-space: nowrap;
    transform: translate(-50%, -50%);
    animation: popUp 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
[data-theme="dark"] .pop { text-shadow: 0 2px 0 #2a1020, 0 6px 18px var(--accent-glow); }
@keyframes popUp {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4) rotate(var(--r, 0deg)); }
    18% { opacity: 1; transform: translate(-50%, -80%) scale(1.15) rotate(var(--r, 0deg)); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -260%) scale(0.9) rotate(var(--r, 0deg)); }
}

/* theme switch flash */
.theme-flash {
    position: fixed;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    background: radial-gradient(circle at var(--fx, 50%) var(--fy, 90%), rgba(255, 255, 255, 0.7), transparent 60%);
    animation: flash 0.7s ease-out forwards;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

@media (max-width: 600px) {
    .main-title { gap: 0.12em; }
    .lc {
        text-shadow:
            0 1px 0 var(--title-side), 0 2px 0 var(--title-side), 0 3px 0 var(--title-side),
            0 4px 0 var(--title-side), 0 5px 0 var(--title-side),
            0 9px 8px rgba(0, 0, 0, 0.12), 0 14px 26px var(--accent-glow);
    }
}

@media (max-height: 560px) {
    .hero-slot { width: 110px; height: 110px; }
    .main-title { font-size: clamp(2.6rem, 9vw, 5rem); }
}

@media (prefers-reduced-motion: reduce) {
    .l, .blob, .hero-hint { animation: none; }
}


/* ============ refined controls ============ */

.music-btn {
    appearance: none;
    border: 0;
    background: none;
    padding: 6px 2px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--pill-text);
    font-family: 'Quicksand', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: lowercase;
    opacity: 0.62;
    transition: opacity 0.3s ease, color 0.6s ease;
}
.music-btn:hover { opacity: 1; }
.music-btn:focus-visible { opacity: 1; outline: 1px solid currentColor; outline-offset: 6px; border-radius: 2px; }
.music-label { position: relative; }
.music-label::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0.24em;
    bottom: -5px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.music-btn:hover .music-label::after { transform: scaleX(1); }
.music-label em { font-style: normal; }
.music-label .state-on { display: none; }
.music-btn.playing .state-on { display: inline; }
.music-btn.playing .state-off { display: none; }

.eq { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.eq i { display: block; width: 2px; height: 2px; border-radius: 1px; background: currentColor; }
.music-btn.playing .eq i { animation: eqBar 1.1s ease-in-out infinite; }
.music-btn.playing .eq i:nth-child(2) { animation-delay: -0.35s; }
.music-btn.playing .eq i:nth-child(3) { animation-delay: -0.7s; }
.music-btn.playing .eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes eqBar { 0%, 100% { height: 3px; } 50% { height: 12px; } }

/* kiss counter: plain type, no box */
.kiss-count {
    margin-top: 18px;
    display: inline-flex;
    align-items: baseline;
    gap: 12px;
    color: var(--pill-text);
    transform: translateZ(35px);
    transition: color 0.6s ease;
}
.kc-num {
    display: inline-block;
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: 2rem;
    line-height: 1;
    color: var(--title-face);
    font-variant-numeric: tabular-nums;
    transition: color 0.6s ease;
}
.kc-num.bump { animation: numIn 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes numIn { from { transform: translateY(35%); opacity: 0; } to { transform: none; opacity: 1; } }
.kc-label {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: lowercase;
    opacity: 0.62;
}
.kc-label::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 1px;
    margin-right: 12px;
    vertical-align: middle;
    background: currentColor;
    opacity: 0.7;
}

/* theme picker: bare dots + name */
.theme-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.theme-bar { display: flex; align-items: center; gap: 10px; }
.theme-dot {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    cursor: pointer;
    border-radius: 50%;
    color: var(--pill-text);
}
.dot-swatch {
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    opacity: 0.7;
    transition: opacity 0.25s ease, outline-color 0.25s ease;
    outline: 1px solid transparent;
    outline-offset: 3px;
}
.theme-dot:hover .dot-swatch { opacity: 1; }
.theme-dot.active .dot-swatch { opacity: 1; outline-color: currentColor; }
.theme-dot:focus-visible { outline: none; }
.theme-dot:focus-visible .dot-swatch { outline-color: currentColor; opacity: 1; }
.swatch-pink { background: #ff5c84; }
.swatch-lavender { background: #a45ee5; }
.swatch-blue { background: #2eaee0; }
.swatch-peach { background: #f2784b; }
.swatch-matcha { background: #48a77a; }
.swatch-dark { background: #3a2433; box-shadow: inset 0 0 0 1px rgba(255, 92, 132, 0.6); }
.theme-name {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: 0.98rem;
    color: var(--pill-text);
    opacity: 0.6;
    min-height: 1.3em;
    transition: opacity 0.25s ease, color 0.6s ease;
}
