:root {
    color-scheme: dark;
    --background: #15130f;
    --panel: #191711;
    --panel-soft: #1f1c16;
    --card: #17140f;
    --border: #2c2820;
    --border-strong: #494132;
    --text: #ece6d8;
    --text-secondary: #9a9284;
    --text-muted: #7d7565;
    --accent: #c9a24b;
    --critical: #cf5b4e;
    --elevated: #d8a13f;
    --stable: #6fae7e;
    --shadow: 0 18px 48px rgb(0 0 0 / 24%);
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    background: var(--background);
    color: var(--text);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: clip;
    background:
        linear-gradient(rgb(201 162 75 / 4%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(201 162 75 / 3%) 1px, transparent 1px),
        var(--background);
    background-size: 48px 48px;
    color: var(--text);
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.site-shell {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 38px 0 28px;
}

.brand-header {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: 34px;
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-strong);
}

.brand-link {
    display: inline-flex;
    align-items: center;
}

.brand-link img {
    display: block;
    width: 100%;
    height: auto;
}

.brand-copy h1,
.panel-heading h2 {
    margin: 0;
    font-family: "Spectral", Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand-copy h1 {
    font-size: clamp(2.2rem, 6vw, 4.6rem);
    line-height: 0.96;
}

.eyebrow,
.section-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.subtitle {
    margin: 13px 0 0;
    color: var(--text-secondary);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
}

main {
    padding: 30px 0;
}

.receiver-panel,
.data-panel {
    border: 1px solid var(--border);
    border-radius: 1px;
    background: linear-gradient(145deg, var(--panel), var(--card));
    box-shadow: var(--shadow);
}

.receiver-panel {
    padding: clamp(20px, 4vw, 34px);
}

.panel-heading {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.panel-heading.compact {
    margin-bottom: 18px;
}

.panel-heading h2 {
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.1;
}

.status-line {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--text-secondary);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-pending {
    background: var(--elevated);
}

.status-active {
    background: var(--stable);
    box-shadow: 0 0 0 4px rgb(111 174 126 / 15%);
}

.status-error {
    background: var(--critical);
}

.primary-action {
    min-height: 48px;
    padding: 12px 19px;
    border: 1px solid var(--accent);
    border-radius: 1px;
    background: var(--accent);
    color: #15130f;
    cursor: pointer;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.primary-action:hover:not(:disabled) {
    background: #dbb65e;
}

.primary-action:disabled {
    cursor: wait;
    opacity: 0.58;
}

.error-state {
    margin-top: 16px;
    padding: 12px 14px;
    border-left: 3px solid var(--critical);
    background: rgb(207 91 78 / 10%);
    color: #f0b1aa;
    font-size: 0.9rem;
}

.spectrum-frame {
    margin: 24px 0 0;
}

#spectrum {
    display: block;
    width: 100%;
    height: 220px;
    border: 1px solid var(--border);
    background: var(--background);
}

.spectrum-frame figcaption {
    margin-top: 8px;
    color: var(--text-muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.receiver-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
    gap: 20px;
    margin-top: 20px;
}

.data-panel {
    min-width: 0;
    padding: 24px;
}

.count-badge {
    display: inline-grid;
    min-width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--border-strong);
    color: var(--accent);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.78rem;
}

.inbox,
.debug-log {
    min-height: 180px;
    max-height: 420px;
    overflow: auto;
}

.empty-state {
    margin: 0;
    padding: 26px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.message-item {
    margin-bottom: 10px;
    padding: 15px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-muted);
    background: var(--panel-soft);
}

.message-item:last-child {
    margin-bottom: 0;
}

.message-item.priority-priority {
    border-left-color: var(--elevated);
}

.message-item.priority-immediate,
.message-item.priority-flash {
    border-left-color: var(--critical);
}

.message-content {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.88rem;
    line-height: 1.55;
}

.message-metadata {
    display: flex;
    justify-content: space-between;
    margin-top: 13px;
    color: var(--text-muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.debug-log {
    padding: 13px;
    border: 1px solid var(--border);
    background: #12100d;
    color: var(--text-secondary);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    line-height: 1.55;
}

.debug-log p {
    margin: 0 0 7px;
}

.debug-log p:last-child {
    margin-bottom: 0;
}

footer {
    padding-top: 22px;
    border-top: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.6;
}

footer p {
    margin: 3px 0;
}

footer strong {
    color: var(--text);
}

@media (max-width: 760px) {
    .brand-header {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .brand-link {
        width: min(240px, 70vw);
    }

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

@media (max-width: 640px) {
    .site-shell {
        width: min(100% - 28px, 1120px);
        padding-top: 24px;
    }

    .panel-heading {
        flex-direction: column;
        gap: 14px;
    }

    .status-line,
    .primary-action {
        width: 100%;
    }

    #spectrum {
        height: 170px;
    }

    .data-panel {
        padding: 19px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
