:root {
    --bg-start: #7869dd;
    --bg-end: #6a53c4;
    --surface: #f7f7fb;
    --card: #ffffff;
    --line: #dfdfeb;
    --line-strong: #8a95ff;
    --text: #35353d;
    --muted: #7d7d89;
    --primary: #6877ff;
    --primary-deep: #6f4abd;
    --cyan: #32c8ff;
    --pink: #ff8eb5;
    --danger: #f05a66;
    --shadow: 0 18px 45px rgba(53, 54, 93, 0.14);
    --shadow-soft: 0 8px 22px rgba(53, 54, 93, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    font-family: "Poppins", sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
    padding: 18px;
}

button,
a {
    font: inherit;
}

.app-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    background: var(--surface);
    border-radius: 28px;
    padding: 28px 30px 34px;
    box-shadow: var(--shadow);
}

.hero {
    text-align: center;
    padding-top: 2px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.7rem;
    background: linear-gradient(135deg, #7e86ff, #784ac2);
    box-shadow: 0 10px 24px rgba(111, 74, 189, 0.36);
}

.hero h1 {
    font-size: clamp(2.05rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.hero p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 1.02rem;
}

.top-tabs {
    margin: 30px auto 0;
    padding-bottom: 18px;
    max-width: 680px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.tab-chip {
    border: none;
    border-radius: 12px;
    background: transparent;
    padding: 11px 20px;
    color: #666874;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.tab-chip.active {
    color: var(--primary);
    background: #eef0ff;
    box-shadow: inset 0 -2px 0 var(--primary);
}

.card-box {
    margin-top: 24px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px 22px;
    box-shadow: var(--shadow-soft);
}

.card-box h2,
.card-box h3 {
    text-align: center;
    font-size: 1.05rem;
    color: #50525c;
}

.email-builder {
    margin: 18px auto 0;
    max-width: 640px;
    min-height: 56px;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(170px, 210px) auto auto;
    align-items: center;
    gap: 10px;
    border: 2px solid var(--line-strong);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(104, 119, 255, 0.12);
}

.email-address,
.email-input,
.mailbox-address,
.capture-email,
.capture-msg {
    font-family: "JetBrains Mono", monospace;
}

.email-address,
.email-input {
    padding: 0 10px;
    color: #6d6e79;
    font-size: 0.94rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
}

.email-domain-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4f4f5d;
    font-weight: 600;
    white-space: nowrap;
}

.at-sign {
    color: var(--primary);
    font-size: 1.05rem;
}

.domain-pill {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
}

.domain-select {
    width: 100%;
    min-width: 0;
    height: 40px;
    border: none;
    outline: none;
    background: transparent;
    color: #4f4f5d;
    font-weight: 600;
}

.icon-btn,
.primary-btn,
.secondary-btn,
.trash-btn,
.close-btn,
.share-btn-round,
.share-primary,
.btn-secondary-full {
    border: none;
    cursor: pointer;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn.copy {
    background: linear-gradient(135deg, #ffbfd1, var(--pink));
    color: #8d2855;
}

.icon-btn.refresh {
    background: linear-gradient(135deg, #8793ff, #6b4fd4);
}

.primary-btn {
    min-height: 46px;
    padding: 0 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    box-shadow: 0 12px 26px rgba(111, 74, 189, 0.24);
}

.secondary-btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 12px;
    background: #eef0ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
}

.email-actions {
    margin: 16px auto 0;
    max-width: 640px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.current-email-bar {
    margin: 14px auto 0;
    max-width: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.84rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.current-label {
    font-weight: 600;
}

.current-value {
    font-family: "JetBrains Mono", monospace;
    color: #50525c;
}

.primary-btn {
    min-height: 46px;
    margin: 0;
}

.service-chip {
    width: fit-content;
    margin: 0 auto 16px;
    min-height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #5fd6ff, var(--cyan));
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    box-shadow: 0 8px 18px rgba(50, 200, 255, 0.22);
}

.chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
}

.mailbox-box {
    max-width: 690px;
    margin: 0 auto 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fcfcff, #f2f3f8);
}

.mailbox-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.mailbox-label {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mailbox-address {
    margin-top: 6px;
    color: #4a4d58;
    font-size: 0.92rem;
    word-break: break-word;
}

.mailbox-meta {
    color: var(--muted);
    font-size: 0.8rem;
    text-align: right;
}

.inbox-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.inbox-panel {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.inbox-heading,
.modal-header,
.modal-actions,
.msg-header,
.capture-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.inbox-heading {
    margin-bottom: 14px;
}

.inbox-heading h3 {
    text-align: left;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    color: #fff;
    background: var(--danger);
    vertical-align: middle;
    margin-left: 8px;
}

.trash-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffe4e6;
    color: var(--danger);
}

.message-list {
    display: grid;
    gap: 12px;
    max-height: 460px;
    overflow: auto;
}

.message-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fafaff;
    cursor: pointer;
}

.message-card.unread {
    border-color: #cad2ff;
    background: #f7f8ff;
}

.message-card.read {
    opacity: 0.84;
}

.msg-avatar,
.meta-avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef0ff;
    color: #6772ff;
    font-weight: 700;
}

.msg-content {
    flex: 1;
    min-width: 0;
}

.msg-from,
.msg-subject {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-from {
    max-width: 70%;
    font-weight: 700;
    font-size: 0.9rem;
}

.msg-time,
.meta-time {
    color: var(--muted);
    font-size: 0.75rem;
}

.msg-subject {
    margin: 4px 0;
    font-weight: 600;
    font-size: 0.88rem;
}

.msg-snippet,
.modal-body,
.share-note {
    color: var(--muted);
}

.msg-snippet {
    line-height: 1.45;
    font-size: 0.84rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-placeholder {
    padding: 44px 18px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    text-align: center;
    color: #c0c2ca;
}

.empty-placeholder i {
    display: block;
    margin-bottom: 10px;
    font-size: 2.6rem;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(39, 41, 61, 0.45);
    z-index: 20;
}

.modal.show {
    display: flex;
}

.modal-center {
    align-items: center;
}

.modal-content {
    width: min(760px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.share-modal-content {
    max-width: 380px;
}

.close-btn,
.share-btn-round {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}

.close-btn {
    background: #f0f1f7;
    color: var(--text);
}

.share-btn-round {
    background: #eef0ff;
    color: var(--primary);
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin: 16px 0;
    border-bottom: 1px solid var(--line);
}

.meta-info {
    display: grid;
    gap: 3px;
}

.meta-from {
    font-weight: 700;
}

.modal-body {
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.share-note {
    margin: 10px 0 18px;
    line-height: 1.6;
}

.share-primary,
.btn-secondary-full {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    font-weight: 700;
}

.share-primary {
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
}

.btn-secondary-full {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.capture-shell {
    position: fixed;
    left: -9999px;
    top: 0;
}

.capture-card-style {
    width: 400px;
    padding: 28px;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff, #f5f6ff);
    color: var(--text);
}

.capture-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.capture-body {
    padding: 16px 0;
}

.capture-label {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.capture-gap {
    margin-top: 16px;
}

.capture-email {
    margin-top: 8px;
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    background: #eef0ff;
    color: #555b78;
}

.capture-msg {
    margin-top: 10px;
    line-height: 1.6;
    font-size: 1.08rem;
    color: #454856;
}

.capture-footer {
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    text-align: center;
    font-size: 0.78rem;
}

.toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 22px;
    border-radius: 999px;
    background: #303240;
    color: #fff;
    transition: transform 0.28s ease;
    z-index: 30;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 760px) {
    body {
        padding: 8px;
    }

    .app-shell {
        border-radius: 22px;
        padding: 22px 14px 24px;
    }

    .email-builder {
        grid-template-columns: 1fr;
    }

    .email-address,
    .email-input {
        white-space: normal;
        word-break: break-word;
    }

    .email-domain-wrap {
        justify-content: center;
    }

    .icon-btn,
    .primary-btn,
    .secondary-btn {
        width: 100%;
    }

    .email-actions {
        flex-direction: column;
    }

    .inbox-columns {
        grid-template-columns: 1fr;
    }

    .mailbox-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .mailbox-meta {
        text-align: left;
    }
}
