/* ══════════════════════════════════════════════════════════════
   BE MY VALENTINE — Editorial Luxury Theme
   ══════════════════════════════════════════════════════════════ */

/* ─── Reset & Custom Properties ─────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Core Palette — Deep Wine & Champagne */
    --wine:         #1a0a10;
    --wine-mid:     #2a111a;
    --wine-light:   #3d1425;
    --burgundy:     #6b1d3a;
    --rose:         #c4556a;
    --rose-soft:    #d4838f;
    --blush:        #e8c4c8;
    --champagne:    #c9a96e;
    --champagne-lt: #ddc396;
    --ivory:        #f5ede3;
    --cream:        #faf7f2;

    /* Surfaces */
    --bg:           #110810;
    --card-bg:      #1a0f16;
    --card-border:  rgba(201, 169, 110, 0.12);
    --field-bg:     rgba(255, 255, 255, 0.025);
    --field-border: rgba(201, 169, 110, 0.1);

    /* Text */
    --text-primary:   #f5ede3;
    --text-secondary: rgba(245, 237, 227, 0.55);
    --text-muted:     rgba(245, 237, 227, 0.28);

    /* Shadows */
    --shadow-card:    0 40px 100px rgba(0, 0, 0, 0.6),
                      0 0 0 1px rgba(201, 169, 110, 0.06);
    --shadow-btn:     0 6px 30px rgba(107, 29, 58, 0.45);

    /* Motion */
    --ease:         cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur:          0.45s;

    /* Sizes */
    --radius:       20px;
    --radius-sm:    12px;
}


/* ─── Base ───────────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}


/* ─── Ambient Background — Rich Mesh ─────────────────────────── */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 15% 25%, rgba(107, 29, 58, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(201, 169, 110, 0.09) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 85%, rgba(107, 29, 58, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 55%, rgba(196, 85, 106, 0.07) 0%, transparent 40%),
        radial-gradient(ellipse at 25% 65%, rgba(201, 169, 110, 0.05) 0%, transparent 50%);
}

.ambient::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 90%, rgba(107, 29, 58, 0.12) 0%, transparent 35%),
        radial-gradient(circle at 90% 80%, rgba(201, 169, 110, 0.06) 0%, transparent 30%);
    animation: ambientShift 40s ease-in-out infinite alternate;
}

@keyframes ambientShift {
    0%   { opacity: 1; }
    50%  { opacity: 0.6; }
    100% { opacity: 1; }
}


/* ─── Aurora Blobs — Lava-Lamp Color Pools ────────────────────── */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    filter: blur(100px);
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.aurora-1 {
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    top: -15%;
    left: -10%;
    background: radial-gradient(circle, rgba(107, 29, 58, 0.35) 0%, rgba(107, 29, 58, 0) 70%);
    animation: auroraMove1 25s ease-in-out infinite;
}

.aurora-2 {
    width: 45vw;
    height: 45vw;
    max-width: 550px;
    max-height: 550px;
    top: 10%;
    right: -15%;
    background: radial-gradient(circle, rgba(201, 169, 110, 0.18) 0%, rgba(201, 169, 110, 0) 70%);
    animation: auroraMove2 30s ease-in-out infinite;
}

.aurora-3 {
    width: 55vw;
    height: 55vw;
    max-width: 650px;
    max-height: 650px;
    bottom: -20%;
    left: 20%;
    background: radial-gradient(circle, rgba(196, 85, 106, 0.2) 0%, rgba(196, 85, 106, 0) 70%);
    animation: auroraMove3 28s ease-in-out infinite;
}

.aurora-4 {
    width: 35vw;
    height: 35vw;
    max-width: 420px;
    max-height: 420px;
    bottom: 15%;
    right: 5%;
    background: radial-gradient(circle, rgba(107, 29, 58, 0.15) 0%, rgba(107, 29, 58, 0) 70%);
    animation: auroraMove4 22s ease-in-out infinite;
}

@keyframes auroraMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(8vw, 6vh) scale(1.15); }
    66%      { transform: translate(-4vw, 10vh) scale(0.9); }
}

@keyframes auroraMove2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(-10vw, 4vh) scale(1.1); }
    66%      { transform: translate(-5vw, -8vh) scale(1.2); }
}

@keyframes auroraMove3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(6vw, -8vh) scale(1.12); }
    66%      { transform: translate(-8vw, -3vh) scale(0.95); }
}

@keyframes auroraMove4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-6vw, -5vh) scale(1.2); }
}


