:root {
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-2: #313338;
  --border: #3f4147;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --success: #23a55a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

a { color: #00a8fc; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
h1, h2, h3 { margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }

/* Navigation */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand img, .me img { width: 32px; height: 32px; border-radius: 50%; }
.nav-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-right > a:not(.btn) { color: var(--muted); }
.me { display: flex; align-items: center; gap: .5rem; }

.container { max-width: 960px; margin: 0 auto; padding: 2rem 1rem 6rem; }

/* Boutons */
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 1px solid transparent;
  padding: .5rem 1rem; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* Cartes */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.center { text-align: center; }

/* Accueil */
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero-avatar { width: 96px; height: 96px; border-radius: 50%; margin-bottom: 1rem; }
.hero h1 { font-size: 2.4rem; }
.hero p { max-width: 560px; margin: .5rem auto 1.5rem; }
.actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 2rem; }
.features p { margin: 0; }

/* Liste des serveurs */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.guild-card { display: flex; flex-direction: column; align-items: center; gap: .75rem; text-align: center; }
.guild-card.dim .guild-icon { opacity: .5; }
.guild-name { font-weight: 600; overflow-wrap: anywhere; }
.guild-icon { width: 72px; height: 72px; border-radius: 50%; }
.guild-icon.placeholder { display: grid; place-items: center; background: var(--panel-2); font-size: 1.8rem; font-weight: 700; }

/* Page de configuration */
.guild-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.guild-header h1 { margin: 0; }
.guild-header p { margin: 0; }
.settings { display: flex; flex-direction: column; gap: 1rem; }
.settings label { display: block; margin-top: .75rem; color: var(--muted); font-size: .9rem; font-weight: 600; }
.settings label.row { display: flex; align-items: center; gap: .75rem; color: var(--text); font-weight: 400; font-size: 1rem; }

input:not([type=checkbox]), select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .6rem .75rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }

/* Interrupteur */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0 !important; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #80848e; border-radius: 24px; cursor: pointer; transition: .2s; }
.switch span::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); }

.cmd-row { display: grid; grid-template-columns: 160px 1fr auto; gap: .5rem; align-items: start; margin-bottom: .5rem; }
.cmd-row input, .cmd-row textarea { margin-top: 0; }
#add-cmd { margin-top: .5rem; }

.alert { background: rgba(35, 165, 90, .15); border: 1px solid var(--success); padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; padding: 0; }
.alert-error { background: rgba(237, 66, 69, .15); border-color: #ed4245; }
#rules .btn { margin-top: 1rem; }

.save-bar {
  position: sticky; bottom: 1rem; display: flex; justify-content: flex-end;
  padding: .75rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
}

@media (max-width: 600px) {
  .nav { padding: .75rem 1rem; }
  .me span, .me { display: none; }
  .cmd-row { grid-template-columns: 1fr auto; }
  .cmd-row textarea { grid-column: 1 / -1; grid-row: 2; }
}
