* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0812;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(200, 170, 230, 0.09) 0%, transparent 60%),
        radial-gradient(ellipse at 65% 25%, rgba(180, 160, 210, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(180, 220, 200, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

/* ---- 3D scene ---- */
.scene {
    width: 300px;
    height: 300px;
    perspective: 900px;
    position: relative;
}

.birthday-flash {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    background:
        radial-gradient(circle at center,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(240, 230, 255, 0.82) 15%,
            rgba(236, 220, 252, 0.65) 30%,
            rgba(255, 220, 235, 0.45) 45%,
            rgba(204, 238, 220, 0.30) 60%,
            transparent 80%);
    filter: blur(2px);
}

.birthday-flash.is-flash-opening {
    animation: birthday-flash-open 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.birthday-flash.is-flash-closing {
    animation: birthday-flash 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(-150px);
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease, filter 0.45s ease;
}

.birthday-option {
    text-transform: lowercase;
}

/* ---- Birthday grid mode ---- */
.birthday-grid-view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.92);
    filter: blur(6px);
    transition: opacity 0.28s ease, transform 0.28s ease, filter 0.28s ease, visibility 0s linear 0.28s;
}

.scene.is-birthday-grid .cube {
    opacity: 0;
    pointer-events: none;
    filter: blur(4px);
}

.scene.is-birthday-opening .cube {
    filter: blur(2px) saturate(1.08);
}

.scene.is-birthday-opening .birthday-grid-view {
    opacity: 0.45;
    visibility: visible;
    transform: translateY(-14px) scale(0.82);
    filter: blur(3px);
}

.scene.is-birthday-grid .birthday-grid-view {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
    filter: blur(0);
    transition-delay: 0s;
}

/* ---- Cube Text (pixel font made of tiny cubes) ---- */
.cube-text {
    --cube-pixel-size: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
    animation: cube-text-breathe 3s ease-in-out infinite;
    position: relative;
}

.cube-text-top {
    margin-bottom: 10px;
}

.cube-text-bottom {
    margin-top: 10px;
}

.scene.is-birthday-grid .cube-text {
    opacity: 1;
    transform: translateY(0);
}

.cube-word {
    display: flex;
    gap: 3px;
}

.cube-letter {
    display: grid;
    grid-template-columns: repeat(5, var(--cube-pixel-size));
    grid-template-rows: repeat(7, var(--cube-pixel-size));
    gap: 1px;
}

.cube-pixel {
    width: var(--cube-pixel-size);
    height: var(--cube-pixel-size);
    border-radius: 1.5px;
    background: linear-gradient(135deg, rgba(80, 190, 110, 0.75), rgba(120, 210, 150, 0.6), rgba(160, 225, 175, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 6px rgba(80, 190, 110, 0.35), 0 0 12px rgba(100, 200, 140, 0.15), inset 0 0 3px rgba(255, 255, 255, 0.2);
}

.cube-pixel-empty {
    width: var(--cube-pixel-size);
    height: var(--cube-pixel-size);
}

@keyframes cube-text-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.03); }
}

/* ---- Cube Text Particles ---- */
.cube-text-particle {
    position: fixed;
    pointer-events: none;
    z-index: 45;
    font-size: 16px;
    opacity: 0;
    animation-fill-mode: both;
    animation-timing-function: ease-in-out;
    text-shadow: 0 0 6px currentColor;
    filter: brightness(1.3);
}

/* ---- Confetti ---- */
.confetti-piece {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    border-radius: 2px;
    opacity: 1;
    animation-name: confetti-burst;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes confetti-burst {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    15% {
        opacity: 1;
    }
    40% {
        transform: translate(var(--x), var(--y)) rotate(calc(var(--r) * 0.6)) scale(1);
        opacity: 0.95;
    }
    100% {
        transform: translate(var(--x), calc(var(--y) + 120vh)) rotate(var(--r)) scale(0.4);
        opacity: 0;
    }
}

.birthday-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 2px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.22s ease 0.04s, transform 0.22s ease 0.04s;
}

.scene.is-birthday-grid .birthday-grid {
    opacity: 1;
    transform: translateY(0);
}

.memory-cube {
    width: 90px;
    height: 72px;
    perspective: 450px;
    cursor: pointer;
    outline: none;
    opacity: 0;
    transform: translateY(-12px) scale(0.9);
    transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.scene.is-birthday-grid .memory-cube {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.scene.is-birthday-grid .memory-cube:nth-child(1) { transition-delay: 0.03s; }
.scene.is-birthday-grid .memory-cube:nth-child(2) { transition-delay: 0.05s; }
.scene.is-birthday-grid .memory-cube:nth-child(3) { transition-delay: 0.07s; }
.scene.is-birthday-grid .memory-cube:nth-child(4) { transition-delay: 0.09s; }
.scene.is-birthday-grid .memory-cube:nth-child(5) { transition-delay: 0.11s; }
.scene.is-birthday-grid .memory-cube:nth-child(6) { transition-delay: 0.13s; }
.scene.is-birthday-grid .memory-cube:nth-child(7) { transition-delay: 0.15s; }
.scene.is-birthday-grid .memory-cube:nth-child(8) { transition-delay: 0.17s; }
.scene.is-birthday-grid .memory-cube:nth-child(9) { transition-delay: 0.19s; }


.memory-cube-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(-12deg) rotateY(18deg);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.memory-cube-face-front {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: linear-gradient(
        135deg,
        rgba(210, 190, 235, 0.14),
        rgba(195, 175, 225, 0.1),
        rgba(190, 210, 205, 0.06)
    );
    box-shadow:
        0 0 22px rgba(190, 170, 220, 0.1),
        inset 0 0 18px rgba(255, 255, 255, 0.04);
    transform: translateZ(8px);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.memory-cube-face-front::before,
.memory-cube-face-front::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: linear-gradient(
        135deg,
        rgba(205, 185, 230, 0.09),
        rgba(180, 200, 195, 0.05)
    );
}

.memory-cube-face-front::before {
    top: 6px;
    right: -8px;
    width: 8px;
    height: calc(100% - 12px);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    transform: skewY(-12deg);
}

.memory-cube-face-front::after {
    left: 6px;
    top: -8px;
    width: calc(100% - 12px);
    height: 8px;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    transform: skewX(-12deg);
}

.memory-cube:hover .memory-cube-inner,
.memory-cube:focus-visible .memory-cube-inner {
    transform: rotateX(-14deg) rotateY(18deg) translateY(-5px) scale(1.06);
    box-shadow: 0 0 20px rgba(200, 180, 230, 0.25);
}

.birthday-back-arrow {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s;
    background: rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: scale(0.95);
    transition:
        color 0.25s,
        border-color 0.25s,
        box-shadow 0.25s,
        transform 0.25s,
        opacity 0.18s ease 0.08s;
}

.scene.is-birthday-grid .birthday-back-arrow {
    opacity: 1;
    transform: scale(1);
}

.birthday-back-arrow:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(200, 180, 230, 0.4);
    transform: scale(1.12);
}

.birthday-back-arrow:active {
    transform: scale(0.95);
}

/* ---- Photo Viewer ---- */
.photo-viewer {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 18, 0.97);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.scene.is-photo-viewer .photo-viewer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.scene.is-photo-viewer .birthday-grid-view {
    opacity: 0;
}

.photo-viewer-image {
    max-width: 85vw;
    max-height: 70vh;
    object-fit: contain;
    position: relative;
    z-index: 2;
    border: 3px solid rgba(200, 170, 235, 0.7);
    border-image: linear-gradient(
        135deg,
        rgba(200, 170, 235, 0.85),
        rgba(236, 200, 252, 0.80),
        rgba(255, 190, 220, 0.75),
        rgba(180, 230, 210, 0.70),
        rgba(200, 210, 255, 0.80),
        rgba(210, 180, 240, 0.85)
    ) 1;
    border-radius: 0;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow:
        0 0 60px rgba(200, 170, 235, 0.25),
        0 0 45px rgba(236, 200, 252, 0.20),
        0 0 35px rgba(255, 190, 220, 0.18),
        0 0 30px rgba(180, 230, 210, 0.15),
        0 0 50px rgba(200, 210, 255, 0.16),
        inset 0 0 1px rgba(255, 255, 255, 0.5);
}

.scene.is-photo-viewer .photo-viewer-image {
    opacity: 1;
    transform: scale(1);
}

.photo-viewer-back {
    margin-top: 40px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s, opacity 0.25s;
    opacity: 0;
}

.scene.is-photo-viewer .photo-viewer-back {
    opacity: 1;
    transition-delay: 0.15s;
}

.photo-viewer-back:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(200, 180, 230, 0.4);
    transform: scale(1.12);
}

.photo-viewer-back:active {
    transform: scale(0.95);
}

/* ---- Spring Effects in Photo Viewer ---- */
.spring-effect {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    animation-fill-mode: both;
    animation-timing-function: ease-in-out;
}

/* Heart: two rotated rounded squares overlapping */
.spring-heart {
    width: 28px;
    height: 28px;
    position: relative;
}
.spring-heart::before,
.spring-heart::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 0 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, rgba(200, 160, 230, 0.5), rgba(220, 180, 240, 0.35));
    box-shadow: 0 0 18px rgba(200, 170, 230, 0.3);
}
.spring-heart::before {
    transform: rotate(-45deg);
    transform-origin: bottom right;
}
.spring-heart::after {
    transform: rotate(45deg);
    transform-origin: bottom left;
    left: 14px;
}

