@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;700&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
    --font-display: 'Fraunces', 'Times New Roman', serif;
    --font-body: 'Space Grotesk', 'Arial', sans-serif;
    --radius-lg: 28px;
    --radius-md: 18px;
    --shadow-soft: 0 30px 80px rgba(0, 0, 0, 0.25);
    --shadow-strong: 0 18px 50px rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-color, #f8f5ff);
    background: var(--bg, #0b0f1f);
}

.page {
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.theme {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}

.theme .page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    min-height: 100vh;
}

.theme--spark {
    --bg: radial-gradient(circle at top, #1d2144 0%, #0b0f1f 48%, #070814 100%);
    --card-bg: rgba(16, 18, 35, 0.85);
    --accent: #f7b955;
    --muted: #b9b3d4;
    --glow: rgba(247, 185, 85, 0.25);
}

.theme--balloons {
    --bg: linear-gradient(160deg, #ffe7f1 0%, #c9f1ff 45%, #fff1d6 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --accent: #ff6a8b;
    --text-color: #1c1b29;
    --muted: #4f4a6b;
    --glow: rgba(255, 106, 139, 0.2);
}

.theme--sunrise {
    --bg: radial-gradient(circle at top, #ffefc2 0%, #ffbe9e 50%, #ff8f87 100%);
    --card-bg: rgba(255, 255, 255, 0.78);
    --accent: #e75a37;
    --text-color: #2b1d14;
    --muted: #5d4336;
    --glow: rgba(231, 90, 55, 0.2);
}

.theme--retro {
    --bg: linear-gradient(140deg, #0f1d2b 0%, #1d3452 45%, #262242 100%);
    --card-bg: rgba(14, 21, 34, 0.86);
    --accent: #36f2c2;
    --text-color: #f1fbff;
    --muted: #93a7c4;
    --glow: rgba(54, 242, 194, 0.25);
}

.theme--cinematic {
    --bg: radial-gradient(circle at top, rgba(10, 12, 26, 0.9) 0%, rgba(7, 9, 18, 0.95) 60%, #05060f 100%);
    --card-bg: rgba(12, 14, 26, 0.78);
    --accent: #f06c52;
    --text-color: #f7f2ef;
    --muted: #c2b7b0;
    --glow: rgba(240, 108, 82, 0.28);
}

.theme--studio {
    --bg: radial-gradient(circle at top left, #fef7e8 0%, #e7f0ff 48%, #ffffff 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --accent: #2d6cdf;
    --text-color: #1d1a2c;
    --muted: #4f5061;
    --glow: rgba(45, 108, 223, 0.15);
}

.studio {
    background: var(--bg);
    color: var(--text-color);
}

.studio .page {
    display: block;
    padding: 0;
}

.studio-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 24px 72px;
}

.studio-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    gap: 16px;
}

.nav-brand {
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    letter-spacing: 1px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    font-size: 14px;
    color: var(--muted);
}

.nav-actions form {
    margin: 0;
}

.nav-button {
    padding: 10px 16px;
    font-size: 14px;
}

.studio-header {
    margin-bottom: 32px;
}

.studio-eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--accent);
    margin: 0 0 12px;
    font-weight: 600;
}

.studio-header h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 4vw, 52px);
    margin: 0 0 12px;
}

.studio-subtitle {
    margin: 0;
    max-width: 640px;
    color: var(--muted);
    font-size: 18px;
}

.studio-grid,
.share-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 32px;
}

.studio-form,
.share-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(8px);
}

.admin-form {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-strong);
    display: grid;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

label {
    font-weight: 600;
    font-size: 14px;
}

input,
select,
textarea {
    border-radius: 14px;
    border: 1px solid rgba(34, 34, 54, 0.1);
    padding: 12px 14px;
    font-size: 15px;
    font-family: var(--font-body);
    background: rgba(255, 255, 255, 0.85);
    color: inherit;
}

textarea {
    resize: vertical;
}

.field-error {
    color: #c1262e;
    margin: 4px 0 0;
    font-size: 13px;
}

.field-hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.primary-button,
.secondary-button,
.ghost-button,
.wish-button {
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 16px 32px rgba(45, 108, 223, 0.25);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.6);
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.audio-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 6;
    backdrop-filter: blur(8px);
}

