:root {
  --bg: #090a1a;
  --bg2: #0e1024;
  --panel: #12142c;
  --panel2: #171937;
  --line: #2a2858;
  --line2: #3b3478;
  --text: #ebe8ff;
  --muted: #9a96c8;
  --dim: #6d6a99;
  --accent: #8b5cf6;
  --accent2: #a855f7;
  --accent-soft: rgba(139, 92, 246, .16);
  --green: #22c55e;
  --red: #f43f5e;
  --gold: #f5b942;
  --blue: #60a5fa;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --r-commun: #9ca3af;
  --r-rare: #3b82f6;
  --r-heroique: #a855f7;
  --r-legendaire: #f59e0b;
  --r-mythique: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(168, 85, 247, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ───── Layout ───── */
.layout { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, #120f2e 0%, #0b0c1e 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.brand { text-align: center; padding: 22px 16px 18px; border-bottom: 1px solid var(--line); }
.brand-emblem {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 18px; display: grid; place-items: center;
  font-size: 36px; background: radial-gradient(circle at 30% 30%, #7c3aed, #2e1065); box-shadow: 0 0 30px rgba(139, 92, 246, .45);
}
.brand-name { font-weight: 800; font-size: 20px; color: #c4b5fd; letter-spacing: .04em; text-transform: uppercase; }
.brand-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.brand-tag { display: inline-block; margin-top: 8px; font-size: 10px; letter-spacing: .15em; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line2); color: #c4b5fd; }

.nav { padding: 12px 10px; flex: 1; }
.nav a, .nav .group-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin: 2px 0;
  border-radius: 12px; color: #d6d2ff; background: none; border: 1px solid transparent; cursor: pointer; font-size: 16px; text-align: left;
}
.nav a:hover, .nav .group-btn:hover { background: rgba(139, 92, 246, .08); }
.nav a.active { background: linear-gradient(90deg, #7c3aed, #6d28d9); border-color: #a78bfa; color: #fff; box-shadow: 0 0 20px rgba(124, 58, 237, .35); }
.nav .ico { width: 26px; text-align: center; font-size: 19px; }
.nav .chev { margin-left: auto; color: var(--dim); transition: transform .2s; }
.nav .group.open .chev { transform: rotate(180deg); }
.nav .sub { display: none; padding-left: 14px; }
.nav .group.open .sub { display: block; }
.nav .sub a { font-size: 14.5px; padding: 9px 14px; }
.sidebar-foot { padding: 18px; color: var(--dim); font-style: italic; font-size: 13px; border-top: 1px solid var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  background: linear-gradient(90deg, rgba(18, 15, 46, .92), rgba(30, 20, 70, .92));
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }
.guild-title { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.guild-shield { font-size: 30px; }
.guild-title b { font-size: 22px; letter-spacing: .02em; display: block; }
.guild-title span { color: var(--muted); font-size: 13px; }
.search { position: relative; }
.search input {
  width: 220px; padding: 10px 14px 10px 36px; border-radius: 12px; background: rgba(9, 10, 26, .6); border: 1px solid var(--line2); outline: none;
}
.search input:focus { border-color: var(--accent); }
.search::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .8; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(9, 10, 26, .5); cursor: pointer; position: relative; }
.user-chip .who b { display: block; font-size: 14px; }
.user-chip .who span { font-size: 12px; color: var(--green); }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; min-width: 190px; display: none; box-shadow: var(--shadow); }
.user-menu.open { display: block; }
.user-menu a, .user-menu button { display: block; width: 100%; padding: 9px 12px; border-radius: 8px; background: none; border: 0; text-align: left; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover { background: var(--accent-soft); }

.content { padding: 28px; max-width: 1400px; width: 100%; }

/* ───── Composants ───── */
.card {
  background: linear-gradient(180deg, rgba(23, 25, 55, .9), rgba(16, 17, 40, .9));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-h h2 { font-size: 20px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 20px 22px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 20px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line2); background: rgba(139, 92, 246, .08); color: var(--text); font-weight: 600; transition: .15s;
}
.btn:hover { border-color: var(--accent); background: rgba(139, 92, 246, .18); }
.btn.primary { background: linear-gradient(90deg, #7c3aed, #9333ea); border-color: #a78bfa; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.success { background: linear-gradient(90deg, #15803d, #16a34a); border-color: #4ade80; }
.btn.danger { border-color: rgba(244, 63, 94, .5); color: #fda4af; background: rgba(244, 63, 94, .08); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; padding: 14px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: 13px; border: 1px solid var(--line2); background: var(--accent-soft); color: #ddd6fe; }
.pill.green { color: #86efac; background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .4); }
.pill.red { color: #fda4af; background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .4); }
.pill.gold { color: #fde68a; background: rgba(245, 185, 66, .12); border-color: rgba(245, 185, 66, .4); }
.pill.gray { color: var(--muted); background: rgba(255, 255, 255, .04); }
.tabs { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line2); background: none; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--accent-soft); border-color: var(--accent); color: #fff; }

.av { border-radius: 50%; object-fit: cover; flex: none; background: #2e1065; }
.av-sm { width: 32px; height: 32px; }
.av-md { width: 42px; height: 42px; }
.av-xl { width: 180px; height: 180px; border: 3px solid #7c3aed; box-shadow: 0 0 50px rgba(139, 92, 246, .5); }
.av-ini { display: inline-grid; place-items: center; font-weight: 700; color: #ddd6fe; background: linear-gradient(135deg, #6d28d9, #312e81); }
.av-sm.av-ini { font-size: 14px; } .av-md.av-ini { font-size: 18px; } .av-xl.av-ini { font-size: 72px; }

/* Formulaires */
label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(9, 10, 26, .65); border: 1px solid var(--line2); outline: none;
}
.input:focus { border-color: var(--accent); }
select.input option { background: var(--panel); }
.class-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
.class-pick input { position: absolute; opacity: 0; pointer-events: none; }
.class-pick span { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border: 1px solid var(--line2); border-radius: 12px; background: rgba(9, 10, 26, .5); cursor: pointer; text-align: center; font-size: 13px; transition: .15s; }
.class-pick .cls-ico { width: 64px; height: 64px; border-radius: 10px; margin: 0; }
.class-pick span:hover { border-color: var(--accent); }
.class-pick input:checked + span { border-color: #b08d57; background: rgba(176, 141, 87, .12); box-shadow: 0 0 18px rgba(176, 141, 87, .3); }
.class-pick input:focus-visible + span { outline: 2px solid var(--accent); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Tableau */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; user-select: none; }
table.t th.num, table.t td.num { text-align: right; }
table.t tbody tr { cursor: pointer; transition: background .1s; }
table.t tbody tr:hover { background: rgba(139, 92, 246, .07); }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell small { display: block; color: var(--dim); font-size: 12px; }

/* ───── Accueil ───── */
.hello { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 26px; }
.hello h1 { font-size: 34px; }
.hello p { margin: 6px 0 0; color: var(--muted); }
.clock { text-align: right; color: var(--muted); font-size: 13px; }
.checklist { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.check-item { display: block; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(9, 10, 26, .35); }
.check-item b { color: #c4b5fd; text-decoration: underline; text-underline-offset: 3px; }
.check-item.done b { color: #86efac; text-decoration: none; }
.check-item p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.next-event { overflow: hidden; }
.hero {
  position: relative; padding: 26px; min-height: 220px;
  background:
    linear-gradient(90deg, rgba(14, 12, 36, .97) 0%, rgba(14, 12, 36, .75) 55%, rgba(14, 12, 36, .35) 100%),
    radial-gradient(600px 300px at 85% 30%, rgba(239, 68, 68, .35), transparent 60%),
    radial-gradient(500px 300px at 65% 90%, rgba(139, 92, 246, .45), transparent 60%),
    linear-gradient(135deg, #1e1b4b, #3b0764 50%, #450a0a);
}
.hero h3 { font-size: 40px; font-weight: 900; margin: 14px 0 10px; text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.hero .meta { display: flex; gap: 22px; flex-wrap: wrap; color: #ddd6fe; }
.countdown-row { display: flex; gap: 16px; align-items: stretch; margin-top: 20px; flex-wrap: wrap; }
.countdown { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line2); border-radius: 14px; background: rgba(9, 10, 26, .6); min-width: 300px; }
.countdown div { text-align: center; padding: 14px 6px; }
.countdown div + div { border-left: 1px solid var(--line); }
.countdown b { display: block; font-size: 36px; color: #c4b5fd; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.part-count { display: grid; place-items: center; padding: 0 16px; text-align: center; }
.part-count b { font-size: 28px; }

/* ───── Profil ───── */
.profile-head { display: grid; grid-template-columns: 220px 1fr auto; gap: 26px; align-items: center; padding: 26px; position: relative; overflow: hidden; }
.profile-head::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 260px at 10% 50%, rgba(139, 92, 246, .25), transparent 70%); pointer-events: none; }
.profile-head > * { position: relative; }
.profile-head .pic { display: grid; place-items: center; }
.profile-head h1 { font-size: 36px; }
.profile-head .cls { font-size: 20px; color: #c4b5fd; margin: 8px 0; display: flex; align-items: center; gap: 10px; }
.cls-ico { width: 1.6em; height: 1.6em; border-radius: 6px; object-fit: cover; vertical-align: middle; border: 1px solid var(--line2); margin-right: 4px; }
.profile-head .cls .cls-ico { width: 44px; height: 44px; border-radius: 10px; border-color: #b08d57; box-shadow: 0 0 14px rgba(176, 141, 87, .35); }
@media (max-width: 1100px) { .profile-head .cls { justify-content: center; } }
.profile-head .motto { color: var(--muted); font-style: italic; margin-top: 14px; }
.rank-line { text-align: right; margin-bottom: 14px; color: var(--muted); }
.rank-line b { color: var(--gold); font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line2); border-radius: 14px; padding: 16px 12px; text-align: center; background: rgba(9, 10, 26, .45); }
.tile span { display: block; color: var(--muted); font-size: 13px; }
.tile b { display: block; font-size: 26px; margin: 8px 0 2px; }
.tile small { color: var(--dim); font-size: 12px; }
.up { color: var(--green); } .down { color: var(--red); }

.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.attr { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line2); border-radius: 14px; background: rgba(9, 10, 26, .45); }
.attr .i { font-size: 34px; }
.attr span { color: var(--muted); font-size: 14px; display: block; }
.attr b { font-size: 28px; }
.attr.wide { grid-column: span 2; }

.chart svg { width: 100%; height: auto; display: block; }
.chart .empty { padding: 50px 0; text-align: center; color: var(--dim); }

.equip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.slot {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; border: 2px solid var(--line2);
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .06), rgba(9, 10, 26, .6)); display: grid; place-items: center; text-align: center; padding: 8px;
}
.slot .e { font-size: 34px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6)); }
.slot .n { font-size: 11px; color: var(--muted); line-height: 1.2; position: absolute; left: 8px; right: 8px; top: 8px; }
.slot .plus { position: absolute; right: 6px; bottom: 6px; background: #0b0c1e; border: 1px solid var(--line2); border-radius: 8px; padding: 1px 7px; font-weight: 800; font-size: 13px; }
.slot.empty { opacity: .35; }
.slot.r-commun { border-color: var(--r-commun); }
.slot.r-rare { border-color: var(--r-rare); box-shadow: inset 0 0 18px rgba(59, 130, 246, .25); }
.slot.r-heroique { border-color: var(--r-heroique); box-shadow: inset 0 0 18px rgba(168, 85, 247, .3); }
.slot.r-legendaire { border-color: var(--r-legendaire); box-shadow: inset 0 0 22px rgba(245, 158, 11, .3); }
.slot.r-mythique { border-color: var(--r-mythique); box-shadow: inset 0 0 22px rgba(239, 68, 68, .35); }

.gear-line { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line2); border-radius: 12px; background: rgba(9, 10, 26, .45); }
.gear-line .e { font-size: 28px; }
.gear-line span { font-size: 12px; color: var(--muted); display: block; }

.ring-wrap { display: flex; gap: 20px; align-items: center; }
.kv { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv b.green { color: var(--green); }
.abyss { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.abyss div { padding: 16px; border: 1px solid var(--line2); border-radius: 12px; background: rgba(9, 10, 26, .4); }
.abyss b { display: block; margin-bottom: 8px; }
.grade-bleu { color: var(--blue); } .grade-violet { color: #c084fc; } .grade-aucun { color: var(--muted); }

/* ───── Événements ───── */
.ev-list { display: grid; gap: 14px; }
.ev { display: grid; grid-template-columns: 80px 1fr auto; gap: 18px; align-items: center; padding: 16px 20px; }
.ev-date { text-align: center; border: 1px solid var(--line2); border-radius: 12px; padding: 8px 0; background: rgba(9, 10, 26, .5); }
.ev-date b { display: block; font-size: 26px; line-height: 1.1; }
.ev-date span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.ev h3 { font-size: 18px; margin-bottom: 6px; }
.ev .row { color: var(--muted); font-size: 14px; }

/* Classement */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 16px; align-items: end; margin-bottom: 20px; }
.podium .p { text-align: center; padding: 22px 12px; cursor: pointer; }
.podium .p .medal { font-size: 40px; }
.podium .p b { display: block; font-size: 18px; margin-top: 8px; }
.podium .p .val { font-size: 24px; color: #c4b5fd; font-weight: 800; margin-top: 6px; }
.podium .p1 { padding-top: 34px; border-color: rgba(245, 185, 66, .5); box-shadow: 0 0 40px rgba(245, 185, 66, .15); }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(480px, 100%); padding: 38px; text-align: center; }
.login h1 { font-size: 30px; margin: 14px 0 6px; }
.discord-btn { background: #5865f2; border-color: #7983f5; font-size: 17px; padding: 14px; width: 100%; margin-top: 26px; }
.discord-btn:hover { background: #4752c4; }
.alert { padding: 12px 16px; border-radius: 12px; margin-top: 18px; text-align: left; font-size: 14px; }
.alert.err { background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .4); color: #fecdd3; }
.alert.info { background: var(--accent-soft); border: 1px solid var(--line2); color: #ddd6fe; }
.demo-list { display: grid; gap: 8px; margin-top: 14px; text-align: left; }
.demo-list a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 10px; }
.demo-list a:hover { border-color: var(--accent); background: var(--accent-soft); }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: var(--shadow); animation: pop .2s ease-out; }
.toast.err { border-color: rgba(244, 63, 94, .6); }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ───── Mobile ───── */
@media (max-width: 1100px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-head { grid-template-columns: 1fr; text-align: center; }
  .rank-line { text-align: center; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .topbar .burger { display: inline-flex; }
  .search, .guild-title span { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .content { padding: 18px; }
  .equip { grid-template-columns: repeat(3, 1fr); }
  .abyss { grid-template-columns: repeat(2, 1fr); }
  .ev { grid-template-columns: 64px 1fr; }
  .ev > :last-child { grid-column: span 2; }
  .hero h3 { font-size: 28px; }
  .user-chip .who { display: none; }
}