/* Butterfly: two wing shapes */
.spring-butterfly {
    width: 44px;
    height: 30px;
    position: relative;
}
.spring-butterfly::before,
.spring-butterfly::after {
    content: '';
    position: absolute;
    top: 0;
    width: 20px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50% 50% 30% 30%;
    background: linear-gradient(135deg, rgba(210, 190, 240, 0.4), rgba(180, 210, 220, 0.25));
    box-shadow: 0 0 14px rgba(200, 180, 235, 0.25);
}
.spring-butterfly::before {
    left: 0;
    transform: rotate(-10deg);
}
.spring-butterfly::after {
    right: 0;
    transform: rotate(10deg);
}

/* Flower: circle with petal box-shadows */
.spring-flower {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(190, 220, 200, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        14px 0 0 4px rgba(210, 180, 235, 0.35),
        -14px 0 0 4px rgba(210, 180, 235, 0.35),
        0 14px 0 4px rgba(220, 190, 240, 0.3),
        0 -14px 0 4px rgba(220, 190, 240, 0.3),
        10px 10px 0 3px rgba(255, 200, 220, 0.25),
        -10px -10px 0 3px rgba(255, 200, 220, 0.25),
        10px -10px 0 3px rgba(200, 220, 210, 0.25),
        -10px 10px 0 3px rgba(200, 220, 210, 0.25),
        0 0 24px rgba(200, 170, 230, 0.2);
}

/* Pollen particle: glowing dot */
.spring-pollen {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.spring-pollen.pollen-lavender {
    background: rgba(210, 190, 235, 0.6);
    box-shadow: 0 0 12px rgba(210, 190, 235, 0.4), 0 0 28px rgba(210, 190, 235, 0.15);
}
.spring-pollen.pollen-mint {
    background: rgba(190, 220, 205, 0.55);
    box-shadow: 0 0 12px rgba(190, 220, 205, 0.4), 0 0 28px rgba(190, 220, 205, 0.15);
}
.spring-pollen.pollen-pink {
    background: rgba(240, 200, 220, 0.55);
    box-shadow: 0 0 12px rgba(240, 200, 220, 0.4), 0 0 28px rgba(240, 200, 220, 0.15);
}
.spring-pollen.pollen-gold {
    background: rgba(235, 220, 180, 0.55);
    box-shadow: 0 0 12px rgba(235, 220, 180, 0.4), 0 0 28px rgba(235, 220, 180, 0.15);
}
.spring-pollen.pollen-blue {
    background: rgba(190, 200, 235, 0.55);
    box-shadow: 0 0 12px rgba(190, 200, 235, 0.4), 0 0 28px rgba(190, 200, 235, 0.15);
}

/* Leaf: rotated oval with stem line */
.spring-leaf {
    width: 18px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(160deg, rgba(140, 200, 160, 0.45), rgba(170, 215, 180, 0.3), rgba(160, 210, 175, 0.2));
    box-shadow: 0 0 14px rgba(150, 210, 170, 0.2), 0 0 28px rgba(150, 210, 170, 0.08);
    transform: rotate(-40deg);
}
.spring-leaf::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 20%;
    width: 1px;
    height: 60%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%);
}

