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

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --radius:       4px;
    --mono:         'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    /* Colours come from /theme.css, generated from theme.palettes in config.json. */
}

/* ── Layout ────────────────────────────────────────────────────────────── */
html, body {
    height: 100%;
    overflow: hidden;
}
body {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
    flex-shrink: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.5rem;
    z-index: 10;
}
.nav-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 1rem;
    white-space: nowrap;
    margin-right: 0.5rem;
}
.brand:hover { color: var(--primary-h); }
.brand-logo { display: block; width: 28px; height: 28px; filter: var(--logo-filter, none); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

/* Nav controls */
.nav-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    width: 160px;
    outline: none;
}
.nav-input:focus { border-color: var(--primary); }

.nav-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    outline: none;
}
.nav-select:focus { border-color: var(--primary); }

.nav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-sub);
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); }

.nav-btn-save {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.nav-btn-save:hover { background: var(--primary); color: var(--on-primary); }


.nav-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-sub);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    padding: 0 0.2rem;
}
.nav-label:hover { color: var(--primary); }
.nav-label input { cursor: pointer; }

/* ── Prism Line Numbers ────────────────────────────────────────────────── */
.line-numbers .line-numbers-rows {
    border-right: 1px solid var(--border) !important;
    padding-right: 0.5rem !important;
}
.line-numbers-rows > span:before {
    color: var(--text-muted) !important;
}

.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; padding: 0; background: none; border: 1px solid transparent;
    border-radius: var(--radius); color: var(--text-sub); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); color: var(--text); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.palette-select { max-width: 8.5rem; }

/* ── Full-page main ────────────────────────────────────────────────────── */
.full-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* On the view page, override to allow the comments to extend below */
.full-page.view-page {
    overflow: visible;
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}

/* ── Editor textarea ───────────────────────────────────────────────────── */
.full-editor {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 1rem 1.5rem;
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    tab-size: 4;
}

/* ── View: full-page code ──────────────────────────────────────────────── */
.view-full {
    min-height: calc(100vh - 42px); /* at least full viewport below navbar */
    background: var(--code-bg);
}
.view-full pre {
    margin: 0;
    padding: 1rem 1.5rem;
    min-height: 100%;
    background: transparent;
}
.view-full code {
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.6;
}
/* Word wrap toggle */
.wrap-lines .view-full pre,
.wrap-lines .view-full code {
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Inline error (view page) ──────────────────────────────────────────── */
.error-inline {
    padding: 0.75rem 1.5rem;
    color: var(--danger);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

/* ── Page-container (error pages, etc.) ───────────────────────────────── */
.page-container {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
    overflow-y: auto;
}

/* ── Error pages ───────────────────────────────────────────────────────── */
.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60%;
}
.error-content { text-align: center; max-width: 380px; }
.error-content h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.error-content p  { color: var(--text-sub); margin-bottom: 1.5rem; }
.error-actions    { display: flex; justify-content: center; gap: 0.75rem; }

/* Generic button (used on error pages) */
.btn {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    background: none;
    color: var(--text-sub);
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary); color: var(--on-primary); }

/* ── Notification toast ────────────────────────────────────────────────── */
.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-sub);
    z-index: 100;
}

/* ── Prism overrides: transparent background ───────────────────────────── */
pre[class*="language-"], code[class*="language-"] {
    background: transparent !important;
}

/* ── Line highlight (paste view) ───────────────────────────────────────── */
.view-full pre { position: relative; }
.view-full code { position: relative; z-index: 1; }

/* Overlay bar behind code text */
.line-hl {
    position: absolute;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-left: 3px solid var(--primary);
    pointer-events: none;
    z-index: 0;
}
[data-theme="dark"] .line-hl {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
}

/* Gutter span for highlighted lines */
.line-numbers-rows > span.hl-active::before {
    color: var(--primary) !important;
    font-weight: 700;
}
/* Gutter spans are clickable when line numbers are shown */
.line-numbers-rows {
    pointer-events: auto !important;
}
.line-numbers-rows > span {
    cursor: pointer;
    pointer-events: auto;
}
.line-numbers-rows > span:hover::before {
    color: var(--text-sub) !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .nav-input  { width: 90px; }
}

