:root {
    --bg: #0f0d0a;
    --bg-card: #1a1714;
    --bg-input: #241f1a;
    --warm: #e8c97a;
    --accent: #d4541a;
    --text: #f0e8d8;
    --muted: #8a7a60;
    --danger: #c0392b;
    --success: #27ae60;
    --border: #2a2520;
    --radius: 6px;
}

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

body {
    font-family: 'VT323', 'DM Sans', system-ui, sans-serif;
    font-size: 20px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--warm); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: 'Press Start 2P', cursive; font-weight: 400; }
h1 { font-size: 1.4rem; margin-bottom: 0.35rem; color: var(--warm); line-height: 1.4; }

/* Header */
header {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
}
nav {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--warm);
    line-height: 1.4;
}
.logo:hover { text-decoration: none; opacity: 0.9; }
.nav-links { display: flex; align-items: center; gap: 1rem; font-size: 1rem; }
.nav-user { color: var(--muted); }
.badge {
    background: var(--accent);
    color: var(--text);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex: 1;
}

.subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: 1.1rem; }
.breadcrumb { color: var(--muted); font-size: 1rem; margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--warm); }
.empty { color: var(--muted); font-style: italic; margin-top: 1rem; }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 1rem;
    border-left: 3px solid;
}
.flash-success { background: #1a2e1a; border-color: var(--success); }
.flash-error { background: #2e1a1a; border-color: var(--danger); }
.flash-warning { background: #2e2a1a; border-color: var(--warm); }

/* Category cards */
.category-list { display: flex; flex-direction: column; gap: 0.5rem; }
.category-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}
.category-card:hover { border-color: var(--warm); text-decoration: none; }
.category-card h2 { font-size: 0.8rem; color: var(--warm); margin-bottom: 0.15rem; line-height: 1.4; }
.category-card p { color: var(--muted); font-size: 1rem; }
.category-stats { text-align: right; white-space: nowrap; }

/* Thread list */
.thread-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.thread-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}
.thread-card:hover { border-color: var(--warm); text-decoration: none; }
.thread-card.pinned { border-left: 3px solid var(--accent); }
.thread-card h3 { font-size: 0.7rem; color: var(--text); font-weight: 400; line-height: 1.4; }
.thread-meta { color: var(--muted); font-size: 0.95rem; }
.thread-stats { text-align: right; white-space: nowrap; }
.pin-badge {
    background: var(--accent);
    color: var(--text);
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    display: inline-block;
}

.stat { display: block; font-size: 0.95rem; color: var(--muted); }

/* Posts */
.post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}
.post.op { border-left: 3px solid var(--warm); }
.post-header { margin-bottom: 0.75rem; }
.post-meta { color: var(--muted); font-size: 1rem; }
.post-body { line-height: 1.7; font-size: 1.1rem; }

/* Post actions (reply link + admin controls) */
.post-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.post-actions .inline-form { display: inline; }
.reply-link { color: var(--muted); font-size: 0.95rem; }
.reply-link:hover { color: var(--warm); }
.cancel-reply { color: var(--muted); font-size: 0.95rem; margin-left: 0.5rem; }
.cancel-reply:hover { color: var(--danger); }

/* Nested replies */
.reply-tree.nested {
    margin-left: 1.5rem;
    border-left: 2px solid var(--border);
    padding-left: 0.75rem;
}

.admin-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-block;
    background: var(--accent);
    color: var(--text);
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.9; text-decoration: none; }

.btn-small {
    background: var(--bg-input);
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}
.btn-small:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: #e74c3c; border-color: var(--danger); }

/* Forms */
.auth-form, .thread-form, .reply-form {
    max-width: 480px;
    margin-top: 1rem;
}
label {
    display: block;
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}
label:first-of-type { margin-top: 0; }
.hint { font-size: 0.85rem; }

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    display: block;
    width: 100%;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    font-size: 1.1rem;
    font-family: inherit;
    line-height: 1.5;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--warm);
}
textarea { resize: vertical; }

.reply-form { max-width: 100%; margin-top: 1.5rem; }
.reply-form .btn { margin-top: 0.5rem; }
.thread-form .btn { margin-top: 1rem; }
.auth-form .btn { margin-top: 1rem; }

.auth-links {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--muted);
}
.login-prompt {
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: 1.05rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--warm); }

/* Responsive */
@media (max-width: 600px) {
    main { padding: 1.25rem 1rem; }
    h1 { font-size: 1.1rem; }
    .category-card, .thread-card { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .category-stats, .thread-stats { text-align: left; }
    .reply-tree.nested { margin-left: 0.75rem; }
}