/* Sparkle: diamond shape */
.spring-sparkle {
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(220, 200, 245, 0.4), rgba(255, 255, 255, 0.2));
    box-shadow: 0 0 16px rgba(220, 200, 245, 0.3), 0 0 30px rgba(220, 200, 245, 0.1);
}

@keyframes spring-float-up {
    0%   { opacity: 0; transform: translateY(0) translateX(0) rotate(0deg) scale(0.5); }
    10%  { opacity: 1; }
    50%  { transform: translateY(-30vh) translateX(20px) rotate(180deg) scale(1); }
    90%  { opacity: 0.7; }
    100% { opacity: 0; transform: translateY(-60vh) translateX(-10px) rotate(360deg) scale(0.6); }
}

@keyframes spring-drift-right {
    0%   { opacity: 0; transform: translateX(0) translateY(0) scale(0.4); }
    10%  { opacity: 1; }
    50%  { transform: translateX(20vw) translateY(-15px) scale(1); }
    90%  { opacity: 0.6; }
    100% { opacity: 0; transform: translateX(40vw) translateY(10px) scale(0.5); }
}

@keyframes spring-drift-left {
    0%   { opacity: 0; transform: translateX(0) translateY(0) scale(0.4); }
    10%  { opacity: 1; }
    50%  { transform: translateX(-20vw) translateY(-20px) scale(1); }
    90%  { opacity: 0.6; }
    100% { opacity: 0; transform: translateX(-40vw) translateY(5px) scale(0.5); }
}

