/* Tembox — precision inbox UI (dark/light + LTR/RTL) */
:root {
    color-scheme: light;
    --font-sans: "Segoe UI", Tahoma, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --page: #f5f7f8;
    --page-accent: rgba(15, 118, 110, 0.07);
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-muted: #f3f6f6;
    --surface-hover: #eef4f3;
    --ink: #101716;
    --ink-soft: #52605e;
    --ink-muted: #7c8987;
    --line: #dde5e3;
    --line-strong: #cbd7d4;
    --accent: #0f766e;
    --accent-hover: #0b5f59;
    --accent-soft: rgba(15, 118, 110, 0.10);
    --accent-ring: rgba(15, 118, 110, 0.20);
    --success: #0f9f6e;
    --warning: #b7791f;
    --danger: #d14343;
    --shadow-panel: 0 1px 2px rgba(16, 24, 23, 0.04), 0 14px 35px rgba(16, 24, 23, 0.06);
    --shadow-float: 0 14px 42px rgba(16, 24, 23, 0.14);
    --r-sm: 7px;
    --r-md: 11px;
    --r-lg: 16px;
    --ease: 160ms cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
    color-scheme: dark;
    --page: #080b0b;
    --page-accent: rgba(52, 211, 153, 0.045);
    --surface: #101414;
    --surface-raised: #151a1a;
    --surface-muted: #171d1c;
    --surface-hover: #1b2322;
    --ink: #f1f6f5;
    --ink-soft: #a8b3b1;
    --ink-muted: #6f7b79;
    --line: rgba(239, 255, 251, 0.075);
    --line-strong: rgba(239, 255, 251, 0.13);
    --accent: #34d399;
    --accent-hover: #6ee7b7;
    --accent-soft: rgba(52, 211, 153, 0.10);
    --accent-ring: rgba(52, 211, 153, 0.18);
    --success: #34d399;
    --warning: #f2b84b;
    --danger: #ff6b6b;
    --shadow-panel: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 18px 50px rgba(0, 0, 0, 0.24);
    --shadow-float: 0 20px 54px rgba(0, 0, 0, 0.46);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { min-width: 320px; background: var(--page); }

body {
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(var(--page-accent) 1px, transparent 1px),
        linear-gradient(90deg, var(--page-accent) 1px, transparent 1px),
        var(--page);
    background-size: 48px 48px;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.app-container {
    width: min(100%, 1040px);
    min-height: 100vh;
    margin-inline: auto;
    padding: 24px 24px 38px;
    display: flex;
    flex-direction: column;
}

.navbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 2px 18px;
    border-bottom: 1px solid var(--line);
}

.brand, .brand-text, .nav-actions, .connection-status,
.sync-indicator, .inbox-title-group, .btn, .btn-icon-text,
.reader-header, .meta-row { display: flex; align-items: center; }

.brand { gap: 11px; min-width: 0; }
.brand-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #03110d;
    background: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 74%, white);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.30), 0 5px 18px var(--accent-ring);
}
.brand-text { gap: 8px; min-width: 0; }
.brand-name {
    color: var(--ink);
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.45px;
}
.brand-badge {
    padding: 3px 7px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.nav-actions { gap: 8px; }
.connection-status {
    min-height: 36px;
    gap: 8px;
    padding: 0 12px;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 600;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent);
}
.status-dot.warning { background: var(--warning); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 13%, transparent); }

.icon-btn, .lang-btn {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
}
.icon-btn { width: 36px; }
.lang-btn { min-width: 74px; padding: 0 12px; font-size: 12px; font-weight: 650; }
.icon-btn:hover, .lang-btn:hover { color: var(--ink); background: var(--surface-hover); border-color: var(--line-strong); }
.icon-btn:active, .lang-btn:active { transform: translateY(1px); }
[data-theme="dark"] .sun-icon, [data-theme="light"] .moon-icon { display: block; }
[data-theme="dark"] .moon-icon, [data-theme="light"] .sun-icon { display: none; }

