:root {
    color-scheme: light;
    --ink: #20191b;
    --muted: #6e6266;
    --paper: #fff8f3;
    --surface: #fffdfb;
    --rose: #d9435f;
    --rose-dark: #9f1f38;
    --coral: #ef7f5f;
    --gold: #f0bd4f;
    --mint: #4b9b8f;
    --blue: #dbeaf7;
    --line: rgba(32, 25, 27, .14);
    --shadow: 0 24px 72px rgba(63, 35, 41, .18);
}

html, body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}


* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    font-family: Inter, Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
}

body.lightbox-open {
    overflow: hidden;
}

a,
button {
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
}

button {
    font: inherit;
}

img,
canvas {
    max-width: 100%;
}

.celebration-canvas {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.page-shell,
.birthday-page {
    overflow: hidden;
}

.hero-section {
    position: relative;
    min-height: 100vh;
    padding: 24px clamp(18px, 4vw, 64px) 72px;
    display: grid;
    align-content: center;
    gap: 26px;
    background:
        linear-gradient(180deg, rgba(32, 25, 27, .58), rgba(32, 25, 27, .18) 44%, rgba(255, 248, 243, .96) 100%),
        url("/uploads/hero-couple.jpg") center / cover no-repeat;
    color: #fff;
}

.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 22%, rgba(217, 67, 95, .36), transparent 32%),
        radial-gradient(circle at 82% 18%, rgba(240, 189, 79, .28), transparent 28%),
        linear-gradient(90deg, rgba(32, 25, 27, .62), rgba(32, 25, 27, .12));
    pointer-events: none;
}

.top-nav {
    position: absolute;
    z-index: 4;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    max-width: calc(100% - 28px);
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(18px);
    overflow-x: auto;
}

.top-nav a {
    flex: 0 0 auto;
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.top-nav a:hover {
    background: rgba(255, 255, 255, .18);
}

.hero-content {
    position: relative;
    z-index: 2;
    width: min(980px, 100%);
    margin: 58px auto 0;
    text-align: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--rose);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-section .eyebrow {
    color: #ffe3e8;
}

h1,
h2,
h3,
p,
span,
strong {
    overflow-wrap: anywhere;
}

h1,
h2 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    letter-spacing: 0;
    line-height: .95;
}

h1 {
    font-size: clamp(56px, 11vw, 142px);
    text-shadow: 0 18px 46px rgba(0, 0, 0, .32);
}

h2 {
    font-size: clamp(38px, 7vw, 78px);
}

h3 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.05;
}

.hero-copy {
    width: min(760px, 100%);
    margin: 18px auto 0;
    color: rgba(255, 255, 255, .9);
    font-size: clamp(17px, 2.2vw, 22px);
    line-height: 1.55;
}

.hero-showcase {
    position: relative;
    z-index: 2;
    width: min(1060px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
    justify-items: center;
}

.hero-photo-frame {
    position: relative;
    width: min(820px, 100%);
    aspect-ratio: 16 / 9.5;
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 28px 88px rgba(0, 0, 0, .36);
    animation: heroLift 5.5s ease-in-out infinite;
}

.hero-photo-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.photo-badge {
    position: absolute;
    left: 16px;
    bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 253, 251, .88);
    color: var(--rose-dark);
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.cake-stage {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-top: 30px;
}

.birthday-cake {
    position: relative;
    width: min(360px, calc(100vw - 40px));
    height: 190px;
    border: 0;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 24px 34px rgba(0, 0, 0, .3));
}

.birthday-cake:focus-visible,
.game-toolbar button:focus-visible,
.match-toolbar button:focus-visible,
.mystery-box:focus-visible,
.photo-card:focus-visible,
.lightbox-close:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

.cake-plate,
.cake-layer,
.candle,
.icing-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.cake-plate {
    bottom: 8px;
    width: 320px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 253, 251, .86);
}

.cake-layer {
    border-radius: 8px;
    box-shadow: inset 0 -10px 0 rgba(32, 25, 27, .08);
}