@keyframes spring-zigzag {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.5); }
    10%  { opacity: 1; }
    25%  { transform: translate(14px, -10vh) scale(0.9) rotate(8deg); }
    50%  { transform: translate(-14px, -22vh) scale(1) rotate(-8deg); }
    75%  { transform: translate(10px, -34vh) scale(0.9) rotate(6deg); }
    90%  { opacity: 0.6; }
    100% { opacity: 0; transform: translate(-5px, -48vh) scale(0.4) rotate(0deg); }
}

@keyframes spring-bloom {
    0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
    15%  { opacity: 1; transform: scale(1.3) rotate(0deg); }
    40%  { transform: scale(1) rotate(5deg); }
    70%  { opacity: 0.8; transform: scale(1.05) rotate(-3deg); }
    100% { opacity: 0; transform: scale(0.3) rotate(10deg); }
}

@keyframes spring-twinkle {
    0%   { opacity: 0; transform: rotate(45deg) scale(0); }
    20%  { opacity: 1; transform: rotate(45deg) scale(1.2); }
    40%  { opacity: 0.4; transform: rotate(45deg) scale(0.8); }
    60%  { opacity: 1; transform: rotate(45deg) scale(1); }
    80%  { opacity: 0.5; transform: rotate(45deg) scale(0.9); }
    100% { opacity: 0; transform: rotate(45deg) scale(0); }
}

@keyframes spring-wander {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.3); }
    8%   { opacity: 1; }
    20%  { transform: translate(8px, -6vh) scale(0.8); }
    40%  { transform: translate(-10px, -14vh) scale(1); }
    60%  { transform: translate(12px, -20vh) scale(0.9); }
    80%  { transform: translate(-6px, -28vh) scale(0.7); opacity: 0.5; }
    100% { opacity: 0; transform: translate(4px, -36vh) scale(0.3); }
}


@keyframes birthday-flash-open {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.7);
    }
    45% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