.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding-top: 30px;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-panel);
}

.mailbox-card { display: flex; flex-direction: column; gap: 20px; }
.card-header, .inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;
}
.card-title, .inbox-heading, .reader-subject { letter-spacing: -0.025em; }
.card-title { font-size: 17px; font-weight: 650; }
.retention-hint {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .015em;
}

.mailbox-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 10px;
}
.address-wrapper { position: relative; min-width: 0; }
.mailbox-address {
    width: 100%;
    height: 56px;
    padding: 0 17px;
    color: var(--accent);
    background: var(--surface-muted);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    outline: none;
    font-family: var(--font-mono);
    font-size: clamp(14px, 2.2vw, 18px);
    font-weight: 600;
    letter-spacing: -.02em;
    user-select: all;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.mailbox-address:hover { background: var(--surface-hover); }
.mailbox-address:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.mailbox-buttons { display: flex; gap: 8px; }

.btn, .btn-icon-text, .toggle-btn {
    justify-content: center;
    gap: 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-weight: 650;
    transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.btn {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    font-size: 13px;
    white-space: nowrap;
}
.mailbox-buttons .btn { height: 56px; }
.btn-primary {
    color: #03110d;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 5px 16px var(--accent-ring);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary, .btn-ghost {
    color: var(--ink);
    background: var(--surface-muted);
    border-color: var(--line);
}
.btn-secondary:hover, .btn-ghost:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.btn:active, .btn-icon-text:active, .toggle-btn:active { transform: translateY(1px); }
.btn:disabled { cursor: wait; opacity: .65; transform: none; }
.btn-ghost { min-height: 38px; padding: 0 12px; }

.mailbox-footer {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 18px;
    color: var(--ink-muted);
    font-size: 12px;
}
.sync-indicator { position: relative; gap: 9px; }
.pulse-dot, .pulse-ring { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.pulse-ring { position: absolute; inset-inline-start: 0; animation: pulse-wave 2.2s infinite; }
@keyframes pulse-wave { 0% { transform: scale(1); opacity: .6; } 75%,100% { transform: scale(3); opacity: 0; } }

.inbox-card { min-height: 390px; display: flex; flex-direction: column; padding: 0; }
.inbox-header { min-height: 71px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.inbox-title-group { gap: 9px; }
.inbox-heading { font-size: 18px; font-weight: 650; }
.count-badge {
    min-width: 25px;
    padding: 2px 7px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 650;
    text-align: center;
}
.btn-icon-text {
    min-height: 36px;
    padding: 0 11px;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--line);
    font-size: 12px;
}
.btn-icon-text:hover { color: var(--ink); background: var(--surface-hover); border-color: var(--line-strong); }

.inbox-empty {
    flex: 1;
    min-height: 315px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 42px 24px;
    text-align: center;
}
.empty-animation { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 21px; }
.empty-icon {
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 14px;
}
.radar-circle { position: absolute; border: 1px solid var(--accent); border-radius: 18px; opacity: 0; animation: radar-ping 3s infinite cubic-bezier(.2,.65,.25,1); }
.circle-1 { width: 69px; height: 69px; }
.circle-2 { width: 84px; height: 84px; animation-delay: 1.5s; }
@keyframes radar-ping { 0% { transform: scale(.7); opacity: .28; } 100% { transform: scale(1.25); opacity: 0; } }
.empty-title { margin-bottom: 7px; color: var(--ink); font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.empty-desc { max-width: 440px; color: var(--ink-soft); font-size: 13px; line-height: 1.65; text-wrap: pretty; }

.messages-list { display: flex; flex-direction: column; padding: 10px; gap: 4px; }
.message-item {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.message-item:hover { background: var(--surface-hover); border-color: var(--line); }
.sender-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 650;
}
.message-summary { flex: 1; min-width: 0; }
.message-top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.message-sender, .message-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-sender { color: var(--ink); font-size: 13px; font-weight: 650; }
.message-subject { color: var(--ink-soft); font-size: 13px; }
.message-time { flex: 0 0 auto; color: var(--ink-muted); font-family: var(--font-mono); font-size: 10px; }
.message-arrow { flex: 0 0 auto; color: var(--ink-muted); transition: color var(--ease), transform var(--ease); }
.message-item:hover .message-arrow { color: var(--accent); transform: translateX(3px); }
[dir="rtl"] .message-arrow { transform: scaleX(-1); }
[dir="rtl"] .message-item:hover .message-arrow { transform: scaleX(-1) translateX(3px); }

.reader-card { display: flex; flex-direction: column; gap: 19px; }
.reader-header { justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.reader-view-toggles { display: inline-flex; padding: 3px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 9px; }
.toggle-btn { min-height: 32px; padding: 0 13px; color: var(--ink-soft); background: transparent; border: 0; font-size: 12px; }
.toggle-btn.active { color: var(--ink); background: var(--surface-raised); box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.reader-meta { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 18px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: var(--r-md); }
.reader-subject { margin-bottom: 6px; color: var(--ink); font-size: 21px; font-weight: 650; overflow-wrap: anywhere; }
.meta-row { align-items: baseline; gap: 9px; font-size: 13px; }
.meta-label { min-width: 62px; color: var(--ink-muted); font-weight: 600; }
.meta-val { color: var(--ink-soft); overflow-wrap: anywhere; }
.reader-content { min-height: 270px; padding: 19px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.reader-content.html-mode { padding: 0; background: #fff; }
.body-html-container { width: 100%; }
.body-text-container pre { color: var(--ink); font-family: var(--font-sans); font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.sanitized-frame { display: block; width: 100%; min-height: 520px; background: #fff; border: 0; border-radius: var(--r-sm); }

.app-footer { padding: 24px 8px 0; color: var(--ink-muted); font-size: 11px; line-height: 1.6; text-align: center; }
.toast-container { position: fixed; z-index: 9999; inset-inline: 20px; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
    max-width: min(440px, 100%);
    padding: 11px 15px;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-float);
    font-size: 13px;
    font-weight: 600;
    pointer-events: auto;
    animation: toast-in .22s var(--ease) both;
}
.toast-success { box-shadow: inset 0 2px 0 var(--success), var(--shadow-float); }
.toast-error { box-shadow: inset 0 2px 0 var(--danger), var(--shadow-float); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.spin-on-click { transform-origin: center; }
.spin-on-click.spin-on-click { animation: spin .65s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.session-control {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 14px;
}
.countdown-ring { position: relative; width: 78px; height: 78px; flex: 0 0 auto; }
.countdown-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-track, .countdown-progress { fill: none; stroke-width: 6; }
.countdown-track { stroke: var(--line); }
.countdown-progress {
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-dasharray: 251.327;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset .7s linear, stroke var(--ease);
}
.countdown-ring.is-urgent .countdown-progress { stroke: var(--warning); }
.countdown-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.countdown-value strong { color: var(--ink); font-family: var(--font-mono); font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.countdown-value span { margin-top: 1px; color: var(--ink-muted); font-family: var(--font-mono); font-size: 8px; letter-spacing: .08em; }
.session-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 190px; }
.session-copy > span { color: var(--ink-muted); font-size: 10px; }
.session-copy > strong { margin-top: 1px; color: var(--ink); font-size: 13px; }
.session-actions { display: flex; gap: 6px; margin-top: 8px; }
.renew-btn, .delete-btn {
    min-height: 29px;
    padding: 0 9px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 650;
    transition: background var(--ease), color var(--ease), border-color var(--ease), opacity var(--ease);
}
.renew-btn { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-ring); }
.renew-btn:hover { color: var(--accent-hover); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.delete-btn { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); }
.delete-btn:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.renew-btn:disabled, .delete-btn:disabled { cursor: wait; opacity: .55; }

/* First-visit creation surface */
.landing-content { flex: 1; display: flex; flex-direction: column; gap: 54px; padding: 54px 0 28px; }
.create-card { width: min(100%, 920px); margin-inline: auto; padding: clamp(26px, 4vw, 42px); }
.creation-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 20px; max-width: 760px; }
.create-icon {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    color: #03110d;
    background: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 72%, white);
    border-radius: 17px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.30), 0 15px 36px var(--accent-ring);
}
.create-overline { color: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 650; letter-spacing: .13em; text-transform: uppercase; }
.create-title { margin-top: 8px; color: var(--ink); font-size: clamp(27px, 4vw, 42px); font-weight: 650; line-height: 1.09; letter-spacing: -.043em; text-wrap: balance; }
.create-description { max-width: 650px; margin-top: 11px; color: var(--ink-soft); font-size: clamp(13px, 2vw, 16px); line-height: 1.65; text-wrap: pretty; }
.creation-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 30px; }
.creation-option { position: relative; min-height: 285px; padding: 25px; display: flex; flex-direction: column; align-items: flex-start; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.random-option { background: linear-gradient(145deg, var(--accent-soft), var(--surface-muted) 62%); border-color: var(--accent-ring); }
.option-index { margin-bottom: 30px; color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 650; }
.creation-option h2 { color: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: -.025em; }
.creation-option > p { max-width: 340px; margin-top: 8px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.create-btn, .custom-create-btn { width: 100%; min-height: 46px; margin-top: auto; font-size: 13px; }
[dir="rtl"] .create-btn svg { transform: scaleX(-1); }
.custom-option form { width: 100%; margin-top: 18px; display: flex; flex: 1; flex-direction: column; }
.custom-option label { margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.custom-address-field { width: 100%; min-height: 45px; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; transition: border-color var(--ease), box-shadow var(--ease); }
.custom-address-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.custom-address-field input { min-width: 0; flex: 1; height: 43px; padding: 0 11px; color: var(--ink); background: transparent; border: 0; outline: 0; font-family: var(--font-mono); font-size: 13px; }
.custom-address-field span { max-width: 58%; padding-inline: 10px; color: var(--ink-muted); border-inline-start: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; white-space: nowrap; }
.field-hint { margin-top: 6px; color: var(--ink-muted); font-size: 10px; line-height: 1.45; }
.field-error { min-height: 18px; margin-top: 3px; color: var(--danger); font-size: 10px; }
.custom-create-btn { margin-top: auto; }

.instructions-section {
    width: min(100%, 900px);
    margin-inline: auto;
}
.section-heading { max-width: 580px; }
.section-heading h2 {
    margin-top: 9px;
    color: var(--ink);
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 650;
    line-height: 1.18;
    letter-spacing: -.035em;
}
.section-heading > p:last-child { margin-top: 10px; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.instruction-list {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    list-style: none;
    border-block: 1px solid var(--line);
}
.instruction-list li {
    min-height: 155px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 25px 22px;
    border-inline-end: 1px solid var(--line);
}
.instruction-list li:last-child { border-inline-end: 0; }
.step-number { color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 650; }
.instruction-list h3 { color: var(--ink); font-size: 14px; font-weight: 650; }
.instruction-list p { margin-top: 7px; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 16px;
    color: var(--ink-soft);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: 12px;
    line-height: 1.6;
}
.privacy-note svg { flex: 0 0 auto; margin-top: 1px; color: var(--accent); }

.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.confirm-dialog {
    width: min(92vw, 430px);
    margin: auto;
    padding: 26px;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: var(--shadow-float);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(5px); }
.dialog-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 12px; }
.confirm-dialog h2 { margin-top: 17px; font-size: 20px; letter-spacing: -.025em; }
.confirm-dialog > p { margin-top: 8px; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.custom-switch-dialog form { margin-top: 20px; }
.custom-switch-dialog label { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.custom-dialog-icon { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-ring); }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }

.knowledge-section {
    margin-top: 70px;
    padding: clamp(28px, 5vw, 48px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-panel);
}
.article-copy { display: none; }
html[lang="ar"] .article-ar, html[lang="en"] .article-en { display: block; }
.article-header { max-width: 720px; }
.article-header h2 { margin-top: 10px; color: var(--ink); font-size: clamp(27px, 4vw, 40px); font-weight: 650; line-height: 1.15; letter-spacing: -.04em; text-wrap: balance; }
.article-header > p:last-child { margin-top: 13px; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.article-layout { margin-top: 38px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.article-layout article { padding: 27px 24px; border-bottom: 1px solid var(--line); }
.article-layout article:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.article-layout h3, .article-summary h3 { color: var(--ink); font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.article-layout p, .article-layout li, .article-summary p { color: var(--ink-soft); font-size: 13px; line-height: 1.85; }
.article-layout p { margin-top: 10px; }
.article-layout ul, .article-layout ol { margin-top: 10px; padding-inline-start: 20px; }
.article-layout li + li { margin-top: 6px; }
.article-layout li::marker { color: var(--accent); font-family: var(--font-mono); font-weight: 650; }
.article-layout strong { color: var(--ink); font-weight: 650; }
.article-summary { margin-top: 26px; padding: 19px 21px; background: var(--accent-soft); border: 1px solid var(--accent-ring); border-radius: 12px; }
.article-summary p { margin-top: 7px; }

@media (max-width: 760px) {
    .app-container { padding: 16px 14px 28px; }
    .landing-content { padding-top: 34px; gap: 40px; }
    .create-card { padding: 28px 20px; }
    .creation-heading { grid-template-columns: 1fr; }
    .create-icon { width: 56px; height: 56px; }
    .creation-options { grid-template-columns: 1fr; }
    .creation-option { min-height: 255px; }
    .instruction-list { grid-template-columns: 1fr; }
    .instruction-list li { min-height: auto; padding: 20px 4px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .instruction-list li:last-child { border-bottom: 0; }
    .mailbox-footer { align-items: flex-start; flex-direction: column; }
    .session-control { width: 100%; justify-content: center; }
    .session-copy { flex: 1; min-width: 0; }
    .knowledge-section { margin-top: 42px; padding: 25px 18px; }
    .article-layout { grid-template-columns: 1fr; }
    .article-layout article { padding-inline: 4px; }
    .article-layout article:nth-child(odd) { border-inline-end: 0; }
    .navbar { min-height: 52px; padding-bottom: 14px; }
    .main-content { padding-top: 18px; gap: 12px; }
    .card { padding: 18px; border-radius: 13px; }
    .mailbox-box { grid-template-columns: 1fr; }
    .mailbox-buttons { width: 100%; }
    .mailbox-buttons .btn { flex: 1; min-width: 0; height: 48px; padding-inline: 12px; }
    .mailbox-address { height: 54px; }
    .inbox-header { min-height: 64px; padding: 0 18px; }
    .inbox-empty { min-height: 285px; }
}

@media (max-width: 520px) {
    .connection-status { width: 36px; padding: 0; justify-content: center; }
    .connection-status .status-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
    .brand-badge { display: none; }
    .brand-name { font-size: 18px; }
    .card-header { align-items: flex-start; flex-direction: column; }
    .mailbox-buttons { display: grid; grid-template-columns: 1fr 1fr; }
    .mailbox-buttons .btn:last-child { grid-column: 1 / -1; }
    .session-control { align-items: flex-start; }
    .countdown-ring { width: 70px; height: 70px; }
    .session-actions { flex-wrap: wrap; }
    .dialog-actions .btn { flex: 1; }
    .reader-header { align-items: stretch; flex-direction: column; }
    .reader-view-toggles { width: 100%; }
    .toggle-btn { flex: 1; }
    .message-item { padding-inline: 10px; }
    .sender-avatar { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
