:root { --bg: #0b0907; --gold: #e3b04b; --gold-2: #f5d27a; --text: #f1e9da; --muted: #a99b86; --line: rgba(245,210,122,.18); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(214,112,52,.22), transparent 70%),
    radial-gradient(ellipse 100% 60% at 50% 120%, rgba(120,30,20,.28), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100vh;
}
a { color: var(--gold-2); }
.wrap { max-width: 980px; margin: 0 auto; padding: 18px 16px 60px; }
header.site { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.logo { font-size: 26px; font-weight: 700; letter-spacing: .28em; color: var(--gold-2); text-shadow: 0 0 22px rgba(227,176,75,.35); text-decoration: none; }
.logo span { color: #c9483a; letter-spacing: 0; margin-right: .3em; }
.user { color: var(--muted); font-size: 14px; display: flex; gap: 10px; align-items: center; }
h2 { font-weight: 600; letter-spacing: .06em; color: var(--gold-2); font-size: 18px; margin: 28px 0 12px; text-transform: uppercase; }
.card {
  background: linear-gradient(180deg, rgba(32,25,20,.95), rgba(18,14,11,.95)); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; box-shadow: 0 14px 40px rgba(0,0,0,.45);
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: #120e0b; color: var(--text);
  font: inherit; font-size: 16px;
}
textarea { font-family: Consolas, monospace; font-size: 13px; min-height: 120px; }
input[type=range] { width: 100%; accent-color: var(--gold); }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,.12); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  color: #1d1206; background: linear-gradient(180deg, #d9a440, #9a6c1b); text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
button.ghost, .button.ghost { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--line); box-shadow: none; }
button.green, .button.green { background: linear-gradient(180deg, #2e7d69, #1a4f42); color: #fff; }
button.red { background: linear-gradient(180deg, #8e3427, #5f1e16); color: #fff; }
button:disabled { filter: grayscale(.8) brightness(.6); cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); box-shadow: none; padding: 9px 16px; }
.seg button.on { background: linear-gradient(180deg, #d9a440, #9a6c1b); color: #1d1206; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: #ff8a70; min-height: 20px; font-size: 14px; margin-top: 8px; }
.t-name { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.t-meta { color: var(--muted); font-size: 14px; line-height: 1.6; }
.t-meta b { color: var(--text); font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pill.open { background: #1f5a4a; color: #bff0dd; } .pill.closed { background: #4a3a34; color: #e2cdbd; }
/* niveau des robots : vert = debutant, orange = intermediaire, rouge = difficile */
.lvl { flex: 0 0 auto !important; display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.lvl::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.lvl-1 { background: rgba(46,160,90,.16); color: #6fdc98; border-color: rgba(46,160,90,.45); }
.lvl-2 { background: rgba(230,140,30,.16); color: #ffb54d; border-color: rgba(230,140,30,.45); }
.lvl-3 { background: rgba(215,60,50,.18); color: #ff7b6e; border-color: rgba(215,60,50,.5); }
.seg.lvlseg button[data-v="1"].on { background: linear-gradient(180deg, #3cae6c, #1f6e41); color: #fff; }
.seg.lvlseg button[data-v="2"].on { background: linear-gradient(180deg, #f0a03a, #b06a12); color: #1d1206; }
.seg.lvlseg button[data-v="3"].on { background: linear-gradient(180deg, #e0574a, #98261c); color: #fff; }
.pill.running { background: #9a6c1b; color: #fff1c9; } .pill.finished, .pill.cancelled, .pill.interrupted { background: #2b2a27; color: var(--muted); }
.count { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold-2); }
.actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.actions > * { flex: 1 1 auto; }
ol.res { margin: 8px 0 0; padding-left: 26px; color: var(--text); font-size: 14px; max-height: 220px; overflow: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list td, table.list th { padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; }
table.list th { color: var(--muted); font-weight: 600; }
details summary { cursor: pointer; color: var(--muted); margin-top: 10px; }
.hide { display: none !important; }
/* bandeau « en cours » en haut du lobby */
#live { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.live-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; cursor: pointer; text-align: left; width: 100%;
  padding: 12px 16px; border-radius: 14px; color: var(--text); font: inherit; font-size: 14px; font-weight: 400;
  background: linear-gradient(90deg, rgba(154,108,27,.35), rgba(32,25,20,.95) 55%);
  border: 1px solid rgba(245,210,122,.45); box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
.live-item:hover { border-color: var(--gold-2); filter: brightness(1.12); }
/* parties ou il y a de vrais joueurs : bleu nuit translucide, bien visibles */
.card.with-humans {
  background: linear-gradient(180deg, rgba(26,52,104,.78), rgba(10,22,48,.82)); border-color: rgba(110,160,255,.65);
  box-shadow: 0 0 0 1px rgba(110,160,255,.22), 0 0 26px rgba(60,120,255,.28), 0 14px 40px rgba(0,0,0,.45);
}
.hum-tag {
  display: inline-flex; align-items: center; flex: 0 0 auto !important; white-space: nowrap; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #d6e5ff; background: rgba(70,120,230,.3); border: 1px solid rgba(120,170,255,.6);
}
.live-item.with-humans { background: linear-gradient(90deg, rgba(44,88,180,.55), rgba(14,26,52,.94) 60%); border-color: rgba(120,170,255,.65); }
.live-item.next { background: linear-gradient(90deg, rgba(31,90,74,.45), rgba(32,25,20,.95) 55%); border-color: rgba(120,220,190,.35); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #e0452f; box-shadow: 0 0 10px #e0452f; animation: pulse 1.6s infinite; flex: 0 0 auto; }
.live-item.next .live-dot { background: #4fc79f; box-shadow: 0 0 10px #4fc79f; }
@keyframes pulse { 50% { opacity: .35; } }
.live-name { font-weight: 700; font-size: 16px; color: var(--gold-2); }
.live-meta { color: var(--muted); flex: 1 1 260px; }
.live-meta b { color: var(--text); font-weight: 600; }
.live-go { font-weight: 700; color: var(--gold-2); white-space: nowrap; }
.modal { position: fixed; inset: 0; background: rgba(5,4,3,.78); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-box { width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 6px; color: var(--gold-2); font-size: 20px; }
/* ---- ecran d'accueil (une fois par visite) : jeu gratuit, sans argent */
.splash {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(ellipse 70% 45% at 50% 40%, rgba(214,112,52,.22), transparent 70%),
    radial-gradient(ellipse 100% 60% at 50% 120%, rgba(120,30,20,.35), transparent 60%),
    var(--bg);
  transition: opacity .6s ease, visibility .6s; cursor: pointer;
}
.splash.out { opacity: 0; visibility: hidden; }
.splash[hidden] { display: none; }
.splash-in { text-align: center; max-width: 420px; animation: splashUp .7s ease-out both; }
@keyframes splashUp { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.splash-cactus { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 18px rgba(214,112,52,.45)); }
.splash-name { margin-top: 14px; font-size: 24px; font-weight: 700; letter-spacing: .3em; color: var(--gold-2); text-shadow: 0 0 22px rgba(227,176,75,.4); }
.splash-sub { margin-top: 6px; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
.splash-free {
  margin: 26px auto 0; padding: 16px 18px; border: 1px solid rgba(245,210,122,.35); border-radius: 14px;
  background: rgba(30,24,20,.75); text-align: left; display: grid; gap: 10px; font-size: 15px;
}
.splash-free div { display: flex; gap: 10px; align-items: flex-start; }
.splash-free b { color: var(--gold-2); }
.splash-free .i { flex: 0 0 auto; width: 22px; text-align: center; }
.splash-go { margin-top: 22px; min-width: 180px; }
.splash-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.splash-by { margin-top: 26px; font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.splash-by b { color: var(--gold-2); font-weight: 600; }
.free-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 40px; }
/* ---- classement en direct (lobby) */
table.list td.r, table.list th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.list tr.me td { color: var(--gold-2); font-weight: 700; background: rgba(245,210,122,.08); }
table.list tr.out td { color: var(--muted); }
table.list tr.sec td { color: var(--gold-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding-top: 14px; }
/* ---- page /admin : tuiles d'activite */
.stat-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stat { background: linear-gradient(180deg, rgba(32,25,20,.95), rgba(18,14,11,.95)); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }
/* lobby : boutons Quiz / Mes statistiques / Classement */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 8px; }
@media (max-width: 640px) { .tools { grid-template-columns: repeat(2, 1fr); } }
.modal-box.wide { width: min(640px, 100%); overflow-x: hidden; }
.tools .tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  padding: 12px 8px; border-radius: 14px; font-size: 15px; font-weight: 700; text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, rgba(48,38,28,.95), rgba(22,17,13,.95)); border: 1px solid rgba(245,210,122,.3); box-shadow: none;
}
.tools .tool small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.tools .tool:hover { border-color: var(--gold-2); filter: brightness(1.12); }
@media (max-width: 520px) { .tools .tool { font-size: 13px; padding: 10px 4px; } .tools .tool small { font-size: 10.5px; } }
b.up { color: #6fdc98; } b.down { color: #ff7b6e; }
svg.chart { width: 100%; height: 120px; display: block; margin-top: 8px; background: rgba(0,0,0,.25); border-radius: 10px; }

/* compte de test (Jolinard3D) : robots de test dans un tournoi */
.test-bots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 8px 10px; border-radius: 10px; border: 1px dashed rgba(245,210,122,.35); color: var(--muted); font-size: 13px; }
.test-bots input { width: 76px; flex: 0 0 auto; }
.test-bots button { padding: 6px 12px; font-size: 13px; }