@keyframes birthday-flash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    40% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* ---- Faces ---- */
.cube-face {
    position: absolute;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: linear-gradient(135deg,
        rgba(210, 190, 235, 0.15),
        rgba(195, 175, 225, 0.12),
        rgba(190, 210, 205, 0.06));
    box-shadow:
        0 0 40px rgba(190, 170, 220, 0.12),
        0 0 80px rgba(210, 190, 240, 0.08),
        inset 0 0 40px rgba(255, 255, 255, 0.04);
    backface-visibility: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.face-front  { transform: rotateY(   0deg) translateZ(150px); }
.face-back   { transform: rotateY( 180deg) translateZ(150px); }
.face-right  { transform: rotateY(  90deg) translateZ(150px); }
.face-left   { transform: rotateY( -90deg) translateZ(150px); }
.face-top    { transform: rotateX(  90deg) translateZ(150px); }
.face-bottom { transform: rotateX( -90deg) translateZ(150px); }

.scene.is-birthday-opening .cube-face {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        0 0 48px rgba(200, 180, 230, 0.16),
        0 0 88px rgba(210, 190, 240, 0.12),
        inset 0 0 40px rgba(255, 255, 255, 0.06);
}

.scene.is-birthday-opening .face-front  { transform: rotateY(0deg) translateZ(164px); }
.scene.is-birthday-opening .face-back   { transform: rotateY(180deg) translateZ(164px); }
.scene.is-birthday-opening .face-right  { transform: rotateY(90deg) translateZ(164px); }
.scene.is-birthday-opening .face-left   { transform: rotateY(-90deg) translateZ(164px); }
.scene.is-birthday-opening .face-top    { transform: rotateX(90deg) translateZ(170px); }
.scene.is-birthday-opening .face-bottom { transform: rotateX(-90deg) translateZ(160px); }

/* ---- Cube rotation states ---- */
.cube.show-front  { transform: translateZ(-150px) rotateY(    0deg); }
.cube.show-back   { transform: translateZ(-150px) rotateY( -180deg); }
.cube.show-right  { transform: translateZ(-150px) rotateY(  -90deg); }
.cube.show-left   { transform: translateZ(-150px) rotateY(   90deg); }
.cube.show-top    { transform: translateZ(-150px) rotateX(  -90deg); }
.cube.show-bottom { transform: translateZ(-150px) rotateX(   90deg); }

/* ---- Menu options on front face ---- */
.menu-option {
    position: absolute;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 8px 18px;
    border-radius: 4px;
    transition: color 0.25s, text-shadow 0.25s;
    white-space: nowrap;
}

.menu-option:hover {
    color: #fff;
    text-shadow: 0 0 12px rgba(230, 210, 255, 0.9);
}

/* Position each option at its cube edge, baseline facing outward */
.edge-right {
    right: -9px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    transform-origin: center center;
}

.edge-left {
    left: -9px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center center;
}

.edge-top {
    top: 10px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    transform-origin: center center;
}

.menu-option.edge-top.birthday-option {
    transform: translateX(-50%);
    padding-top: 0;
    line-height: 1;
}

.edge-bottom {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

/* ---- Back arrows on empty faces ---- */
.back-arrow {
    position: absolute;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s;
    background: rgba(255, 255, 255, 0.05);
    z-index: 10;
}

.back-arrow:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(200, 180, 230, 0.4);
    transform: scale(1.12);
}

.back-arrow:active {
    transform: scale(0.95);
}

/* Arrow placement: right face arrow ← sits at left edge */
.face-right  .back-arrow { left: 20px;  top: 50%; margin-top: -28px; }
/* Arrow placement: left face arrow → sits at right edge */
.face-left   .back-arrow { right: 20px; top: 50%; margin-top: -28px; }
/* Arrow placement: top face arrow ↓ sits at bottom edge */
.face-top    .back-arrow { bottom: 20px; left: 50%; margin-left: -28px; }
/* Arrow placement: bottom face arrow ↑ sits at top edge */
.face-bottom .back-arrow { top: 20px;   left: 50%; margin-left: -28px; }

/* ---- Dice dots decoration ---- */
.cube-face::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 6px;
    height: 6px;
    background: rgba(230, 220, 245, 0.35);
    border-radius: 50%;
    box-shadow:
        268px 0   rgba(230, 220, 245, 0.35),
        0   268px rgba(230, 220, 245, 0.35),
        268px 268px rgba(230, 220, 245, 0.35);
    pointer-events: none;
}

/* ============================================
   TERRARIUM — 3D spring nature scene inside cube
   ============================================ */

.terrarium {
    position: absolute;
    width: 300px;
    height: 300px;
    left: 0;
    top: 0;
    pointer-events: none;
    transform-style: preserve-3d;
}

/* ---- Ground plane (horizontal) ---- */
.ground {
    position: absolute;
    width: 280px;
    height: 280px;
    left: 10px;
    top: 10px;
    background: radial-gradient(ellipse at 40% 45%, #72b872 0%, #5a9e5a 40%, #4a8e4a 80%);
    border-radius: 50%;
    transform: translateY(55px) rotateX(90deg);
    box-shadow: 0 0 40px rgba(50, 100, 50, 0.2);
}

/* ---- Hills (cross-plane semicircle domes) ---- */
.hill {
    position: absolute;
    bottom: 30%;
    transform-style: preserve-3d;
}

.hill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    box-shadow: inherit;
    transform: rotateY(90deg);
}

.hill-back {
    width: 100px;
    height: 45px;
    left: 5%;
    background: #5fa85f;
    border-radius: 50px 50px 0 0;
    box-shadow: inset 0 8px 12px rgba(120, 200, 120, 0.4);
    transform: translateZ(-40px);
}

.hill-front {
    width: 80px;
    height: 35px;
    right: 10%;
    left: auto;
    background: #55a055;
    border-radius: 40px 40px 0 0;
    box-shadow: inset 0 6px 10px rgba(110, 190, 110, 0.4);
    transform: translateZ(35px);
}

