/* CSS FUNZONE - theme sombre ambre (maquette validee) */
:root {
  --bg: #0E1115; --bar: #12161B; --card: #151A20; --tile: #1B2129; --hover: #1E242C;
  --line: #232933; --line2: #2A313B;
  --ink: #E6E8EB; --ink2: #9AA3AE; --ink3: #7C8590; --ink4: #5A6370;
  --amber: #F2A33A; --amber2: #FFC067; --amber-bg: #2A2215; --amber-ink: #F2C277;
  --ct: #7FA9E8; --t: #E0A84A;
  --green: #4CC38A; --green-bg: #16302A; --red: #F07A6E; --red-bg: #3A1D1B; --blue-bg: #1C2A3D;
  --r: 12px; --r2: 8px;
  --font: 'IBM Plex Sans', system-ui, sans-serif; --cond: 'Barlow Condensed', 'IBM Plex Sans', sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--amber); text-underline-offset: 2px; }
a:hover { color: var(--amber2); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 600; }
h3.sub { font-size: 13px; color: var(--ink2); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; font-weight: 600; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--tile); padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--ink2); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1440px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.main { padding-top: 24px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 20px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 4px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* en-tete */
.top { background: var(--bar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 24px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: baseline; gap: 7px; text-decoration: none; font-family: var(--cond); font-weight: 700; font-size: 26px; letter-spacing: .04em; }
.logo .l1 { color: var(--amber); } .logo .l2 { color: var(--ink); }
.logo .l3 { font-size: 12px; letter-spacing: .14em; color: var(--ink2); border: 1px solid var(--line2); border-radius: 4px; padding: 1px 6px; align-self: center; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; order: 3; width: 100%; margin: 0 -12px; }
.top-in { row-gap: 6px; }
.nav a { padding: 8px 12px; border-radius: 6px; color: var(--ink2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--hover); color: var(--ink); font-weight: 600; }
.top .btn.primary { margin-left: auto; }
.me { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line2); border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink4); flex: none; }
.dot.ok { background: var(--green); } .dot.ko { background: var(--red); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink4); font-size: 12px; padding-top: 16px; padding-bottom: 28px; border-top: 1px solid var(--line); }
.foot a { color: var(--ink3); }

/* cartes et grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.page-title { font-size: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end, .end { justify-content: flex-end; align-self: end; }
.grow { flex: 1 1 auto; min-width: 0; }
.narrow { max-width: 900px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 20px; }
.sticky-bar { position: sticky; top: 64px; z-index: 5; }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '▾'; margin-left: auto; color: var(--ink3); }
details.card:not([open]) > summary::after { content: '▸'; }
details.card[open] > summary { margin-bottom: 14px; }

/* tuiles d'etat */
.status-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { display: block; color: var(--ink2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.mapname { font-family: var(--cond); font-weight: 700; font-size: 40px; line-height: 1; display: block; }
.mapname.sm { font-size: 24px; display: inline; }
.chip { padding: 5px 12px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-ink); font-weight: 600; font-size: 13px; }
.chip.green { background: var(--green-bg); color: var(--green); } .chip.red { background: var(--red-bg); color: var(--red); }
.score { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.score span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.score b { font-family: var(--cond); font-size: 44px; line-height: 1; }
.score .ct { color: var(--ct); text-align: right; } .score .t { color: var(--t); } .score .sep { color: var(--ink4); font-size: 28px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tiles-8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--tile); border-radius: var(--r2); padding: 12px 14px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tile > span { color: var(--ink2); font-size: 12px; }
.tile > b { font-size: 18px; font-weight: 600; }
.tile > b.mono { font-weight: 500; }

/* boutons et formulaires */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r2); border: 1px solid var(--line2); background: var(--tile); color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; min-height: 36px; white-space: nowrap; }
.btn:hover { background: var(--hover); color: var(--ink); border-color: #3A424D; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1A1206; font-weight: 600; }
.btn.primary:hover { background: var(--amber2); border-color: var(--amber2); }
.btn.danger { background: var(--red-bg); border-color: #5A2A26; color: #F7A49E; }
.btn.danger:hover { background: #4A2420; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; min-height: 30px; }
.btn.xs { padding: 3px 8px; font-size: 12px; min-height: 26px; }
.btn.lg { padding: 12px 20px; font-size: 15px; min-height: 46px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
form.inline { display: inline; }
label { color: var(--ink2); font-size: 13px; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line2); color: var(--ink); border-radius: var(--r2); padding: 8px 10px; font: 14px var(--font); min-height: 36px; }
input.num { font-family: var(--mono); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); outline: none; }
input[type=color] { width: 56px; height: 34px; padding: 2px; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r2); }
input[type=file] { color: var(--ink2); }
input[type=range] { width: 100%; accent-color: var(--amber); }
input[type=checkbox], input[type=radio] { accent-color: var(--amber); width: 16px; height: 16px; }
.row > input, .row > select { width: auto; flex: 1 1 160px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; margin: 0; }
legend { color: var(--ink2); font-size: 13px; padding: 0 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.form-grid > div { display: flex; flex-direction: column; gap: 6px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 22px; transition: .15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: var(--ink); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--amber); }
.switch input:checked + span::before { transform: translateX(18px); background: #1A1206; }
.switch input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r2); padding: 2px; }
.seg a, .seg button { padding: 5px 12px; border-radius: 6px; color: var(--ink2); text-decoration: none; background: none; border: 0; font: 500 13px var(--font); cursor: pointer; }
.seg .on { background: var(--hover); color: var(--ink); }