/* ── Utility & New Actions ─────────────────────────────────────────────── */
.nav-btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}
.nav-btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.nav-user {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

/* ── Auth Box (Login) ──────────────────────────────────────────────────── */
.auth-box {
    max-width: 360px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--nav-border);
    border-radius: var(--radius);
    text-align: center;
}
.auth-box h1 { font-size: 1.25rem; margin-bottom: 1.5rem; }
.form-group { text-align: left; margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-sub); margin-bottom: 0.3rem; }
.form-group input { 
    width: 100%; padding: 0.5rem; border: 1px solid var(--border); 
    border-radius: var(--radius); background: var(--bg); color: var(--text); outline: none;
}
.form-group input:focus { border-color: var(--primary); }
.submit-btn { 
    width: 100%; padding: 0.6rem; background: var(--primary); color: var(--on-primary); 
    border: none; border-radius: var(--radius); cursor: pointer; font-weight: 600; margin-top: 0.5rem;
}
.submit-btn:hover { background: var(--primary-h); }
.error-msg { color: var(--danger); font-size: 0.8rem; margin-bottom: 1rem; }

/* ── Admin Dashboard ───────────────────────────────────────────────────── */
.admin-header { margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.admin-header h1 { font-size: 1.5rem; }
.admin-header p { color: var(--text-sub); }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.admin-table th, .admin-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.admin-table th { color: var(--text-sub); font-weight: 600; }
.admin-table tr:hover { background: var(--surface); }

.btn-delete-small {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
}
.btn-delete-small:hover { background: var(--danger); color: #fff; }

.table-responsive { overflow-x: auto; }

/* ── Comments panel ────────────────────────────────────────────────── */
.comments-panel {
    flex-direction: column;
    border-top: 2px solid var(--border);
    background: var(--surface);
    /* no max-height — extends the page naturally */
}
.comments-panel.collapsed .comments-body {
    display: none;
}
.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-sub);
    flex-shrink: 0;
    user-select: none;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 42px; /* stick just below navbar */
    background: var(--surface);
    z-index: 5;
}
.comments-header:hover { background: var(--bg); }
.comments-title { font-weight: 600; }
.comments-chevron { font-size: 0.7rem; color: var(--text-muted); }
.comments-body {
    padding: 0.5rem 0;
}
.comments-list {
    padding: 0 1.5rem;
}
.comment-item { padding: 0.35rem 0; }
.comment-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.comment-meta.has-nick {
    color: var(--primary);
    font-weight: 600;
}
.comment-content {
    font-size: 0.85rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}
.comments-loading, .comments-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.75rem 0;
}
.comment-form-wrap {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 1rem;
    border-top: 1px solid var(--border);
    align-items: flex-start;
    margin-top: 0.25rem;
    background: var(--surface);
}
.comment-form-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}
.comment-nick {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    outline: none;
    width: 180px;
}
.comment-nick:focus { border-color: var(--primary); }
.comment-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    resize: vertical;
    min-height: 4rem;
    outline: none;
    line-height: 1.5;
    width: 100%;
}
.comment-input:focus { border-color: var(--primary); }

/* ── Markdown comments ────────────────────────────────────────────────── */
.comments-panel { display: flex; }
.comment-content.markdown-body { white-space: normal; line-height: 1.55; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child  { margin-bottom: 0; }
.markdown-body p, .markdown-body ul, .markdown-body ol,
.markdown-body pre, .markdown-body blockquote, .markdown-body table { margin: 0 0 0.6rem; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 0.8rem 0 0.4rem; line-height: 1.3; }
.markdown-body h1 { font-size: 1.2rem; } .markdown-body h2 { font-size: 1.1rem; }
.markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 1rem; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5rem; }
.markdown-body a { color: var(--primary); }
.markdown-body code {
    font-family: var(--mono); font-size: 0.8rem;
    background: var(--code-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.05rem 0.3rem;
}
.markdown-body pre { background: var(--code-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.6rem 0.8rem; overflow-x: auto; }
.markdown-body pre code { border: none; padding: 0; background: none; }
.markdown-body blockquote { border-left: 3px solid var(--border); color: var(--text-sub);
    padding: 0 0.8rem; margin-left: 0; }
.markdown-body table { border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 0.25rem 0.6rem; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); }

.comment-reply {
    background: none; border: none; padding: 0 0 0 0.5rem; cursor: pointer;
    color: var(--text-muted); font-size: 0.72rem; font-family: inherit;
}
.comment-reply:hover { color: var(--primary); }

.comment-tabs { display: flex; align-items: center; gap: 0.25rem; }
.comment-tab {
    background: none; border: 1px solid transparent; border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0; padding: 0.2rem 0.7rem;
    color: var(--text-sub); cursor: pointer; font-family: inherit; font-size: 0.8rem;
}
.comment-tab.active { background: var(--bg); border-color: var(--border); color: var(--text); }
.comment-hint { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); }
.comment-preview {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.4rem 0.6rem; min-height: 4rem; font-size: 0.85rem;
}

