.emotia-dialog {
    width: 100%;
    max-width: 28rem;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(18px, 4.5vw, 24px);
    border-radius: 30px;
    border: 1px solid rgba(255, 248, 238, 0.24);
    background: linear-gradient(165deg, rgba(42, 34, 30, 0.74) 0%, rgba(16, 13, 15, 0.86) 100%);
    backdrop-filter: blur(36px) saturate(210%);
    -webkit-backdrop-filter: blur(36px) saturate(210%);
    color: #fffaf4;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.68),
        inset 0 1px 0 rgba(255, 255, 255, 0.36),
        inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}
.emotia-dialog-heading { font-size: 20px; font-weight: 760; line-height: 1.2; letter-spacing: -.022em; color: #fffaf4; }
.emotia-dialog-note { color: rgba(242, 230, 218, 0.74); font-size: 13px; line-height: 1.48; }
.emotia-dialog-close, .emotia-dialog-chip, .emotia-dialog-secondary, .emotia-dialog-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 248, 238, 0.20);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 100%);
    color: #fffaf4;
    font-size: 13px;
    font-weight: 650;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.26);
    transition: transform 150ms cubic-bezier(.22, 1, .36, 1), background 160ms ease, border-color 160ms ease;
}
.emotia-dialog-close:active, .emotia-dialog-chip:active, .emotia-dialog-secondary:active, .emotia-dialog-submit:active { transform: scale(.96); }
.emotia-dialog-close { min-height: 34px; width: 34px; padding: 0; border-radius: 50%; flex: none; }
.emotia-dialog-chip[aria-pressed="true"] {
    border-color: rgba(255, 255, 255, 0.78);
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.92) 0%, rgba(238, 212, 176, 0.86) 100%);
    color: #1c1510;
    box-shadow: 0 6px 18px rgba(243, 214, 173, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}
.emotia-dialog-submit {
    min-height: 46px;
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.95) 0%, rgba(238, 212, 176, 0.88) 100%);
    color: #1c1510;
    border-color: rgba(255, 255, 255, 0.85);
    font-weight: 750;
    box-shadow: 0 8px 24px rgba(243, 214, 173, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}
.emotia-dialog-submit:disabled { opacity: .55; }
.emotia-dialog-field {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255, 248, 238, 0.18);
    border-radius: 16px;
    color: #fffaf4;
    background: rgba(12, 10, 12, 0.48);
    font-size: 15px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.32);
}
.emotia-dialog-field::placeholder { color: rgba(240, 228, 215, 0.45); }
.emotia-dialog :is(button, input, textarea):focus-visible { outline: 2px solid #eac89e; outline-offset: 2px; }
.emotia-letter-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 38%, #4b2b35ef, #160f13f2 68%); }
.emotia-letter-paper { padding: clamp(15px, 4vw, 23px); border-radius: 16px; background: #f8eee2; color: #30251e; font-size: 17px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.emotia-receipt-image { display: block; width: 100%; max-height: 57dvh; object-fit: contain; border-radius: 15px; background: #151210; }
.emotia-receipt-image.hidden { display: none; }
.emotia-dialog [role="status"]:empty { display: none; }

.emotia-letter-overlay .emotia-letter-card {
    display: grid;
    gap: 15px;
    border-color: #a07665;
    background: linear-gradient(155deg, #46302e, #26201d 55%);
    animation: emotia-letter-appear 400ms cubic-bezier(.22, 1, .36, 1) both;
}
.emotia-letter-heading { position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; padding-inline: 30px; }
.emotia-letter-heading .emotia-dialog-close { position: absolute; right: 0; top: 0; }
.emotia-letter-heading h2 { width: 100%; color: #fff4e8; font-size: clamp(24px, 7vw, 34px); overflow-wrap: anywhere; }
.emotia-letter-kicker { color: #ebc4ac; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.emotia-letter-seal {
    display: grid; place-items: center; width: 47px; height: 47px; margin-bottom: 4px;
    border: 1px solid #c79181; border-radius: 50%; color: #ffe1c9;
    background: radial-gradient(circle at 35% 30%, #a26062, #6a383e 75%);
    box-shadow: inset 0 0 0 3px #5e303470, 0 5px 14px #180a0b55;
}
.emotia-letter-card .emotia-letter-paper { border: 1px solid #edcaaa; background: linear-gradient(135deg, #fff7eb, #f5e6d8); }
.emotia-letter-reply { min-height: 44px; gap: 8px; }
@keyframes emotia-letter-appear {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .emotia-letter-overlay .emotia-dialog { animation: none; }
}

.emotia-letter-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.emotia-letter-hearts span {
    position: absolute;
    top: 63%;
    left: calc(50% - 11px);
    color: #f3a8ba;
    font-size: 22px;
    line-height: 1;
    text-shadow: 0 2px 8px #3a1a26;
    animation: emotia-letter-heart-rise 1100ms ease-out both;
}
.emotia-letter-hearts span:nth-child(even) { color: #ffd2bf; font-size: 17px; }
@keyframes emotia-letter-heart-rise {
    0% { opacity: 0; transform: translate(calc(var(--heart-start) * min(1vw, 5.5px)), 20px) scale(.48); }
    25% { opacity: .95; }
    65% { opacity: .85; }
    100% { opacity: 0; transform: translate(calc(var(--heart-offset) * min(1vw, 5.5px)), var(--heart-rise)) rotate(14deg) scale(.8); }
}
