/* ==========================================================================
   CSS Retro Game Design — "365 Days With You"
   Theme: The Ethereal 8-Bit Abyss (Retro black, pixel pink, starlight gold)
   Inspired by: C:\Users\patri\Desktop\jellyfish
   ========================================================================== */

/* Variables */
:root {
    --bg-dark: #000000;
    --bg-light: #06060a;
    --primary-pink: #E8A0BF;
    --primary-pink-dark: #D580A8;
    --primary-pink-light: #F8D8E8;
    --primary-gold: #FFD700;
    --primary-gold-dark: #FFA500;
    --primary-gold-light: #FFE880;
    --accent-purple: #C8A0E0;
    --glass-bg: rgba(6, 6, 10, 0.85);
    --glass-border: #E8A0BF;
    --glass-glow: rgba(232, 160, 191, 0.15);
    --text-main: #FFFFFF;
    --text-muted: #F8D8E8;
    --font-heading: 'Press Start 2P', monospace;
    --font-display: 'Silkscreen', monospace;
    --font-body: 'VT323', monospace;
    --transition-smooth: all 0.2s steps(4); /* Retro stepped frame-by-frame animation! */
}

/* CRT Scanlines Overlay */
.crt::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(232, 160, 191, 0.05), rgba(255, 215, 0, 0.02), rgba(200, 160, 220, 0.05));
    z-index: 99999;
    background-size: 100% 4px, 4px 100%;
    pointer-events: none;
    opacity: 0.8;
}

/* CRT Screen Flicker */
@keyframes crt-flicker {
    0% { opacity: 0.99; }
    50% { opacity: 1.0; }
    100% { opacity: 0.99; }
}

html.crt {
    animation: crt-flicker 0.15s infinite;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 30%, #080812 0%, var(--bg-dark) 85%);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.2rem; /* VT323 is slightly small; scaling up for cozy reading */
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    padding-bottom: 4rem;
}

/* Ambient Background: Starfield & Bubbles */
.starfield, .bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background-color: #ffffff;
    border-radius: 0; /* Retro square stars! */
    animation: twinkle var(--duration, 4s) infinite ease-in-out;
    opacity: 0.1;
}

.bubble {
    position: absolute;
    bottom: -60px; /* Lower start to accommodate larger 48px stars */
    animation: float-up var(--duration, 15s) linear forwards;
    pointer-events: none;
}

.bubble svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Main Container Layout */
.app-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    position: relative;
    z-index: 1;
}

/* Retro Speaker Control */
.audio-control-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 8px; /* Square block button */
    background: var(--glass-bg);
    border: 3px solid var(--primary-pink);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0px rgba(232, 160, 191, 0.2);
    transition: var(--transition-smooth);
}

.audio-control-btn:hover {
    transform: scale(1.1) translateY(-4px);
    border-color: var(--primary-gold);
    box-shadow: 4px 4px 0px rgba(255, 215, 0, 0.3);
}

.audio-icon {
    width: 24px;
    height: 24px;
    fill: var(--text-main);
    transition: var(--transition-smooth);
}

.audio-control-btn:hover .audio-icon {
    fill: var(--primary-gold);
}

.audio-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #06060a;
    border: 2px solid var(--primary-pink);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    color: var(--text-main);
    box-shadow: 3px 3px 0px rgba(232, 160, 191, 0.2);
}

.audio-control-btn:hover .audio-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Retro Double-Border Panels */
.glass-panel {
    background: var(--glass-bg);
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    box-shadow: 6px 6px 0px rgba(232, 160, 191, 0.15);
    transition: var(--transition-smooth);
}

.title-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: #0a060d;
    border: 2px solid var(--primary-pink);
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--primary-pink);
    margin-bottom: 1.5rem;
    box-shadow: 3px 3px 0px rgba(232, 160, 191, 0.25);
    animation: pulse-badge 2s infinite ease-in-out;
}

/* Canvas / Visual Centerpiece */
.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 480px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    background: #040406;
}

.canvas-wrapper:hover {
    border-color: var(--primary-gold);
    box-shadow: 6px 6px 0px rgba(255, 215, 0, 0.15);
}

