* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #0b0b10;
    --bg-deep: #050507;
    --ink: #f5f5f7;
    --muted: #b8b8c6;
    --line: rgba(255, 255, 255, 0.08);
    --purple: #8b5cf6;
    --purple-bright: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.45);
    --panel: #151521;
    --panel-strong: #1c1c2b;
    --white: #ffffff;
    --success: #22c55e;
}

body.light {
    color-scheme: light;
    --bg: #f5f4fb;
    --bg-deep: #ece9f7;
    --ink: #17141f;
    --muted: #5b556a;
    --line: rgba(23, 20, 31, 0.12);
    --panel: #ffffff;
    --panel-strong: #ffffff;
}

body {
    font-family: "Space Grotesk", "Sora", "IBM Plex Sans", "Segoe UI", sans-serif;
    background: radial-gradient(1200px 800px at 15% -10%, rgba(139, 92, 246, 0.35), transparent 55%),
        radial-gradient(900px 700px at 95% 10%, rgba(168, 85, 247, 0.25), transparent 45%),
        linear-gradient(180deg, var(--bg), var(--bg-deep));
    color: var(--ink);
    min-height: 100vh;
    padding: 48px 24px 80px;
    overflow-x: hidden;
}

.bg-orbit {
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    border: 1px solid rgba(168, 85, 247, 0.15);
    top: 10%;
    left: -120px;
    filter: blur(0.4px);
    animation: orbit 18s linear infinite;
    pointer-events: none;
}

.bg-orbit.orbit-2 {
    width: 360px;
    height: 360px;
    top: 65%;
    left: 70%;
    animation-duration: 22s;
    border-color: rgba(139, 92, 246, 0.2);
}

.bg-orbit.orbit-3 {
    width: 240px;
    height: 240px;
    top: 35%;
    left: 55%;
    animation-duration: 14s;
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes orbit {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.03); }
    100% { transform: rotate(360deg) scale(1); }
}

.app {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
    z-index: 1;
}

.hero {
    display: grid;
    gap: 14px;
    text-align: left;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.logo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--purple-bright);
    box-shadow: 0 0 12px var(--purple-glow);
}

h1 {
    font-size: clamp(2.4rem, 4vw, 3.8rem);
    font-weight: 700;
    line-height: 1.05;
}

.subhead {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 640px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    animation: panelIn 0.8s ease forwards;
    opacity: 0;
    transform: translateY(12px);
}

.email-panel {
    animation-delay: 0.1s;
}

.inbox-panel {
    animation-delay: 0.2s;
}

@keyframes panelIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.panel-hint {
    color: var(--muted);
    font-size: 0.9rem;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--purple);
    box-shadow: 0 0 10px var(--purple-glow);
    animation: pulse 1.6s ease infinite;
}

.status-dot.ok {
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.status-dot.error {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.55);
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.address-wrap {
    display: grid;
    gap: 16px;
}

.address {
    background: var(--panel-strong);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 18px 20px;
    border-radius: 14px;
    font-family: "JetBrains Mono", "Fira Code", "Menlo", monospace;
    font-size: 1.1rem;
    color: var(--white);
    word-break: break-all;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.3);
}

.light .address {
    color: var(--ink);
    border-color: rgba(23, 20, 31, 0.2);
    box-shadow: inset 0 0 14px rgba(23, 20, 31, 0.08);
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border: 1px solid transparent;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.98rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.btn.primary {
    background: linear-gradient(135deg, var(--purple), var(--purple-bright));
    color: var(--white);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.35);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(168, 85, 247, 0.45);
}

.btn.ghost {
    background: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn.ghost:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 24px rgba(255, 255, 255, 0.08);
}

.light .btn.ghost {
    color: var(--ink);
    border-color: rgba(23, 20, 31, 0.2);
}

.light .btn.ghost:hover {
    border-color: rgba(23, 20, 31, 0.35);
    box-shadow: 0 10px 24px rgba(23, 20, 31, 0.08);
}

.btn.tiny {
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: 10px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.stat {
    background: #141422;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
}

.light .stat {
    background: #f6f4fb;
    border-color: rgba(23, 20, 31, 0.12);
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 6px;
}

.email-list {
    list-style: none;
    display: grid;
    gap: 14px;
}

.email-list li,
.email-card {
    background: #0f0f18;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 18px 20px;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.light .email-list li,
.light .email-card {
    background: #ffffff;
    border-color: rgba(23, 20, 31, 0.12);
}

.email-list li:hover,
.email-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.email-list .empty {
    color: var(--muted);
    border-style: dashed;
}

.email-meta {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
}

.email-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.link-btn {
    background: transparent;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.light .link-btn {
    color: var(--ink);
    border-color: rgba(23, 20, 31, 0.2);
}

.link-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.email-meta strong {
    color: var(--white);
}

.light .email-meta strong {
    color: var(--ink);
}

.email-body {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #151524;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: "JetBrains Mono", "Fira Code", "Menlo", monospace;
    font-size: 0.86rem;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.light .email-body {
    color: var(--ink);
    border-color: rgba(23, 20, 31, 0.12);
    background: #f3f1f9;
}

.skeleton {
    border-style: dashed;
    position: relative;
    overflow: hidden;
}

.skeleton-line {
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin-bottom: 10px;
}

.skeleton-block {
    height: 80px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.light .skeleton-line {
    background: rgba(23, 20, 31, 0.12);
}

.light .skeleton-block {
    background: rgba(23, 20, 31, 0.08);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 1.6s infinite;
}

.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-70 { width: 70%; }

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.drawer {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 5;
}

.drawer.open {
    display: block;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 7, 0.7);
    backdrop-filter: blur(6px);
}

.drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: min(480px, 92vw);
    background: var(--panel-strong);
    border-left: 1px solid var(--line);
    padding: 24px;
    display: grid;
    gap: 16px;
    animation: slideIn 0.25s ease;
}

.drawer-close {
    justify-self: end;
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.drawer-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.drawer-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.drawer-subject {
    font-size: 1.1rem;
    font-weight: 600;
}

.drawer-body {
    font-family: "JetBrains Mono", "Fira Code", "Menlo", monospace;
    white-space: pre-wrap;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
    border-radius: 12px;
    min-height: 200px;
}

.light .drawer-body {
    background: #f3f1f9;
    border-color: rgba(23, 20, 31, 0.12);
}
@keyframes slideIn {
    from { transform: translateX(20%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 720px) {
    body {
        padding: 32px 16px 64px;
    }

    .panel {
        padding: 20px;
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .cta-row {
        flex-direction: column;
    }
}
