:root {
  --bg: #050505;
  --panel: #111111;
  --panel-2: #1a1a1a;
  --ink: #f7f4ef;
  --muted: #aaa69f;
  --line: rgba(247, 244, 239, .16);
  --lime: #8f1d22;
  --cyan: #8e8d85;
  --red: #b7353a;
  --gold: #d8d5cc;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; }
img { display: block; max-width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 16px clamp(18px, 5vw, 70px);
  background: rgba(5, 5, 5, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
  text-decoration: none;
  text-transform: uppercase;
}
.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
}
.brand span {
  color: var(--ink);
  max-width: 24ch;
  overflow-wrap: anywhere;
}
.main-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.main-menu a,
.menu-toggle {
  padding: 9px 12px;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}
.main-menu a:hover,
.main-menu .nav-cta {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}
.menu-toggle { display: none; cursor: pointer; }

.hero {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(360px, 1fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  padding: clamp(56px, 8vw, 110px) clamp(18px, 5vw, 70px);
  background:
    linear-gradient(135deg, rgba(143,29,34,.26), transparent 38%),
    linear-gradient(315deg, rgba(142,141,133,.14), transparent 40%),
    var(--bg);
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--lime);
  font-size: .82rem;
  font-weight: 950;
  text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.08; }
h1 { max-width: 18ch; font-size: clamp(2.1rem, 4vw, 3.6rem); text-transform: uppercase; }
h2 { font-size: clamp(1.25rem, 2.2vw, 2rem); }
.hero .hero-copy h1 {
  max-width: 13ch;
  font-size: clamp(2.8rem, 6vw, 5rem);
}
.hero-copy p,
.content-page p,
.card p,
.muted { color: var(--muted); }
.hero-logo {
  width: min(280px, 72vw);
  margin: 0 0 22px;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .45));
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.button, button {
  min-height: 46px;
  padding: 11px 15px;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.button.primary,
button.primary {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}
.button.secondary { box-shadow: 4px 4px 0 var(--red); }
.danger { border-color: rgba(255,79,85,.55); color: #ffd9db; }

.hero-grid,
.card-grid,
.gallery-grid,
.stat-grid,
.admin-gallery {
  display: grid;
  gap: 16px;
}
.hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-card,
.card,
.panel,
.edit-card,
.stat-card {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.hero-card span,
.card span {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--cyan);
  font-weight: 950;
}
.image-card {
  grid-column: span 2;
  position: relative;
  min-height: 280px;
  overflow: hidden;
  text-decoration: none;
}
.image-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-card strong {
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--lime);
  border-radius: 8px;
}
.section,
.auth-section {
  padding: clamp(58px, 8vw, 100px) clamp(18px, 5vw, 70px);
}
.content-page,
.auth-section { max-width: 920px; margin: 0 auto; }
.richtext {
  color: var(--muted);
  font-size: 1.05rem;
}
.card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
.gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 24px; }
.gallery-item {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  padding: 0;
}
.gallery-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}
.gallery-item span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--lime);
  border-radius: 8px;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 28px;
  background: rgba(0,0,0,.88);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 78vh; border-radius: 8px; }
.lightbox-close { position: fixed; top: 18px; right: 18px; }