.canvas-hint {
    position: absolute;
    top: 1rem;
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--primary-pink-light);
    letter-spacing: 1px;
    pointer-events: none;
    text-transform: uppercase;
    animation: fade-pulse 2s infinite ease-in-out;
}

#etherealCanvas {
    background: transparent;
    user-select: none;
}

/* SVG Group Animation Tweaks (positions driven by JS) */
#jellyfishSvg {
    cursor: pointer;
    transition: filter 0.5s ease;
}

#starSvg {
    cursor: pointer;
    transition: filter 0.5s ease;
}

#jellyfishSvg:hover, #jellyfishSvg.active {
    filter: drop-shadow(0 0 16px var(--primary-pink));
}

#starSvg:hover, #starSvg.active {
    filter: drop-shadow(0 0 20px var(--primary-gold));
}

/* Animations Keyframes */

@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.9); }
    50% { opacity: 0.85; transform: scale(1.1); }
}

@keyframes float-up {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: var(--max-opacity, 0.6); }
    90% { opacity: var(--fade-opacity, 0.4); }
    100% { transform: translateY(-110vh) rotate(360deg); opacity: 0; }
}

@keyframes pulse-badge {
    0%, 100% { border-color: var(--primary-pink); box-shadow: 3px 3px 0px rgba(232, 160, 191, 0.25); }
    50% { border-color: var(--primary-gold); box-shadow: 3px 3px 0px rgba(255, 215, 0, 0.25); }
}

@keyframes fade-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem;
    }

    .canvas-wrapper {
        height: 380px;
    }

    .audio-control-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 48px;
        height: 48px;
        border-radius: 6px;
    }
}

/* ==========================================================================
   GBA Interactive Overhaul Styles
   ========================================================================== */

.hidden {
    display: none !important;
}

/* Screen Flash Effect */
.screen-flash-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    transition: none;
}

.screen-flash-overlay.active {
    animation: retro-flash 0.35s steps(4) forwards;
}

@keyframes retro-flash {
    0% { opacity: 0; }
    30% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes fade-in-stepped {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* GBA Title Screen Styles */
.title-screen-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    padding: 2rem 0;
    animation: fade-in-stepped 0.4s steps(4);
}

.title-logo-wrapper {
    margin-bottom: 2.5rem;
    text-align: center;
}

.title-logo {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 5.5vw, 2.4rem);
    color: #ffffff;
    text-shadow: 4px 4px 0px var(--primary-pink-dark);
    margin-bottom: 0.9rem;
    letter-spacing: 1px;
    line-height: 1.2;
    font-weight: normal;
}

.title-rose {
    display: inline-block;
    transition: opacity 0.2s ease;
    font-size: 0.9em;
    filter: drop-shadow(0 0 8px rgba(232, 160, 191, 0.5));
}

/* GBA Title Menu */
.menu-container {
    background: var(--glass-bg);
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    padding: 1.1rem 1.5rem;
    min-width: 260px;
    box-shadow: 6px 6px 0px rgba(232, 160, 191, 0.15);
    margin-bottom: 2rem;
}

.gba-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
}

.menu-item {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0.4rem;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

/* Locked items are hidden from layout until the player has earned them
   (e.g. VIEW STATS unlocks after the climax title-reveal fires). */
.menu-item.locked {
    display: none;
}

.menu-item.active {
    color: var(--primary-gold);
    text-shadow: 2px 2px 0px var(--primary-gold-dark);
    border-color: rgba(255, 215, 0, 0.15);
    background: rgba(255, 215, 0, 0.03);
}

.menu-item:hover {
    color: var(--primary-gold);
}

.menu-selector {
    display: inline-block;
    width: 20px;
    font-family: var(--font-display);
}

.menu-item.active .menu-selector {
    animation: menu-blink 0.8s infinite steps(2);
}

@keyframes menu-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.title-footer {
    margin-top: 1.5rem;
}

.controls-hint {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--primary-pink-light);
    opacity: 0.8;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

/* GBA Game Screen Container */
.game-screen-container {
    animation: fade-in-stepped 0.4s steps(4);
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding: 0 0.5rem;
}

.hud-btn {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--primary-pink-light);
    background: var(--glass-bg);
    border: 2px solid var(--primary-pink);
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px rgba(232, 160, 191, 0.2);
    transition: var(--transition-smooth);
}