/* ---- Stream (horizontal, on ground) ---- */
.stream {
    position: absolute;
    width: 140px;
    height: 40px;
    left: 80px;
    top: 90px;
    background: linear-gradient(180deg,
        rgba(140, 200, 220, 0.8),
        rgba(170, 215, 235, 0.9),
        rgba(140, 200, 220, 0.8));
    background-size: 100% 200%;
    border-radius: 40%;
    transform: translateY(94px) rotateX(90deg) rotateZ(-12deg);
    box-shadow:
        inset 0 0 10px rgba(255, 255, 255, 0.5),
        0 0 12px rgba(100, 180, 220, 0.4);
    animation: stream-shimmer 2.5s ease-in-out infinite;
}

/* ---- Tree (cross-plane) ---- */
.tree {
    position: absolute;
    bottom: 30%;
    left: 18%;
    transform: translateZ(-20px);
    transform-style: preserve-3d;
}

.tree-shadow {
    position: absolute;
    bottom: -4px;
    left: -6px;
    width: 36px;
    height: 36px;
    background: radial-gradient(ellipse, rgba(30, 50, 30, 0.25), transparent 70%);
    border-radius: 50%;
    transform: translateY(4px) rotateX(90deg);
}

.tree-trunk {
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 12px;
    height: 40px;
    background: #8B6B4A;
    border-radius: 3px;
    box-shadow: inset -4px 0 0 rgba(60, 40, 20, 0.3);
    transform-style: preserve-3d;
}

.tree-trunk::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px rgba(60, 40, 20, 0.15);
    transform: rotateY(90deg);
}

.tree-canopy {
    position: absolute;
    bottom: 28px;
    left: -18px;
    width: 60px;
    height: 60px;
    background: #4CAF6A;
    border-radius: 50%;
    box-shadow:
        inset -10px -8px 0 rgba(60, 130, 80, 0.6),
        inset 8px 10px 0 rgba(130, 210, 140, 0.4);
    animation: tree-sway 3.5s ease-in-out infinite;
    transform-origin: bottom center;
    transform-style: preserve-3d;
}

.tree-canopy::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    box-shadow:
        inset -8px -6px 0 rgba(60, 130, 80, 0.5),
        inset 6px 8px 0 rgba(130, 210, 140, 0.3);
    transform: rotateY(90deg);
}

/* ---- Flowers (cross-plane) ---- */
.flower {
    position: absolute;
    --z: 0px;
    transform-style: preserve-3d;
}

.flower-shadow {
    position: absolute;
    bottom: -3px;
    left: -4px;
    width: 20px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(30, 50, 30, 0.2), transparent 70%);
    border-radius: 50%;
    transform: translateY(2px) rotateX(90deg);
}

.flower-stem {
    position: absolute;
    bottom: 0;
    left: 4px;
    width: 4px;
    height: 22px;
    background: #5a9e5a;
    border-radius: 2px;
    transform-style: preserve-3d;
}

.flower-stem::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    transform: rotateY(90deg);
}

.flower-head {
    position: absolute;
    bottom: 18px;
    left: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.4);
    transform-style: preserve-3d;
}

.flower-head::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.3);
    transform: rotateY(90deg);
}

.flower-1 {
    bottom: 32%;
    left: 55%;
    --z: 40px;
    animation: flower-bloom 2.8s ease-in-out infinite;
}
.flower-1 .flower-head { background: #E8A0C8; }

.flower-2 {
    bottom: 31%;
    left: 72%;
    --z: -15px;
    animation: flower-bloom 3.2s ease-in-out infinite 0.6s;
}
.flower-2 .flower-head { background: #C8A0E8; }

.flower-3 {
    bottom: 30%;
    left: 42%;
    --z: 25px;
    animation: flower-bloom 2.5s ease-in-out infinite 1.2s;
}
.flower-3 .flower-head { background: #E8D0A0; }

/* ---- Grass (cross-plane) ---- */
.grass {
    position: absolute;
    bottom: 30%;
    width: 5px;
    height: 18px;
    background: #68B468;
    border-radius: 2px 2px 0 0;
    transform-origin: bottom center;
    transform-style: preserve-3d;
    --z: 0px;
}

.grass::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    transform: rotateY(90deg);
}

.grass-1 { left: 12%; --z: -45px; animation: grass-sway 2.5s ease-in-out infinite; }
.grass-2 { left: 35%; height: 14px; --z: 35px; animation: grass-sway 2.2s ease-in-out infinite 0.3s; }
.grass-3 { left: 62%; height: 20px; --z: 50px; animation: grass-sway 2.8s ease-in-out infinite 0.7s; }
.grass-4 { left: 80%; height: 12px; --z: -20px; animation: grass-sway 2.4s ease-in-out infinite 1.1s; }
.grass-5 { left: 90%; height: 16px; --z: 10px; animation: grass-sway 2.6s ease-in-out infinite 0.5s; }

/* ---- Bee (3D flight + cross-plane) ---- */
.bee {
    position: absolute;
    width: 14px;
    height: 10px;
    background: repeating-linear-gradient(
        90deg,
        #F5D04A 0px, #F5D04A 3px,
        #3A3A3A 3px, #3A3A3A 6px
    );
    border-radius: 50%;
    top: 30%;
    left: 60%;
    box-shadow:
        inset 2px 2px 0 rgba(255, 255, 200, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.2);
    animation: bee-fly 6s ease-in-out infinite;
    transform-style: preserve-3d;
}

.bee::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 3px;
    width: 8px;
    height: 6px;
    background: rgba(220, 230, 255, 0.6);
    border-radius: 50% 50% 20% 20%;
    animation: bee-wings 0.15s ease-in-out infinite alternate;
}

.bee::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
    box-shadow: inherit;
    transform: rotateY(90deg);
}