/* ── Threaded replies: every comment is a box like the paste itself ───── */
.comment-box {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
}
.comment-item:target > .comment-box { outline: 2px solid var(--primary); outline-offset: 1px; }
.comment-box .comment-meta { margin-bottom: 0.45rem; }
.comment-replies {
    margin-left: 1rem;
    padding-left: 0.9rem;
    border-left: 2px solid var(--border);
}
.comment-replies:empty { border-left: none; padding-left: 0; }
.comment-replies > .comment-form-wrap {
    padding: 0.5rem 0 0.25rem;
    margin: 0.35rem 0 0;
    border-top: none;
    background: transparent;
}
.reply-bar { font-size: 0.78rem; color: var(--text-sub); }
.reply-bar[hidden] { display: none; }
.reply-bar .comment-reply { padding-left: 0.5rem; }
@media (max-width: 600px) {
    .comment-replies { margin-left: 0.25rem; padding-left: 0.5rem; }
    .comment-box { padding: 0.5rem 0.7rem; }
}

/* Keep a linked comment (#c-<id>) clear of the sticky "Comments" header */
.comment-item { scroll-margin-top: 5rem; }

/* ── Reports ──────────────────────────────────────────────────────────── */
.notice {
    padding: 0.6rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    color: var(--text);
    font-size: 0.875rem;
}
.report-box { max-width: 36rem; margin: 2rem auto; padding: 0 1rem; }
.report-box h1 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.report-target { color: var(--text-sub); font-size: 0.875rem; margin-bottom: 1rem; }
.report-snippet {
    display: block; margin-top: 0.4rem; padding: 0.5rem 0.75rem;
    background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: var(--mono); font-size: 0.8rem; word-break: break-word;
}
.report-reasons { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.9rem 0.7rem; margin-bottom: 1rem; }
.report-reasons legend { padding: 0 0.4rem; font-size: 0.85rem; color: var(--text-sub); }
.report-reasons label { display: block; padding: 0.2rem 0; font-size: 0.9rem; cursor: pointer; }
.report-note-label { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--text-sub); }
.report-hint { font-size: 0.75rem; color: var(--text-muted); margin: 0.4rem 0 1rem; }

.inline-form { display: inline; margin: 0; }
.comment-delete { color: var(--danger); }
.comment-delete:hover { color: var(--danger); text-decoration: underline; }
a.comment-reply { text-decoration: none; font-weight: 400; color: var(--text-muted); }
a.comment-reply:hover { text-decoration: underline; color: var(--primary); }

.admin-container .table-responsive + .admin-header { margin-top: 2.5rem; }
.admin-container .report-snippet { font-size: 0.75rem; padding: 0.3rem 0.5rem; max-width: 36rem; }
.report-note { margin-top: 0.3rem; font-size: 0.78rem; color: var(--text-sub); font-style: italic; }
.badge {
    display: inline-block; padding: 0.05rem 0.45rem; margin-right: 0.35rem;
    border: 1px solid var(--border); border-radius: 999px;
    font-size: 0.7rem; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.03em;
}
.admin-actions { white-space: nowrap; }
.admin-actions .inline-form + .inline-form { margin-left: 0.3rem; }
.btn-small {
    background: none; border: 1px solid var(--border); color: var(--text-sub);
    padding: 0.2rem 0.5rem; border-radius: var(--radius); cursor: pointer; font-size: 0.75rem;
}
.btn-small:hover { border-color: var(--primary); color: var(--primary); }