/* ─── Light Ray — Volumetric Beam ─────────────────────────────── */
.light-ray {
    position: fixed;
    top: -40%;
    left: 50%;
    width: 200vw;
    height: 200vh;
    pointer-events: none;
    z-index: 0;
    background: conic-gradient(
        from 180deg at 50% 0%,
        transparent 0deg,
        transparent 160deg,
        rgba(201, 169, 110, 0.03) 170deg,
        rgba(201, 169, 110, 0.06) 180deg,
        rgba(201, 169, 110, 0.03) 190deg,
        transparent 200deg,
        transparent 360deg
    );
    transform: translateX(-50%);
    animation: rayRotate 60s linear infinite;
    opacity: 0.7;
}

@keyframes rayRotate {
    0%   { transform: translateX(-50%) rotate(0deg); }
    100% { transform: translateX(-50%) rotate(360deg); }
}


/* ─── Constellation — SVG Star Map ────────────────────────────── */
.constellation {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.8;
    animation: constellationPulse 8s ease-in-out infinite alternate;
}

.constellation svg {
    width: 100%;
    height: 100%;
}

@keyframes constellationPulse {
    0%   { opacity: 0.6; }
    100% { opacity: 1; }
}


/* ─── Film Grain Overlay ──────────────────────────────────────── */
.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    mix-blend-mode: overlay;
}


/* ─── Floating Particles ──────────────────────────────────────── */
.particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    bottom: -10px;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--champagne);
    opacity: 0;
    animation: particleFloat linear infinite;
    will-change: transform, opacity;
}

.particle.glow {
    width: 4px;
    height: 4px;
    background: var(--rose-soft);
    box-shadow: 0 0 8px 2px rgba(196, 85, 106, 0.3);
    filter: blur(0.5px);
}

@keyframes particleFloat {
    0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
    8%   { opacity: 0.5; }
    30%  { transform: translateY(-30vh) translateX(20px) scale(0.95); opacity: 0.3; }
    60%  { transform: translateY(-60vh) translateX(-15px) scale(0.85); opacity: 0.15; }
    100% { transform: translateY(-110vh) translateX(30px) scale(0.6); opacity: 0; }
}

/* Regular particles */
.particle:nth-child(1)  { left:  5%; width: 1.5px; height: 1.5px; animation-duration: 22s; animation-delay: 0s; }
.particle:nth-child(2)  { left: 12%; width: 2px;   height: 2px;   animation-duration: 18s; animation-delay: 3s; }
.particle:nth-child(3)  { left: 22%; width: 1px;   height: 1px;   animation-duration: 25s; animation-delay: 1s; }
.particle:nth-child(4)  { left: 35%; width: 2.5px; height: 2.5px; animation-duration: 20s; animation-delay: 5s; }
.particle:nth-child(5)  { left: 45%; width: 1px;   height: 1px;   animation-duration: 24s; animation-delay: 2s; }
.particle:nth-child(6)  { left: 55%; width: 2px;   height: 2px;   animation-duration: 19s; animation-delay: 7s; }
.particle:nth-child(7)  { left: 65%; width: 1.5px; height: 1.5px; animation-duration: 23s; animation-delay: 4s; }
.particle:nth-child(8)  { left: 72%; width: 1px;   height: 1px;   animation-duration: 26s; animation-delay: 6s; }
.particle:nth-child(9)  { left: 80%; width: 2px;   height: 2px;   animation-duration: 21s; animation-delay: 1.5s; }
.particle:nth-child(10) { left: 88%; width: 1.5px; height: 1.5px; animation-duration: 17s; animation-delay: 8s; }
.particle:nth-child(11) { left: 30%; width: 1px;   height: 1px;   animation-duration: 28s; animation-delay: 10s; }
.particle:nth-child(12) { left: 95%; width: 2px;   height: 2px;   animation-duration: 20s; animation-delay: 3.5s; }

/* Glow particles — larger, softer, different paths */
.particle:nth-child(13) { left: 8%;  animation-duration: 26s; animation-delay: 2s; }
.particle:nth-child(14) { left: 28%; animation-duration: 22s; animation-delay: 6s; }
.particle:nth-child(15) { left: 48%; animation-duration: 30s; animation-delay: 0.5s; }
.particle:nth-child(16) { left: 62%; animation-duration: 24s; animation-delay: 9s; }
.particle:nth-child(17) { left: 78%; animation-duration: 20s; animation-delay: 4s; }
.particle:nth-child(18) { left: 92%; animation-duration: 27s; animation-delay: 7.5s; }


/* ─── Card ────────────────────────────────────────────────────── */
.card {
    position: relative;
    z-index: 10;
    width: 94%;
    max-width: 520px;
    background: var(--card-bg);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 52px 44px 44px;
    text-align: center;
    animation: cardReveal 1s var(--ease) both;
    overflow: visible;
}