/* tableaux et listes */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--ink3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #171C23; }
.tbl tr.dim { opacity: .5; }
.tbl tr.team-h td { background: var(--tile); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 7px 8px; }
.tbl tr.team-h.t td { color: var(--t); } .tbl tr.team-h.ct td { color: var(--ct); }
.tbl tr.dead td { color: var(--ink3); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > div { display: flex; flex-direction: column; min-width: 0; }
.av { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; background: var(--line2); }
.av-txt { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: var(--ink2); }
.pill .av { border-radius: 50%; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--tile); color: var(--ink2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.red { background: var(--red-bg); color: #F7A49E; } .badge.amber { background: var(--amber-bg); color: var(--amber-ink); }
.lvl { font-family: var(--mono); font-size: 12px; font-weight: 500; border: 1px solid; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.lvl.big { font-size: 14px; padding: 2px 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.empty { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 24px 12px; color: var(--ink2); border: 1px dashed var(--line2); border-radius: var(--r2); }
.empty strong { color: var(--ink); font-weight: 600; }
.flash { padding: 10px 14px; border-radius: var(--r2); background: var(--green-bg); color: #A6E9C8; border: 1px solid #22453B; }
.flash.err { background: var(--red-bg); color: #F7C1BB; border-color: #5A2A26; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; font: 12px/1.5 var(--mono); color: var(--ink2); overflow: auto; max-height: 340px; white-space: pre-wrap; margin: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.toast .flash { box-shadow: 0 6px 24px rgba(0,0,0,.4); }

/* partie en cours */
.pactions select { width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px; }
.weapons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.rules { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 1600px) { .weapons { grid-template-columns: minmax(0, 1fr); } }
.weapon, .rule { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; }
.weapon span, .rule span { flex: 1; }
.weapon.on, .rule.on { background: var(--red-bg); }
.weapon.on span::after { content: ' · interdite'; color: #F7A49E; font-size: 12px; }
.weapon span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weapon.allowed span::after { content: ' · autorisée'; color: var(--green); font-size: 12px; }
.rule.on span::after { content: ' · suspendue'; color: #F7A49E; font-size: 12px; }
.dlg { background: var(--card); color: var(--ink); border: 1px solid var(--line2); border-radius: var(--r); padding: 20px; width: min(440px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 7, 10, .7); }

/* sons */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--amber); }
.count { font-family: var(--mono); font-size: 11px; color: var(--ink3); }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.subtabs button { background: var(--tile); border: 1px solid var(--line2); color: var(--ink2); border-radius: 999px; padding: 4px 12px; font: 500 13px var(--font); cursor: pointer; }
.subtabs button.on { background: var(--amber-bg); color: var(--amber-ink); border-color: #5A4320; }
.sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.snd { display: flex; align-items: center; gap: 6px; background: var(--tile); border-radius: var(--r2); padding: 5px 6px; min-width: 0; }
.snd-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--line2); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0; }
.icon svg { width: 15px; height: 15px; }
.icon:hover { border-color: var(--amber); color: var(--amber); }
.icon.playing { background: var(--amber); color: #1A1206; border-color: var(--amber); }
.icon.del:hover { border-color: var(--red); color: var(--red); }

/* reglages */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 20px; }
.set { display: flex; flex-direction: column; gap: 5px; }
.set .key { font-size: 11px; color: var(--ink4); background: none; padding: 0; }
.levels { display: flex; flex-direction: column; gap: 12px; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 10px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld-model, .fld-text { grid-column: span 2; }
.fld small { font-size: 11.5px; }
.cycle { columns: 2; margin: 0; padding-left: 20px; color: var(--ink2); font-family: var(--mono); font-size: 12.5px; }

/* graphiques */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart { margin: 0; background: var(--tile); border-radius: var(--r2); padding: 12px 14px; position: relative; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chart figcaption b { font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.chart svg { width: 100%; height: 170px; display: block; overflow: visible; }
.chart .grid line { stroke: #2A313B; stroke-width: 1; }
.chart .axis text { fill: var(--ink3); font: 11px var(--mono); }
.chart .tip { position: absolute; pointer-events: none; background: #0B0E12; border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; font-size: 12px; white-space: nowrap; z-index: 2; }
.chart .tip b { font-family: var(--mono); font-weight: 500; }
.chart table { display: none; }

/* public */
.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 20px 0 8px; }
.hero-title { font-family: var(--cond); font-size: clamp(48px, 9vw, 86px); line-height: .95; letter-spacing: .02em; margin: 6px 0 14px; color: var(--amber); }
.hero-title span { color: var(--ink); }
.lead { font-size: 17px; color: #C8CDD3; max-width: 640px; margin-bottom: 20px; }
.live-card { display: flex; flex-direction: column; gap: 10px; }
.live-row { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.features p { color: #C8CDD3; margin: 0; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.pos { width: 26px; height: 26px; border-radius: 6px; background: var(--tile); display: inline-flex; align-items: center; justify-content: center; font: 600 12px var(--mono); color: var(--ink2); flex: none; }
.rank li:first-child .pos { background: var(--amber); color: #1A1206; }
.tbl tr.podium.p1 td:first-child { color: var(--amber); font-weight: 700; }
.cmds { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.rules-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.map-tile { background: var(--tile); border-radius: var(--r2); padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; }
.amounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-bottom: 8px; }
.amount input { position: absolute; opacity: 0; }
.amount span { display: flex; align-items: center; justify-content: center; height: 48px; border: 1px solid var(--line2); border-radius: var(--r2); background: var(--tile); color: var(--ink); font: 600 17px var(--mono); cursor: pointer; }
.amount input:checked + span { background: var(--amber); border-color: var(--amber); color: #1A1206; }
.amount input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.goal { margin: 12px 0 18px; }
.goal-top { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--ink2); }
.bar { height: 10px; background: var(--tile); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--amber); border-radius: 999px; }
.login { max-width: 480px; margin: 40px auto; display: flex; flex-direction: column; gap: 14px; }
.qr { background: #fff; padding: 12px; border-radius: var(--r2); width: max-content; }
.code-input { font: 600 24px var(--mono) !important; letter-spacing: .3em; text-align: center; max-width: 220px; }

/* MOTD (fenetre en jeu) et vote */
body.motd { padding: 16px 20px; font-size: 14px; max-width: 760px; }
body.motd section { margin-top: 14px; }
body.motd h2 { color: var(--amber); font-size: 15px; margin-bottom: 6px; }
.motd-h { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.vote-page h1 { font-size: 22px; margin: 6px 0 16px; }
.vote-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.vote-btns .btn { min-width: 140px; }

@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles-8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .grid-2, .charts, .features { grid-template-columns: minmax(0, 1fr); }
  .tiles, .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav { overflow-x: auto; flex-wrap: nowrap; margin: 0; }
  .me .pill .muted, .hide-sm { display: none; }
  .mapname { font-size: 32px; }
  .score b { font-size: 34px; }
  .sticky-bar { position: static; }
  .fld-model, .fld-text { grid-column: span 1; }
}
@media (forced-colors: active) { .btn, .icon, .tile, .card { border: 1px solid CanvasText; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