.ghost-button {
    background: transparent;
    color: inherit;
    border: 1px dashed rgba(0, 0, 0, 0.2);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.wish-button:hover {
    transform: translateY(-2px);
}

.preview-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.preview-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 12px;
}

.preview-steps {
    margin: 0 0 16px;
    padding-left: 20px;
    color: var(--muted);
}

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

.share-card {
    display: grid;
    gap: 20px;
}

.share-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 14px;
}

.meta-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
}

.meta-value {
    font-weight: 600;
}

.qr-frame {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}

.qr-frame img {
    max-width: 100%;
    height: auto;
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.share-link {
    display: grid;
    gap: 8px;
}

.share-link-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.admin-table {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-strong);
    overflow-x: auto;
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
    color: var(--muted);
    padding: 10px 8px;
}

.admin-table td {
    padding: 12px 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

.admin-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.section-title {
    font-weight: 600;
    margin: 0 0 10px;
}

.chip-grid {
    display: grid;
    gap: 10px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.auth-shell {
    max-width: 520px;
    margin: 0 auto;
    padding: 64px 24px 80px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-strong);
    display: grid;
    gap: 20px;
}

.auth-card h1 {
    font-family: var(--font-display);
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-footer {
    margin: 0;
    color: var(--muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
}

.ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0.6;
    animation: float 12s ease-in-out infinite;
}

.orb--1 {
    width: 180px;
    height: 180px;
    background: var(--glow);
    top: -40px;
    left: 8%;
}

.orb--2 {
    width: 120px;
    height: 120px;
    background: var(--glow);
    bottom: 10%;
    right: 12%;
    animation-delay: 2s;
}

.orb--3 {
    width: 90px;
    height: 90px;
    background: var(--glow);
    top: 30%;
    right: 20%;
    animation-delay: 4s;
}

.spark {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--accent);
    opacity: 0.65;
    animation: drift 9s ease-in-out infinite;
}

.spark--1 {
    top: 20%;
    left: 18%;
}

.spark--2 {
    top: 60%;
    right: 22%;
    animation-delay: 2.5s;
}

.spark--3 {
    bottom: 18%;
    left: 38%;
    animation-delay: 4.5s;
}

.balloon-rain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cake-cut .balloon-rain {
    opacity: 1;
}

.balloon {
    position: absolute;
    width: 52px;
    height: 64px;
    border-radius: 50% 50% 45% 45%;
    top: -15%;
    opacity: 0;
    animation: balloon-fall 3.6s ease-in forwards;
    animation-play-state: paused;
}

.balloon::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 52px;
    background: rgba(255, 255, 255, 0.55);
    left: 50%;
    top: 64px;
    transform: translateX(-50%);
}

.cake-cut .balloon {
    animation-play-state: running;
    opacity: 1;
}

/* Gift page balloons - visible when not hidden */
.gift-balloons {
    opacity: 1;
    z-index: 95;
}

.gift-balloons[hidden] {
    display: none;
}

.gift-balloons .balloon {
    animation-play-state: running;
    opacity: 1;
    animation-iteration-count: infinite;
}

.balloon--10 {
    left: 12%;
    background: #36f2c2;
    animation-delay: 0.55s;
}

.balloon--11 {
    left: 50%;
    background: #ff9f43;
    animation-delay: 0.35s;
}

.balloon--12 {
    left: 82%;
    background: #ee5a8f;
    animation-delay: 0.7s;
}

.balloon--1 {
    left: 6%;
    background: #ff6a8b;
    animation-delay: 0.1s;
}

.balloon--2 {
    left: 18%;
    background: #f7b955;
    animation-delay: 0.4s;
}

.balloon--3 {
    left: 30%;
    background: #7bdff2;
    animation-delay: 0.2s;
}

.balloon--4 {
    left: 42%;
    background: #ffd166;
    animation-delay: 0.6s;
}

.balloon--5 {
    left: 54%;
    background: #9bdeac;
    animation-delay: 0.3s;
}

.balloon--6 {
    left: 66%;
    background: #f19c79;
    animation-delay: 0.5s;
}

.balloon--7 {
    left: 78%;
    background: #cdb4db;
    animation-delay: 0.25s;
}