/* Animated border glow */
.card-border {
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius) + 1px);
    padding: 1px;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(201, 169, 110, 0.2),
        rgba(107, 29, 58, 0.15) 30%,
        rgba(201, 169, 110, 0.08) 60%,
        rgba(107, 29, 58, 0.12)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ─── Card Header ─────────────────────────────────────────────── */
.card-header {
    margin-bottom: 8px;
}

.ornament {
    color: var(--champagne);
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    opacity: 0.7;
}

.ornament.flip {
    margin-bottom: 0;
    margin-top: 12px;
    transform: scaleY(-1);
}


/* ─── Typography ──────────────────────────────────────────────── */
.title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 2.8rem;
    font-weight: 300;
    font-style: italic;
    line-height: 1.1;
    margin-bottom: 10px;
    color: var(--ivory);
    letter-spacing: -0.02em;
}

.subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}


/* ─── Mode Badge ──────────────────────────────────────────────── */
.mode-badge {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--champagne);
    border: 1px solid rgba(201, 169, 110, 0.15);
    border-radius: 0;
    padding: 6px 20px;
    margin-bottom: 32px;
    background: transparent;
    position: relative;
}

.mode-badge::before,
.mode-badge::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border: 1px solid rgba(201, 169, 110, 0.25);
    transform: rotate(45deg);
}

.mode-badge::before {
    left: -4px;
    top: 50%;
    translate: 0 -50%;
    background: var(--card-bg);
}

.mode-badge::after {
    right: -4px;
    top: 50%;
    translate: 0 -50%;
    background: var(--card-bg);
}


/* ─── Form Fields ─────────────────────────────────────────────── */
.field {
    margin-bottom: 22px;
    text-align: left;
    flex: 1;
}

.field-row {
    display: flex;
    gap: 16px;
}

/* ── Names Row — Stylish entrance ── */
.names-row {
    position: relative;
    padding-bottom: 22px;
    margin-bottom: 6px;
}

.names-row::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(201, 169, 110, 0.5) 30%,
        var(--champagne) 50%,
        rgba(201, 169, 110, 0.5) 70%,
        transparent);
    opacity: 0.25;
}

.names-row .field input {
    text-align: center;
    font-style: italic;
    letter-spacing: 0.5px;
}

.field label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--champagne);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
}

.field input,
.field textarea {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-bottom: 1px solid var(--field-border);
    border-radius: 0;
    background: var(--field-bg);
    color: var(--text-primary);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    outline: none;
    transition: all var(--dur) var(--ease);
    resize: none;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--champagne);
    background: rgba(201, 169, 110, 0.03);
    box-shadow: 0 1px 0 0 var(--champagne);
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--text-muted);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 300;
}

.field textarea {
    min-height: 100px;
    line-height: 1.7;
}


/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 32px;
    border: none;
    border-radius: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-arrow {
    position: relative;
    z-index: 1;
    display: flex;
    transition: transform 0.4s var(--ease);
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-primary {
    background: var(--burgundy);
    color: var(--ivory);
    box-shadow: var(--shadow-btn);
    border: 1px solid rgba(201, 169, 110, 0.1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(201, 169, 110, 0.08) 50%, transparent 65%);
    translate: -100% 0;
    transition: translate 0.8s var(--ease);
    z-index: 0;
}

.btn-primary:hover::before {
    translate: 100% 0;
}

.btn-primary:hover {
    background: #7d2243;
    box-shadow: 0 8px 40px rgba(107, 29, 58, 0.55);
    border-color: rgba(201, 169, 110, 0.2);
}

.btn-primary:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(201, 169, 110, 0.12);
    margin-top: 14px;
    gap: 10px;
}

.btn-ghost:hover {
    background: rgba(201, 169, 110, 0.04);
    border-color: rgba(201, 169, 110, 0.25);
    color: var(--champagne);
}

.btn-ghost svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.btn-ghost:hover svg {
    opacity: 1;
}