.hud-btn:hover {
    color: var(--primary-gold);
    border-color: var(--primary-gold);
    box-shadow: 3px 3px 0px rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

.hud-status {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--primary-gold-light);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* GBA Bottom Dialogue Box */
.gba-dialog-box {
    margin-top: 1.5rem;
    background: #06060a;
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    padding: 1.2rem 1.5rem;
    min-height: 110px;
    position: relative;
    box-shadow: 6px 6px 0px rgba(232, 160, 191, 0.15);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.dialog-speaker {
    position: absolute;
    top: -15px;
    left: 20px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: #ffffff;
    background: #06060a;
    border: 2px solid var(--primary-pink);
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    box-shadow: 2px 2px 0px rgba(232, 160, 191, 0.2);
    text-transform: uppercase;
}

.gba-dialog-box.speaker-star {
    border-color: var(--primary-gold);
    box-shadow: 6px 6px 0px rgba(255, 215, 0, 0.15);
}

.gba-dialog-box.speaker-star .dialog-speaker {
    border-color: var(--primary-gold);
    box-shadow: 2px 2px 0px rgba(255, 215, 0, 0.2);
}

.dialog-content {
    margin-top: 0.4rem;
    font-family: var(--font-body);
    font-size: 1.45rem;
    line-height: 1.4;
    color: var(--text-main);
}

.dialog-arrow {
    position: absolute;
    bottom: 8px;
    right: 15px;
    font-size: 0.9rem;
    color: var(--primary-gold);
    animation: arrow-bounce 0.8s infinite steps(2);
    display: none; /* Triggered when dialogue completes */
}

@keyframes arrow-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* GBA Save Screen & Slot Styling */
.save-screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 2rem 0;
    animation: fade-in-stepped 0.4s steps(4);
}

.save-screen-inner {
    width: 100%;
    max-width: 440px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.save-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: #ffffff;
    text-shadow: 3px 3px 0px var(--primary-pink-dark);
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.save-slot-card {
    background: #06060a;
    border: 4px double var(--primary-gold);
    border-radius: 8px;
    width: 100%;
    box-shadow: 6px 6px 0px rgba(255, 215, 0, 0.15);
    margin-bottom: 2.5rem;
    text-align: left;
    overflow: hidden;
}

.save-slot-header {
    background: rgba(255, 215, 0, 0.08);
    border-bottom: 2px solid var(--primary-gold);
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-slot-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--primary-gold);
    font-weight: bold;
}

.save-slot-badge {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: #ffffff;
    background: var(--primary-gold-dark);
    padding: 0.1rem 0.5rem;
    border-radius: 2px;
}

.save-slot-body {
    padding: 0.9rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.save-slot-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-body);
    font-size: 1.25rem;
    border-bottom: 1px dashed rgba(255, 215, 0, 0.15);
    padding-bottom: 0.3rem;
}

.save-slot-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.save-label {
    color: var(--primary-gold-light);
    opacity: 0.8;
}

.save-val {
    color: #ffffff;
    text-align: right;
}

.save-val.text-pink {
    color: var(--primary-pink);
    font-weight: bold;
}

.save-val.text-gold {
    color: var(--primary-gold);
    font-weight: bold;
}

.save-val.text-glow {
    color: #ffffff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.save-back-btn {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary-pink);
    background: var(--glass-bg);
    border: 3px solid var(--primary-pink);
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    box-shadow: 4px 4px 0px rgba(232, 160, 191, 0.2);
    transition: var(--transition-smooth);
}

.save-back-btn:hover {
    color: var(--primary-gold);
    border-color: var(--primary-gold);
    box-shadow: 4px 4px 0px rgba(255, 215, 0, 0.25);
    transform: translateY(-4px);
}

/* ==========================================================================
   GBA Lift & Anniversary Animation Stages
   ========================================================================== */

/* Animation Stage Container */
.animation-stage {
    position: relative;
    width: 100%;
    height: 360px;
    overflow: hidden;
    background: #040406;
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    box-shadow: 6px 6px 0px rgba(232, 160, 191, 0.15);
}

