.erva-reaction {
    flex: 0 0 auto;
    padding: 1rem 1.25rem;
    background: #f0ede4;
/*    color: #301b3c; */
/*    border-top: 1px solid #d8cbd3; */
/*    font: 10px/1.4 var(--cabane-scene-font); */
    text-align: center;
}

.erva-reaction button {
    min-height: 44px;
    border: 1px solid #79516e;
    border-radius: 999px;
    padding: .55rem 1rem;
    background: #fffaf4;
    color: #66324e;
    font: inherit;
    cursor: pointer;
}

.erva-reaction button[aria-pressed=true] {
    background: #e8d9df;
    cursor: default;
}

.erva-reaction button:disabled:not([aria-pressed=true]) {
    opacity: .6;
    cursor: wait;
}

.erva-reaction button:focus-visible {
    outline: 3px solid #ac7100;
    outline-offset: 3px;
}

.erva-reaction p {
    margin: .45rem 0 0;
    font-size: 90%;
}

.erva-reaction [role=status]:empty {
    display: none;
}

@media print {
    .erva-reaction {
        display: none;
    }
}

.erva-reaction > button {
    margin: .25rem;
    --relief-color: var(--static-surface);
}

.erva-word {
    box-sizing: border-box;
    width: min(42rem, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 1.25rem;
    border: 1px solid #79516e;
    border-radius: 12px;
    background: #fffaf4;
    color: #301b3c;
    font: 16px/1.5 system-ui, sans-serif;
    overflow: auto;
    overscroll-behavior: contain;
}

.erva-word::backdrop {
    background: #160e20aa;
}

.erva-word header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.erva-word h2 {
    margin: 0;
    font-size: 90%;
}

.erva-word button {
    min-height: 44px;
    padding: .5rem 1rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.erva-word label {
    display: block;
    margin: 1rem 0;
}

.erva-word input, .erva-word textarea {
    box-sizing: border-box;
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .65rem;
    font: 16px/1.5 system-ui, sans-serif;
    color: #301b3c;
    background: white;
    border: 1px solid #79516e;
    border-radius: 4px;
}

.erva-word .erva-identity-transfer-confirm {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}

.erva-word .erva-identity-transfer-confirm input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: .2rem 0 0;
    padding: 0;
}

.erva-identity-transfer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.erva-identity-transfer-actions button {
    margin: 0;
}

.erva-word textarea {
    resize: vertical;
    min-height: 10rem;
}

.erva-word :focus-visible {
    outline: 3px solid #ac7100;
    outline-offset: 2px;
}

.erva-word .erva-word-trap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.erva-word section {
    border-top: 1px solid #d8cbd3;
    margin-top: 1.5rem;
}

.erva-word article {
    border-bottom: 1px solid #d8cbd3;
    padding: .5rem 0;
}

.erva-word-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.erva-word [data-draft], .erva-word [data-count] {
    font-size: 75%;
    color: var(--static-muted);
}

@media (max-width: 600px) {
    .erva-word {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    }
}

.erva-mail-button {
    min-height: 44px;
    margin: .5rem;
    padding: .5rem 1rem;
    font: inherit;
    cursor: pointer;
}

/* A single CSS sweep, only when the server confirms a new action. */
.erva-reaction-control {
    display: inline-block;
    position: relative;
    margin: .25rem;
}

.erva-reaction-hint {
    position: absolute;
    z-index: 2;
    bottom: calc(100% + .5rem);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(18rem, 70vw);
    padding: .5rem .7rem;
    border-radius: .4rem;
    background: #301b3c;
    color: #fffaf4;
    font-size: .85rem;
    line-height: 1.4;
    box-shadow: 0 3px 12px #301b3c33;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.erva-reaction-control:has(button:hover) .erva-reaction-hint,
.erva-reaction-control:has(button:focus-visible) .erva-reaction-hint {
    visibility: visible;
    opacity: 1;
}

.erva-confirming {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.erva-confirming::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(110deg, transparent 25%, #ffffff22 37%, #ffffffbb 49%, #ffffff44 55%, transparent 68%);
    transform: translateX(-120%);
    animation: erva-chrome 1.2s ease-in-out;
}

.erva-reaction button.erva-confirming {
    animation: erva-heart-arrived 1.2s ease-out;
}

@keyframes erva-chrome {
    to {
        transform: translateX(120%);
    }
}

@keyframes erva-heart-arrived {
    0%, 65% {
        background-color: #fffaf4;
    }
    100% {
        background-color: #e8d9df;
    }
}

.erva-word.erva-word-thanks {
    position: fixed;
    overflow-y: auto;
    width: min(34rem, calc(100vw - 2rem));
    height: fit-content;
    margin: auto;
    border: 1px solid #79516e;
    border-radius: 12px;
    padding: 1.5rem;
    background: #f5edf1;
}

.erva-thanks-note {
    font-size: .85rem;
}

@media (prefers-reduced-motion: reduce) {
    .erva-confirming::after {
        display: none;
        animation: none;
    }

    .erva-reaction button.erva-confirming {
        animation: none;
    }

    .erva-reaction-hint {
        transition: none;
    }
}

.erva-word [hidden] {
    display: none;
}

.erva-word [data-email] {
    margin-bottom: 1rem;
}

.erva-word [data-email-state] {
    overflow-wrap: anywhere;
}

.erva-word [data-email] button {
    margin: .2rem .25rem .2rem 0;
}

/* Compact post-message journey. The editable preferences panel is independent. */
.erva-word.erva-word-thanks {
    width: min(44rem, calc(100vw - 2rem));
}

.erva-email-journey {
    border-top: 0;
}

.erva-email-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.erva-email-grid:has([data-code][hidden]) {
    grid-template-columns: 1fr;
}

.erva-email-journey label {
    margin: .5rem 0;
    font-size: .9rem;
}

.erva-code-row {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.erva-code-row input {
    min-width: 0;
}

.erva-email-journey button, .erva-word form > button[type=submit] {
    border: 1px solid #79516e;
    border-radius: 999px;
    background: #fffaf4;
    padding: .55rem 1rem;
}

.erva-email-journey button:hover, .erva-word form > button[type=submit]:hover {
    background: #e8d9df;
}

.erva-email-journey button:disabled {
    opacity: .6;
}

.erva-email-journey [data-resend] {
    flex: 0 0 44px;
    padding: .25rem;
    font-size: 1.4rem;
}

.erva-journey-actions {
    display: flex;
    gap: .6rem;
}

.erva-email-journey [data-news] {
    margin-top: .75rem;
    border: 0;
}

.erva-email-journey [data-verified] {
    color: #315d3c;
    background: #e9f0e7;
    border-radius: .5rem;
    padding: .6rem .8rem;
    overflow-wrap: anywhere;
    font-size: .9rem;
}

.erva-journey-finish {
    border-radius: .6rem;
    padding: 1rem;
    background: #e9f0e7;
    color: #315d3c;
    text-align: center;
}

.erva-email-journey [data-error]:empty {
    display: none;
}

.erva-email-journey [data-skip] {
    margin-top: .75rem;
}

@media (max-width: 600px) {
    .erva-email-grid {
        grid-template-columns: 1fr;
        gap: .5rem;
    }

    .erva-email-journey input {
        width: 100%;
    }
}

.erva-email-submit {
    min-height: 48px;
}

@media (max-width: 600px) {
    .erva-email-grid:has([data-code]:not([hidden])) .erva-email-submit {
        display: none;
    }
}