/* ─── Cupid Form ──────────────────────────────────────────────── */
.cupid-form {
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.cupid-form.shrinking {
    opacity: 0;
    transform: scale(0.92) translateY(-10px);
    pointer-events: none;
}

.cupid-form.hidden {
    display: none !important;
}


/* ═══════════════════════════════════════════════════════════════
   FOLDABLE POSTCARD — Sender Result
   A bi-fold card: top half folds DOWN onto bottom half.
   ═══════════════════════════════════════════════════════════════ */
.postcard-wrap {
    display: none;
}

.postcard-wrap.show {
    display: block;
    animation: postcardAppear 0.6s var(--ease) both;
}

@keyframes postcardAppear {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scene container */
.postcard {
    margin-bottom: 20px;
}

.postcard-scene {
    position: relative;
    perspective: 1200px;
    /* Two halves stacked vertically */
}

/* ── Shared panel styles ──────────────────────────────────────── */
.postcard-top,
.postcard-bottom {
    position: relative;
    background: linear-gradient(145deg, #2a1620, #1e0f18, #231218);
    border: 1px solid rgba(201, 169, 110, 0.15);
}

/* Bottom can clip, but top MUST NOT — overflow:hidden kills preserve-3d */
.postcard-bottom {
    overflow: hidden;
}

.postcard-texture {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23c9a96e' stroke-width='0.15' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}


/* ── Top half (folds down) ────────────────────────────────────── */
.postcard-top {
    height: 160px;
    border-bottom: none;
    transform-origin: bottom center;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    position: relative;
}

/* When folding class applied — top rotates -180° (folds down onto bottom) */
.postcard.folding .postcard-top {
    transform: rotateX(-180deg);
}

/* The inner content (visible when card is open/unfolded) */
.postcard-top-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backface-visibility: hidden;
    z-index: 2;
}

.postcard-top-heart {
    color: var(--rose);
    filter: drop-shadow(0 4px 16px rgba(196, 85, 106, 0.3));
    animation: heartBeatSoft 2s ease-in-out infinite;
}

@keyframes heartBeatSoft {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.postcard-top-label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    color: var(--champagne);
    letter-spacing: 0.06em;
    opacity: 0.8;
}

/* The back face (visible after fold, shows stamp & lines) */
.postcard-top-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #231218, #1e0f18, #2a1620);
    backface-visibility: hidden;
    transform: rotateX(180deg);
    z-index: 3;
    overflow: hidden;
}

.postcard-stamp {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 52px;
    height: 60px;
    border: 2px dashed rgba(201, 169, 110, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rose);
}

.postcard-lines {
    position: absolute;
    top: 18px;
    right: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.postcard-lines span {
    display: block;
    width: 80px;
    height: 1px;
    background: rgba(201, 169, 110, 0.12);
}

/* Fold crease line — the hinge between the two halves */
.postcard-scene::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    top: 160px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 169, 110, 0.12), rgba(201, 169, 110, 0.2), rgba(201, 169, 110, 0.12), transparent);
    z-index: 30;
    transition: opacity 0.8s;
}

.postcard.folding .postcard-scene::after {
    opacity: 0;
}

/* Shadow that appears under the folding panel */
.postcard.folding .postcard-bottom::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 60%);
    z-index: 5;
    animation: foldShadow 1.2s cubic-bezier(0.4,0,0.2,1) both;
    pointer-events: none;
}

@keyframes foldShadow {
    0%   { opacity: 0; }
    40%  { opacity: 1; }
    100% { opacity: 0.6; }
}


/* ── Bottom half (stays flat) ─────────────────────────────────── */
.postcard-bottom {
    height: 140px;
    border-top: none;
    display: flex;
    align-items: center;
    padding: 24px 32px;
}

.postcard-bottom-text {
    position: relative;
    z-index: 1;
    text-align: left;
}

.postcard-to {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 400;
    font-style: italic;
    color: var(--ivory);
    margin-bottom: 8px;
}

.postcard-from {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 1px;
}


/* ── Status text ──────────────────────────────────────────────── */
.postcard-status {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--champagne);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 16px 0 4px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.postcard-status.visible {
    opacity: 0.7;
    transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════════════
   WAX SEAL — Shared Component
   ═══════════════════════════════════════════════════════════════ */
.wax-seal {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

/* Sender postcard seal — hidden until stamped */
#waxSealSender {
    position: absolute;
    top: 131px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%) scale(0);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
}

.seal-outer {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #9e2e3a, #6b1d2a 40%, #4a1420 70%, #3a0e18);
    box-shadow:
        0 4px 20px rgba(107, 29, 58, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.08),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Jagged wax edge */
    filter: url('#wavy') drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.seal-outer::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(201, 169, 110, 0.15);
}

.seal-outer::after {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 1px solid rgba(201, 169, 110, 0.08);
}

.seal-inner {
    color: var(--champagne);
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Sender seal stamp animation */
#waxSealSender.stamping {
    animation: sealStamp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#waxSealSender.stamped {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

@keyframes sealStamp {
    0%   { transform: translateX(-50%) scale(0) rotate(-20deg); opacity: 0; }
    60%  { transform: translateX(-50%) scale(1.25) rotate(5deg); opacity: 1; }
    80%  { transform: translateX(-50%) scale(0.95) rotate(-2deg); opacity: 1; }
    100% { transform: translateX(-50%) scale(1) rotate(0deg); opacity: 1; }
}

/* Seal glow pulse after stamp */
#waxSealSender.stamped .seal-outer {
    animation: sealGlow 2s ease-in-out infinite alternate;
}

