:root {
  --bg: #050505;
  --bg-soft: #0b0b0c;
  --card: rgba(255, 255, 255, 0.04);
  --card-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(220, 38, 38, 0.25);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.65);
  --primary: #dc2626;
  --primary-dark: #991b1b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --container: 1200px;
}

body[data-theme="red"] {
  --primary: #ef4444;
  --primary-dark: #7f1d1d;
}

body[data-theme="light"] {
  --bg: #f6f6f7;
  --bg-soft: #ffffff;
  --card: rgba(0, 0, 0, 0.03);
  --card-strong: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(220, 38, 38, 0.25);
  --text: #111827;
  --muted: rgba(17, 24, 39, 0.68);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body,
.site-body {
  margin: 0;
  padding: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top, rgba(220, 38, 38, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(127, 29, 29, 0.2), transparent 25%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(0, 0, 0, 0.58);
  border-bottom: 1px solid var(--border);
}

body[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.82);
}

.nav {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  transition: 0.2s ease;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.18);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--border);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.28);
}

.section {
  padding: 38px 0 52px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.section-header h1,
.section-header h2 {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
}

.section-header p {
  margin: 0;
  color: var(--muted);
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mt-24 {
  margin-top: 24px;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
}

.alert.success {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
}

.user-chip img {
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.guild-card {
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 190px;
  transition: 0.22s ease;
}

.guild-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
}

.guild-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guild-icon,
.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
}

.profile-avatar {
  border-radius: 999px;
}

.guild-title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge.success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.badge.warning {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.24);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-align: center;
}

.commands-category {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 14px;
}

.commands-toggle {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.commands-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.commands-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.commands-arrow.rotated {
  transform: rotate(180deg);
}

.commands-list {
  padding: 0 18px 18px;
  display: grid;
  gap: 12px;
}

.command-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.command-card h4 {
  margin: 0 0 6px;
}

.command-card p {
  margin: 0;
  color: var(--muted);
}

.command-badge {
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.28);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.config-layout {
  display: grid;
  gap: 18px;
}

.config-card {
  background: linear-gradient(180deg, var(--card-strong), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-head h2,
.card-head h1 {
  margin: 0 0 6px;
}

.card-head p {
  margin: 0;
  color: var(--muted);
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-weight: 700;
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.9);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

body[data-theme="light"] .field-group input,
body[data-theme="light"] .field-group select,
body[data-theme="light"] .field-group textarea {
  background: #fff;
}

.field-group textarea {
  min-height: 110px;
  resize: vertical;
}

.field-group select[multiple] {
  min-height: 150px;
  padding: 8px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 16px;
}

.switch-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.sticky-actions {
  position: sticky;
  bottom: 16px;
  z-index: 5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding: 24px 0 34px;
  background: rgba(0, 0, 0, 0.18);
}

.footer-bottom {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.legal-links {
  margin: 0;
  padding-left: 18px;
  line-height: 2;
}

.legal-links a {
  color: var(--text);
  text-decoration: underline;
}

.legal-content h2 {
  margin-top: 24px;
  margin-bottom: 10px;
}

.legal-content p {
  color: var(--muted);
  line-height: 1.7;
}

.profile-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.consent-wrapper {
  max-width: 760px;
  margin: 60px auto 0;
}

.consent-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.consent-item input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.mobile-compact .config-card {
  padding: 16px;
}

.mobile-compact .guild-card {
  padding: 14px;
}

@media (max-width: 960px) {
  .nav {
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .container {
    width: min(var(--container), calc(100% - 20px));
  }

  .guild-grid {
    grid-template-columns: 1fr;
  }

  .command-card {
    flex-direction: column;
  }

  .switch-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }

  .profile-box {
    flex-direction: column;
    text-align: center;
  }
}