:root {
    --forum-accent: #d9a441;
    --forum-accent-soft: rgba(217, 164, 65, 0.15);
    --bg: #0b0d12;
    --panel: rgba(255, 255, 255, 0.03);
    --panel-solid: #12151c;
    --header: #171b26;
    --border: rgba(255, 255, 255, 0.08);
    --border-soft: rgba(255, 255, 255, 0.06);
    --text: #f2f2f2;
    --text-muted: #8b90a0;
    --accent: #2d82e6;
    --accent-soft: rgba(45, 130, 230, 0.18);
    --success: #4fd17a;
    --danger: #e6564f;
    --warning: #e6a23c;
    --purple: #a855f7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease, opacity .15s ease; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: #fff; margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--panel-solid);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar .brand { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .02em; }
.sidebar .brand span { color: var(--accent); }
.brand-link { display: block; text-align: center; }
.sidebar-logo { display: block; width: 100%; max-width: 170px; height: auto; margin: 0 auto; }

.credits-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: border-color .2s ease, transform .2s ease;
}
.credits-box:hover { border-color: rgba(45,130,230,0.35); transform: translateY(-1px); }
.credits-box .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.credits-box .value { font-size: 22px; font-weight: 700; color: var(--accent); }
.credits-box a { font-size: 12px; color: var(--success); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 12px 4px 4px; }
.nav-heading.bugs { color: var(--warning); }
.nav-heading.factions { color: var(--purple); }
.nav-heading.credits { color: var(--success); }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 7px;
    border-radius: 6px;
    color: #c7cbd6;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-left-color .15s ease, transform .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.04); text-decoration: none; transform: translateX(2px); }
.nav-link.active { background: var(--accent-soft); color: #fff; border-left-color: var(--accent); }
.nav-icon { display: block; flex-shrink: 0; opacity: .75; }
.nav-link.active .nav-icon { opacity: 1; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 64px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 0 28px;
}

.topbar .credits-pill { background: rgba(79, 209, 122, 0.15); color: var(--success); border: 1px solid rgba(79,209,122,0.3); padding: 6px 12px; border-radius: 20px; font-weight: 700; font-size: 13px; }
.topbar .user-chip { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }

.content { padding: 28px; flex: 1; }
.breadcrumb { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.breadcrumb a { color: var(--text-muted); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: border-color .2s ease;
    animation: fadeInUp .35s ease both;
}
.card-header { border-left: 3px solid var(--accent); padding-left: 10px; font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

.stat-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 14px;
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
.stat-box:hover { transform: translateY(-2px); border-color: rgba(45,130,230,0.3); background: rgba(255,255,255,0.05); }
.stat-box .label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .05em; }
.stat-box .value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.stat-box .value.money { color: var(--success); }
.stat-box .value.warn { color: var(--warning); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; transition: background-color .12s ease; }
th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; background: rgba(45,130,230,0.08); }
tr:hover td { background: rgba(255,255,255,0.04); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; transition: transform .15s ease; }
.badge:hover { transform: scale(1.06); }
.badge-low { background: rgba(45,130,230,0.18); color: #6bb2f9; }
.badge-medium { background: rgba(45,130,230,0.25); color: #8fc4ff; }
.badge-high { background: rgba(230,162,60,0.2); color: var(--warning); }
.badge-critical { background: rgba(230,86,79,0.2); color: var(--danger); }
.badge-open { background: rgba(230,162,60,0.2); color: var(--warning); }
.badge-released, .badge-confirmed { background: rgba(79,209,122,0.18); color: var(--success); }
.badge-rejected { background: rgba(230,86,79,0.18); color: var(--danger); }
.badge-triaged { background: rgba(168,85,247,0.18); color: var(--purple); }
.badge-admin { background: rgba(230,86,79,0.2); color: var(--danger); }
.badge-user { background: rgba(255,255,255,0.08); color: var(--text-muted); }

form { display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
    width: 100%;
    background: rgba(0,0,0,0.35);
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.25);
    color: var(--text);
    padding: 10px 8px;
    font-size: 14px;
    font-family: inherit;
    border-radius: 3px 3px 0 0;
    transition: border-color .15s ease, background-color .15s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-bottom-color: var(--accent); background: rgba(0,0,0,0.5); }
textarea { min-height: 90px; resize: vertical; }
.hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #c7cbd6; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #2570c9; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(230,86,79,0.15); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.alert { border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; animation: slideDown .3s ease both; }
.alert-error { background: rgba(230,86,79,0.12); border: 1px solid rgba(230,86,79,0.35); color: #ff8b85; }
.alert-success { background: rgba(79,209,122,0.12); border: 1px solid rgba(79,209,122,0.35); color: var(--success); }
.alert-info { background: rgba(45,130,230,0.12); border: 1px solid rgba(45,130,230,0.35); color: #8fc4ff; }

.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: rgba(18,20,24,0.9); border: 1px solid var(--border); border-radius: 8px; padding: 32px; box-shadow: 0 10px 40px rgba(0,0,0,0.55); position: relative; overflow: hidden; animation: cardIn .4s ease both; }
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(45,130,230,0) 0%, rgba(45,130,230,0.9) 50%, rgba(45,130,230,0) 100%);
    background-size: 200% 100%;
    animation: shimmer 3.5s ease-in-out infinite;
}
.auth-card::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 340px;
    height: 340px;
    background: url('/brand/logo.png') center / contain no-repeat;
    transform: translate(-50%, -50%);
    opacity: 0.05;
    z-index: -1;
    pointer-events: none;
}
.auth-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.auth-logo { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto 4px; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }

