.emotia-dialog {
    width: 100%;
    max-width: 30rem;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(16px, 4.5vw, 25px);
    border-radius: 24px;
    border: 1px solid #5c4d3e;
    background: #27211d;
    color: #fff6ed;
    font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    box-shadow: 0 18px 55px #0008;
}
.emotia-dialog-heading { font-size: 23px; font-weight: 700; line-height: 1.2; letter-spacing: -.025em; }
.emotia-dialog-note { color: #d7c8b8; font-size: 13px; line-height: 1.5; }
.emotia-dialog-close, .emotia-dialog-chip, .emotia-dialog-secondary, .emotia-dialog-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 13px;
    border-radius: 12px;
    border: 1px solid #655646;
    background: #352c25;
    color: #fff6ed;
    font-size: 13px;
    font-weight: 650;
}
.emotia-dialog-close { min-height: 36px; width: 36px; padding: 0; border-radius: 50%; flex: none; }
.emotia-dialog-chip[aria-pressed="true"] { border-color: #d7b68e; background: #513e2f; }
.emotia-dialog-submit { background: #ead0ad; color: #2a2118; border-color: #ead0ad; }
.emotia-dialog-submit:disabled { opacity: .55; }
.emotia-dialog-field {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #655646;
    border-radius: 12px;
    color: #fff6ed;
    background: #201a17;
    font-size: 16px;
}
.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); }
}