/* Character Placement wrapper */
.pixel-char {
    position: absolute;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: none;
    z-index: 4; /* above .placed-food (z-index 2) so dialog bubbles overlap food cleanly */
}

.sprite-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Character Specific positions on Lift Stage */
#liftJellyfish {
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);
    animation: float-jellyfish-subtle 4s infinite ease-in-out;
}

#liftStar {
    left: 50%;
    top: -120px; /* starts off-screen */
    transform: translate(-50%, -50%);
    animation: float-star-subtle 5s infinite ease-in-out;
}

@keyframes float-jellyfish-subtle {
    0%, 100% { transform: translate(-50%, -50%) translateY(0) rotate(-1deg); }
    50% { transform: translate(-50%, -50%) translateY(-8px) rotate(1deg); }
}

@keyframes float-star-subtle {
    0%, 100% { transform: translate(-50%, -50%) translateY(0) rotate(1deg); }
    50% { transform: translate(-50%, -50%) translateY(-6px) rotate(-1deg); }
}

/* Particles overlay styled as pixel blocks */
.lift-particle-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.lift-particle {
    position: absolute;
    background-color: var(--primary-gold);
    width: 6px;
    height: 6px;
    border-radius: 0; /* Square retro particles! */
    animation: lift-float var(--dur, 3s) linear forwards;
    opacity: 0.8;
}

.lift-particle.pink {
    background-color: var(--primary-pink);
}

@keyframes lift-float {
    0% { transform: translateY(0) scale(1); opacity: 0.8; }
    80% { opacity: 0.6; }
    100% { transform: translateY(-400px) scale(0.6); opacity: 0; }
}

/* Anniversary Screen Styles */
.anniversary-screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 2rem 0;
    animation: fade-in-stepped 0.4s steps(4);
}

.anniversary-card {
    background: var(--glass-bg);
    border: 4px double var(--primary-pink);
    border-radius: 8px;
    padding: 1.8rem 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 6px 6px 0px rgba(232, 160, 191, 0.15);
    text-align: center;
}

.anniversary-title {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 3.8vw, 1.6rem);
    color: #ffffff;
    text-shadow: 3px 3px 0px var(--primary-pink-dark);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    white-space: nowrap;
    opacity: 0;
    transform: scale(0.7);
    transform-origin: 50% 50%;
    transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.18, 1.5, 0.3, 1);
}

.anniversary-title.revealed {
    opacity: 1;
    transform: scale(1);
}

/* "EST. MAY 21, 2025" — sits under the revealed HAPPY ONE YEAR title.
   Tied to the title's .revealed state via sibling combinator so it fades in
   shortly after the title pops. */
.anniversary-date-caption {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--primary-gold-light);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 0.55s ease 0.15s;
    text-shadow: 1px 1px 0px rgba(255, 215, 0, 0.15);
}

.anniversary-title.revealed + .anniversary-date-caption {
    opacity: 0.85;
}

.anniversary-closing {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.45;
    color: var(--primary-pink-light);
    text-shadow: 1px 1px 0px rgba(232, 160, 191, 0.2);
    margin: 0 0 1.4rem;
    padding: 0 0.4rem;
    min-height: 1.5em;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.anniversary-closing.visible {
    opacity: 1;
}

.anniversary-stage {
    position: relative;
    width: 100%;
    height: 260px;
    /* Warm cozy interior — rose wallpaper with very subtle vertical stripes */
    background:
        repeating-linear-gradient(90deg, transparent 0, transparent 16px, rgba(255, 255, 255, 0.025) 16px, rgba(255, 255, 255, 0.025) 17px),
        linear-gradient(180deg, #7A3F55 0%, #5C2C42 55%, #3D1A2A 100%);
    border: 2px dashed rgba(232, 160, 191, 0.25);
    border-radius: 4px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    overflow: hidden;
}

/* Characters placement on Anniversary screen */
#finalJellyfish {
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
    animation: float-jellyfish-subtle 4s infinite ease-in-out;
}

#finalStar {
    left: 120%; /* starts off-screen right */
    top: 55%;
    transform: translate(-50%, -50%);
    animation: float-star-subtle 5s infinite ease-in-out;
}

