:root {
    --ink: #f3efe4;
    --muted: #a6a493;
    --dim: #747568;
    --surface: rgba(30, 31, 26, 0.88);
    --surface-strong: #20211c;
    --line: rgba(255, 255, 255, 0.1);
    --amber: #f4b83f;
    --amber-soft: #ffd77c;
    --red: #ff5a55;
    --red-soft: rgba(255, 70, 66, 0.11);
    --green: #89c976;
    --page: #11120f;
    --display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: var(--display);
    background: linear-gradient(135deg, #11120f 0%, #181913 56%, #10110e 100%);
}

.generated-background,
.generated-background span {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.generated-background {
    z-index: -1;
    overflow: hidden;
}

.background-glow {
    opacity: 0.95;
}

.glow-amber {
    background: radial-gradient(circle at 82% 12%, rgba(244, 184, 63, 0.16), transparent 31rem);
}

.glow-moss {
    background: radial-gradient(circle at 8% 58%, rgba(115, 130, 89, 0.13), transparent 32rem);
}

.background-grid {
    opacity: 0.2;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.background-vignette {
    background:
        linear-gradient(90deg, rgba(17, 18, 15, 0.62), transparent 24%, transparent 76%, rgba(17, 18, 15, 0.68)),
        linear-gradient(180deg, transparent 0%, rgba(17, 18, 15, 0.18) 58%, rgba(17, 18, 15, 0.72) 100%);
}

a {
    color: inherit;
}

.site-header,
footer,
main {
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #17170f;
    font-size: 25px;
    font-weight: 900;
    background: var(--amber);
    clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 22% 100%, 0 78%);
}

.brand strong,
.brand small {
    display: block;
    letter-spacing: 0.12em;
}

.brand strong {
    font-size: 17px;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font: 10px var(--mono);
}

.secure-badge {
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--muted);
    font: 12px var(--mono);
}

.secure-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 14px var(--green);
}

main {
    min-height: calc(100vh - 190px);
    padding: 72px 0 90px;
}

.search-panel {
    max-width: 850px;
    animation: rise 600ms ease-out both;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--amber);
    font: 700 11px/1 var(--mono);
    letter-spacing: 0.19em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 26px;
    font-size: clamp(48px, 7.2vw, 94px);
    line-height: 0.94;
    letter-spacing: -0.055em;
}

h1 em {
    color: var(--amber-soft);
    font-style: normal;
    font-weight: 400;
}

.intro {
    max-width: 620px;
    margin-bottom: 45px;
    color: var(--muted);
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.55;
}

#search-form {
    padding: 26px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(14px);
}

#search-form > label,
.filter-field span {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font: 11px var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

input,
button {
    min-height: 54px;
    border: 0;
    font: 15px var(--mono);
}

input {
    width: 100%;
    outline: 1px solid var(--line);
    padding: 0 17px;
    color: var(--ink);
    background: #11120f;
    transition: outline-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
    outline-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(244, 184, 63, 0.12);
}

button,
.error-panel a,
.new-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 0 22px;
    color: #17170f;
    font-weight: 800;
    text-decoration: none;
    background: var(--amber);
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease;
}

button:hover,
.error-panel a:hover,
.new-search:hover {
    transform: translateY(-2px);
    background: var(--amber-soft);
}

#search-help {
    margin: 15px 0 0;
    color: var(--dim);
    font-size: 13px;
}

code {
    color: var(--amber-soft);
    font-family: var(--mono);
}

.form-error {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--red);
    font: 13px var(--mono);
}

.loading-panel,
.error-panel {
    min-height: 48vh;
    display: grid;
    align-content: center;
    justify-items: start;
}

.loading-panel[hidden],
.error-panel[hidden],
.log-view[hidden],
#truncated-notice[hidden],
#empty-state[hidden] {
    display: none;
}

.loading-panel p {
    color: var(--muted);
    font: 14px var(--mono);
}

.loader {
    width: 62px;
    height: 4px;
    margin-bottom: 20px;
    background: linear-gradient(90deg, var(--amber) 50%, var(--line) 50%);
    background-size: 200% 100%;
    animation: scan 900ms linear infinite;
}

.error-panel h1 {
    max-width: 800px;
}

.error-panel > p:not(.eyebrow) {
    color: var(--muted);
}