@keyframes sealGlow {
    0%   { box-shadow: 0 4px 20px rgba(107, 29, 58, 0.6), 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.08); }
    100% { box-shadow: 0 4px 30px rgba(158, 46, 58, 0.7), 0 2px 12px rgba(201, 169, 110, 0.15), inset 0 1px 2px rgba(255,255,255,0.1); }
}


/* ═══════════════════════════════════════════════════════════════
   ENVELOPE — Receiver View
   ═══════════════════════════════════════════════════════════════ */
.envelope-scene {
    position: relative;
}

.envelope {
    position: relative;
    margin: 0 auto 28px;
    max-width: 340px;
    perspective: 600px;
}

.envelope-body {
    position: relative;
    background: linear-gradient(160deg, #2a1620, #1e0f18);
    border: 1px solid rgba(201, 169, 110, 0.12);
    height: 200px;
    overflow: visible;
}

.envelope-texture {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23c9a96e' stroke-width='0.15' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* Triangle flap */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(180deg, #2a1620, #22121a);
    border-bottom: 1px solid rgba(201, 169, 110, 0.1);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.8s var(--ease), opacity 0.4s;
    z-index: 15;
    overflow: hidden;
}

.flap-texture {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h40v40H0z' fill='none'/%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23c9a96e' stroke-width='0.15' opacity='0.04'/%3E%3C/svg%3E");
}

/* Seal on envelope */
.wax-seal-envelope {
    bottom: auto;
    top: 62px;
    z-index: 25;
    transition: all 0.6s var(--ease);
}

.wax-seal-envelope .seal-outer {
    width: 50px;
    height: 50px;
    cursor: default;
}

/* Letter inside envelope */
.envelope-letter {
    position: absolute;
    bottom: 10px;
    left: 10%;
    right: 10%;
    height: 70%;
    background: linear-gradient(145deg, rgba(245, 237, 227, 0.08), rgba(245, 237, 227, 0.03));
    border: 1px solid rgba(245, 237, 227, 0.06);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s var(--ease) 0.3s;
}

.letter-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 60%;
    opacity: 0.3;
}

.letter-lines span {
    display: block;
    height: 1px;
    background: rgba(201, 169, 110, 0.2);
}

.letter-lines span:nth-child(1) { width: 100%; }
.letter-lines span:nth-child(2) { width: 80%; }
.letter-lines span:nth-child(3) { width: 90%; }
.letter-lines span:nth-child(4) { width: 60%; }

.envelope-hint {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 12px;
    text-align: center;
}

/* Quiz section below envelope */
.quiz-below-envelope {
    margin-top: 24px;
}

/* ── Envelope open animation ──────────────────────────────────── */
.envelope.opening .envelope-flap {
    transform: rotateX(180deg);
    opacity: 0.5;
}

.envelope.opening .wax-seal-envelope {
    animation: sealBreak 0.5s var(--ease) forwards;
}

@keyframes sealBreak {
    0%   { transform: translateX(-50%) scale(1) rotate(0deg); opacity: 1; }
    40%  { transform: translateX(-50%) scale(1.2) rotate(10deg); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(0.5) rotate(30deg); opacity: 0; }
}

.envelope.opening .envelope-letter {
    transform: translateY(-60px);
}

.envelope.opened {
    animation: envelopeShrink 0.6s var(--ease) 0.6s forwards;
}

@keyframes envelopeShrink {
    to {
        opacity: 0;
        transform: scale(0.85) translateY(-20px);
        height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
}


/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
    height: 1px;
    margin: 32px 0;
    background: linear-gradient(90deg, transparent, rgba(201, 169, 110, 0.15), transparent);
    position: relative;
}

.divider::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -3px;
    width: 6px;
    height: 6px;
    border: 1px solid rgba(201, 169, 110, 0.2);
    transform: translateX(-50%) rotate(45deg);
    background: var(--card-bg);
}


/* ─── Link Output (Cupid Mode) ────────────────────────────────── */
.link-output {
    display: none;
    animation: slideUp 0.6s var(--ease);
}

.link-output.show {
    display: block;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.link-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--champagne);
    margin-bottom: 16px;
    opacity: 0.7;
}

.link-box-wrap {
    position: relative;
}

.link-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(201, 169, 110, 0.08);
    border-radius: 0;
    padding: 16px 52px 16px 18px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--text-secondary);
    word-break: break-all;
    text-align: left;
    max-height: 90px;
    overflow-y: auto;
    line-height: 1.6;
    transition: border-color 0.3s;
}

