:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: #172033;
    background: #f3f6fb;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

.page {
    width: min(100% - 32px, 760px);
    margin: 0 auto;
    padding: 64px 0 36px;
}

.intro {
    margin-bottom: 32px;
    text-align: center;
}

.eyebrow {
    margin: 0 0 12px;
    color: #596ee8;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.14em;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 7vw, 3rem);
    letter-spacing: -0.045em;
}

.subtitle {
    max-width: 540px;
    margin: 14px auto 0;
    color: #647087;
    line-height: 1.6;
}

.card {
    border: 1px solid #e3e8f1;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 32px rgb(28 43 75 / 5%);
}

.address-card,
.search-card {
    margin-bottom: 18px;
    padding: 24px;
}

h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
}

.address-row,
.search-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.address {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #384ed0;
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 700;
}

.copy-button,
.secondary-button,
.search-button {
    flex: 0 0 auto;
    min-height: 44px;
    border: 0;
    border-radius: 9px;
    padding: 0 18px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.copy-button {
    color: #384ed0;
    background: #edf0ff;
}

.secondary-button {
    border: 1px solid #d5dcf5;
    color: #384ed0;
    background: #fff;
}

.search-button {
    color: #fff;
    background: #485de0;
}

.copy-button:hover,
.secondary-button:hover,
.search-button:hover {
    filter: brightness(0.96);
}

.hint {
    margin: 12px 0 0;
    color: #68748a;
    font-size: 0.92rem;
    line-height: 1.5;
}

.address-actions {
    margin-top: 14px;
}

.custom-address {
    margin-top: 20px;
    border-top: 1px solid #edf0f5;
    padding-top: 18px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 650;
}

.custom-address-row {
    display: flex;
    gap: 12px;
}

.address-input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border: 1px solid #cfd7e5;
    border-radius: 9px;
    padding: 0 12px;
    color: inherit;
    font: inherit;
}

.address-input:focus {
    border-color: #596ee8;
    outline: 3px solid rgb(89 110 232 / 17%);
}

.message {
    display: block;
    margin-top: 16px;
    border-radius: 9px;
    padding: 12px 14px;
    line-height: 1.5;
}

.error {
    color: #9c2c32;
    background: #fff0f0;
}

.status {
    color: #286044;
    background: #edf8f1;
}

.empty {
    color: #596579;
    background: #fff;
}

.results {
    margin-top: 30px;
}

.results-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.results-heading h2 {
    margin-bottom: 12px;
}

.result-count {
    color: #68748a;
    font-size: 0.9rem;
}

.email-card {
    margin-bottom: 14px;
    padding: 20px 24px;
}

.email-card h3 {
    margin: 0 0 14px;
    overflow-wrap: anywhere;
    font-size: 1.05rem;
}

.email-meta {
    display: grid;
    gap: 7px;
    margin: 0 0 16px;
    color: #566278;
    font-size: 0.9rem;
}

.email-meta div {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
}

.email-meta dt {
    font-weight: 650;
}

.email-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.email-body {
    max-height: 420px;
    overflow: auto;
    margin: 0;
    border-top: 1px solid #edf0f5;
    padding-top: 16px;
    color: #303b50;
    font: 0.93rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

footer {
    padding-top: 10px;
    color: #7a8497;
    font-size: 0.85rem;
    text-align: center;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

@media (max-width: 540px) {
    .page {
        width: min(100% - 24px, 760px);
        padding-top: 38px;
    }

    .address-card,
    .search-card {
        padding: 20px;
    }

    .search-row {
        align-items: stretch;
        flex-direction: column;
    }

    .custom-address-row {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-button {
        width: 100%;
    }

    .search-button {
        width: 100%;
    }

    .email-card {
        padding: 18px;
    }
}