/* ---- Butterfly (3D flight + cross-plane) ---- */
.butterfly {
    position: absolute;
    top: 25%;
    left: 30%;
    width: 6px;
    height: 6px;
    animation: butterfly-fly 8s ease-in-out infinite;
    transform-style: preserve-3d;
}

.butterfly::before,
.butterfly::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 14px;
    background: rgba(200, 160, 230, 0.85);
    border-radius: 50% 50% 50% 0;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

.butterfly::before {
    right: 2px;
    transform-origin: bottom right;
    animation: wing-left 0.6s ease-in-out infinite alternate;
}

.butterfly::after {
    left: 2px;
    transform: scaleX(-1);
    transform-origin: bottom left;
    animation: wing-right 0.6s ease-in-out infinite alternate;
}

.butterfly-cross {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateY(90deg);
}

.butterfly-cross::before,
.butterfly-cross::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 14px;
    background: rgba(200, 160, 230, 0.85);
    border-radius: 50% 50% 50% 0;
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.3);
}

.butterfly-cross::before {
    right: 2px;
    transform-origin: bottom right;
    animation: wing-left 0.6s ease-in-out infinite alternate;
}

.butterfly-cross::after {
    left: 2px;
    transform: scaleX(-1);
    transform-origin: bottom left;
    animation: wing-right 0.6s ease-in-out infinite alternate;
}

/* ---- Particles: Pollen ---- */
.pollen {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 240, 0.8);
    border-radius: 50%;
    filter: blur(0.5px);
}

.pollen-1 { left: 20%; bottom: 40%; animation: pollen-float-1 9s ease-in-out infinite; }
.pollen-2 { left: 50%; bottom: 35%; animation: pollen-float-2 11s ease-in-out infinite 2s; }
.pollen-3 { left: 70%; bottom: 45%; animation: pollen-float-3 8s ease-in-out infinite 4s; }
.pollen-4 { left: 35%; bottom: 50%; animation: pollen-float-4 10s ease-in-out infinite 1.5s; }
.pollen-5 { left: 85%; bottom: 38%; animation: pollen-float-5 12s ease-in-out infinite 3s; }

/* ---- Particles: Sparkles ---- */
.sparkle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}

.sparkle-1 { left: 25%; top: 28%; transform: translateZ(45px); animation: sparkle-pulse 5s ease-in-out infinite; }
.sparkle-2 { left: 65%; top: 22%; transform: translateZ(-35px); animation: sparkle-pulse 6s ease-in-out infinite 1.8s; }
.sparkle-3 { left: 45%; top: 35%; transform: translateZ(15px); animation: sparkle-pulse 7s ease-in-out infinite 3.5s; }

/* ---- Particles: Falling petals ---- */
.petal {
    position: absolute;
    width: 8px;
    height: 6px;
    background: rgba(230, 180, 210, 0.7);
    border-radius: 50% 0 50% 0;
}

.petal-1 { left: 40%; top: 10%; animation: petal-fall-1 12s ease-in-out infinite; }
.petal-2 { left: 70%; top: 5%; animation: petal-fall-2 14s ease-in-out infinite 4s; }

/* ---- Lighting (horizontal light pool on ground) ---- */
.light-overlay {
    position: absolute;
    width: 240px;
    height: 240px;
    left: 10px;
    top: 10px;
    background: radial-gradient(
        ellipse at 35% 35%,
        rgba(255, 250, 230, 0.2) 0%,
        rgba(230, 220, 245, 0.08) 40%,
        transparent 65%
    );
    border-radius: 50%;
    transform: translateY(73px) rotateX(90deg);
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

@keyframes stream-shimmer {
    0%, 100% { background-position: 0% 0; }
    50% { background-position: 0% 100%; }
}

@keyframes tree-sway {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(3deg); }
}