.link-box:hover {
    border-color: rgba(201, 169, 110, 0.18);
}

.copy-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    translate: 0 -50%;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(201, 169, 110, 0.1);
    border-radius: 0;
    background: transparent;
    color: var(--champagne);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease);
    opacity: 0.5;
}

.copy-btn:hover {
    opacity: 1;
    background: rgba(201, 169, 110, 0.08);
    border-color: var(--champagne);
}

.copy-btn.copied {
    color: #7dba6e;
    border-color: rgba(125, 186, 110, 0.3);
}

.share-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 16px;
    font-style: italic;
    font-family: 'Cormorant Garamond', serif;
}


/* ─── Valentine Mode — Question ───────────────────────────────── */
.question-card {
    position: relative;
    background: rgba(201, 169, 110, 0.03);
    border: 1px solid rgba(201, 169, 110, 0.1);
    border-radius: 0;
    padding: 36px 28px 28px;
    margin-bottom: 28px;
    text-align: center;
}

.question-card::before {
    content: '';
    position: absolute;
    top: -1px; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--champagne), transparent);
    opacity: 0.2;
}

.question-quote {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 4rem;
    font-weight: 300;
    color: var(--champagne);
    opacity: 0.2;
    line-height: 0.6;
    margin-bottom: 12px;
    display: block;
}

.question-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.6;
    color: var(--blush);
    letter-spacing: 0.02em;
}

.error-msg {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--rose);
    margin-top: 16px;
    min-height: 24px;
    transition: all 0.3s;
    font-weight: 400;
    letter-spacing: 0.02em;
}


/* ─── Shake Animation ─────────────────────────────────────────── */
.shake {
    animation: shake 0.5s var(--ease) both;
}

@keyframes shake {
    0%         { transform: translateX(0); }
    15%, 65%   { transform: translateX(-5px); }
    30%, 80%   { transform: translateX(5px); }
    45%        { transform: translateX(-3px); }
    100%       { transform: translateX(0); }
}


/* ═══════════════════════════════════════════════════════════════
   SUCCESS VIEW — Opened Postcard
   ═══════════════════════════════════════════════════════════════ */
.success-view {
    display: none;
    animation: successReveal 0.8s var(--ease);
}

.success-view.show {
    display: block;
}

@keyframes successReveal {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.opened-postcard {
    position: relative;
    background: linear-gradient(160deg, #2a1620, #1e0f18, #231218);
    border: 1px solid rgba(201, 169, 110, 0.15);
    padding: 40px 32px;
    overflow: hidden;
}

.opened-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.heart-anim {
    display: inline-flex;
    color: var(--rose);
    animation: heartBeat 1.4s ease-in-out infinite;
    filter: drop-shadow(0 4px 20px rgba(196, 85, 106, 0.35));
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    10%      { transform: scale(1.15); }
    20%      { transform: scale(1); }
    30%      { transform: scale(1.1); }
    40%      { transform: scale(1); }
}

.revealed-msg {
    position: relative;
    padding: 32px 28px;
    margin: 16px 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.8;
    color: var(--ivory);
    font-style: italic;
    letter-spacing: 0.02em;
    text-align: center;
    border-top: 1px solid rgba(201, 169, 110, 0.08);
    border-bottom: 1px solid rgba(201, 169, 110, 0.08);
}

.revealed-msg::before,
.revealed-msg::after {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 4rem;
    font-weight: 300;
    color: rgba(201, 169, 110, 0.12);
    position: absolute;
    line-height: 1;
}

.revealed-msg::before {
    content: '\201C';
    top: 4px;
    left: 12px;
}

.revealed-msg::after {
    content: '\201D';
    bottom: -8px;
    right: 12px;
}

.opened-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.broken-seal .seal-outer {
    width: 36px;
    height: 36px;
    opacity: 0.4;
}

.seal-broken {
    position: relative;
}

.seal-broken::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(0,0,0,0.3) 50%, transparent 60%);
    border-radius: 50%;
    z-index: 5;
}

.success-footer {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}


