:root {
  --bg: #0b0d12; --card: #141821; --card2: #1b202b; --line: #262c39; --text: #e8ebf1; --muted: #8b93a5;
  --acc: #f5a524; --acc2: #ffcc66; --ok: #2ecc71; --mid: #f1c40f; --ko: #e74c3c; --blue: #4ea1ff;
  --r: 12px; --navh: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--acc2); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0 0 .8rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; color: var(--acc2); }
h3 { font-size: 1rem; margin: .2rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: rgba(11,13,18,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.15rem; letter-spacing: .02em; }
.brand img { width: 30px; height: 30px; }
.brand b { color: var(--acc); }
#who { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
#who img { width: 28px; height: 28px; border-radius: 50%; }

main { max-width: 1100px; margin: 0 auto; padding: 16px 14px calc(var(--navh) + 30px + env(safe-area-inset-bottom)); }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around;
  background: #0f1219; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 1.15rem; color: var(--muted); }
.nav a span { font-size: .68rem; }
.nav a.on { color: var(--acc); }
@media (min-width: 900px) {
  .nav { top: 57px; bottom: auto; justify-content: center; gap: 4px; border-top: 0; border-bottom: 1px solid var(--line); background: #0d1017; }
  .nav a { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 10px 16px; font-size: 1rem; }
  .nav a span { font-size: .9rem; }
  main { padding-top: 64px; padding-bottom: 40px; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font: inherit; cursor: pointer; }
.btn:hover { border-color: #3a4254; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #1a1205; font-weight: 600; }
.btn.danger { color: var(--ko); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.on { border-color: var(--acc); color: var(--acc); }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; font-weight: 600; padding: 12px 20px; font-size: 1.05rem; }

input, select, textarea { width: 100%; background: #0f1219; color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font: inherit; font-size: 16px; }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.tag.acc { color: var(--acc); border-color: #5a4316; }
.t-entraînement { color: var(--blue); } .t-scrim { color: var(--acc); } .t-match { color: var(--ko); }
.win { color: var(--ok); font-weight: 700; } .loss { color: var(--ko); font-weight: 700; } .draw { color: var(--mid); font-weight: 700; }

.event { display: flex; gap: 12px; }
.event .date { min-width: 54px; text-align: center; background: var(--card2); border-radius: 10px; padding: 6px 4px; }
.event .date b { display: block; font-size: 1.3rem; line-height: 1.1; }
.event .date span { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.event .body { flex: 1; min-width: 0; }
.att { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.att .btn.on.présent { border-color: var(--ok); color: var(--ok); }
.att .btn.on.peut-être { border-color: var(--mid); color: var(--mid); }
.att .btn.on.absent { border-color: var(--ko); color: var(--ko); }
.dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.dot { font-size: .72rem; padding: 1px 6px; border-radius: 6px; background: var(--card2); }
.dot.présent { color: var(--ok); } .dot.peut-être { color: var(--mid); } .dot.absent { color: var(--ko); text-decoration: line-through; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.avail th, .avail td { padding: 8px 3px; }
.avail td.cell { text-align: center; cursor: pointer; user-select: none; min-width: 34px; }
.avail td.cell.dispo { background: rgba(46,204,113,.22); }
.avail td.cell.peut-être { background: rgba(241,196,15,.2); }
.avail td.cell.indispo { background: rgba(231,76,60,.18); }
.avail td.cell.ro { cursor: default; }
.heat { text-align: center; font-weight: 600; }

.player { display: flex; gap: 12px; align-items: center; }
.player img, .player .ph { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-weight: 700; color: var(--acc); }

.strat-card { cursor: pointer; padding: 0; overflow: hidden; }
.strat-card .cover { aspect-ratio: 16/9; background: var(--card2) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 2rem; }
.strat-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.strat-card .inner { padding: 12px; }
.content p { margin: .4rem 0; }
.content ul { margin: .4rem 0; padding-left: 1.2rem; }
.content h3 { color: var(--acc2); margin-top: 1rem; }
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 12px; }
.gallery img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs .th { position: relative; }
.thumbs img { width: 110px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumbs .x { position: absolute; top: -6px; right: -6px; background: var(--ko); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .8rem; }
.bar { height: 8px; background: var(--card2); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; flex: 1 1 140px; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.65); display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--card); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
.modal-box.wide { max-width: 1100px; }
@media (min-width: 720px) { .modal { align-items: center; } .modal-box { border-radius: 16px; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--navh) + 20px + env(safe-area-inset-bottom)); z-index: 60;
  background: #222837; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; max-width: 90vw; }
.toast.err { border-color: var(--ko); color: #ffb3aa; }

.alert { background: rgba(231,76,60,.12); border: 1px solid var(--ko); color: #ffb3aa; padding: 10px; border-radius: 10px; }
.login { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.login img { width: 84px; }

/* Éditeur de schéma */
.draw-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
.canvas-wrap { background: #000; border-radius: 10px; overflow: hidden; touch-action: none; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; }