@keyframes flower-bloom {
    0%, 100% { transform: translateZ(var(--z, 0px)) scale(0.92); }
    50% { transform: translateZ(var(--z, 0px)) scale(1.08); }
}

@keyframes grass-sway {
    0%, 100% { transform: translateZ(var(--z, 0px)) rotate(-8deg); }
    50% { transform: translateZ(var(--z, 0px)) rotate(8deg); }
}

@keyframes bee-fly {
    0%   { transform: translate3d(0, 0, 40px); }
    15%  { transform: translate3d(30px, -20px, 70px); }
    30%  { transform: translate3d(55px, -5px, 20px); }
    45%  { transform: translate3d(30px, 15px, -30px); }
    60%  { transform: translate3d(-10px, 10px, -50px); }
    75%  { transform: translate3d(-30px, -15px, 0px); }
    90%  { transform: translate3d(-10px, -25px, 50px); }
    100% { transform: translate3d(0, 0, 40px); }
}

@keyframes bee-wings {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(0.4); }
}

@keyframes butterfly-fly {
    0%   { transform: translate3d(0, 0, -20px); }
    20%  { transform: translate3d(-25px, -30px, 40px); }
    40%  { transform: translate3d(10px, -50px, 60px); }
    60%  { transform: translate3d(40px, -25px, -10px); }
    80%  { transform: translate3d(15px, 10px, -40px); }
    100% { transform: translate3d(0, 0, -20px); }
}

@keyframes wing-left {
    0% { transform: rotate(0deg) scaleY(1); }
    100% { transform: rotate(-40deg) scaleY(0.6); }
}

@keyframes wing-right {
    0% { transform: scaleX(-1) rotate(0deg) scaleY(1); }
    100% { transform: scaleX(-1) rotate(-40deg) scaleY(0.6); }
}

@keyframes pollen-float-1 {
    0% { transform: translate3d(0, 0, 30px); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translate3d(15px, -80px, 50px); opacity: 0.6; }
    90% { opacity: 0; }
    100% { transform: translate3d(25px, -150px, 20px); opacity: 0; }
}

@keyframes pollen-float-2 {
    0% { transform: translate3d(0, 0, -40px); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translate3d(-10px, -80px, -20px); opacity: 0.6; }
    90% { opacity: 0; }
    100% { transform: translate3d(-20px, -150px, -50px); opacity: 0; }
}

@keyframes pollen-float-3 {
    0% { transform: translate3d(0, 0, 55px); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translate3d(20px, -80px, 30px); opacity: 0.6; }
    90% { opacity: 0; }
    100% { transform: translate3d(10px, -150px, 60px); opacity: 0; }
}

@keyframes pollen-float-4 {
    0% { transform: translate3d(0, 0, -10px); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translate3d(-15px, -80px, 20px); opacity: 0.6; }
    90% { opacity: 0; }
    100% { transform: translate3d(-5px, -150px, -15px); opacity: 0; }
}

@keyframes pollen-float-5 {
    0% { transform: translate3d(0, 0, 20px); opacity: 0; }
    10% { opacity: 0.8; }
    50% { transform: translate3d(10px, -80px, -30px); opacity: 0.6; }
    90% { opacity: 0; }
    100% { transform: translate3d(20px, -150px, 10px); opacity: 0; }
}

@keyframes sparkle-pulse {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    30% { opacity: 0.9; transform: scale(1.2); }
    60% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes petal-fall-1 {
    0% { transform: translate3d(0, 0, 25px) rotate(0deg); opacity: 0; }
    5% { opacity: 0.7; }
    50% { transform: translate3d(-30px, 120px, 50px) rotate(180deg); opacity: 0.5; }
    95% { opacity: 0; }
    100% { transform: translate3d(-20px, 220px, 15px) rotate(340deg); opacity: 0; }
}

@keyframes petal-fall-2 {
    0% { transform: translate3d(0, 0, -30px) rotate(0deg); opacity: 0; }
    5% { opacity: 0.7; }
    50% { transform: translate3d(20px, 120px, -10px) rotate(180deg); opacity: 0.5; }
    95% { opacity: 0; }
    100% { transform: translate3d(15px, 220px, -40px) rotate(340deg); opacity: 0; }
}