/* ─── Site Footer ─────────────────────────────────────────────── */
.site-footer {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

.site-footer span {
    font-family: 'Inter', sans-serif;
    font-size: 0.55rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.5;
}


/* ─── Utility ─────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 169, 110, 0.12); border-radius: 2px; }

::selection {
    background: rgba(201, 169, 110, 0.2);
    color: var(--ivory);
}


/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 520px) {
    .card {
        padding: 40px 28px 36px;
        max-width: 100%;
    }

    .title { font-size: 2.2rem; }
    .subtitle { font-size: 0.72rem; }

    .field-row {
        flex-direction: column;
        gap: 0;
    }

    .field input,
    .field textarea {
        padding: 14px 16px;
        font-size: 1rem;
    }

    .btn {
        padding: 16px 24px;
        font-size: 0.72rem;
    }

    .question-card { padding: 28px 20px 22px; }
    .revealed-msg { padding: 28px 22px; font-size: 1.1rem; }
    .ornament svg { width: 90px; }

    .postcard-top { height: 130px; }
    .postcard-bottom { height: 120px; padding: 20px 24px; }
    .postcard-scene::after { top: 130px; }
    #waxSealSender { top: 102px; }
    .postcard-to { font-size: 1.3rem; }
    .envelope-body { height: 170px; }
    .wax-seal-envelope { top: 52px; }
    .wax-seal-envelope .seal-outer { width: 42px; height: 42px; }
}

@media (max-width: 360px) {
    .card {
        width: 98%;
        padding: 32px 20px 28px;
    }

    .title { font-size: 1.9rem; }

    .mode-badge {
        font-size: 0.52rem;
        padding: 5px 14px;
        letter-spacing: 2px;
    }

    .postcard-top { height: 110px; }
    .postcard-bottom { height: 100px; }
    .postcard-scene::after { top: 110px; }
    #waxSealSender { top: 82px; }
    .envelope-body { height: 150px; }
}

@media (hover: hover) {
    .field input:hover,
    .field textarea:hover {
        border-color: rgba(201, 169, 110, 0.2);
        background: rgba(255, 255, 255, 0.035);
    }
}

@media (min-resolution: 2dppx) {
    .card-border {
        background: linear-gradient(135deg, rgba(201, 169, 110, 0.15), rgba(107, 29, 58, 0.1) 30%, rgba(201, 169, 110, 0.06) 60%, rgba(107, 29, 58, 0.08));
    }
}


/* ═══════════════════════════════════════════════════════════════
   JOURNEY — Begin Your Journey Button & Overlay
   ═══════════════════════════════════════════════════════════════ */

/* ─── Journey Button ──────────────────────────────────────────── */
.btn-journey {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 22px;
    padding: 18px 32px;
    border: 1px solid rgba(201, 169, 110, 0.25);
    border-radius: 0;
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.08), rgba(107, 29, 58, 0.12));
    color: var(--champagne);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.5s var(--ease);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px);
    animation: none;
}

.btn-journey.show {
    display: flex;
    animation: journeyBtnReveal 1s var(--ease) 0.5s both;
}

.btn-journey::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.12), rgba(212, 131, 143, 0.08));
    opacity: 0;
    transition: opacity 0.5s var(--ease);
}

.btn-journey:hover::before {
    opacity: 1;
}

.btn-journey:hover {
    border-color: rgba(201, 169, 110, 0.4);
    box-shadow: 0 0 40px rgba(201, 169, 110, 0.12), 0 0 80px rgba(107, 29, 58, 0.08);
    transform: translateY(-2px);
}

.btn-journey .btn-text {
    position: relative;
    z-index: 1;
}

.btn-journey .btn-arrow {
    position: relative;
    z-index: 1;
    color: var(--rose-soft);
    transition: transform 0.4s var(--ease);
}

.btn-journey:hover .btn-arrow {
    transform: translateY(-3px) rotate(15deg);
}

@keyframes journeyBtnReveal {
    0%   { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ─── Journey Overlay ─────────────────────────────────────────── */
.journey-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
    background: #06010d;
}

.journey-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

.journey-overlay canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   3D CHAT OVERLAY
   ═══════════════════════════════════════════════════════════════ */
.chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.8s ease;
    background: radial-gradient(ellipse at 50% 30%, #0c061a 0%, #06010d 60%, #020008 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chat-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

.chat-overlay #chatBgCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ── Chat Room Container ─────────────────────────────────────── */
.chat-room {
    position: relative;
    z-index: 1;
    width: min(92vw, 520px);
    height: min(85vh, 720px);
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    /* 3D glass morphism */
    background: linear-gradient(
        145deg,
        rgba(255,255,255,0.04) 0%,
        rgba(255,255,255,0.01) 50%,
        rgba(0,0,0,0.1) 100%
    );
    backdrop-filter: blur(40px) saturate(1.3);
    -webkit-backdrop-filter: blur(40px) saturate(1.3);
    border: 1px solid rgba(201,169,110,0.12);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.03),
        0 8px 32px rgba(0,0,0,0.45),
        0 40px 80px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 0 120px rgba(201,169,110,0.04);
    /* 3D perspective depth tilt */
    transform: perspective(1200px) rotateX(1deg) rotateY(0deg);
    transition: transform 0.5s ease;
    animation: chatRoomFloat 6s ease-in-out infinite;
}

@keyframes chatRoomFloat {
    0%, 100% { transform: perspective(1200px) rotateX(1deg) translateY(0); }
    50%      { transform: perspective(1200px) rotateX(0deg) translateY(-6px); }
}

/* ── Header ──────────────────────────────────────────────────── */
.chat-header {
    position: relative;
    padding: 22px 24px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(201,169,110,0.08);
    flex-shrink: 0;
}

.chat-header-glow {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 60px;
    background: radial-gradient(ellipse, rgba(212,131,143,0.12) 0%, transparent 70%);
    pointer-events: none;
}


.chat-exit-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(245, 237, 227, 0.4);
    transition: all 0.3s ease;
    padding: 6px;
    border-radius: 50%;
    z-index: 10;
}