/* The floating pixel rose — soft breathing glow blending pink + Star's gold */
.pixel-rose {
    position: absolute;
    left: 4px;
    top: 38px;
    font-size: 1.8rem;
    pointer-events: none;
    opacity: 0;
    animation: rose-glow-pulse 2.6s infinite ease-in-out;
}

@keyframes rose-glow-pulse {
    0%, 100% {
        filter:
            drop-shadow(0 0 4px var(--primary-pink))
            drop-shadow(0 0 10px rgba(232, 160, 191, 0.45))
            drop-shadow(0 0 16px rgba(255, 215, 0, 0.15));
    }
    50% {
        filter:
            drop-shadow(0 0 7px var(--primary-pink))
            drop-shadow(0 0 16px rgba(232, 160, 191, 0.7))
            drop-shadow(0 0 24px rgba(255, 215, 0, 0.3));
    }
}

/* Inner sway/breathing of the bloom itself — independent of outer positioning */
.rose-bloom {
    display: inline-block;
    transform-origin: 50% 100%;
    animation: rose-bloom-sway 3.4s infinite ease-in-out;
}

@keyframes rose-bloom-sway {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50%      { transform: rotate(3deg)  translateY(-1px); }
}

/* Pixel-art gift sprite (foods) — same hand position as the rose */
.pixel-gift {
    position: absolute;
    left: -2px;
    top: 30px;
    width: 38px;
    height: 38px;
    pointer-events: none;
    opacity: 0;
    overflow: visible;
    filter: drop-shadow(0 0 5px rgba(255, 220, 150, 0.55));
    /* No CSS opacity transition: JS drives opacity per-frame.
       If a transition existed, the dying opacity would bleed into the next food
       sprite right after swap, briefly revealing it. */
}

.pixel-gift.visible {
    opacity: 1;
    animation: gift-bob 1.4s infinite ease-in-out;
}

@keyframes gift-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* Speech bubbles for Star and Jellyfish dialog moments.
   Each bubble is a CHILD of its speaker's .pixel-char container, so it floats
   above the speaker and tracks any character movement. Text wraps when needed
   so the bubble stays narrow enough to not overflow the stage. */
.speech-bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px); /* sit just above the character sprite */
    width: max-content;
    max-width: 150px;
    background-color: #F5E4C0;
    padding: 5px 10px;
    font-family: 'VT323', monospace;
    font-size: 1.05rem;
    line-height: 1.15;
    color: #3D1614;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    z-index: 6;
    border-radius: 4px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    transform-origin: 50% 100%;
    transform: translateX(-50%) scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.speech-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.speech-bubble.star-speech {
    border: 3px solid #E0A444;
    color: #5C2F11;
}

.speech-bubble.jelly-speech {
    border: 3px solid #D580A8;
    color: #4A1A2F;
}

/* Bubble tail — a tiny triangle pointing straight down to the speaker */
.speech-bubble::after,
.speech-bubble::before {
    content: '';
    position: absolute;
    left: 50%;
    width: 0;
    height: 0;
}

/* Outer (coloured border) tail */
.speech-bubble::before {
    bottom: -9px;
    margin-left: -7px;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid;
}

/* Inner (cream fill) tail — sits just inside the outer one so the border line stays clean */
.speech-bubble::after {
    bottom: -5px;
    margin-left: -5px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #F5E4C0;
}