.form,
.admin-form,
.edit-card {
  display: grid;
  gap: 14px;
}
label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; }
input, textarea, select {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
textarea { resize: vertical; }
.check,
.checks label { display: flex; align-items: center; gap: 8px; }
.check input,
.checks input { width: auto; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form-error,
.flash {
  padding: 12px 14px;
  background: rgba(255,79,85,.15);
  border: 1px solid rgba(255,79,85,.45);
  border-radius: 8px;
}
.flash { margin: 18px clamp(18px, 5vw, 70px); }
.flash-success { background: rgba(143,29,34,.16); border-color: rgba(143,29,34,.5); }

.profile-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: clamp(22px, 5vw, 56px);
  align-items: start;
  padding: clamp(58px, 8vw, 100px) clamp(18px, 5vw, 70px);
}
.profile-card,
.profile-panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.avatar {
  width: 132px;
  height: 132px;
  margin-bottom: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 4rem;
  font-weight: 950;
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 6px 6px 0 var(--red);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-card h1 {
  max-width: none;
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
}
.profile-facts {
  display: grid;
  gap: 12px;
  margin: 24px 0 0;
}
.profile-facts div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.profile-facts dt {
  color: var(--cyan);
  font-weight: 950;
}
.profile-facts dd {
  margin: 3px 0 0;
  color: var(--muted);
}
.admin-avatar {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.forum-list,
.topic-list {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}
.forum-category,
.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.forum-category:hover,
.topic-row:hover {
  border-color: var(--lime);
}
.forum-category p,
.topic-row p {
  margin: 8px 0 0;
  color: var(--muted);
}
.forum-category strong,
.topic-row strong {
  flex: 0 0 auto;
  color: var(--cyan);
}
.forum-form-panel {
  margin-top: 28px;
}
.forum-post {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.forum-post aside {
  display: grid;
  align-content: start;
  gap: 10px;
  color: var(--cyan);
  font-weight: 950;
}
.forum-avatar,
.forum-avatar-placeholder {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 950;
  background: var(--lime);
  border-radius: 8px;
}
.forum-avatar {
  object-fit: cover;
}
.bbcode {
  color: var(--ink);
}
.bbcode blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--bg);
  border-left: 4px solid var(--cyan);
  border-radius: 8px;
}
.bbcode pre {
  overflow: auto;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.bbcode a {
  color: var(--lime);
  font-weight: 900;
}
.bbcode-image {
  max-height: 360px;
  margin-top: 12px;
  border-radius: 8px;
}
.bbcode-editor {
  display: grid;
  gap: 10px;
}
.bbcode-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.bbcode-toolbar button {
  min-height: 34px;
  width: auto;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--panel-2);
}
.bbcode-toolbar button:hover {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}
.bbcode-editor textarea {
  min-height: 190px;
}
.bbcode-preview-title {
  color: var(--cyan);
  font-size: .92rem;
  text-transform: uppercase;
}
.bbcode-preview {
  min-height: 120px;
  padding: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.bbcode-preview span {
  color: var(--muted);
}
.html-editor {
  display: grid;
  gap: 10px;
}
.html-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.html-toolbar button {
  min-height: 34px;
  width: auto;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--panel-2);
}
.html-toolbar button:hover,
.html-toolbar button.is-active {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}
.html-editor-surface {
  min-height: 360px;
  padding: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  overflow: auto;
}
.html-editor-surface:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(143, 29, 34, .2);
}
.html-editor-surface h2,
.html-editor-surface h3,
.html-editor-surface p,
.html-editor-surface ul,
.html-editor-surface ol,
.html-editor-surface blockquote {
  margin-top: 0;
  margin-bottom: 14px;
}
.html-editor-surface blockquote {
  padding: 12px 14px;
  color: var(--muted);
  background: var(--panel);
  border-left: 4px solid var(--lime);
  border-radius: 8px;
}
.html-editor-surface img {
  max-height: 320px;
  border-radius: 8px;
}
.html-editor textarea:not([hidden]) {
  min-height: 260px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 24px clamp(18px, 5vw, 70px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.admin-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.admin-sidebar {
  min-height: 100vh;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.admin-nav { display: grid; gap: 8px; margin-top: 28px; }
.admin-nav a {
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin-nav a:hover { color: var(--ink); background: var(--lime); }
.admin-main { padding: 34px clamp(18px, 4vw, 52px); }
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card strong { display: block; color: var(--cyan); font-size: 2.8rem; line-height: 1; }
.admin-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.compact-panel {
  position: sticky;
  top: 22px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.small-button {
  min-height: 36px;
  padding: 8px 10px;
  font-size: .9rem;
}
.page-list {
  display: grid;
  gap: 8px;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}
.page-list-item {
  display: grid;
  gap: 3px;
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.page-list-item small {
  color: var(--muted);
}
.page-list-item:hover,
.page-list-item.is-active {
  color: var(--ink);
  background: var(--lime);
  border-color: var(--lime);
}
.page-list-item:hover small,
.page-list-item.is-active small {
  color: #f0d9d9;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.search-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-bottom: 14px;
}
.user-list {
  max-height: 62vh;
}
.user-editor-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.user-editor-head h2,
.user-editor-head p {
  margin: 0;
}
.admin-avatar-placeholder {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 2.5rem;
  font-weight: 950;
  background: var(--lime);
  border-radius: 8px;
}
.table-list { display: grid; gap: 10px; margin-top: 18px; }
.table-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 110px 130px auto auto;
  gap: 8px;
  align-items: center;
}
.edit-card { margin-top: 16px; }
.admin-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-gallery img { height: 180px; width: 100%; object-fit: cover; border-radius: 8px; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .main-menu {
    position: absolute;
    top: 76px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .main-menu.is-open { display: flex; }
  .hero,
  .admin-body,
  .table-row,
  .admin-split,
  .forum-post,
  .profile-shell { grid-template-columns: 1fr; }
  .card-grid,
  .gallery-grid,
  .stat-grid,
  .admin-gallery { grid-template-columns: 1fr; }
  .admin-sidebar { min-height: auto; }
  .compact-panel { position: static; }
}

@media (max-width: 560px) {
  h1 { font-size: clamp(2rem, 12vw, 3rem); }
  .hero .hero-copy h1 { font-size: clamp(2.5rem, 14vw, 3.7rem); }
  .brand span { max-width: 14ch; }
  .brand img {
    width: 42px;
    height: 42px;
  }
  .hero-grid,
  .checks,
  .search-form { grid-template-columns: 1fr; }
  .image-card { grid-column: auto; }
  .actions,
  .button,
  button { width: 100%; justify-content: center; text-align: center; }
}