.chat-exit-btn:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.08);
    transform: scale(1.1);
}

.chat-title-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chat-heart-icon {
    color: #d4838f;
    animation: heartPulseChat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(212,131,143,0.4));
}

@keyframes heartPulseChat {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

.chat-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.3rem;
    color: #f5ede3;
    letter-spacing: 0.04em;
    margin: 0;
}

.chat-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: rgba(201,169,110,0.5);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 6px 0 0;
}

/* ── Messages ────────────────────────────────────────────────── */
.chat-messages-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(201,169,110,0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(201,169,110,0.15);
    border-radius: 4px;
}

/* ── Chat Bubble ─────────────────────────────────────────────── */
.chat-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 18px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #f5ede3;
    position: relative;
    word-wrap: break-word;
    /* 3D depth per bubble */
    transform: perspective(800px) rotateX(0deg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: bubbleIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.chat-bubble:hover {
    transform: perspective(800px) rotateX(-1deg) scale(1.02) translateY(-1px);
}

@keyframes bubbleIn {
    0%   { opacity: 0; transform: perspective(800px) rotateX(15deg) translateY(20px) scale(0.92); }
    100% { opacity: 1; transform: perspective(800px) rotateX(0deg) translateY(0) scale(1); }
}

/* Sent (sender — right) */
.chat-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(212,131,143,0.25) 0%, rgba(212,131,143,0.12) 100%);
    border: 1px solid rgba(212,131,143,0.15);
    border-bottom-right-radius: 6px;
    box-shadow:
        0 4px 12px rgba(212,131,143,0.08),
        inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Received (partner — left) */
.chat-bubble.received {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(201,169,110,0.18) 0%, rgba(201,169,110,0.08) 100%);
    border: 1px solid rgba(201,169,110,0.12);
    border-bottom-left-radius: 6px;
    box-shadow:
        0 4px 12px rgba(201,169,110,0.06),
        inset 0 1px 0 rgba(255,255,255,0.03);
}

.chat-bubble-sender {
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: 500;
}

.chat-bubble.sent .chat-bubble-sender {
    color: rgba(212,131,143,0.6);
}

.chat-bubble.received .chat-bubble-sender {
    color: rgba(201,169,110,0.6);
}

.chat-bubble-text {
    color: #f5ede3;
}

.chat-bubble-time {
    font-size: 0.55rem;
    color: rgba(245,237,227,0.25);
    margin-top: 4px;
    text-align: right;
}

/* ── Typing indicator ────────────────────────────────────────── */
.chat-typing {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0 22px 8px;
    height: 20px;
}

.chat-typing.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(201,169,110,0.4);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input ───────────────────────────────────────────────────── */
.chat-input-area {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 18px;
    border-top: 1px solid rgba(201,169,110,0.06);
    flex-shrink: 0;
}

.chat-input-glow {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 40px;
    background: radial-gradient(ellipse, rgba(201,169,110,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.chat-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,169,110,0.1);
    border-radius: 14px;
    padding: 12px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: #f5ede3;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.chat-input::placeholder {
    color: rgba(245,237,227,0.2);
}

.chat-input:focus {
    border-color: rgba(201,169,110,0.25);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 20px rgba(201,169,110,0.06);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(212,131,143,0.18);
    background: linear-gradient(135deg, rgba(212,131,143,0.2) 0%, rgba(212,131,143,0.08) 100%);
    color: #d4838f;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, rgba(212,131,143,0.35) 0%, rgba(212,131,143,0.15) 100%);
    border-color: rgba(212,131,143,0.3);
    box-shadow: 0 0 20px rgba(212,131,143,0.12);
    transform: scale(1.05);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* ── System message ──────────────────────────────────────────── */
.chat-system-msg {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: rgba(201,169,110,0.35);
    letter-spacing: 0.05em;
    padding: 8px 0;
    animation: bubbleIn 0.5s ease both;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-room {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        animation: none;
        transform: none;
    }
}

