/* --- THEME VARIABLES --- */
:root {
    --music-scale: 1; 
    --bg-color: #ffd372; --primary-color: #ff69b4; --text-color: #333;
    --blob1: #ff69b4; --blob2: #00f2fe; --blob3: #8a2be2; --blob4: #ff0844; --blob5: #ffffff; --blob6: #f9d423;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body, html { width: 100%; overflow-y: auto; overflow-x: hidden; background-color: var(--bg-color); font-family: 'Poppins', sans-serif; transition: background-color 0.5s ease; }
.hidden-element { visibility: hidden; opacity: 0; }
#lottie-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 1; pointer-events: none; overflow: hidden; }
.top-decoration { position: fixed; top: -50px; left: 0; width: 100%; object-fit: cover; z-index: 5; pointer-events: none; }
.birthday-banner { max-width: 700px; width: 90%; margin-bottom: 20px; z-index: 15; pointer-events: none; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.1)); animation: floatBanner 4s ease-in-out infinite; }
@keyframes floatBanner { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* --- AMBIENT BLOBS --- */
.ambient-blobs { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 0; pointer-events: none; overflow: hidden; transform: scale(var(--music-scale)); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; will-change: transform; animation: floatBlob 20s infinite alternate ease-in-out; transition: background-color 1s ease; }
.blob-1 { width: 45vw; height: 45vw; background: var(--blob1); top: -10%; left: -10%; animation-duration: 25s; }
.blob-2 { width: 35vw; height: 35vw; background: var(--blob2); bottom: -10%; right: -10%; animation-duration: 22s; animation-direction: alternate-reverse; }
.blob-3 { width: 40vw; height: 40vw; background: var(--blob3); top: 40%; left: 60%; animation-duration: 28s; }
.blob-4 { width: 30vw; height: 30vw; background: var(--blob4); top: 60%; left: 10%; animation-duration: 20s; animation-direction: alternate-reverse; }
.blob-5 { width: 35vw; height: 35vw; background: var(--blob5); top: 15%; right: 15%; animation-duration: 26s; }
.blob-6 { width: 45vw; height: 45vw; background: var(--blob6); bottom: -20%; left: 25%; animation-duration: 30s; }
@keyframes floatBlob { 0% { transform: translate(0vw, 0vh) scale(1); } 33% { transform: translate(25vw, -15vh) scale(1.15); } 66% { transform: translate(-15vw, 20vh) scale(0.85); } 100% { transform: translate(15vw, 15vh) scale(1); } }

/* --- SIDE WIDGETS --- */
#music-player, #theme-switcher { position: absolute; left: 30px; background: rgba(255, 255, 255, 0.6); padding: 15px 20px; border-radius: 20px; z-index: 50; backdrop-filter: blur(10px); border: 2px solid white; box-shadow: 0 10px 30px rgba(0,0,0,0.1); width: 220px; }
#music-player { bottom: 30px; }
#theme-switcher { top: 30px; } 
#music-player h4, #theme-switcher h4 { color: var(--primary-color); margin-bottom: 10px; font-family: 'Caveat Brush', cursive; font-size: 1.5rem; transition: color 0.5s ease;}
.swatch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 5px; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.1s ease, box-shadow 0.1s ease; box-sizing: border-box; }
.swatch:hover { transform: scale(1.2); z-index: 2; position: relative; }
.swatch.active { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 10px rgba(0,0,0,0.8); transform: scale(1.1); }
.controls button { padding: 8px 12px; border: none; background: #1a1a1a; color: white; border-radius: 10px; cursor: pointer; font-weight: bold; font-family: 'Poppins', sans-serif; transition: transform 0.1s;}
.controls button:active { transform: scale(0.95); }

#letter-notification { position: absolute; right: 40px; bottom: 30px; font-size: 4rem; cursor: pointer; z-index: 50; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.2)); animation: floatLetter 3s ease-in-out infinite; }
@keyframes floatLetter { 0%, 100% { transform: translateY(0px) rotate(0deg); } 50% { transform: translateY(-10px) rotate(5deg); } }
#letter-notification:hover { animation: none; transform: scale(1.1) rotate(-10deg); transition: transform 0.2s; }
.notification-dot { position: absolute; top: 0; right: -5px; width: 20px; height: 20px; background: #ff0844; border-radius: 50%; border: 3px solid white; animation: pulse 1.5s infinite; z-index: 2; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

#letter-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0,0,0,0.5); z-index: 300; display: none; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.letter-content { background: #fffaf0; padding: 40px; border-radius: 5px; max-width: 500px; width: 90%; text-align: left; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.3); border-top: 20px solid var(--primary-color); font-family: 'Poppins', sans-serif; }
.letter-content h2 { font-family: 'Caveat Brush', cursive; font-size: 3rem; color: var(--primary-color); margin-bottom: 20px; text-align: center;}
.close-letter { position: absolute; top: 10px; right: 20px; font-size: 1.5rem; cursor: pointer; color: #333; font-weight: bold;}
.typing-cursor { display: inline-block; width: 3px; color: var(--primary-color); font-weight: bold; font-size: 1.2rem; animation: blink 0.8s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
#typed-message { display: inline; font-size: 1.1rem; color: #333; line-height: 1.6; }

.hero-section { position: relative; width: 100%; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 10; overflow: hidden; }
#magic-btn { margin-top: 40px; padding: 16px 48px; font-size: 1.5rem; font-weight: 900; color: white; background-color: var(--primary-color); border: 3px solid #1a1a1a; border-radius: 50px; cursor: pointer; text-transform: uppercase; letter-spacing: 2px; box-shadow: 0px 8px 0px #1a1a1a; transition: background-color 0.5s ease, transform 0.1s ease, box-shadow 0.1s ease; z-index: 20; }
#magic-btn:hover { transform: translateY(4px); box-shadow: 0px 4px 0px #1a1a1a; }
#magic-btn:active { transform: translateY(8px); box-shadow: 0px 0px 0px #1a1a1a; }
#gif-overlay { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); z-index: 200; pointer-events: none; opacity: 0; }
#gif-overlay img { max-width: 400px; border-radius: 20px; }
.balloon { position: fixed; width: 60px; height: 75px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; z-index: 150; pointer-events: auto; cursor: crosshair; box-shadow: inset -10px -10px 20px rgba(0,0,0,0.1); }
.balloon::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; background: inherit; clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }

#photo-frame-container { perspective: 1200px; width: 320px; height: 420px; cursor: pointer; z-index: 30; }
.photo-frame { width: 100%; height: 100%; position: relative; border-radius: 30px; padding: 15px; background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 105, 180, 0.3)); box-shadow: 0 30px 60px rgba(0,0,0,0.2), inset 0 0 0 2px rgba(255, 255, 255, 0.8); transform-style: preserve-3d; will-change: transform; }
.frame-front, .frame-back { position: absolute; top: 15px; left: 15px; width: calc(100% - 30px); height: calc(100% - 30px); object-fit: cover; border-radius: 18px; box-shadow: inset 0 0 20px rgba(0,0,0,0.2); backface-visibility: hidden; }
.frame-back { transform: rotateY(180deg); }
.frame-glare { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 30px; background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.6) 25%, transparent 30%); z-index: 5; pointer-events: none; }

