:root {
    color-scheme: dark;
    --panel-bg: rgba(10, 15, 24, 0.76);
    --panel-bg-strong: rgba(13, 20, 32, 0.86);
    --panel-border: rgba(255, 255, 255, 0.13);
    --panel-muted: #b9c6d8;
    --panel-text: #f5f8fc;
    --panel-accent: #de4e4e;
    --panel-accent-hover: #c84343;
    --panel-blue: #74b8ff;
    --panel-green: #43b978;
    --panel-danger: #ef5a5a;
}

* { box-sizing: border-box; }

body.panel-page,
body.forum-page,
body.auth-panel-page {
    min-height: 100vh;
    margin: 0;
    color: var(--panel-text);
    font-family: Arial, sans-serif;
    background:
        linear-gradient(135deg, rgba(6, 9, 15, 0.58), rgba(9, 16, 28, 0.48)),
        url("Img/AACFlogo.png") center center / cover no-repeat,
        radial-gradient(circle at top, #24344a 0, #101824 46%, #070a10 100%);
    background-attachment: fixed, fixed, fixed;
}

body.panel-page::before,
body.forum-page::before,
body.auth-panel-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(7, 10, 16, 0.08), rgba(7, 10, 16, 0.48) 72%);
}

.panel-shell,
.forum-shell,
.auth-shell {
    position: relative;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.auth-shell { width: min(500px, calc(100% - 32px)); }

.panel-topbar,
.forum-topbar,
.top-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-topbar,
.forum-topbar { margin-bottom: 28px; }

.panel-topbar a,
.top-links a,
.action-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.panel-topbar a:hover,
.top-links a:hover,
.action-link:hover {
    border-color: rgba(222, 78, 78, 0.65);
    background: rgba(222, 78, 78, 0.18);
}

.language-switcher {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.flag-link {
    display: inline-flex;
    width: 30px;
    height: 20px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0.78;
}

.flag-link.active,
.flag-link:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.8);
}

.flag-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.panel-hero,
.forum-hero,
.auth-card {
    margin-bottom: 20px;
    padding: 26px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-bg);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(6px);
}

.panel-eyebrow {
    margin: 0 0 8px;
    color: #f08a8a;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-hero h1,
.forum-hero h1,
.auth-card h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.05;
}

.forum-hero h1,
.auth-card h1 { font-size: clamp(1.8rem, 3vw, 2.8rem); }

.panel-hero p,
.forum-hero p,
.auth-card .helper-text {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--panel-muted);
    line-height: 1.55;
}

.panel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card,
.panel-card,
.member-card,
.user-card,
.forum-card,
.topic-card,
.reply-card {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-bg-strong);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

.stat-card,
.forum-card,
.reply-card { padding: 16px; }
.forum-card { margin-bottom: 18px; }

.stat-card span { display: block; color: var(--panel-muted); font-size: 0.9rem; }
.stat-card strong { display: block; margin-top: 6px; font-size: 1.8rem; }
.panel-grid,
.topic-list { display: grid; gap: 12px; }

.member-card,
.user-card,
.topic-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
}

.member-main,
.user-main,
.topic-main { min-width: 0; }
.member-name,
.user-name,
.topic-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1.15rem; font-weight: 800; }
.topic-title { margin: 0 0 8px; }
.topic-title a { color: var(--panel-text); text-decoration: none; }
.topic-title a:hover { color: var(--panel-blue); }

.meta,
.topic-meta {
    margin-top: 7px;
    color: var(--panel-muted);
    line-height: 1.45;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.content {
    margin-top: 12px;
    white-space: pre-wrap;
    line-height: 1.55;
    color: #e8edf5;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(116, 184, 255, 0.16);
    color: #bfe0ff;
    border: 1px solid rgba(116, 184, 255, 0.36);
    font-size: 0.78rem;
    font-weight: 800;
}

.badge.self { background: rgba(67, 185, 120, 0.16); color: #bdf3d2; border-color: rgba(67, 185, 120, 0.34); }

.actions,
.topic-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.topic-actions { justify-content: flex-start; margin-top: 14px; }
.actions form,
.topic-actions form { margin: 0; }

button,
.button,
.button-link {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button,
.primary-btn { background: var(--panel-accent); }
button:hover,
.primary-btn:hover { background: var(--panel-accent-hover); }
.admin-btn,
.edit-btn { background: var(--panel-green); }
.admin-btn:hover,
.edit-btn:hover { background: #349d63; }
.delete-btn { background: var(--panel-danger); }
.delete-btn:hover { background: #d94747; }

.topic-stats {
    min-width: 86px;
    text-align: center;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.06);
}
.topic-stats strong { display: block; font-size: 1.4rem; }
.topic-stats span { color: var(--panel-muted); font-size: 0.8rem; }

.section-title { margin: 0 0 14px; font-size: 1.2rem; }
label { display: block; color: var(--panel-muted); margin-bottom: 6px; font-size: 0.92rem; }
input[type="text"], input[type="password"], textarea {
    width: 100%;
    border: 1px solid var(--panel-border);
    background: rgba(5, 8, 14, 0.72);
    color: var(--panel-text);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}
textarea { resize: vertical; }

.message,
.empty-state {
    padding: 16px;
    border-radius: 8px;
    color: var(--panel-muted);
    border: 1px dashed var(--panel-border);
    text-align: center;
}
.message { text-align: left; margin-bottom: 15px; border-style: solid; }
.message.error { background: rgba(222, 78, 78, 0.18); color: #ffd7d7; border-color: rgba(222, 78, 78, 0.45); }
.message.success { background: rgba(65, 166, 113, 0.18); color: #d9ffe8; border-color: rgba(65, 166, 113, 0.45); }
.links { margin-top: 18px; text-align: center; }
.links a { color: #f08a8a; font-weight: 700; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.muted-note { color: var(--panel-muted); }

@media (max-width: 700px) {
    .panel-shell,
    .forum-shell,
    .auth-shell { width: min(100% - 20px, 1120px); padding-top: 16px; }
    .panel-hero,
    .forum-hero,
    .auth-card { padding: 20px; }
    .member-card,
    .user-card,
    .topic-card { display: block; }
    .actions { justify-content: flex-start; margin-top: 14px; }
    .actions form,
    .actions button { width: 100%; }
    .topic-stats { margin-top: 14px; text-align: left; }
}