.error-panel a {
    min-height: 48px;
    margin-top: 12px;
}

.log-view {
    animation: rise 500ms ease-out both;
}

.log-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 40px;
}

.log-heading h1 {
    margin: 0;
    font-size: clamp(38px, 5vw, 67px);
}

.log-heading h1 span {
    color: var(--amber-soft);
    font-family: var(--mono);
    font-size: 0.55em;
    letter-spacing: -0.04em;
}

.new-search {
    min-height: 44px;
    color: var(--ink);
    outline: 1px solid var(--line);
    background: transparent;
    white-space: nowrap;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.summary-card {
    min-width: 0;
    padding: 24px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.summary-card > span,
.summary-card small {
    display: block;
    color: var(--dim);
    font: 10px/1.5 var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-card strong {
    display: block;
    overflow: hidden;
    margin: 12px 0 7px;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-card {
    background: linear-gradient(120deg, var(--red-soft), var(--surface));
}

.target-card strong {
    color: #ff7b76;
}

.notice {
    margin-top: 16px;
    padding: 14px 18px;
    color: #e9c880;
    border-left: 3px solid var(--amber);
    background: rgba(244, 184, 63, 0.08);
    font: 13px/1.5 var(--mono);
}

.message-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin: 70px 0 28px;
}

.message-toolbar h2 {
    margin: 0;
    font-size: 34px;
}

.filter-field {
    width: min(370px, 100%);
}

.filter-field input {
    min-height: 45px;
}

.message-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.message-entry {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
    animation: rise 350ms ease-out both;
}

.message-entry[hidden] {
    display: none;
}

.message-rail {
    position: relative;
    padding-top: 21px;
    border-right: 1px solid var(--line);
}

.message-rail time {
    color: var(--dim);
    font: 11px var(--mono);
}

.rail-dot {
    position: absolute;
    top: 24px;
    right: -5px;
    width: 9px;
    height: 9px;
    border: 2px solid var(--page);
    border-radius: 50%;
    background: var(--amber);
}

.message-entry article {
    min-width: 0;
    margin: 0 0 12px 25px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    background: rgba(28, 29, 24, 0.7);
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
}

.message-author {
    color: var(--amber-soft);
    font-size: 15px;
}

.target-label,
.server-label {
    padding: 3px 7px;
    font: 700 9px var(--mono);
    letter-spacing: 0.08em;
}

.target-label {
    color: #ffd5d3;
    background: var(--red);
}

.server-label {
    color: var(--muted);
    outline: 1px solid var(--line);
}

.message-text {
    margin: 11px 0 0;
    color: #d9d7cc;
    font: 14px/1.65 var(--mono);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.whereami {
    display: block;
    margin-top: 10px;
    color: var(--dim);
    font: 10px var(--mono);
}

.message-entry.is-target article {
    border-color: rgba(255, 90, 85, 0.48);
    background: linear-gradient(90deg, var(--red-soft), rgba(28, 29, 24, 0.78));
    box-shadow: inset 3px 0 var(--red);
}

.message-entry.is-target .rail-dot {
    background: var(--red);
    box-shadow: 0 0 12px rgba(255, 90, 85, 0.55);
}

.message-entry.is-target .message-author {
    color: #ff817c;
}

.empty-state {
    padding: 34px;
    color: var(--muted);
    border: 1px dashed var(--line);
    text-align: center;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 0 34px;
    color: var(--dim);
    border-top: 1px solid var(--line);
    font: 10px var(--mono);
    letter-spacing: 0.08em;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scan {
    to { background-position: -200% 0; }
}

@media (max-width: 760px) {
    .site-header,
    footer,
    main {
        width: min(100% - 28px, 1180px);
    }

    .secure-badge {
        display: none;
    }

    main {
        padding-top: 52px;
    }

    h1 {
        font-size: clamp(44px, 14vw, 64px);
    }

    .search-row,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .search-row button {
        min-height: 52px;
    }

    .log-heading,
    .message-toolbar,
    footer {
        align-items: stretch;
        flex-direction: column;
    }

    .new-search {
        align-self: flex-start;
    }

    .message-entry {
        grid-template-columns: 75px minmax(0, 1fr);
    }

    .message-entry article {
        margin-left: 15px;
        padding: 15px;
    }
}

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