.speech-bubble.star-speech::before { border-top-color: #E0A444; }
.speech-bubble.jelly-speech::before { border-top-color: #D580A8; }

/* Cozy pixel-art indoor backdrop — sits behind everything */
.cozy-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Wood floor strip at the bottom of the room */
.cozy-floor {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 22px;
    background:
        /* horizontal grain lines */
        linear-gradient(180deg, transparent 0, transparent 1px, #3D1F0E 1px, #3D1F0E 2px, transparent 2px),
        linear-gradient(180deg, transparent 0, transparent 9px, rgba(61, 31, 14, 0.5) 9px, rgba(61, 31, 14, 0.5) 10px, transparent 10px),
        linear-gradient(180deg, transparent 0, transparent 15px, rgba(61, 31, 14, 0.4) 15px, rgba(61, 31, 14, 0.4) 16px, transparent 16px),
        /* plank base — warm brown gradient */
        linear-gradient(180deg, #8B5028 0%, #6B3818 70%, #4A2410 100%);
    box-shadow: inset 0 1px 0 #4A2410;
}

/* Window with moon inside — pixel-art frame tucked in the upper-left */
.cozy-window {
    position: absolute;
    left: 16%;
    top: 28%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px rgba(245, 228, 192, 0.4)) drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.35));
}

/* Tiny framed heart picture on the opposite wall — cozy domestic detail */
.cozy-picture {
    position: absolute;
    left: 84%;
    top: 30%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.35));
}

/* Ambient warm sparkles / twinkle lights (not stars — we're indoors now) */
.cozy-star {
    position: absolute;
    background-color: #FFE0A0;
    box-shadow: 0 0 4px rgba(255, 224, 160, 0.7);
    pointer-events: none;
    animation: cozy-twinkle 3.4s infinite ease-in-out;
    image-rendering: pixelated;
}

.cozy-star.bright {
    background-color: #FFF5D8;
    box-shadow: 0 0 5px rgba(255, 245, 216, 0.85);
}

@keyframes cozy-twinkle {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.85; }
}

/* Golden dust sprinkled by Star while she orbits Jellyfish's head at the end */
.head-orbit-dust {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: #FFE880;
    box-shadow: 0 0 5px rgba(255, 232, 128, 0.9);
    pointer-events: none;
    z-index: 5;
    animation: head-orbit-dust-fall 1.3s ease-in forwards;
    image-rendering: pixelated;
}

.head-orbit-dust.bright {
    width: 4px;
    height: 4px;
    background-color: #FFFAEC;
    box-shadow: 0 0 6px rgba(255, 250, 236, 0.9);
}

@keyframes head-orbit-dust-fall {
    0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
    25%  { transform: translate(calc(var(--dx, 0px) * 0.3), calc(var(--dy, 0px) * 0.3)) scale(1); opacity: 0.95; }
    100% { transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(0.5); opacity: 0; }
}

/* Placed feast around Jellyfish — each food settles at its slot and stays visible */
.placed-food {
    position: absolute;
    width: 38px;
    height: 38px;
    margin-left: -19px;
    margin-top: -19px;
    pointer-events: none;
    opacity: 0;
    overflow: visible;
    filter: drop-shadow(0 0 5px rgba(255, 220, 150, 0.55));
    transition: opacity 0.35s ease;
    z-index: 2;
}

.placed-food.visible {
    opacity: 1;
    /* No bob — the food sits still on the wood floor. */
}

@keyframes placed-food-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

/* Steam wisps — added via .steaming class for hot foods (skip for cold pudding) */
.pixel-gift.steaming::before,
.pixel-gift.steaming::after,
.placed-food.steaming::before,
.placed-food.steaming::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    top: -4px;
    pointer-events: none;
    animation: gift-steam 1.6s infinite ease-out;
}

.pixel-gift.steaming::before,
.placed-food.steaming::before {
    left: 12px;
    animation-delay: 0s;
}

.pixel-gift.steaming::after,
.placed-food.steaming::after {
    left: 22px;
    animation-delay: 0.8s;
}

@keyframes gift-steam {
    0%   { opacity: 0; transform: translateY(4px) scale(0.5); }
    25%  { opacity: 0.85; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-28px) scale(1.6); }
}

/* Breathing pulsating animations for vector character glows */
.sprite-svg circle {
    animation: glow-pulse-gold 4s infinite ease-in-out;
    transform-origin: center;
    transform-box: fill-box;
}

/* Jellyfish's core pink glow */
.jelly-core-glow {
    display: none; /* Hide Jellyfish's core pink glow, just have Star's protective golden shield */
    animation: glow-pulse-teal 4s infinite ease-in-out;
    transform-origin: center;
    transform-box: fill-box;
}

/* Star's protective golden shield wrapping Jellyfish */
.star-protective-glow {
    animation: glow-pulse-gold 4s infinite ease-in-out;
    transform-origin: center;
    transform-box: fill-box;
}