.code-display { text-align: center; padding: 24px; background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px dashed var(--accent); margin: 16px 0; animation: pulseBorder 2.2s ease-in-out infinite, fadeInUp .35s ease both; }
.code-display .code { font-size: 32px; font-weight: 800; letter-spacing: .15em; color: #fff; }
.code-display .cmd { font-family: 'Consolas', monospace; background: rgba(0,0,0,0.4); padding: 8px 14px; border-radius: 6px; display: inline-block; margin-top: 10px; color: var(--success); }

.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }

.landing-hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    min-height: 560px;
    text-align: center;
    padding: 24px 24px 56px;
    background:
        linear-gradient(180deg, rgba(11,13,18,0.15) 0%, rgba(11,13,18,0.55) 55%, rgba(11,13,18,0.93) 100%),
        url('/brand/banner.png') center center / cover no-repeat;
}
.landing-hero p { color: var(--text-muted); max-width: 560px; margin: 12px auto 28px; }
.landing-actions { display: flex; gap: 12px; justify-content: center; }
.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 32px;
    border-bottom: 1px solid var(--border);
}
.landing-logo-link { display: block; line-height: 0; }
.landing-section { max-width: 960px; margin: 0 auto; padding: 40px 24px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.placeholder-box { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.placeholder-box .icon { font-size: 40px; margin-bottom: 12px; }

.post-body { white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
.post-body a { text-decoration: underline; }
.post-body strong { color: #fff; }
.post-body ul { margin: 6px 0; padding-left: 22px; }
.post-body li { margin: 2px 0; }
.post-body blockquote {
    margin: 10px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--forum-accent);
    background: rgba(217, 164, 65, 0.08);
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
}
.post-embed-img { max-width: 100%; border-radius: 6px; margin: 8px 0; display: block; }

/* Transitions & animations ------------------------------------------------ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}
@keyframes pulseBorder {
    0%, 100% { border-color: rgba(45,130,230,0.4); }
    50% { border-color: rgba(45,130,230,0.9); }
}
@keyframes softPulse {
    0%, 100% { opacity: .55; }
    50% { opacity: 1; }
}

.content > .card:nth-of-type(1) { animation-delay: 0s; }
.content > .card:nth-of-type(2) { animation-delay: .05s; }
.content > .card:nth-of-type(3) { animation-delay: .1s; }
.content > .card:nth-of-type(4) { animation-delay: .15s; }
.content > .card:nth-of-type(n+5) { animation-delay: .18s; }

#linkStatus { animation: softPulse 1.8s ease-in-out infinite; }

.sidebar { animation: fadeInUp .3s ease both; }
.topbar { animation: fadeInUp .3s ease .05s both; }

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

/* Forum - deliberately distinct from the panel: warm gold accent instead of
   blue, a masthead banner, and board-style category rows instead of cards. */

.hidden { display: none !important; }

.forum-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(217,164,65,0.06), transparent);
}
.forum-nav-link.active { color: var(--forum-accent); border-left-color: var(--forum-accent); background: var(--forum-accent-soft); }
.forum-nav-link:hover { color: var(--forum-accent); }
.nav-logo { display: block; height: 34px; width: auto; }
.landing-nav .nav-logo { height: 100px; }

.forum-masthead {
    text-align: center;
    padding: 44px 24px 32px;
    background: radial-gradient(ellipse at top, var(--forum-accent-soft), transparent 65%);
    border-bottom: 1px solid var(--border);
}
.forum-masthead h1 { font-size: 30px; margin-bottom: 6px; }
.forum-masthead p { color: var(--text-muted); margin: 0 0 20px; }
.forum-stats-strip { display: flex; justify-content: center; gap: 40px; }
.forum-stats-strip div { text-align: center; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.forum-stats-strip strong { display: block; font-size: 20px; color: var(--forum-accent); font-weight: 800; text-transform: none; letter-spacing: 0; }

.forum-category-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 8px;
    margin-bottom: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-left-color .15s ease, transform .15s ease, background-color .15s ease;
    animation: fadeInUp .35s ease both;
}
.forum-category-row:hover { border-left-color: var(--forum-accent); background: rgba(217,164,65,0.05); transform: translateX(2px); text-decoration: none; }
.forum-category-icon { width: 44px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.forum-category-icon img { display: block; opacity: .9; }
.forum-category-info { flex: 1; min-width: 0; }
.forum-category-info h2 { font-size: 16px; margin-bottom: 2px; }
.forum-category-stats { text-align: right; font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.forum-category-stats strong { display: block; color: var(--forum-accent); font-size: 16px; }

.forum-footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 20px 24px;
    color: var(--text-muted);
    font-size: 12.5px;
}
.forum-footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.forum-footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.forum-footer-links a { color: var(--text-muted); }
.forum-footer-links a:hover { color: var(--forum-accent); }

/* Admin game documentation */
code {
    background: rgba(0,0,0,0.35);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 12.5px;
    color: var(--forum-accent, #d9a441);
}
.docs-feature h2 { scroll-margin-top: 16px; }