.game-section { position: relative; width: 100%; min-height: 80vh; display: flex; flex-direction: column; align-items: center; padding-top: 50px; padding-bottom: 50px; z-index: 10; background-color: rgba(255, 255, 255, 0.1); border-top: 4px dashed rgba(0,0,0,0.1); }
.game-title { font-family: 'Caveat Brush', cursive, sans-serif; font-size: 3rem; color: var(--primary-color); text-shadow: 2px 2px 0px rgba(255,255,255,0.8); margin-bottom: 10px; text-align: center; transition: color 0.5s ease; }
.game-instructions { font-size: 1.2rem; color: var(--text-color); margin-bottom: 20px; text-align: center; padding: 0 10px; transition: color 0.5s ease;}
.canvas-wrapper { position: relative; width: 1000px; max-width: 95%; border: 6px solid #1a1a1a; border-radius: 20px; background-color: #fff; box-shadow: 0px 15px 0px rgba(0,0,0,0.1); overflow: hidden; }
canvas { display: block; width: 100%; height: auto; cursor: pointer; touch-action: none; }
#game-over-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); display: none; flex-direction: column; justify-content: center; align-items: center; }
#game-over-screen h3 { font-size: 3rem; color: #1a1a1a; margin-bottom: 20px; }
#restart-btn { padding: 10px 30px; font-size: 1.2rem; font-weight: 900; color: white; background-color: var(--primary-color); border: 3px solid #1a1a1a; border-radius: 50px; cursor: pointer; box-shadow: 0px 5px 0px #1a1a1a; transition: background-color 0.5s ease, transform 0.1s; }
#restart-btn:active { transform: translateY(5px); box-shadow: 0px 0px 0px #1a1a1a; }
#mascot-hitbox { position: fixed; width: 250px; height: 250px; z-index: 100; pointer-events: none; }
#kaja-img { position: absolute; width: 100%; height: 100%; object-fit: contain; object-position: bottom; pointer-events: none; filter: drop-shadow(0px 10px 15px rgba(0,0,0,0.3)); }
.site-footer { width: 100%; padding: 25px 0; text-align: center; font-size: 1.2rem; color: var(--text-color); font-weight: 900; position: relative; z-index: 10; background-color: rgba(255, 255, 255, 0.2); border-top: 4px dashed rgba(0,0,0,0.1); }
.site-footer p { text-shadow: 1px 1px 0px rgba(255,255,255,0.5); }

/* =========================================
   SECRET DESIGNER PAD (Upgraded with Sidebar)
========================================= */
#secret-pad-btn { position: absolute; right: 40px; top: 120px; cursor: pointer; z-index: 500; transition: transform 0.2s; }
.pad-icon-img { width: 55px; height: 55px; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3)); }
#secret-pad-btn:hover { transform: scale(1.1) rotate(10deg); }