@keyframes glow-pulse-gold {
    0%, 100% {
        transform: scale(1);
        opacity: 0.35;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.60;
    }
}

@keyframes glow-pulse-teal {
    0%, 100% {
        transform: scale(1);
        opacity: 0.45;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.70;
    }
}

/* Final Menu Container */
.final-menu-container {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.final-menu-container.visible {
    opacity: 1;
}

@media (max-width: 768px) {
    .anniversary-card {
        padding: 1.5rem 1rem;
    }
}

/* Programmatic Override & Cinematic Stardust */
.pixel-char.no-animation,
.pixel-char.no-animation .star-protective-glow,
.pixel-char.no-animation .jelly-core-glow,
.pixel-char.no-animation circle {
    animation: none !important;
}

@keyframes final-spark-float {
    0% { transform: translate(0, 0) scale(1.5); opacity: 1; }
    100% { transform: translate(var(--dx, 20px), var(--dy, -20px)) scale(0.5); opacity: 0; }
}

.final-sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-gold);
    box-shadow: 0 0 6px var(--primary-gold);
    border-radius: 0; /* Retro square */
    pointer-events: none;
    z-index: 10;
    animation: final-spark-float 1.2s cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

.final-sparkle.pink {
    background-color: var(--primary-pink);
    box-shadow: 0 0 6px var(--primary-pink);
}

.final-sparkle.white {
    background-color: #ffffff;
    box-shadow: 0 0 6px #ffffff;
}

/* Climax radial burst — gold flash that pulses outward from Jellyfish */
.explosion-flash {
    position: absolute;
    left: 50%;
    top: calc(55% + 10px);
    width: 30px;
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 232, 128, 0.95) 0%, rgba(255, 215, 0, 0.6) 35%, rgba(232, 160, 191, 0.25) 65%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 9;
    animation: explosion-flash-pulse 0.9s cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

@keyframes explosion-flash-pulse {
    0%   { transform: scale(0.2); opacity: 0; }
    25%  { transform: scale(3.5); opacity: 1; }
    100% { transform: scale(11); opacity: 0; }
}

/* Cutscene Locking */
.title-screen-container.cutscene-active .menu-container {
    pointer-events: none !important;
}

/* Spill-Over Glow Stardust Stream Particles */
.stream-particle {
    position: absolute;
    border-radius: 0; /* GBA retro pixels */
    pointer-events: none;
    z-index: 9;
}
.stream-particle.gold {
    background-color: var(--primary-gold);
    box-shadow: 0 0 4px var(--primary-gold);
}
.stream-particle.light-gold {
    background-color: var(--primary-gold-light);
    box-shadow: 0 0 4px var(--primary-gold-light);
}
.stream-particle.pink {
    background-color: var(--primary-pink);
    box-shadow: 0 0 4px var(--primary-pink);
}
.stream-particle.white {
    background-color: #ffffff;
    box-shadow: 0 0 4px #ffffff;
}

/* Stardust Stream Collision Splashes */
.stream-splash {
    position: absolute;
    background-color: var(--primary-gold-light);
    border-radius: 0;
    pointer-events: none;
    z-index: 10;
    animation: splash-fade 0.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes splash-fade {
    0% {
        transform: translate(0, 0) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0.2);
        opacity: 0;
    }
}

/* Love Trail Sparkles for the Rose Glide */
.love-trail-sparkle {
    position: absolute;
    border-radius: 0; /* GBA retro pixels */
    pointer-events: none;
    z-index: 9;
    animation: love-spark-fade 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
.love-trail-sparkle.pink {
    background-color: var(--primary-pink);
    box-shadow: 0 0 4px var(--primary-pink);
}
.love-trail-sparkle.light-pink {
    background-color: #F8D8E8;
    box-shadow: 0 0 4px #F8D8E8;
}
.love-trail-sparkle.white {
    background-color: #ffffff;
    box-shadow: 0 0 4px #ffffff;
}

@keyframes love-spark-fade {
    0% {
        transform: translate(0, 0) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx, -15px), var(--dy, 10px)) scale(0.3);
        opacity: 0;
    }
}



