:root {
    --bg: #0c0e13;
    --bg-panel: #14171f;
    --bg-card: rgba(20, 23, 31, 0.92);
    --bg-input: #191c26;
    --border: rgba(65, 130, 255, 0.16);
    --border-strong: rgba(65, 130, 255, 0.34);
    --blue: #2f7bff;
    --blue-dim: #6fa1ff;
    --blue-light: #6fa1ff;
    --text: #eef1f8;
    --text-dim: #8790a8;
    --text-faint: #5b6377;
    --danger: #ef5b72;
    --success: #33c07f;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    background:
        radial-gradient(ellipse 900px 500px at 15% -10%, rgba(47, 123, 255, 0.10), transparent 60%),
        radial-gradient(ellipse 700px 500px at 90% 10%, rgba(47, 123, 255, 0.06), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: -apple-system, "Segoe UI", "Inter", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-dim); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--blue); }

h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.2px; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }

.dim { color: var(--text-dim); font-size: 13px; }

.container { max-width: 900px; margin: 0 auto; padding: 28px 20px 40px; }

/* ---- nav ------------------------------------------------------------- */
.nav {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px; border-bottom: 1px solid var(--border);
    background: rgba(12, 14, 19, 0.78); backdrop-filter: blur(14px) saturate(140%);
}
.nav .brand { font-weight: 800; font-size: 19px; letter-spacing: -0.2px; color: var(--text); }
.nav .brand:hover { color: var(--blue-dim); }
.nav .links { display: flex; gap: 22px; align-items: center; font-size: 14px; }
.nav .links a { color: var(--text-dim); font-weight: 500; }
.nav .links a:hover { color: var(--text); }
.nav .links span { color: var(--text-faint); }

/* ---- cards & rows ------------------------------------------------------ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.card h1 { margin-bottom: 14px; }

.category-row, .thread-row, .user-row, .invite-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 15px 4px; border-bottom: 1px solid var(--border);
    border-radius: var(--radius-sm); margin: 0 -4px;
    transition: background 0.15s ease;
}
.category-row:hover, .thread-row:hover, .user-row:hover, .invite-row:hover {
    background: rgba(47, 123, 255, 0.06);
}
.category-row:last-child, .thread-row:last-child,
.user-row:last-child, .invite-row:last-child { border-bottom: none; }

/* ---- pills ------------------------------------------------------------ */
.pill {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px;
}
.pill.active { background: rgba(51, 192, 127, 0.14); color: var(--success); }
.pill.revoked, .pill.banned { background: rgba(239, 91, 114, 0.14); color: var(--danger); }
.pill.none { background: rgba(135, 144, 168, 0.12); color: var(--text-dim); }

/* ---- forms -------------------------------------------------------------- */
label {
    display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim);
    margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.4px;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=search], textarea, select {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text); border-radius: var(--radius-sm); padding: 11px 13px;
    font-family: inherit; font-size: 14px; margin-bottom: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[type=text]:focus, input[type=password]:focus, input[type=search]:focus,
textarea:focus, select:focus {
    outline: none; border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.16);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

