:root {
    --question-stack-gap: 22px;
    --question-page-pad-y: 28px;
    --question-page-pad-x: 18px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    min-height: 100%;
}

body {
    margin: 0;
    padding: var(--question-page-pad-y) var(--question-page-pad-x);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    font-family: 'Arial', sans-serif;
    color: white;
    text-align: center;
    overflow-x: auto;
    overflow-y: auto;
}

.container { padding: 20px; position: relative; z-index: 2; }
h1 {
    font-size: 2.5rem;
    white-space: nowrap;
}

#question-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--question-stack-gap);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
    overflow: visible;
    padding-bottom: 32px;
}

.question-heading-scroll {
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
#question-heading {
    margin: 0;
    display: inline-block;
    width: max-content;
    max-width: none;
    white-space: nowrap;
    text-align: center;
}

.story-photo-wrap {
    margin: 0;
    width: 100%;
    max-width: min(92vw, 380px);
    border-radius: 16px;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}
.story-photo-wrap img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    max-height: min(52vh, 420px);
    object-fit: cover;
    vertical-align: middle;
}

.question-buttons-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    transition: padding-top 0.28s ease;
}

.btn {
    padding: 15px 35px;
    font-size: 1.2rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin: 0;
}

.btn-yes {
    background-color: #16a34a;
    color: white;
    font-weight: 700;
    transition: transform 0.28s ease;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.45);
    transform-origin: center center;
}
.btn-yes:hover { filter: brightness(1.06); }

.btn-no {
    padding: 9px 22px;
    font-size: 0.98rem;
    background-color: #dc2626;
    color: white;
    font-weight: 600;
    transition: left 0.05s, top 0.05s;
    line-height: 1.3;
    z-index: 25;
    white-space: nowrap;
}

#photo-section { display: none; }
.photo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 800px;
}
.photo-grid img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    border: 5px solid white;
}

#celebration-layer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
#celebration-layer.visible {
    display: flex;
    pointer-events: auto;
}

#fw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.celebration-stack {
    position: relative;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(14px, 3vh, 22px);
    max-width: min(96vw, 720px);
    max-height: min(88vh, 720px);
    padding: 20px 18px 28px;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: auto;
    pointer-events: auto;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
    -webkit-overflow-scrolling: touch;
}

.celebration-stack .line1 {
    font-size: clamp(1.35rem, 4.5vw, 2.35rem);
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
    order: 1;
    white-space: nowrap;
    width: max-content;
    max-width: none;
    text-align: center;
}

#celebration-jpg {
    display: none;
    order: 2;
    width: 100%;
    max-width: min(82vw, 360px);
    max-height: min(36vh, 320px);
    height: auto;
    object-fit: cover;
    border-radius: 18px;
    border: 5px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.celebration-stack .line2 {
    order: 3;
    color: yellow;
    font-size: clamp(1rem, 3.2vw, 1.65rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.55;
    white-space: nowrap;
    width: max-content;
    max-width: none;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}
.celebration-stack .line2.show {
    opacity: 1;
    transform: translateY(0);
}

.love-btn {
    order: 4;
    margin-top: 4px;
    opacity: 0;
    transform: scale(0.88);
    pointer-events: none;
    transition: opacity 0.55s ease, transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
    padding: 14px 52px;
    font-size: 1.22rem;
    font-weight: 800;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: white;
    box-shadow: 0 10px 32px rgba(244, 63, 94, 0.42);
}
.love-btn:hover { filter: brightness(1.06); }
.love-btn.love-btn-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

#heart-gallery-layer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    background: linear-gradient(160deg, #ff9a9e 0%, #fad0c4 45%, #fbc2eb 100%);
    overflow: hidden;
    padding: 0;
    gap: 0;
}
#heart-gallery-layer.visible {
    display: flex;
}

#heart-side-strip {
    flex: 0 0 clamp(130px, 32vw, 380px);
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-height: 100dvh;
    border-right: 3px solid rgba(255, 255, 255, 0.5);
}
#heart-side-strip video {
    flex: 1;
    min-height: 0;
    width: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

#heart-main {
    --heart-thumb: 56px;
    --heart-gap: 3px;
    --heart-row7-width: calc(7 * var(--heart-thumb) + 6 * var(--heart-gap));
    --heart-one-slot: calc(var(--heart-thumb) + var(--heart-gap));
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 100%;
    min-height: 100dvh;
    padding: 10px 12px 10px 8px;
    overflow: auto;
}

.heart-panel {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    margin: auto;
    max-width: 100%;
    padding: 8px 0;
}

/* 하트 오른쪽에 간격 없이 붙임, 아래에서 둘째 층(3장 행)과 상단 정렬 */
.heart-and-caption {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
}

#heart-root.heart-custom {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: var(--heart-gap);
    margin: 0;
    flex-shrink: 0;
}

.heart-story-caption {
    flex: 0 1 auto;
    margin: 0;
    margin-top: calc(4 * var(--heart-thumb) + 4 * var(--heart-gap));
    margin-left: calc(-1 * var(--heart-one-slot));
    padding: clamp(12px, 2vw, 18px) clamp(14px, 2.5vw, 22px);
    width: max-content;
    max-width: min(46vw, 335px);
    text-align: left;
    white-space: pre-line;
    color: #7a2848;
    font-size: clamp(0.7rem, 1.85vw, 0.94rem);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    background: rgba(255, 248, 252, 0.92);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 4px 24px rgba(255, 154, 158, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.heart-caption-line2 {
    white-space: nowrap;
}

@media (max-width: 520px) {
    .heart-story-caption {
        margin-top: 14px;
        margin-left: 0;
        max-width: min(92vw, 420px);
    }
}

.heart-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--heart-gap);
}

.heart-row-seven-wide {
    width: var(--heart-row7-width);
    justify-content: center;
}

.heart-row-midfour {
    width: var(--heart-row7-width);
    justify-content: center;
    gap: var(--heart-gap);
}

.heart-skip-slot {
    flex: 0 0 var(--heart-one-slot);
    height: var(--heart-thumb);
    pointer-events: none;
}

.heart-row-ends {
    width: var(--heart-row7-width);
    justify-content: space-between;
}

.heart-cell {
    width: var(--heart-thumb);
    height: var(--heart-thumb);
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    outline: 1px solid rgba(255, 255, 255, 0.35);
    opacity: 0;
    transform: scale(0.94);
    filter: brightness(0.92);
    transition:
        opacity 0.52s ease-out,
        transform 0.45s cubic-bezier(0.25, 0.9, 0.35, 1),
        filter 0.45s ease-out;
}
.heart-cell.is-in {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
}
