:root {
  /* Light Theme Colors */
  --bg: #f4ede4;
  --bg-soft: #fbf7f2;
  --panel: #fffdf9;
  --panel-soft: #f8f1e7;
  --bg-body: #f8f2ea;
  --line: #ded1c1;
  --line-strong: #ccb79f;
  --text: #2f241b;
  --text-soft: #4d3d2f;
  --muted: #79695a;
  --accent: #d8842e;
  --accent-strong: #b8651e;
  --accent-soft: #f3dfc5;
  --danger: #c45441;
  --danger-soft: #f8e2dd;
  --success: #4d8660;
  --success-soft: #e4f1e8;
  --shadow-sm: 0 1px 2px rgba(49, 31, 17, 0.05);
  --shadow-md: 0 12px 30px rgba(49, 31, 17, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;
  
  /* Rules & Spec Specifics */
  --rule-card-bg: linear-gradient(180deg, #fffdf9 0%, #f8f1e7 100%);
  --rule-item-bg: rgba(255, 255, 255, 0.7);
  --rule-badge-bg: #fff1dc;
  --rule-badge-border: #e3bf91;
  --rule-punishment-bg: linear-gradient(180deg, #fff2ef 0%, #f8e2dd 100%);
  --rule-punishment-label: #9b4335;
  --rule-punishment-text: #7f3327;
  --rule-header-bg: #fffdf9;
  --rule-icon-bg: rgba(255, 255, 255, 0.72);
}

html.theme-dark {
  /* Dark Theme Colors */
  --bg: #111418;
  --bg-soft: #1a1d23;
  --panel: #1e2128;
  --panel-soft: #282c34;
  --bg-body: #111418;
  --line: #2e343d;
  --line-strong: #3f4752;
  --text: #eef0f3;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent-strong: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.1);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.5);

  /* Rules & Spec Specifics Dark */
  --rule-card-bg: linear-gradient(180deg, #232730 0%, #1e2128 100%);
  --rule-item-bg: rgba(255, 255, 255, 0.03);
  --rule-badge-bg: #2e343d;
  --rule-badge-border: #4d3d2f;
  --rule-punishment-bg: linear-gradient(180deg, #2d1d1b 0%, #251816 100%);
  --rule-punishment-label: #ef4444;
  --rule-punishment-text: #fecaca;
  --rule-header-bg: #1e2128;
  --rule-icon-bg: rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-body);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5, p, ul, li, small, strong { margin: 0; }
form { margin: 0; }

p, small, li, label {
  color: var(--muted);
  line-height: 1.6;
}

.site-shell {
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.topbar, .panel, .panel-soft {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}

.topbar-main, .topbar-actions, .thread-row-top, .list-panel-head,
.feed-item-top, .feed-item-foot, .thread-header-meta, .post-topline,
.profile-meta, .hero-actions, .admin-actions, .admin-row, .moderation-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.brand-copy { display: grid; gap: 2px; }

.brand-copy strong, .hero h1, .page-hero h1, .thread-header h1,
.form-box h1, .profile-hero h1 {
  font-size: clamp(1.7rem, 2vw, 2.4rem);
  line-height: 1.15;
}

.brand-copy strong { font-size: 1rem; }

.eyebrow, .brand-copy small {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.nav a {
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--muted);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav a:hover, .nav a.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 15px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.button:hover { border-color: var(--line-strong); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fffaf4; }
.button-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button-secondary { background: var(--panel-soft); border-color: var(--line); }
.button-muted { background: transparent; border-color: var(--line); }
.button-danger { background: var(--danger); border-color: var(--danger); color: #fff8f6; }

.account-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.account-copy { display: grid; gap: 2px; }
.account-copy small { font-size: 0.76rem; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(180deg, #f5e2c7, #ecd0ab);
  color: var(--accent-strong);
  font-weight: 800;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 34px; height: 34px; font-size: 0.78rem; }
.avatar-sm { width: 42px; height: 42px; font-size: 0.88rem; }
.avatar-lg { width: 78px; height: 78px; font-size: 1.2rem; }
.avatar-xl { width: 108px; height: 108px; font-size: 1.6rem; }

.avatar-changer {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}
.avatar-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: white;
}
.avatar-changer:hover .avatar-overlay {
  opacity: 1;
}
.avatar-overlay-text {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 4px;
}

.flash-list, .forum-page, .content-page, .rules-page {
  display: grid;
  gap: 18px;
}

.flash {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.flash-error {
  background: var(--danger-soft);
  border-color: rgba(196, 84, 65, 0.25);
  color: #6f3025;
}

.flash-success {
  background: var(--success-soft);
  border-color: rgba(77, 134, 96, 0.24);
  color: #2d5b3e;
}

.panel { border-radius: var(--radius-lg); padding: 20px; }
.panel-soft { border-radius: var(--radius-md); padding: 16px; background: var(--panel-soft); }

.hero, .page-hero, .profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
}

.hero-copy, .hero-side, .profile-summary { display: grid; gap: 12px; }
.hero-text, .page-hero p, .form-note { max-width: 760px; }

.hero-side {
  align-content: space-between;
  min-width: 260px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.hero-side-row { display: grid; gap: 6px; }
.hero-side-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.list-panel { display: grid; gap: 16px; }
.list-panel-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.list-panel-head h2, .reply-box h2, .profile-upload h2 { font-size: 1.12rem; }
.table-note { font-size: 0.85rem; }

.forum-table, .thread-list, .feed-list, .admin-list,
.rules-sections, .rules-list, .profile-grid, .forum-post-list {
  display: grid;
  gap: 12px;
}

.forum-table-row, .thread-row, .feed-item, .moderation-item {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.forum-table-row:hover, .thread-row:hover, .feed-item:hover, .moderation-item:hover {
  border-color: var(--line-strong);
  background: var(--panel);
}

.forum-table-row { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr); }

.forum-table-main, .forum-table-meta, .thread-row-main,
.thread-row-meta, .thread-row-side, .feed-copy, .moderation-copy {
  display: grid;
  gap: 6px;
}

.forum-table-main strong, .thread-row-main strong,
.feed-copy strong, .moderation-copy strong { color: var(--text); }

.thread-row {
  grid-template-columns: auto minmax(0, 1.4fr) minmax(180px, 0.9fr) minmax(160px, 0.7fr);
  align-items: center;
}

.thread-author-inline { display: flex; align-items: center; justify-content: center; }
.thread-row-meta, .thread-row-side { text-align: right; }

.status-badge, .role-badge, .section-chip, .thread-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  background: var(--panel);
}

.status-pending { background: #fff1da; border-color: #e7c58b; color: #8d5f1b; }
.status-approved { background: var(--success-soft); border-color: rgba(77, 134, 96, 0.28); color: #2f6847; }
.status-rejected, .status-locked { background: var(--danger-soft); border-color: rgba(196, 84, 65, 0.28); color: #8b3c2f; }
.status-resolved { background: #e4f1e8; border-color: #a8d5ba; color: #2d5b3e; }
.status-work { background: #fff1da; border-color: #f3d6a4; color: #b8651e; }
.status-waiting { background: #f0ece7; border-color: var(--line); color: var(--muted); }
.status-neutral { background: #f0ece7; }
.role-player { background: #f1ebe3; }
.role-admin { background: #f6e0c2; border-color: #e4bd84; color: #8f5818; }

.thread-header { display: grid; gap: 12px; }

.forum-post {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.post-author {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  padding: 22px 18px;
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
  text-align: center;
}

.post-content { display: grid; gap: 16px; padding: 20px 22px; }
.post-topline {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
}

.post-body { color: var(--text); line-height: 1.72; word-break: break-word; }
.reply-box { display: grid; gap: 12px; }
.form-grid { display: grid; gap: 14px; }
.form-grid label { display: grid; gap: 8px; font-weight: 700; color: var(--text); }

input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.auth-page { justify-items: center; }
.auth-box, .form-box { width: min(760px, 100%); }
.auth-switch a { color: var(--accent-strong); font-weight: 700; }

.feed-item { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.feed-item-foot { font-size: 0.86rem; color: var(--muted); }
.admin-layout, .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-card { display: grid; gap: 16px; }
.moderation-item { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.moderation-copy > p { margin-top: 4px; }
.moderation-user { justify-content: flex-start; }
.admin-actions { flex-wrap: wrap; justify-content: flex-end; }
.profile-summary { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.profile-upload { display: grid; gap: 10px; align-content: start; }

.rules-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
  min-width: 240px;
}

.rules-summary-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  text-align: center;
}

.rules-summary-card strong { font-size: 1.3rem; color: var(--accent-strong); }
.rules-summary-card span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.rules-cards-page { gap: 20px; }

.rules-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.rules-card-grid.is-single-mode .rule-card:not(.is-active) {
  display: none;
}

.rule-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--rule-card-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
}

.rules-card-grid:not(.is-single-mode) .rule-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.rule-card.is-active {
  grid-column: 1 / -1;
  background: var(--rule-header-bg);
  cursor: default;
}

.rule-card.is-active .rule-card-summary {
  display: none;
}

.rule-card-summary {
  list-style: none;
  cursor: pointer;
  min-height: 280px;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: space-between;
}

.rule-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rule-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 64px;
  padding: 0 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--rule-icon-bg);
  color: var(--accent-strong);
  font-size: 1.15rem;
  font-weight: 800;
}

.rule-card-copy { display: grid; gap: 10px; }
.rule-card-copy h2 { font-size: clamp(1.3rem, 2vw, 1.8rem); line-height: 1.15; }
.rule-card-copy p { color: var(--text); opacity: 0.82; }

.rule-card-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.rule-card-body {
  display: grid;
  gap: 18px;
  padding: 0 22px 22px;
  border-top: 1px solid var(--line);
}

.rule-theme-fire { background: var(--rule-card-bg); }
.rule-theme-fire .rule-card-icon { color: #b7651d; }
.rule-theme-ban { background: var(--rule-card-bg); }
.rule-theme-ban .rule-card-icon { color: #a94b3f; }
.rule-theme-chat { background: var(--rule-card-bg); }
.rule-theme-chat .rule-card-icon { color: #6650a8; }
.rule-theme-bolt { background: var(--rule-card-bg); }
.rule-theme-bolt .rule-card-icon { color: #9c7720; }

.rule-section-full-head {
  display: grid;
  gap: 6px;
  padding-top: 18px;
}

.rule-section-full-head h3,
.rule-full-title h4,
.rule-extra h5 {
  color: var(--text);
}

.rule-full-list {
  display: grid;
  gap: 14px;
}

.rule-full-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--rule-item-bg);
}

.rule-full-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rule-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule-badge-border);
  background: var(--rule-badge-bg);
  color: var(--accent-strong);
  font-weight: 800;
}

.rule-extra {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

.rule-extra-list {
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.rule-extra-list li {
  list-style-type: disc;
  color: var(--text);
}

.rule-punishment {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--danger-soft);
  border-radius: 12px;
  background: var(--rule-punishment-bg);
}

.rule-punishment span {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rule-punishment-label);
}

.rule-punishment strong { color: var(--rule-punishment-text); line-height: 1.45; }

.rule-alert {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
}

.rule-alert-danger { background: var(--danger-soft); border: 1px solid rgba(196, 84, 65, 0.26); }
.rule-alert-neutral { background: #f0ece7; border: 1px solid var(--line); }

.muted-note, .empty-box { color: var(--muted); }
.empty-box {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

/* Custom Titul CSS */
.titul-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.titul-generator {
  display: grid;
  gap: 24px;
}
.generator-header h2 { font-size: 1.45rem; color: var(--text); }
.generator-header p { color: var(--muted); margin-top: 4px; }

.color-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.color-item {
  position: relative;
  display: inline-block;
}
.color-input {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  background: transparent;
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 2px solid var(--line); border-radius: 12px; }

.color-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--bg-hover);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 50%;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-remove-btn:hover {
  background: #ff4757;
  color: #fff;
  border-color: #ff4757;
}

/* Hide remove button if only one color is left */
.color-picker-list .color-item:only-child .color-remove-btn {
  display: none;
}

.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
}

.generator-preview {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: var(--radius-md);
  display: grid;
  gap: 10px;
}
.chat-preview-box {
  background: rgba(0, 0, 0, 0.4);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 500;
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.8);
}
.chat-bracket { color: #aaa; }
.chat-name { color: #ccc; margin-left: 2px; }
.chat-msg { color: #fff; }

.generator-output {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.generator-output textarea { 
  font-family: monospace; 
  margin-top: 8px; 
  background: var(--bg-soft);
}

.guide-steps { display: grid; gap: 18px; margin-top: 18px; }
.guide-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.guide-step strong { color: var(--text); font-size: 1.05rem; display: block; margin-bottom: 4px; }
.guide-step p { font-size: 0.92rem; }

/* Voting System */
.thread-voting {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.vote-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.vote-btn:hover { background: var(--bg-hover); }
.vote-up.active { 
  background: rgba(30, 200, 100, 0.15); 
  border-color: rgba(30, 200, 100, 0.4); 
  color: #2ed573; 
}
.vote-down.active { 
  background: rgba(255, 71, 87, 0.15); 
  border-color: rgba(255, 71, 87, 0.4); 
  color: #ff4757; 
}
.rating-score {
  font-size: 1.25rem;
  font-weight: 800;
  min-width: 32px;
  text-align: center;
  color: var(--text);
}
.rating-score.positive, .rating-badge.positive { color: #2ed573; }
.rating-score.negative, .rating-badge.negative { color: #ff4757; }

.vote-login-alert {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--muted);
}

.rating-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

@media (max-width: 960px) {
  .hero, .page-hero, .profile-hero, .admin-layout, .profile-grid,
  .forum-table-row, .thread-row, .moderation-item, .rules-card-grid, .titul-layout {
    grid-template-columns: 1fr;
  }
  .rule-card[open] { grid-column: auto; }
  .thread-row-meta, .thread-row-side { text-align: left; }
  .forum-post { grid-template-columns: 1fr; }
  .post-author {
    grid-template-columns: auto 1fr auto;
    justify-items: start;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }
}

@media (max-width: 720px) {
  .site-shell { width: min(100% - 16px, 100%); }
  .topbar-main, .hero-actions, .topbar-actions, .list-panel-head,
  .thread-header-meta, .feed-item-top, .feed-item-foot, .post-topline,
  .profile-summary { flex-direction: column; align-items: flex-start; }
  .rules-summary { grid-template-columns: 1fr 1fr; min-width: 0; width: 100%; }
  .nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .nav a { white-space: nowrap; }
  .panel { padding: 16px; }
  .rule-card-summary { min-height: 240px; padding: 18px; }
  .rule-card-body { padding: 0 18px 18px; }
  .rule-full-title { align-items: flex-start; flex-direction: column; }
}

/* Mobile Optimization & Responsive Design */
@media (max-width: 1024px) {
  .site-shell { padding: 12px 0 30px; }
  .hero, .page-hero, .profile-hero { grid-template-columns: 1fr; }
  .hero-side { min-width: 0; order: 2; }
  .titul-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .topbar { padding: 12px; }
  .topbar-main { flex-direction: column; align-items: flex-start; gap: 16px; }
  .topbar-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  
  .nav { gap: 4px; }
  .nav a { padding: 6px 10px; font-size: 0.85rem; }
  
  .forum-table-row { grid-template-columns: 1fr; gap: 8px; }
  .forum-table-meta { text-align: left; padding-top: 8px; border-top: 1px solid var(--line); }
  
  .thread-row { 
    grid-template-columns: 1fr; 
    gap: 12px; 
    align-items: flex-start;
  }
  .thread-author-inline { display: none; }
  .thread-row-meta, .thread-row-side { text-align: left; font-size: 0.85rem; }
  
  .forum-post { grid-template-columns: 1fr; }
  .post-author { 
    flex-direction: row; 
    padding: 12px 18px; 
    border-right: none; 
    border-bottom: 1px solid var(--line); 
    justify-content: flex-start;
    text-align: left;
  }
  .avatar-lg { width: 42px; height: 42px; }
  
  .admin-layout, .profile-grid, .rules-card-grid { grid-template-columns: 1fr; }
  
  .brand-copy strong { font-size: 1.1rem; }
  
  /* Compact buttons for mobile */
  .button { padding: 8px 12px; font-size: 0.85rem; }
}

/* Theme Toggle Button Extra Styling */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-toggle:hover {
  background: var(--panel-soft);
  transform: rotate(15deg);
}
.theme-toggle svg { width: 20px; height: 20px; stroke: currentColor; }
/* --- Error Pages --- */
.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 24px;
}

.error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 40px;
    max-width: 600px;
}

.error-visual {
    margin-bottom: 24px;
}

.error-image {
    width: 280px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    background: var(--bg-soft);
    display: block;
    border: 1px solid var(--line);
}

.error-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.error-code-label {
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 4px;
}

.error-info h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 2px;
}

.error-description {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

@media (max-width: 480px) {
    .error-card {
        padding: 40px 24px;
    }
    .error-info h1 {
        font-size: 1.8rem;
    }
    .error-actions {
        flex-direction: column;
        width: 100%;
    }
    .error-actions .button {
        width: 100%;
    }
}

/* --- Flash Messages --- */
.flash-list {
    margin-bottom: 24px;
    display: grid;
    gap: 12px;
}

.flash {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    font-weight: 600;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease;
}

.flash-success {
    background: var(--success-soft);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.flash-error, .flash-danger {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.flash-info {
    background: var(--bg-soft);
    border-color: var(--line);
    color: var(--text-soft);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Prank Screamer --- */
.scare-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.scare-overlay.show {
    display: flex;
    animation: scare-shake 0.05s infinite alternate;
}

.scare-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scare-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 3rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
}

.scare-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

@keyframes scare-shake {
    0% { transform: translate(10px, 10px) scale(1.1); }
    50% { transform: translate(-10px, -10px) scale(1.2); }
    100% { transform: translate(10px, -10px) scale(1.15); }
}
