/* ==========================================================================
   end2end.space — single dark design system
   Plain, terminal-adjacent pastebin look. No gradients, no glow, no pure
   #000/#fff. Every view uses these variables and primitives only.
   ========================================================================== */

:root {
    color-scheme: dark;

    --bg: #101619;
    --surface: #141b21;
    --surface-input: #0c141a;
    --surface-2: #1a232b;

    --border: #2a3742;
    --border-soft: #1f2b34;

    --text: #e9eef3;
    --text-2: #97a5b2;
    --muted: #6d7c88;

    --link: #6cc3ff;
    --accent: #00a7ff;
    --danger: #e57474;
    --success: #72c58b;
    --warning: #d8a657;

    --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --radius: 6px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code,
pre,
.mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

code {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 1px 5px;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    font-weight: 650;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

hr {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 18px 0;
}

.muted { color: var(--text-2); }
.faint { color: var(--muted); }
.small { font-size: 0.85rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.word-break-all { word-break: break-all; }

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.site-header {
    width: 100%;
    border-bottom: 1px solid var(--border);
    /* Same color as the page background so the logo's own dark backdrop
       blends seamlessly into the header. */
    background: var(--bg);
    flex-shrink: 0;
}

.site-logo-link {
    display: inline-block;
    line-height: 0;
}

.site-logo {
    display: block;
    height: 34px;
    width: auto;
}

.site-logo:hover {
    opacity: 0.85;
}

@media (max-width: 520px) {
    .site-logo {
        height: 26px;
    }
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.site-title {
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.site-title:hover {
    text-decoration: none;
    color: var(--link);
}

.nav-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-2);
}

.nav-links a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-links a.is-active {
    color: var(--text);
    font-weight: 600;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1 0 auto;
}

.container-narrow {
    max-width: 720px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 16px 0;
    flex-shrink: 0;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-brand {
    color: var(--muted);
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.footer-links a {
    color: var(--text-2);
    font-size: 0.85em;
}

.footer-links a:hover {
    color: var(--text);
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.panel-raised {
    background: var(--surface-2);
}

.page-title {
    margin: 0 0 16px;
}

.meta-line {
    color: var(--text-2);
    font-size: 0.9em;
    margin: 4px 0;
}

.meta-line strong {
    color: var(--text);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-2);
    font-size: 0.9em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: var(--surface-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

textarea {
    font-family: var(--font-mono);
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 1px solid var(--link);
    outline-offset: 0;
    border-color: var(--link);
}

input[readonly] {
    color: var(--text-2);
}

.checks {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    cursor: pointer;
}

.checks input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--link);
}

.form-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-hint {
    display: block;
    color: var(--muted);
    font-size: 0.82em;
    margin: 4px 0 12px;
}

.field-error {
    color: var(--danger);
    font-size: 0.85em;
    margin: -8px 0 12px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-block;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--text-2);
    text-decoration: none;
}

.btn-primary {
    background: #14344c;
    border-color: #1f4c73;
    color: #8fd2ff;
}

.btn-primary:hover {
    border-color: var(--accent);
}

.btn-danger {
    background: #241416;
    border-color: #4a2a2c;
    color: var(--danger);
}

.btn-danger:hover {
    border-color: var(--danger);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-small {
    padding: 3px 8px;
    font-size: 0.8em;
    font-weight: 500;
}

.linklike {
    background: none;
    border: none;
    padding: 0;
    color: var(--link);
    font: inherit;
    cursor: pointer;
}

.linklike:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 10px 12px;
    margin-bottom: 14px;
}

.alert-success {
    border-color: #2a4a34;
    color: var(--success);
}

.alert-error {
    border-color: #4a2a2c;
    color: var(--danger);
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

/* --------------------------------------------------------------------------
   Badges — deliberately plain: 1px border, colored text, nothing else.
   -------------------------------------------------------------------------- */

.badge {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-2);
    vertical-align: middle;
    white-space: nowrap;
}

.badge-role-admin {
    border-color: #4a2a2c;
    color: var(--danger);
}

.badge-role-mod {
    border-color: #2a4a34;
    color: var(--success);
}

.badge-ai {
    border-color: var(--border);
    color: var(--text-2);
}

.badge-hidden {
    border-color: #4a2a2c;
    color: var(--danger);
}

.badge-lock {
    border-color: var(--border);
    color: var(--warning);
}

.badge-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
    background: var(--surface);
}

.table th,
.table td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.92em;
}

.table th {
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-2);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table .actions-cell {
    text-align: right;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

/* --------------------------------------------------------------------------
   Auth forms
   -------------------------------------------------------------------------- */

.auth-form {
    max-width: 420px;
    margin: 48px auto;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.auth-form h2 {
    margin: 0 0 18px;
    text-align: center;
}

.auth-alt {
    margin-top: 16px;
    text-align: center;
    color: var(--text-2);
    font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-2);
    font-size: 0.9em;
}

.pagination span.disabled {
    color: var(--muted);
    border-color: var(--border-soft);
}

.pagination .page-status {
    border: none;
    color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Creator page (create paste) — including the one-line bug fix.

   Grid/flex children default to min-width:auto, so one unwrapped long code
   line could stretch the whole form and push the centered submit button
   "into the middle". Every level of the chain gets min-width:0 and the
   horizontal overflow is contained inside the CodeMirror scroller.
   -------------------------------------------------------------------------- */

.creator-panels,
.creator-panel,
.creator-panel-body,
#pasteForm,
.form-row,
.form-row > div,
.agent-grid,
.agent-grid > div {
    min-width: 0;
    max-width: 100%;
}

.creator-panels {
    display: grid;
    gap: 14px;
}

.creator-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.creator-panel[open] {
    border-color: var(--text-2);
}

.creator-panel summary {
    cursor: pointer;
    font-weight: 650;
    padding: 13px 16px;
    user-select: none;
    color: var(--text);
}

.creator-panel summary:hover {
    color: var(--link);
}

.creator-panel-body {
    border-top: 1px solid var(--border-soft);
    padding: 16px;
}

.creator-submit {
    margin-top: 18px;
    text-align: center;
}

.agent-mode-block {
    display: grid;
    gap: 12px;
}

.agent-mode-block h2 {
    margin: 0;
}

.agent-flags {
    display: grid;
    gap: 8px;
}

.agent-flags label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    cursor: pointer;
}

.agent-flags input {
    width: auto;
    margin: 0;
    accent-color: var(--link);
}

.turnstile-slot {
    margin-top: 16px;
    min-height: 65px;
}

.ticket-output {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.ticket-output textarea {
    min-height: 190px;
}

.autonomous-agent-block {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    display: grid;
    gap: 10px;
}

.autonomous-grid {
    display: grid;
    gap: 10px;
}

.autonomous-grid > div {
    display: grid;
    gap: 4px;
}

.autonomous-grid strong {
    font-size: 0.85em;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   CodeMirror — dark theme + containment.

   viewportMargin stays at its default (10): rendering only the visible
   viewport keeps multi-megabyte pastes from freezing the tab. Long lines
   scroll horizontally inside the editor instead of widening the page.
   -------------------------------------------------------------------------- */

.CodeMirror {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-input);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
}

.CodeMirror-scroll {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.CodeMirror.cm-viewer {
    height: min(72vh, 780px);
}

.CodeMirror-gutters {
    background: var(--surface-input);
    border-right: 1px solid var(--border-soft);
}

.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
    background: var(--surface-input);
}

.CodeMirror-linenumber {
    color: var(--muted);
}

.CodeMirror-cursor {
    border-left: 1px solid var(--text);
}

.CodeMirror-selected {
    background: #1e3a52 !important;
}

.CodeMirror-focused .CodeMirror-selected {
    background: #264a66 !important;
}

.CodeMirror-activeline-background {
    background: var(--surface-2);
}

.cm-s-default .cm-keyword { color: #6fb7ff; }
.cm-s-default .cm-atom { color: #d8a657; }
.cm-s-default .cm-number { color: #d8a657; }
.cm-s-default .cm-def { color: #8fc7ff; }
.cm-s-default .cm-variable { color: var(--text); }
.cm-s-default .cm-variable-2 { color: #c6d6e2; }
.cm-s-default .cm-property { color: #6fb7ff; }
.cm-s-default .cm-operator { color: var(--text-2); }
.cm-s-default .cm-comment { color: var(--muted); font-style: italic; }
.cm-s-default .cm-string { color: var(--success); }
.cm-s-default .cm-string-2 { color: var(--success); }
.cm-s-default .cm-meta { color: var(--text-2); }
.cm-s-default .cm-tag { color: #6fb7ff; }
.cm-s-default .cm-attribute { color: #d8a657; }
.cm-s-default .cm-builtin { color: #6fb7ff; }
.cm-s-default .cm-bracket { color: var(--text-2); }
.cm-s-default .cm-link { color: var(--link); }

.paste-viewer-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
}

.paste-viewer-wrap .CodeMirror {
    border: 0;
    border-radius: 0;
}

/* --------------------------------------------------------------------------
   Recent pastes list
   -------------------------------------------------------------------------- */

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.recent-item-main {
    flex: 1;
    min-width: 0;
}

.recent-item-title {
    display: block;
    font-weight: 600;
    color: var(--link);
    font-size: 1.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-item-title:hover {
    text-decoration: underline;
}

.recent-item-by {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 0.88em;
    flex-shrink: 0;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}

.avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 2.6rem;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Profile
   -------------------------------------------------------------------------- */

.profile-head {
    text-align: center;
    margin-bottom: 22px;
}

.profile-head h1 {
    margin: 12px 0 6px;
}

.bio-box {
    max-width: 600px;
    margin: 14px auto;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-section {
    margin: 24px auto;
    max-width: 980px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
}

.agent-section-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.agent-create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    align-items: end;
    margin-top: 14px;
}

.agent-create-form label {
    margin-bottom: 0;
}

.notice-verified {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Secret reveal modal
   -------------------------------------------------------------------------- */

.secret-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.secret-overlay.is-open {
    display: flex;
}

.secret-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 13, 0.78);
}

.secret-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 640px);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.secret-dialog .secret-body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    background: var(--surface-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text);
}

/* --------------------------------------------------------------------------
   Paste meta / admin tools
   -------------------------------------------------------------------------- */

.paste-head {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.paste-head h1 {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
}

.paste-options {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.admin-tools {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Legal pages (TOS)
   -------------------------------------------------------------------------- */

.legal-page {
    max-width: 720px;
}

.legal-page h2 {
    margin: 26px 0 8px;
}

.legal-page p {
    color: var(--text-2);
    margin: 8px 0;
}

.legal-list {
    margin: 10px 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.legal-list li {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-left: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text-2);
}

.legal-list strong {
    color: var(--text);
}

/* Yellow warning notice — same card design as the legal list, but in the
   warning color family. Used for the law-enforcement notice on the abuse
   report form. */
.notice-warn {
    margin-top: 18px;
    background: #1d1810;
    border: 1px solid #4a3d1f;
    border-left: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: #d9caa8;
    font-size: 0.88em;
    line-height: 1.55;
}

.notice-warn strong {
    color: var(--warning);
}

.notice-warn a {
    color: #e3c67e;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 16px;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        width: 100%;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 0 16px;
    }

    .form-row,
    .agent-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 16px;
    }

    .CodeMirror,
    .CodeMirror.cm-viewer {
        height: 55vh;
    }
}

/* --------------------------------------------------------------------------
   Site closure notice (shown once per session until the Nov 9 2026 shutdown)
   -------------------------------------------------------------------------- */

.sunset-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sunset-overlay.is-open {
    display: flex;
}

.sunset-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 13, 0.55);
}

.sunset-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    background: rgba(20, 27, 33, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.sunset-dialog p {
    margin: 0 0 12px;
}

.sunset-dialog .btn {
    margin-top: 4px;
}

/* Respect users who prefer fewer motion effects (nothing here animates
   anymore, but future additions should behave). */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