/* ── Create page: description, file bar, editor options (Gist-style structure) ─────── */
.compose-filename {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: inherit; outline: none;
    flex: 1 1 14rem; min-width: 10rem; max-width: 26rem; padding: 0.3rem 0.6rem; font-size: 0.8rem;
}
.compose-filename:focus { border-color: var(--primary); }
.nav-description {
    flex: 1 1 auto; min-width: 8rem; margin: 0 0.5rem; padding: 0.25rem 0.7rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none;
}
.nav-description:focus { border-color: var(--primary); }
.editor-bar {
    flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem;
    padding: 0.5rem 1rem;
    background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.editor-bar-spacer { flex: 1 1 0; }
.bar-field { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--text-sub); white-space: nowrap; }
.full-editor.no-wrap { white-space: pre; overflow-x: auto; }
[hidden] { display: none !important; }
.editor-hint { flex-shrink: 0; padding: 0.25rem 1rem; font-size: 0.7rem; color: var(--text-muted); background: var(--surface); border-top: 1px solid var(--border); }

/* ── View page: file header ───────────────────────────────────────────── */
.file-name { font-weight: 600; font-size: 0.85rem; color: var(--text); word-break: break-all; }
.file-meta { font-size: 0.75rem; color: var(--text-muted); }

.notice .removal-url {
    width: min(28rem, 100%); margin: 0 0.5rem; padding: 0.2rem 0.5rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: var(--mono); font-size: 0.75rem;
}

/* Everything for the paste lives in the file bar: no controls in the top bar on the create page */
.editor-bar .nav-btn { padding: 0.3rem 0.8rem; }
.editor-hint kbd {
    padding: 0.05rem 0.35rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); color: var(--text-sub); font-family: var(--mono); font-size: 0.68rem;
}
.tab-moves-focus .full-editor, .full-editor.tab-moves-focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }

/* The paste's name and stats sit in the top bar: Logo | filename (bash · 8 lines · 201 B) | controls */
.paste-info {
    display: flex; align-items: baseline; gap: 0.6rem; flex: 1 1 8rem; min-width: 0;
    overflow: hidden; white-space: nowrap; margin: 0 0.4rem;
}
.paste-description { color: var(--text-sub); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; max-width: 45%; }
.paste-info .file-name { overflow: hidden; text-overflow: ellipsis; word-break: normal; flex: 0 1 auto; min-width: 3rem; }
.paste-info .file-meta { flex: 0 0 auto; }
@media (max-width: 900px) {
    .navbar { height: auto; min-height: 42px; flex-wrap: wrap; padding: 0.3rem 0.75rem; }
    .nav-content, .nav-links { flex-wrap: wrap; }
    .paste-info { flex-basis: 100%; order: 5; margin: 0; }
}

/* ── Site notice (under the top bar) and footer (bottom of every page) ────── */
.site-notice {
    flex-shrink: 0; padding: 0.45rem 1rem; font-size: 0.8rem; color: var(--text);
    background: color-mix(in srgb, var(--primary) 8%, var(--bg));
    border-bottom: 1px solid var(--border); border-left: 3px solid var(--primary);
}
.site-footer {
    flex-shrink: 0; padding: 0.3rem 1rem; font-size: 0.72rem; text-align: center; color: var(--text-muted);
    background: var(--surface); border-top: 1px solid var(--border);
}
.site-notice a, .site-footer a { color: var(--primary); }