.cake-layer-bottom {
    bottom: 28px;
    width: 270px;
    height: 58px;
    background: linear-gradient(90deg, #6f4039, #9f4f57);
}

.cake-layer-middle {
    bottom: 78px;
    width: 230px;
    height: 50px;
    background: linear-gradient(90deg, var(--coral), var(--rose));
}

.cake-layer-top {
    bottom: 122px;
    width: 184px;
    height: 40px;
    background: linear-gradient(90deg, #fff4ed, #f7c7b4);
}

.candle {
    bottom: 158px;
    width: 12px;
    height: 42px;
    border-radius: 4px 4px 2px 2px;
    background: repeating-linear-gradient(45deg, #fff, #fff 6px, var(--mint) 6px, var(--mint) 10px);
}

.candle-one {
    margin-left: -64px;
}

.candle-two {
    margin-left: 0;
}

.candle-three {
    margin-left: 64px;
}

.flame {
    position: absolute;
    left: 50%;
    top: -24px;
    width: 18px;
    height: 26px;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 70% 20% 70% 20%;
    background: radial-gradient(circle at 65% 65%, #fff7a8 0 18%, #f0bd4f 32%, #ef7f5f 68%, rgba(217, 67, 95, .05) 72%);
    box-shadow: 0 0 20px rgba(240, 189, 79, .85);
    animation: flameFlicker .9s ease-in-out infinite alternate;
}

.icing-dot {
    bottom: 104px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold);
}

.dot-one {
    margin-left: -74px;
}

.dot-two {
    margin-left: -10px;
}

.dot-three {
    margin-left: 66px;
}

.cake-message {
    width: min(520px, 100%);
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    text-align: center;
    font-weight: 800;
    backdrop-filter: blur(14px);
}

.birthday-cake.celebrating {
    animation: cakePop .75s ease both;
}

.section-heading {
    width: min(840px, 100%);
    margin-bottom: 30px;
}

.section-heading.compact {
    margin-bottom: 18px;
}

.gallery-section,
.surprise-section,
.games-section,
.letter-section {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 94px 0;
}

.photo-marquee {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    overflow: hidden;
    padding: 12px 0 24px;
}

.photo-track {
    display: flex;
    gap: 14px;
    width: max-content;
    animation: photoDrift 36s linear infinite;
}

.photo-track img {
    width: 220px;
    height: 148px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 16px 38px rgba(63, 35, 41, .14);
}

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

.photo-card {
    position: relative;
    min-height: 250px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    cursor: pointer;
    box-shadow: 0 14px 38px rgba(63, 35, 41, .1);
}

.photo-card:nth-child(3n + 2) {
    min-height: 320px;
}

.photo-card img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    display: block;
    object-fit: cover;
    transition: transform .45s ease;
}

.photo-card span {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(255, 253, 251, .88);
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    text-align: left;
}

.photo-card:hover img {
    transform: scale(1.05);
}

.surprise-section {
    display: grid;
    gap: 20px;
}

.mystery-status {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.mystery-status span {
    color: var(--muted);
    font-weight: 900;
}

.mystery-status strong {
    color: var(--rose-dark);
}

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

.mystery-box {
    position: relative;
    min-height: 156px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(145deg, #fffdfb, #ffe8ec);
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(63, 35, 41, .1);
}

.box-body,
.box-lid,
.box-ribbon {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.box-body {
    bottom: 24px;
    width: 92px;
    height: 70px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--rose), var(--coral));
}

.box-lid {
    bottom: 92px;
    width: 112px;
    height: 32px;
    border-radius: 8px;
    background: var(--rose-dark);
    transition: transform .35s ease;
}

.box-ribbon {
    bottom: 24px;
    width: 18px;
    height: 100px;
    background: var(--gold);
}

.mystery-box strong {
    position: absolute;
    left: 10px;
    top: 10px;
    color: var(--rose-dark);
    font-weight: 900;
}

.mystery-box.opened .box-lid {
    transform: translate(-50%, -48px) rotate(-12deg);
}

.mystery-box.opened {
    background: linear-gradient(145deg, #ddf0e8, #fffdfb);
}

.mystery-reveal {
    display: grid;
    grid-template-columns: minmax(160px, 240px) 1fr;
    gap: 18px;
    align-items: center;
    min-height: 210px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.mystery-reveal img {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    object-fit: cover;
}

.mystery-reveal p {
    margin: 0;
    color: var(--ink);
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(28px, 4vw, 50px);
    line-height: 1.05;
}

.game-stack {
    display: grid;
    gap: 22px;
}

.match-game,
.runner-game {
    display: grid;
    grid-template-columns: minmax(230px, .72fr) minmax(0, 1.45fr);
    gap: 22px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.game-copy p {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.match-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.match-toolbar span {
    color: var(--muted);
    font-weight: 900;
}

.match-toolbar button,
.game-toolbar button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: var(--rose);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

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

.match-card {
    min-height: 86px;
    border: 1px solid rgba(32, 25, 27, .12);
    border-radius: 8px;
    background: linear-gradient(145deg, var(--rose-dark), var(--rose));
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform .25s ease, background .25s ease;
}

.match-card.flipped,
.match-card.matched {
    background: linear-gradient(145deg, #fffdfb, #ddf0e8);
    color: var(--ink);
}

.match-card.matched {
    border-color: rgba(75, 155, 143, .55);
    transform: translateY(-2px);
}

.game-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdfb;
    overflow: hidden;
}

.game-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr)) auto;
    gap: 10px;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: #fff8f4;
}

.toolbar-label {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.game-toolbar strong {
    font-size: 24px;
}

#loveGameCanvas {
    display: block;
    width: 100%;
    aspect-ratio: 7 / 3;
    background: linear-gradient(#ffe8ec 0%, #fff8f4 58%, #ddf0e8 58%, #b8dfd2 100%);
    cursor: pointer;
}

.game-hint {
    margin: 0;
    padding: 14px 16px 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.letter-section {
    display: grid;
    grid-template-columns: minmax(260px, .85fr) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
    padding-bottom: 120px;
}

.letter-photo,
.letter {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.letter-photo img {
    width: 100%;
    height: 100%;
    min-height: 430px;
    display: block;
    object-fit: cover;
}

.letter {
    padding: clamp(28px, 5vw, 58px);
}

.letter p {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.75;
}

.letter strong {
    display: block;
    margin-top: 28px;
    color: var(--rose-dark);
    font-size: 20px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(32, 25, 27, .82);
}

.lightbox.open {
    display: grid;
}

.lightbox img {
    width: min(980px, 100%);
    max-height: 78vh;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 26px 80px rgba(0, 0, 0, .45);
}

.lightbox p {
    margin: 12px 0 0;
    color: #fff;
    font-weight: 900;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    padding: 0 14px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.error-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: 24px;
    text-align: center;
}

.error-page h1 {
    font-size: clamp(42px, 7vw, 82px);
}

.error-page p {
    margin: 0;
    color: var(--muted);
}

.error-page a {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0 20px;
    background: var(--rose);
    color: #fff;
    font-weight: 900;
}

@keyframes heroLift {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes flameFlicker {
    0% {
        transform: translateX(-50%) rotate(39deg) scale(.92);
    }
    100% {
        transform: translateX(-50%) rotate(51deg) scale(1.08);
    }
}

@keyframes cakePop {
    0% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.07) rotate(-1deg);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes photoDrift {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@media (max-width: 980px) {
    .hero-section {
        min-height: auto;
        padding-top: 92px;
    }

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

    .match-game,
    .runner-game,
    .letter-section {
        grid-template-columns: 1fr;
    }

    .letter-photo img {
        min-height: 320px;
    }
}

@media (max-width: 620px) {
    .hero-section {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-content {
        margin-top: 34px;
    }

    .hero-photo-frame {
        aspect-ratio: 4 / 5;
    }

    .birthday-cake {
        transform: scale(.86);
        transform-origin: center top;
        margin-bottom: -20px;
    }

    .gallery-section,
    .surprise-section,
    .games-section,
    .letter-section {
        width: min(100% - 28px, 1180px);
        padding: 66px 0;
    }

    .gallery-grid,
    .mystery-grid,
    .mystery-reveal {
        grid-template-columns: 1fr;
    }

    .photo-card,
    .photo-card:nth-child(3n + 2) {
        min-height: 320px;
    }

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

    .game-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .game-toolbar button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .photo-track img {
        width: 170px;
        height: 118px;
    }
}
