:root {
  --bg: #0e0f1a;
  --bg-soft: #14162466;
  --surface: #171a2b;
  --surface-2: #1d2136;
  --border: #2a2f47;
  --text: #eef0fb;
  --text-muted: #9aa0c3;
  --primary: #5865f2;
  --primary-hover: #4752c4;
  --success: #57f287;
  --danger: #ed4245;
  --warn: #fee75c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 20% -10%, #23264a 0%, var(--bg) 45%) fixed;
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 0.85em; color: var(--warn); }

/* ---------------- Top Nav ---------------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  background: rgba(14, 15, 26, 0.85);
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.topnav-links { display: flex; gap: 20px; color: var(--text-muted); font-weight: 500; }
.topnav-links a:hover { color: var(--text); }
.topnav-user { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: none;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }

/* ---------------- Hero ---------------- */
.hero { position: relative; padding: 80px 32px 40px; text-align: center; overflow: hidden; }
.hero-glow {
  position: absolute; inset: -200px 0 auto 0; height: 500px;
  background: radial-gradient(ellipse at center, rgba(88,101,242,0.35), transparent 70%);
  filter: blur(40px); z-index: 0;
}
.hero-content { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.pill {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px;
}
.hero h1 { font-size: 2.4rem; line-height: 1.35; margin: 0 0 16px; }
.hero .lead { color: var(--text-muted); font-size: 1.1rem; line-height: 1.8; margin-bottom: 30px; }
.hero-actions { margin-bottom: 60px; }

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; max-width: 1000px; margin: 0 auto; position: relative; z-index: 1;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: right; box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.8rem; margin-bottom: 10px; }
.feature-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }

.site-footer { text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.85rem; }

/* ---------------- Container / Pages ---------------- */
.container { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.page-title { margin: 0 0 6px; font-size: 1.7rem; }
.page-subtitle { color: var(--text-muted); margin-bottom: 30px; }

.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.guild-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.guild-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.guild-icon { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.guild-icon-fallback {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  font-weight: 700; text-transform: uppercase;
}
.guild-icon-lg { width: 84px; height: 84px; }
.guild-card-name { font-weight: 600; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 14px; }

/* ---------------- Guild settings page ---------------- */
.guild-header { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.guild-header h1 { margin: 0 0 4px; font-size: 1.6rem; }
.back-link { color: var(--text-muted); font-size: 0.9rem; }
.back-link:hover { color: var(--text); }

.tabs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.tabs-sidebar { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 90px; }
.tab-btn {
  text-align: right; background: transparent; border: 1px solid transparent; color: var(--text-muted);
  padding: 12px 14px; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 500;
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.tabs-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel h2 { margin-top: 0; font-size: 1.3rem; margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field span { font-size: 0.88rem; color: var(--text-muted); }
input[type="text"], input[type="number"], input[type="color"], select, textarea {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 0.95rem; font-family: inherit;
}
textarea { resize: vertical; }
input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }

.toggle-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.93rem;
}
.switch-row:last-child { border-bottom: none; }
.switch-row input[type="checkbox"] { width: 42px; height: 24px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.hint { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 14px; }

.log-row { flex-wrap: wrap; gap: 10px 14px; }
.log-row-label { flex: 1 1 170px; }
.log-row-channel { flex: 0 1 220px; min-width: 140px; padding: 6px 10px; font-size: 0.85rem; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 22px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: all 0.25s ease; z-index: 100; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { border-color: var(--danger); color: #ffb3b4; }

@media (max-width: 800px) {
  .tabs-layout { grid-template-columns: 1fr; }
  .tabs-sidebar { position: static; flex-direction: row; overflow-x: auto; }
}
