.dae-ref[hidden] { display: none !important; }

.dae-ref {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    font-family: "Arimo", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #1c1917;
}

.dae-ref__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 18, 16, 0.62);
    backdrop-filter: blur(5px);
}

.dae-ref__dialog {
    position: relative;
    width: min(640px, 100%);
    max-height: min(880px, calc(100vh - 48px));
    display: flex;
    background: #fffcf8;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(28, 20, 14, 0.28);
    overflow: hidden;
}

.dae-ref__form {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.dae-ref__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 252, 248, 0.92);
    box-shadow: 0 0 0 1px rgba(28, 25, 23, 0.08);
    cursor: pointer;
}

.dae-ref__close span,
.dae-ref__close span:before {
    position: absolute;
    left: 10px;
    top: 17px;
    width: 16px;
    height: 1.5px;
    background: #1c1917;
    content: "";
}

.dae-ref__close span { transform: rotate(45deg); }
.dae-ref__close span:before { left: 0; top: 0; transform: rotate(90deg); }

.dae-ref__head,
.dae-ref__foot,
.dae-ref__done {
    padding-left: 28px;
    padding-right: 28px;
}

.dae-ref__head {
    padding-top: 28px;
    padding-bottom: 8px;
}

.dae-ref__kicker {
    margin: 0 48px 8px 0;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #9c3b2e;
}

.dae-ref h2 {
    margin: 0 36px 10px 0;
    color: #1c1917;
    font-family: "Archivo Narrow", "Arial Narrow", sans-serif;
    font-weight: 700;
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.dae-ref__lead,
.dae-ref__situations,
.dae-ref__hint,
.dae-ref__field small,
.dae-ref__foot p,
.dae-ref__done p {
    color: #57534e;
    font-size: 15px;
    line-height: 1.5;
}

.dae-ref__lead { margin: 0; }

.dae-ref__body {
    overflow: auto;
    padding: 12px 28px 8px;
    min-height: 0;
}

.dae-ref__situations { margin: 8px 0 14px; }

.dae-ref__emergency {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f8efe8;
    color: #6b2a22;
    font-size: 15px;
}

.dae-ref__units {
    margin: 0 0 18px;
    padding: 4px 0 0;
}

.dae-ref__units p {
    margin: 0 0 8px;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #78716c;
}

.dae-ref__units ul {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dae-ref__units li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee7e1;
    font-size: 15px;
}

.dae-ref__units a {
    color: #1c1917;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.dae-ref__age,
.dae-ref__field { display: block; margin: 0 0 16px; }

.dae-ref__age { border: 0; padding: 0; }

.dae-ref legend,
.dae-ref__field > span {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
    font-weight: 700;
}

.dae-ref__field em {
    margin-left: 6px;
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #a8a29e;
}

.dae-ref__age label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #e7e0da;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.dae-ref__age input { accent-color: #9c3b2e; }

.dae-ref input[type="text"],
.dae-ref textarea {
    width: 100%;
    margin-top: 8px;
    padding: 12px 13px;
    border: 1px solid #e7e0da;
    border-radius: 12px;
    background: #fff;
    color: #1c1917;
    font: inherit;
    font-size: 16px;
    box-sizing: border-box;
}

.dae-ref textarea { resize: vertical; }

.dae-ref input:focus,
.dae-ref textarea:focus,
.dae-ref__age label:focus-within,
.dae-ref__close:focus,
.dae-ref button:focus {
    outline: 2px solid #9c3b2e;
    outline-offset: 2px;
}

.dae-ref__honey {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}

.dae-ref__notice {
    margin: 0 0 8px;
    color: #9c3b2e;
    font-size: 14px;
}

.dae-ref__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 16px;
    border-top: 1px solid #eee7e1;
    background: #fffcf8;
}

.dae-ref__foot p { margin: 0; max-width: 280px; font-size: 13px; }

.dae-ref__send,
.dae-ref__done button {
    border: 0;
    border-radius: 999px;
    padding: 12px 20px;
    background: #9c3b2e;
    color: #fff;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
}

.dae-ref__send[disabled] { opacity: 0.65; cursor: wait; }

.dae-ref__done {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 280px;
    padding-top: 48px;
    padding-bottom: 36px;
}

.dae-ref__done[hidden] { display: none !important; }

.dae-ref__done button { align-self: flex-start; margin-top: 8px; }

@media (max-width: 640px) {
    .dae-ref { padding: 0; align-items: end; }
    .dae-ref__dialog {
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .dae-ref h2 { font-size: 26px; }
    .dae-ref__units ul { grid-template-columns: 1fr; }
    .dae-ref__head,
    .dae-ref__body,
    .dae-ref__foot,
    .dae-ref__done { padding-left: 18px; padding-right: 18px; }
    .dae-ref__foot { align-items: stretch; flex-direction: column; }
    .dae-ref__foot p { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dae-ref__dialog { scroll-behavior: auto; }
}
