/* MushiBot — thème violet doux, moderne et sobre */
:root {
  --bg: #0f0d17; --bg2: #151221; --card: #1b1729; --card2: #221d33; --line: #2e2744; --line2: #3a3256;
  --text: #ece9f6; --muted: #a59fbf; --faint: #6f6890;
  --accent: #a78bfa; --accent2: #7c3aed; --accent-soft: rgba(167,139,250,.14); --accent-glow: rgba(124,58,237,.35);
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 10px 30px -12px rgba(0,0,0,.55), 0 2px 6px -2px rgba(0,0,0,.35);
  --shadow-soft: 0 6px 20px -10px rgba(124,58,237,.35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; --mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #f6f4fb; --bg2: #efebf8; --card: #ffffff; --card2: #f8f6fd; --line: #e6e1f3; --line2: #d9d1ee;
  --text: #1e1a2e; --muted: #6b6485; --faint: #9a94b3; --accent-soft: rgba(124,58,237,.09);
  --shadow: 0 10px 30px -14px rgba(76,29,149,.22), 0 2px 6px -2px rgba(76,29,149,.08); --shadow-soft: 0 6px 20px -10px rgba(124,58,237,.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(900px 500px at 85% -10%, rgba(124,58,237,.16), transparent 60%), radial-gradient(700px 400px at -10% 110%, rgba(167,139,250,.10), transparent 60%); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* layout */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg2) 85%, transparent); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand img { width: 36px; height: 36px; border-radius: 12px; box-shadow: var(--shadow-soft); }
.brand b { font-size: 16px; } .brand small { display: block; color: var(--muted); font-size: 11.5px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0; border-radius: 12px; color: var(--muted); font-weight: 500; transition: .15s; }
.nav a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; box-shadow: var(--shadow-soft); }
.nav a .ic { width: 20px; text-align: center; font-size: 15px; }
.nav .sep { margin: 14px 12px 6px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.nav .badge { margin-left: auto; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(12px); }
.topbar .title { font-size: 17px; font-weight: 650; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 28px 60px; max-width: 1400px; }
.me { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.me img, .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.burger { display: none; }

/* cartes & grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.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: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.stat .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); font-size: 18px; margin-bottom: 6px; }

/* boutons */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--card2); color: var(--text); padding: 8px 14px; border-radius: 11px; font: inherit; font-weight: 550; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; border-color: transparent; box-shadow: var(--shadow-soft); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); } .btn.danger:hover { border-color: var(--bad); background: rgba(248,113,113,.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { color: var(--text); background: var(--accent-soft); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.twitch { background: #9146ff; color: #fff; border-color: transparent; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 15px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }

/* formulaires */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 550; margin-bottom: 6px; font-size: 13px; }
label.f > small { display: block; color: var(--faint); margin-top: 5px; font-size: 12px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=url], input[type=color], select, textarea {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 11px; padding: 9px 12px; font: inherit; outline: none; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input[type=color] { padding: 3px; height: 38px; width: 64px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.toggle:last-child { border-bottom: 0; }
.toggle .t b { display: block; font-weight: 550; } .toggle .t small { color: var(--faint); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); transition: .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + i { background: linear-gradient(135deg, var(--accent2), var(--accent)); }
.switch input:checked + i::after { transform: translateX(18px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line2); border-radius: 11px; background: var(--bg2); min-height: 42px; }
.chips input { flex: 1; min-width: 120px; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 4px 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 5px; font-size: 14px; }

/* tableaux */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
td.actions { text-align: right; white-space: nowrap; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--card2); border: 1px solid var(--line2); color: var(--muted); }
.badge.ok { color: var(--ok); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.25); }
.badge.warn { color: var(--warn); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.25); }
.badge.bad { color: var(--bad); background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }
.badge.acc { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.18); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.dot.live { background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 18px; width: fit-content; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 10px; font: inherit; font-weight: 550; cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* chat */
.chat { height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 6px; }
.msg { display: flex; gap: 10px; align-items: flex-start; padding: 6px 10px; border-radius: 10px; }
.msg:hover { background: var(--accent-soft); }
.msg .time { color: var(--faint); font-size: 11.5px; font-family: var(--mono); padding-top: 2px; flex: none; }
.msg .who { font-weight: 650; flex: none; }
.msg .txt { word-break: break-word; flex: 1; }
.msg .tools { opacity: 0; display: flex; gap: 2px; flex: none; } .msg:hover .tools { opacity: 1; }
.msg.flag { background: rgba(251,191,36,.07); border-left: 3px solid var(--warn); }
.msg.punished { background: rgba(248,113,113,.07); border-left: 3px solid var(--bad); }
.msg.punished .txt .t { text-decoration: line-through; opacity: .6; }
.msg.bot { opacity: .55; } .msg.self { background: var(--accent-soft); }
.flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }

/* jeux */
.game-card { position: relative; overflow: hidden; }
.game-card.running { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-soft); }
.game-card .emoji { font-size: 28px; }
.big-num { font-size: 34px; font-weight: 800; letter-spacing: -.03em; background: linear-gradient(135deg, var(--accent), #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .5s; }
.podium { display: flex; flex-direction: column; gap: 6px; }
.podium .p { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--card2); }
.podium .p .rk { width: 26px; text-align: center; font-weight: 800; }
.winner-flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 12px rgba(124,58,237,0); } }

/* modale & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(8,6,14,.6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line2); border-radius: 20px; padding: 22px 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); }
.modal h2 { margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line2); box-shadow: var(--shadow); animation: slide .2s; max-width: 380px; }
.toast.ok { border-left: 4px solid var(--ok); } .toast.err { border-left: 4px solid var(--bad); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.empty { text-align: center; padding: 30px 10px; color: var(--faint); }
.empty .e { font-size: 30px; margin-bottom: 6px; }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(167,139,250,.25); }
.callout.warn { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.3); }
.callout.bad { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.3); }
.copy { display: flex; gap: 8px; } .copy input { font-family: var(--mono); font-size: 12px; }
.chart-box { position: relative; height: 240px; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; }
.list-steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.list-steps li { counter-increment: s; position: relative; padding: 8px 0 8px 38px; }
.list-steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; }
.list-steps li.done::before { content: "✓"; background: rgba(52,211,153,.15); color: var(--ok); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 260px; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .burger { display: inline-flex; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .content { padding: 18px 14px 50px; } .topbar { padding: 12px 14px; }
}
.btn.disabled { opacity: .45; pointer-events: none; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