#secret-pad-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0,0,0,0.4); z-index: 600; display: none; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
.pad-glass-container { background: rgba(255, 255, 255, 0.3); width: 95%; max-width: 800px; height: 500px; border-radius: 20px; border: 2px solid rgba(255,255,255,0.5); box-shadow: 0 20px 50px rgba(0,0,0,0.3); position: relative; font-family: 'Poppins', sans-serif; overflow: hidden; }
.close-pad { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: #333; z-index: 10; font-weight: bold;}

.pad-layout { display: flex; width: 100%; height: 100%; }

/* Sidebar History */
.pad-sidebar { width: 30%; background: rgba(0,0,0,0.1); padding: 20px; border-right: 1px solid rgba(255,255,255,0.3); display: flex; flex-direction: column; }
#btn-new-note { background: var(--primary-color); color: white; border: none; padding: 12px; border-radius: 10px; font-weight: bold; cursor: pointer; margin-bottom: 20px; transition: transform 0.1s; box-shadow: 0 4px 6px rgba(0,0,0,0.1);}
#btn-new-note:active { transform: scale(0.95); }
.pad-sidebar h4 { color: #333; font-size: 1rem; margin-bottom: 10px; border-bottom: 2px solid rgba(255,255,255,0.5); padding-bottom: 5px; }
#note-history-list { list-style: none; overflow-y: auto; flex-grow: 1; }
#note-history-list li { background: rgba(255,255,255,0.5); padding: 10px; border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-size: 0.9rem; font-weight: bold; color: #333; transition: background 0.2s; }
#note-history-list li:hover { background: rgba(255,255,255,0.8); }

/* Workspace Area */
.pad-workspace { width: 70%; padding: 20px; display: flex; flex-direction: column; }
.pad-tabs { display: flex; gap: 10px; margin-bottom: 15px; margin-right: 30px; }
.pad-tabs button { flex: 1; padding: 10px; border: none; background: rgba(255,255,255,0.5); color: #333; font-weight: bold; border-radius: 10px; cursor: pointer; transition: 0.2s; }
.pad-tabs button.active { background: var(--primary-color); color: white; }

.pad-content-area { width: 100%; flex-grow: 1; background: rgba(255,255,255,0.9); border-radius: 10px; overflow: hidden; position: relative; box-shadow: inset 0 4px 10px rgba(0,0,0,0.1); margin-bottom: 15px; }
#pad-canvas { width: 100%; height: 100%; cursor: crosshair; display: block; touch-action: none;}
#pad-textarea { width: 100%; height: 100%; padding: 15px; border: none; resize: none; font-family: 'Caveat Brush', cursive; font-size: 1.8rem; color: #333; outline: none; background: transparent; }

.pad-controls { display: flex; justify-content: space-between; align-items: center; }
.pad-actions { display: flex; gap: 10px; width: 50%; }
.pad-actions button { flex: 1; padding: 12px; border: none; font-weight: bold; border-radius: 10px; cursor: pointer; color: white; transition: 0.1s; }
#pad-clear { background: #333; }
#pad-save { background: var(--primary-color); }
#pad-save:active, #pad-clear:active { transform: scale(0.95); }

/* Checkbox */
.checkbox-container { display: flex; align-items: center; color: #333; font-size: 0.9rem; cursor: pointer; position: relative; padding-left: 30px; user-select: none; font-weight: bold; }
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { position: absolute; top: 0; left: 0; height: 20px; width: 20px; background-color: rgba(255,255,255,0.8); border-radius: 4px; border: 2px solid #333; }
.checkbox-container input:checked ~ .checkmark { background-color: var(--primary-color); border-color: var(--primary-color); }
.checkmark:after { content: ""; position: absolute; display: none; left: 6px; top: 2px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.checkbox-container input:checked ~ .checkmark:after { display: block; }

/* Overlay for PIN & Naming */
#pad-action-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 20; display: flex; flex-direction: column; justify-content: center; align-items: center; backdrop-filter: blur(5px); color: white; }
#pad-action-overlay h3 { font-family: 'Caveat Brush', cursive; font-size: 2.5rem; margin-bottom: 15px; }
#note-name-input { padding: 12px 20px; border-radius: 10px; border: 2px solid var(--primary-color); font-family: 'Poppins', sans-serif; font-size: 1.1rem; outline: none; margin-bottom: 20px; width: 250px; text-align: center; }
.pin-display { font-size: 2.5rem; letter-spacing: 15px; margin-bottom: 20px; font-weight: bold; height: 50px;}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 250px; margin: 0 auto; margin-bottom: 20px;}
.num-key { background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.5); color: white; font-size: 1.2rem; padding: 12px 0; border-radius: 50%; cursor: pointer; font-weight: bold; aspect-ratio: 1; }
.num-key:active { background: var(--primary-color); }
.enter-key { background: var(--primary-color); border: none; }
.clear-key { background: #333; border: none; }
#cancel-action-btn { background: none; border: none; color: #ccc; cursor: pointer; text-decoration: underline; font-family: 'Poppins'; }
#confirm-action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 900;
    font-family: 'Poppins';
    font-size: 1.1rem;
    cursor: pointer;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
#confirm-action-btn:active { transform: scale(0.95); }

@media (max-width: 768px) {
    .birthday-banner { max-width: 320px; }
    #photo-frame-container { width: 260px; height: 350px; }
    #magic-btn { font-size: 1.2rem; padding: 12px 36px; margin-top: 30px; }
    #music-player, #theme-switcher { position: relative; left: 0; bottom: 0; top: 0; margin-top: 20px; width: 90%; max-width: 300px; }
    #secret-pad-btn { top: 20px; right: 20px; }
    .pad-icon-img { width: 45px; height: 45px; }
    #letter-notification { position: absolute; right: 20px; top: 15px; bottom: auto; font-size: 3rem; }
    .pad-layout { flex-direction: column; }
    .pad-sidebar { width: 100%; height: 30%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.3); padding: 15px; }
    .pad-workspace { width: 100%; height: 70%; padding: 15px; }
    .pad-controls { flex-direction: column; gap: 10px; }
    .pad-actions { width: 100%; }
    .game-title { font-size: 2.2rem; line-height: 1.1; }
    .game-instructions { font-size: 0.95rem; }
}