/* ── Markdown pastes: Source | Preview ────────────────────────────────────── */
.view-switch { display: inline-flex; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.switch-btn { padding: 0.2rem 0.7rem; font-size: 0.78rem; color: var(--text-sub); text-decoration: none; }
.switch-btn + .switch-btn { border-left: 1px solid var(--border); }
.switch-btn:hover { background: var(--surface); color: var(--text); }
.switch-btn.active { background: var(--primary); color: var(--on-primary); }
.paste-preview { display: none; }
.file-card.previewing .paste-preview { display: block; }
.file-card.previewing .view-full, body.previewing .nav-label { display: none; }
.paste-preview { max-width: 52rem; width: 100%; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; font-size: 0.95rem; line-height: 1.7; }
.paste-preview h1, .paste-preview h2 { padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.paste-preview h1 { font-size: 1.7rem; margin: 1.4rem 0 0.8rem; }
.paste-preview h2 { font-size: 1.35rem; margin: 1.3rem 0 0.7rem; }
.paste-preview h3 { font-size: 1.12rem; }
.paste-preview p, .paste-preview ul, .paste-preview ol, .paste-preview pre,
.paste-preview blockquote, .paste-preview table { margin-bottom: 0.9rem; }
.paste-preview > :first-child { margin-top: 0; }

/* ── Loading a text file into the editor ──────────────────────────────────── */
.file-editors.drop-target .full-editor { outline: 2px dashed var(--primary); outline-offset: -8px; background: color-mix(in srgb, var(--primary) 5%, var(--bg)); }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.file-note { color: var(--text-sub); }
.file-note.error { color: var(--danger); font-weight: 600; }

/* ── Several files in one paste: stacked cards, each with its own header ──────── */
.file-list.multi { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.file-list.multi .file-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-list.multi .view-full { min-height: 0; overflow-x: auto; }
.file-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
    padding: 0.35rem 0.75rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.file-head-info { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.file-head-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.file-list.multi .paste-preview { max-width: none; margin: 0; }

/* ── Create page: one card per file ───────────────────────────────────────── */
.file-editors { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.file-editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.file-editors.multi { flex: 1 1 auto; overflow-y: auto; gap: 1rem; padding: 1rem; }
.file-editors.multi .file-editor { flex: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-editors.multi .editor-bar { border-top: none; }
.file-editors.multi .full-editor { flex: none; height: 16rem; }
/* The paste-level bar, always below the files: Expires | Allow comments | Clear | Paste ......... Add another file */
.paste-bar { justify-content: flex-start; }

/* ── API page ─────────────────────────────────────────────────────────────── */
.api-page { padding: 1.5rem 1.5rem 2.5rem; line-height: 1.65; }          /* full width, like the other pages */
.api-page h1 { font-size: 1.6rem; margin-bottom: 0.6rem; }
.api-page h2 { margin: 1.8rem 0 0.6rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); font-size: 1.25rem; }
.api-page h3 { margin: 1.2rem 0 0.4rem; font-size: 1.02rem; }
.api-page p, .api-page ul, .api-page table, .api-page pre { margin-bottom: 0.8rem; }
.api-code { overflow-x: auto; white-space: pre; }
.api-page td, .api-page th { vertical-align: top; }
/* Every table spans the page and its first column shrinks to its content, so text wraps only when it has to. */
.api-page table { width: 100%; }
.api-page th { text-align: left; }
.api-page td:first-child, .api-page th:first-child { width: 1%; white-space: nowrap; }

/* ── Admin: blocked addresses ─────────────────────────────────────────────── */
.block-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.block-form input[name="address"] { flex: 1 1 16rem; min-width: 12rem; }
.block-form input[name="note"] { flex: 2 1 14rem; }
.page-container.admin-page { max-width: 72rem; }          /* the admin tables are wide */

/* ── Admin: the View window ───────────────────────────────────────────────── */
.view-dialog {
    margin: auto;                                  /* the global reset zeroes the dialog's own centring */
    width: min(60rem, 94vw); max-height: 88vh; padding: 0; color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.view-dialog[open] { display: flex; flex-direction: column; }
.view-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.view-dialog-head, .view-dialog-foot {
    flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.6rem 1rem; background: var(--surface);
}
.view-dialog-head { border-bottom: 1px solid var(--border); }
.view-dialog-head small { color: var(--text-muted); margin-left: 0.4rem; }
.view-dialog-foot { justify-content: flex-start; border-top: 1px solid var(--border); }
.view-dialog-body { flex: 1; overflow: auto; padding: 1rem; }
.view-file { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.view-file-head { padding: 0.3rem 0.75rem; font-size: 0.8rem; color: var(--text-sub); background: var(--surface); border-bottom: 1px solid var(--border); }
.view-file-text { margin: 0; padding: 0.75rem; max-height: 22rem; overflow: auto; background: var(--code-bg); font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.view-comments-title { margin: 0.5rem 0; font-size: 1rem; }
.view-comment { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.view-comment.marked { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 30%, transparent); }
.view-comment-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.view-comment-text { white-space: pre-wrap; word-break: break-word; font-size: 0.85rem; }
.block-dialog { width: min(32rem, 94vw); }
.block-field { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.75rem; font-size: 0.8rem; color: var(--text-sub); }
.block-form + .admin-header, .block-form + .table-responsive + .admin-header { margin-top: 2.5rem; }

/* JetBrains Mono and Fira Code join characters into arrows and operators (<- becomes a left arrow, != a
   not-equal sign). A pastebin must show exactly what the text contains, so code never gets ligatures. */
pre, code, kbd, samp, textarea, .removal-url {
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
}