.balloon--8 {
    left: 88%;
    background: #6a9dfc;
    animation-delay: 0.45s;
}

.balloon--9 {
    left: 94%;
    background: #f06c52;
    animation-delay: 0.65s;
}

.greeting-card {
    position: relative;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 40px 36px 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    text-align: center;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.7s ease, opacity 0.7s ease;
    backdrop-filter: blur(10px);
}

.greeting-card.is-revealed {
    transform: translateY(0);
    opacity: 1;
}

.intro-card {
    max-width: 600px;
}

.album-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    max-width: 960px;
    width: 100%;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.album-stage {
    padding: 40px 16px;
}

.book-card {
    max-width: 1000px;
    padding-bottom: 32px;
}

.book-shell {
    display: grid;
    gap: 16px;
    justify-items: center;
    margin-top: 16px;
}

.album-book {
    position: relative;
    width: min(860px, 92vw);
    height: clamp(280px, 50vw, 500px);
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(139, 90, 43, 0.15), rgba(92, 64, 51, 0.2));
    box-shadow: var(--shadow-soft), inset 0 0 30px rgba(0, 0, 0, 0.1);
    perspective: 1400px;
    position: relative;
}

.book-cover {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #8B4513, #654321);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.book-cover[hidden] {
    display: none;
}

.book-cover-title {
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 36px);
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.book-cover-deco {
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    margin-top: 16px;
}

.book-page {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #fffef8, #f5f0e6);
    box-shadow:
        inset 2px 0 8px rgba(0, 0, 0, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 0;
}

.book-page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #f8f6f0;
    padding: 8px;
}

.page-number {
    position: absolute;
    bottom: 12px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.4);
    font-weight: 500;
}

.book-page--left .page-number {
    left: 16px;
}

.book-page--right .page-number {
    right: 16px;
}

.book-page--right {
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.album-book.is-flipping.flip-forward .book-page--right {
    transform: rotateY(-90deg);
}

.album-book.is-flipping.flip-backward .book-page--left {
    transform: rotateY(90deg);
}

.book-spine {
    position: absolute;
    top: 8%;
    bottom: 8%;
    left: 50%;
    width: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.25));
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.book-hint {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.book-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.book-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
}

.book-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.book-btn svg {
    flex-shrink: 0;
}

.book-page-indicator {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    min-width: 80px;
    text-align: center;
}