/* ---- buttons ------------------------------------------------------------ */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--blue);
    color: #ffffff; border: none; border-radius: var(--radius-sm); padding: 10px 18px;
    font-weight: 700; font-size: 14px; cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 6px 18px -8px rgba(47, 123, 255, 0.55);
}
button:hover, .btn:hover { filter: brightness(1.1); transform: translateY(-1px); color: #ffffff; }
button:active, .btn:active { transform: translateY(0); }

button.secondary, .btn.secondary {
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border-strong); box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { background: #20242f; color: var(--text); }

button.danger {
    background: rgba(239, 91, 114, 0.14); color: var(--danger);
    border: 1px solid rgba(239, 91, 114, 0.3); box-shadow: none;
}
button.danger:hover { background: rgba(239, 91, 114, 0.22); color: var(--danger); }

/* ---- notice banner ------------------------------------------------------- */
.notice {
    display: flex; align-items: center; gap: 12px; min-height: 20px;
    padding: 14px 16px 14px 18px; margin-bottom: 18px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    border-left-width: 3px; background: var(--bg-card);
    font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow);
}
.notice::before {
    flex: none; width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; line-height: 1;
}
.notice-error   { border-left-color: var(--danger);  color: var(--text); }
.notice-error::before   { content: "\2715"; background: rgba(239, 91, 114, 0.16); color: var(--danger); }
.notice-success { border-left-color: var(--success); color: var(--text); }
.notice-success::before { content: "\2713"; background: rgba(51, 192, 127, 0.16); color: var(--success); }

/* ---- stat grid ----------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
    text-align: center; padding: 16px 8px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid var(--border);
}
.stat .n { font-size: 26px; font-weight: 800; color: var(--blue-dim); }
.stat .label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---- posts --------------------------------------------------------------- */
.post {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 12px; background: var(--bg-input);
}
.post .meta { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; font-weight: 500; }
.post .body { white-space: pre-wrap; line-height: 1.6; }

code {
    background: rgba(47, 123, 255, 0.12); color: var(--blue-dim);
    padding: 2px 7px; border-radius: 5px; font-size: 12.5px;
}
pre {
    background: var(--bg-input); border: 1px solid var(--border);
    padding: 16px; border-radius: var(--radius-sm); overflow: auto;
}
pre code { background: none; color: var(--text); padding: 0; }

/* ---- footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 20px; }
.site-footer-inner {
    max-width: 900px; margin: 0 auto; padding: 18px 20px;
    display: flex; justify-content: space-between; align-items: center;
}

/* ---- login / register gate ------------------------------------------------ */
.gate-wrap {
    min-height: calc(100vh - 130px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px;
}
.gate-logo {
    font-size: 64px; font-weight: 800; letter-spacing: -1.5px; margin-bottom: 10px;
    color: var(--text); text-transform: uppercase;
    text-shadow: -2px 0 rgba(47, 123, 255, 0.55), 2px 0 rgba(111, 161, 255, 0.45);
}
.gate-tagline { color: var(--text-dim); font-size: 14px; margin-bottom: 30px; }

.gate-card {
    width: 100%; max-width: 460px; padding: 0; overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.gate-card h1 {
    margin: 0; padding: 20px 24px 16px; font-size: 19px;
    border-bottom: 1px solid var(--border);
}
.gate-row {
    display: flex; border-bottom: 1px solid var(--border);
}
.gate-row:last-of-type { border-bottom: none; }
.gate-row-label {
    width: 38%; flex: none; padding: 18px 16px; text-align: right;
    font-size: 12.5px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.gate-row-field { flex: 1; padding: 14px 18px; min-width: 0; }
.gate-row-field input { margin-bottom: 0; }
.gate-row-field .field-note { margin-top: 8px; font-size: 13px; }
.gate-row-field .gate-check {
    display: flex; align-items: center; gap: 7px; margin-top: 10px;
    font-size: 13px; color: var(--text);
}
.gate-row-field .gate-check input { width: auto; margin: 0; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 58px; }
.pw-toggle {
    position: absolute; right: 4px; top: 4px; bottom: 4px;
    background: none; box-shadow: none; color: var(--blue-dim);
    font-size: 12px; font-weight: 700; padding: 0 12px;
}
.pw-toggle:hover { background: none; color: var(--blue); filter: none; transform: none; }

.gate-row-submit {
    justify-content: flex-end; padding: 16px 18px; background: var(--bg-input);
}
.gate-foot { text-align: center; font-size: 13px; color: var(--text-dim); margin-top: 22px; }

@media (max-width: 480px) {
    .gate-row { flex-direction: column; }
    .gate-row-label { width: auto; text-align: left; padding-bottom: 6px; }
    .gate-row-submit { justify-content: stretch; }
    .gate-row-submit button { width: 100%; }
}