.album-book.is-single {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

.album-book.is-single .book-spine {
    display: none;
}

.album-book.is-single .book-page--left {
    display: none;
}

.album-book.is-single .book-page--right {
    grid-column: 1 / -1;
    height: 100%;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.album-photo {
    margin: 0;
}

.album-photo img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
    aspect-ratio: 4 / 5;
}

.album-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.final-message {
    margin: 18px 0 0;
    font-size: 18px;
    color: var(--muted);
}

.gift-stage {
    display: grid;
    gap: 12px;
    justify-items: center;
    margin: 20px 0 12px;
}

.gift-box {
    position: relative;
    width: 180px;
    height: 140px;
}

.gift-base {
    position: absolute;
    inset: auto 0 0 0;
    height: 90px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f7b955 0%, #f06c52 100%);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.6s ease;
}

.gift-lid {
    position: absolute;
    inset: 0 0 auto 0;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffd166 0%, #f7b955 100%);
    transform-origin: center bottom;
    transition: transform 0.6s ease;
}

.gift-ribbon {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 18px;
    transform: translateX(-50%);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.gift-stage.is-open .gift-lid {
    transform: translateY(-24px) rotate(-10deg);
}

.gift-stage.is-open .gift-base {
    transform: translateY(6px);
}

.gift-result {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gift-result[hidden] {
    display: none;
}

.gift-cheer {
    margin: 6px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    animation: gift-pop 0.6s ease;
}

.gift-cheer[hidden] {
    display: none;
}

.gift-collect {
    margin-top: 6px;
}

.farewell-message {
    margin: 10px 0 0;
    font-size: 16px;
    color: var(--muted);
}

.farewell-message[hidden] {
    display: none;
}

.gift-box::after {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gift-stage.is-open .gift-box::after {
    opacity: 1;
    animation: gift-glow 1.4s ease-in-out infinite;
}

.greeting-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 40px);
    margin: 12px 0 8px;
}

.greeting-message {
    font-size: 16px;
    color: var(--muted);
    margin: 0 0 20px;
}

.badge {
    display: inline-flex;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.wish-zone {
    display: grid;
    gap: 12px;
    justify-items: center;
}

.wish-button {
    background: transparent;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.theme--balloons .wish-button,
.theme--sunrise .wish-button {
    border-color: rgba(0, 0, 0, 0.2);
}

.wish-note {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.wish-note.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.signature {
    margin-top: 32px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
}

.floor-glow {
    position: absolute;
    inset: auto 0 0 0;
    height: 240px;
    background: radial-gradient(circle at center, var(--glow) 0%, transparent 70%);
    opacity: 0.6;
    pointer-events: none;
}

.wish-fired .spark {
    animation-duration: 4s;
    opacity: 0.9;
    transform: scale(1.2);
}

@keyframes float {
    0% {
        transform: translateY(0px) translateX(0px);
    }
    50% {
        transform: translateY(20px) translateX(8px);
    }
    100% {
        transform: translateY(0px) translateX(0px);
    }
}

@keyframes drift {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(20deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}


.video-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(circle at top, rgba(20, 24, 40, 0.9) 0%, rgba(7, 9, 18, 0.95) 65%, #05060f 100%);
}

.video-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px 80px;
    gap: 20px;
    width: 100%;
}

.cake-stage {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 14px;
    max-width: 640px;
    width: 100%;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.cake {
    position: relative;
    width: 220px;
    height: 140px;
    margin: 0 auto;
}

.cake-half {
    position: absolute;
    width: 50%;
    height: 100%;
    background: linear-gradient(180deg, #f2c58f 0%, #dba575 100%);
    border-radius: 18px 18px 14px 14px;
    top: 20px;
    box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
    transition: transform 0.8s ease;
}

.cake-half--left {
    left: 0;
}

.cake-half--right {
    right: 0;
}

.cake-icing {
    position: absolute;
    inset: 0 0 auto 0;
    height: 40px;
    background: linear-gradient(180deg, #fff6f0 0%, #f7d9c4 100%);
    border-radius: 18px 18px 12px 12px;
    top: 0;
}

.cake-candles {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    align-items: flex-end;
}

.cake-candle {
    position: relative;
    width: 14px;
    height: 44px;
    background: #f06c52;
    border-radius: 10px;
    box-shadow: 0 0 12px rgba(240, 108, 82, 0.4);
}

.candle--1 {
    height: 48px;
    background: #f06c52;
}

.candle--2 {
    height: 40px;
    background: #ffd166;
}

.candle--3 {
    height: 46px;
    background: #7bdff2;
}

.candle--4 {
    height: 38px;
    background: #cdb4db;
}

.candle--5 {
    height: 44px;
    background: #f19c79;
}

.candle--6 {
    height: 36px;
    background: #9bdeac;
}

.candle--7 {
    height: 50px;
    background: #6a9dfc;
}

.cake-candle::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 22px;
    background: radial-gradient(circle at 30% 30%, #fff7e8 0%, #ffd089 40%, #f06c52 70%, rgba(240, 108, 82, 0.1) 100%);
    border-radius: 50% 50% 50% 50%;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 10px rgba(240, 108, 82, 0.6));
    animation: flicker 1.1s infinite ease-in-out;
}

.cake-candle::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.cake-cut .cake-candle::after {
    animation: flame-out 0.6s ease forwards;
}

.cake-cut .cake-candle::before {
    animation: smoke 1.1s ease forwards;
}

.cake-knife {
    position: absolute;
    width: 160px;
    height: 10px;
    background: #cfd2dd;
    border-radius: 999px;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.cake-cut .cake-knife {
    animation: slice 0.8s ease forwards;
}

.cake-cut .cake-half--left {
    transform: translateX(-22px) rotate(-2deg);
}

.cake-cut .cake-half--right {
    transform: translateX(22px) rotate(2deg);
}

.cut-next {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.cut-next[hidden],
.cut-link[hidden] {
    display: none;
}

.wish-form {
    display: grid;
    gap: 16px;
    text-align: left;
}

.wish-stage {
    padding: 30px 16px 50px;
}

.wish-card {
    max-width: 900px;
}

.wish-page {
    text-align: center;
}

.wish-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    text-align: left;
    margin-bottom: 16px;
}

.wish-form-left,
.wish-form-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wish-form-left .field:last-child {
    flex: 1;
}

.wish-form-left textarea {
    height: 100%;
    min-height: 80px;
}

.wish-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.field-label {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.gift-option {
    position: relative;
    cursor: pointer;
}

.gift-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gift-card {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 12px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.14);
    text-align: center;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.gift-sticker {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: var(--accent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.gift-sticker svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gift-sticker--ring {
    color: #f7b955;
}

.gift-sticker--watch {
    color: #6a9dfc;
}

.gift-sticker--necklace {
    color: #f06c52;
}

.gift-sticker--bracelet {
    color: #9bdeac;
}

.gift-sticker--perfume {
    color: #cdb4db;
}

.gift-sticker--flowers {
    color: #ff6a8b;
}

.gift-sticker--chocolate_box {
    color: #8f6c5b;
}

.gift-sticker--teddy_bear {
    color: #f19c79;
}

.gift-sticker--result {
    width: 58px;
    height: 58px;
}

.gift-label {
    font-weight: 600;
    font-size: 12px;
}
    font-size: 14px;
}

.gift-option input:checked + .gift-card {
    border-color: var(--accent);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.gift-option input:checked + .gift-card .gift-sticker {
    background: rgba(255, 255, 255, 0.28);
    border-color: var(--accent);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.wish-sent {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.wish-modal[hidden] {
    display: none;
}

.wish-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.55);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wish-modal.is-visible {
    opacity: 1;
}

.wish-modal-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-soft);
    position: relative;
    display: grid;
    gap: 16px;
}

.wish-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: transparent;
    border: none;
    font-weight: 600;
    cursor: pointer;
    color: inherit;
}

.wish-modal-card h2 {
    margin: 0;
    font-family: var(--font-display);
}

.wish-modal-subtitle {
    margin: 0;
    color: var(--muted);
}

.dashboard-grid {
    display: grid;
    gap: 24px;
}

.dashboard-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-strong);
    display: grid;
    gap: 16px;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-title {
    margin: 0;
    font-weight: 600;
}

.dashboard-meta {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.wish-list {
    display: grid;
    gap: 14px;
}

.wish-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    display: grid;
    gap: 6px;
}

.wish-name {
    margin: 0;
    font-weight: 600;
}

.wish-message {
    margin: 0;
    color: var(--muted);
}

.wish-gift {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.wish-time {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.wish-empty {
    margin: 0;
    color: var(--muted);
}

@keyframes flicker {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 0.9;
    }
    50% {
        transform: translateX(-50%) scale(0.9) rotate(-3deg);
        opacity: 0.75;
    }
    100% {
        transform: translateX(-50%) scale(1.05) rotate(2deg);
        opacity: 1;
    }
}

@keyframes flame-out {
    0% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.2);
    }
}

@keyframes balloon-fall {
    0% {
        transform: translateY(-10vh) scale(0.9);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    100% {
        transform: translateY(120vh) scale(1.05);
        opacity: 0;
    }
}

@keyframes smoke {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.6);
    }
    30% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -24px) scale(1.4);
    }
}

@keyframes slice {
    0% {
        opacity: 0;
        transform: translate(-50%, -30px);
    }
    40% {
        opacity: 1;
        transform: translate(-50%, 40px);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 80px);
    }
}
@media (max-width: 900px) {
    .studio-grid,
    .share-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .album-book {
        max-width: 360px;
        height: clamp(320px, 70vh, 450px);
        padding: 12px;
    }

    .album-book .book-page img {
        object-fit: contain;
        padding: 6px;
    }

    .book-controls {
        width: 100%;
        justify-content: space-between;
        padding: 0 10px;
    }

    .book-page-indicator {
        order: 0;
    }
}

@media (max-width: 600px) {
    .theme .page {
        padding: 20px 12px;
        min-height: auto;
        align-items: flex-start;
    }

    .studio-shell {
        padding: 40px 18px 64px;
    }

    .studio-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-actions {
        flex-wrap: wrap;
    }

    .greeting-card {
        margin: 0 auto;
        padding: 32px 20px 28px;
        max-height: none;
        overflow-y: visible;
    }

    .stage {
        padding: 30px 14px 50px;
        min-height: auto;
        overflow-y: visible;
    }

    .wish-stage {
        padding: 20px 12px 40px;
        min-height: auto;
    }

    .wish-card {
        max-height: none;
        overflow: visible;
    }

    .wish-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .gift-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .album-stage {
        padding: 20px 10px;
    }

    .cake {
        width: 160px;
        height: 110px;
    }

    .cake-stage {
        padding: 24px 20px;
    }

    .wish-modal-card {
        padding: 24px;
    }

    .share-link-row {
        grid-template-columns: 1fr;
    }

    .album-card {
        padding: 20px 16px;
    }

    .album-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .album-book {
        width: 100%;
        max-width: 320px;
        height: clamp(300px, 65vh, 420px);
        padding: 10px;
        gap: 10px;
    }

    .book-spine {
        width: 4px;
    }

    .gift-box {
        width: 150px;
        height: 120px;
    }

    .gift-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wish-actions {
        width: 100%;
    }

    .wish-actions .primary-button,
    .wish-actions .secondary-button {
        width: 100%;
    }


    .gift-stage .primary-button,
    .gift-stage .secondary-button {
        width: 100%;
    }

    .book-controls {
        width: 100%;
    }

    .book-controls .secondary-button {
        flex: 1;
    }

    .audio-toggle {
        right: 14px;
        bottom: 14px;
    }

    /* Envelope mobile styles */
    .envelope {
        width: min(280px, 80vw);
        height: min(190px, 55vw);
    }

    .praise-card {
        padding: 14px 12px;
    }

    .praise-icon {
        font-size: 28px;
    }

    .praise-title {
        font-size: 15px;
    }

    .praise-text {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}


@media (max-width: 420px) {
    .greeting-card,
    .cake-stage,
    .album-card {
        padding: 24px 16px;
    }

    .cake {
        width: 140px;
        height: 100px;
    }

    .gift-grid {
        grid-template-columns: 1fr;
    }

    .gift-popup {
        padding: 28px 20px;
    }

    .gift-popup-icon {
        width: 80px;
        height: 80px;
    }

    .gift-popup-icon svg {
        width: 40px;
        height: 40px;
    }

    .gift-popup-image-wrap {
        max-width: 180px;
        padding: 6px;
    }

    .gift-popup-image {
        max-width: 160px;
    }

    .album-book {
        height: clamp(280px, 60vh, 380px);
    }

    .book-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .book-btn span {
        display: none;
    }

    .book-page-indicator {
        font-size: 13px;
    }

    /* Step indicator mobile */
    .step-indicator {
        bottom: 16px;
        padding: 8px 16px;
        gap: 10px;
    }

    .step-dot {
        width: 8px;
        height: 8px;
    }

    /* Praise card mobile */
    .praise-card-floating {
        padding: 20px 18px;
        margin-bottom: 16px;
    }

    .praise-icon {
        font-size: 36px;
    }

    .praise-title {
        font-size: 18px;
    }

    .praise-text {
        font-size: 13px;
    }

    /* Goodbye mobile */
    .goodbye-title {
        font-size: clamp(32px, 10vw, 48px);
    }

    .goodbye-text {
        font-size: 16px;
    }

    .goodbye-wish {
        font-size: 18px;
    }

    /* Envelope mobile */
    .envelope {
        width: min(260px, 75vw);
        height: min(170px, 50vw);
    }
}


@keyframes gift-glow {
    0% {
        box-shadow: 0 0 10px rgba(247, 185, 85, 0.35);
    }
    50% {
        box-shadow: 0 0 28px rgba(240, 108, 82, 0.6);
    }
    100% {
        box-shadow: 0 0 12px rgba(247, 185, 85, 0.4);
    }
}

@keyframes gift-pop {
    0% {
        transform: translateY(6px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Gift Popup Styles */
.gift-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gift-popup-overlay[hidden] {
    display: none;
}

.gift-popup-overlay.is-visible {
    opacity: 1;
}

.gift-popup {
    position: relative;
    background: var(--card-bg, rgba(255, 255, 255, 0.95));
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    transform: scale(0.8) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.gift-popup-overlay.is-visible .gift-popup {
    transform: scale(1) translateY(0);
}

.gift-popup-sparkle {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--glow, rgba(247, 185, 85, 0.3)) 0%, transparent 70%);
    animation: sparkle-pulse 2s ease-in-out infinite;
}

.gift-popup-content {
    position: relative;
    z-index: 1;
}

.gift-popup-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid var(--accent);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    animation: gift-icon-bounce 0.8s ease;
}

.gift-popup-icon svg {
    width: 50px;
    height: 50px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gift-popup-image-wrap {
    position: relative;
    margin: 16px auto 20px;
    padding: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: gift-image-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
    max-width: 240px;
}

.gift-popup-image-wrap::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--accent), transparent, var(--accent));
    opacity: 0.5;
    z-index: -1;
    animation: gift-glow 2s ease-in-out infinite;
}

.gift-popup-image {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
    border-radius: 18px;
    object-fit: cover;
    aspect-ratio: 1;
}

@keyframes gift-image-pop {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    60% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.gift-popup-title {
    font-family: var(--font-display);
    font-size: clamp(24px, 5vw, 32px);
    margin: 0 0 12px;
    animation: text-pop 0.6s ease 0.2s both;
}

.gift-popup-label {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.gift-popup-name {
    margin: 8px 0 16px;
    font-size: clamp(28px, 6vw, 38px);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--accent);
    animation: text-pop 0.6s ease 0.4s both;
}

.gift-popup-cheer {
    margin: 0 0 24px;
    font-size: 16px;
    color: var(--muted);
    animation: text-pop 0.6s ease 0.6s both;
}

.gift-popup-collect {
    animation: text-pop 0.6s ease 0.8s both;
}

/* Confetti Styles */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 90;
    overflow: hidden;
}

.confetti-container[hidden] {
    display: none;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    animation: confetti-fall 3.5s ease-in-out forwards;
}

.confetti--1 { left: 5%; background: #ff6a8b; animation-delay: 0s; border-radius: 50%; }
.confetti--2 { left: 15%; background: #f7b955; animation-delay: 0.1s; }
.confetti--3 { left: 25%; background: #7bdff2; animation-delay: 0.2s; border-radius: 50%; }
.confetti--4 { left: 35%; background: #9bdeac; animation-delay: 0.05s; }
.confetti--5 { left: 45%; background: #cdb4db; animation-delay: 0.15s; border-radius: 50%; }
.confetti--6 { left: 55%; background: #f06c52; animation-delay: 0.25s; }
.confetti--7 { left: 65%; background: #ffd166; animation-delay: 0.1s; border-radius: 50%; }
.confetti--8 { left: 75%; background: #6a9dfc; animation-delay: 0.2s; }

.confetti:nth-child(n+9) { left: calc(8% * var(--n, 1)); animation-delay: calc(0.05s * var(--n, 1)); }
.confetti:nth-child(9) { --n: 9; }
.confetti:nth-child(10) { --n: 10; }
.confetti:nth-child(11) { --n: 11; left: 85%; }
.confetti:nth-child(12) { --n: 12; left: 95%; }
.confetti:nth-child(n+13) { left: calc(7% + random(86) * 1%); }

/* Farewell Overlay */
.farewell-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg, rgba(0, 0, 0, 0.85));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.farewell-overlay[hidden] {
    display: none;
}

.farewell-overlay.is-visible {
    opacity: 1;
}

.farewell-content {
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.5s ease;
}

.farewell-overlay.is-visible .farewell-content {
    transform: scale(1);
}

.farewell-wave {
    font-size: 80px;
    display: block;
    animation: wave-hand 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.farewell-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 6vw, 48px);
    margin: 0 0 12px;
    color: var(--text-color, #fff);
}

.farewell-text {
    font-size: 18px;
    color: var(--muted);
    margin: 0 0 24px;
}

@keyframes sparkle-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes gift-icon-bounce {
    0% { transform: scale(0) rotate(-10deg); }
    60% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes text-pop {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes confetti-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@keyframes wave-hand {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

/* Envelope Styles */
.envelope-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg, rgba(0, 0, 0, 0.9));
    display: none;
    visibility: hidden;
    align-items: center;
    justify-content: center;
    z-index: 110;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow-y: auto;
}

.envelope-overlay[hidden] {
    display: none !important;
    visibility: hidden !important;
}

.envelope-overlay:not([hidden]) {
    display: flex;
    visibility: visible;
}

.envelope-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.envelope-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.5s ease;
    gap: 20px;
}

.envelope-overlay.is-visible .envelope-scene {
    transform: scale(1);
}

.envelope {
    position: relative;
    width: min(320px, 85vw);
    height: min(220px, 60vw);
    margin: 0 auto 24px;
    cursor: pointer;
    perspective: 1000px;
}

.envelope-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #d4a574, #c49462);
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.envelope-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #e8c9a0, #d4a574);
    border-radius: 8px;
    clip-path: polygon(0 40%, 50% 70%, 100% 40%, 100% 100%, 0 100%);
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(180deg, #f0d9b5, #e8c9a0);
    border-radius: 8px 8px 0 0;
    clip-path: polygon(0 0, 100% 0, 100% 20%, 50% 100%, 0 20%);
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.envelope.is-open .envelope-flap {
    transform: rotateX(180deg);
}

/* Floating Praise Card (appears above envelope) */
.praise-card-floating {
    background: linear-gradient(135deg, #fff9f0, #fff);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(80px) scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
    order: -1; /* Places card above envelope in flex container */
}

.praise-card-floating[hidden] {
    display: none;
}

.praise-card-floating.is-visible {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: card-float 3s ease-in-out infinite;
    animation-delay: 0.8s;
}

@keyframes card-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

/* Envelope Container */
.envelope-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.envelope-container.is-faded {
    opacity: 0.4;
    transform: scale(0.85);
}

.praise-icon {
    font-size: 48px;
    margin: 0 0 12px;
    animation: float-icon 3s ease-in-out infinite;
}

@keyframes float-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.praise-title {
    font-family: var(--font-display);
    font-size: 22px;
    color: #2d2d2d;
    margin: 0 0 14px;
}

.praise-text {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 14px;
}

.praise-signature {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent, #e75a37);
    margin: 0;
}

.envelope-hint {
    font-size: 14px;
    color: var(--muted);
    margin: 0 0 16px;
    animation: pulse-hint 2s ease-in-out infinite;
}

.envelope-hint[hidden] {
    display: none;
}

.envelope-open-btn[hidden] {
    display: none;
}

.envelope-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    animation: text-pop 0.5s ease both;
    margin-top: 20px;
}

.envelope-actions[hidden] {
    display: none;
}

/* Goodbye Overlay */
.goodbye-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg, rgba(0, 0, 0, 0.95));
    display: none;
    visibility: hidden;
    align-items: center;
    justify-content: center;
    z-index: 120;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.goodbye-overlay[hidden] {
    display: none !important;
    visibility: hidden !important;
}

.goodbye-overlay:not([hidden]) {
    display: flex;
    visibility: visible;
}

.goodbye-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.goodbye-content {
    text-align: center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.goodbye-overlay.is-visible .goodbye-content {
    transform: scale(1);
    opacity: 1;
}

.goodbye-stars {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.goodbye-star {
    font-size: 40px;
    animation: twinkle 1.5s ease-in-out infinite;
}

.goodbye-star:nth-child(2) {
    font-size: 56px;
    animation-delay: 0.3s;
}

.goodbye-star:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.goodbye-title {
    font-family: var(--font-display);
    font-size: clamp(40px, 8vw, 64px);
    margin: 0 0 12px;
    color: var(--text-color, #fff);
    animation: goodbye-wave 2s ease-in-out infinite;
}

@keyframes goodbye-wave {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

.goodbye-text {
    font-size: 18px;
    color: var(--muted);
    margin: 0 0 8px;
}

.goodbye-wish {
    font-size: 22px;
    color: var(--accent);
    margin: 0 0 28px;
    font-weight: 600;
}

.goodbye-btn {
    animation: text-pop 0.6s ease 0.4s both;
}

/* Step Indicator */
.step-indicator {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 200;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    backdrop-filter: blur(10px);
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.step-dot--active {
    background: var(--accent, #f7b955);
    transform: scale(1.3);
    box-shadow: 0 0 10px var(--accent, #f7b955);
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
