/* Fourmidable : couleurs et polices de Fourmageddon (clair / sombre) */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600&family=Nunito:wght@400;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f4ecdc; --card: #fffaf1; --chip: #efe3cc; --banner: #fbf1e1;
  --line: #e2d3b7; --line2: #d4c09c; --dash: #c9ad80;
  --ink: #2b1d11; --soft: #6e5a45;
  --acc: #b8432a; --acct: #b8432a; --good: #4f7f1e;
  --glass: rgba(255, 250, 241, 0.96); --shadow: 0 10px 30px rgba(43, 29, 17, 0.18); --sel: #fff3ea;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17110c; --card: #241a12; --chip: #2e2218; --banner: #2a1f15;
  --line: #3b2d20; --line2: #4d3b2a; --dash: #6b5235;
  --ink: #f2e7d3; --soft: #b9a68c;
  --acct: #e98a6c; --good: #8cc152;
  --glass: rgba(36, 26, 18, 0.96); --shadow: 0 10px 30px rgba(0, 0, 0, 0.45); --sel: #2e1a12;
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 Nunito, system-ui, sans-serif; }
h1, h2, h3 { font-family: Fredoka, Nunito, sans-serif; font-weight: 600; line-height: 1.08; margin: 0; }
p { margin: 0; }
a { color: var(--acct); }
a:hover { color: var(--ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Éléments communs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--acc); color: #fff; font-weight: 700; text-decoration: none; }
.btn:hover { color: #fff; filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--acct); border: 1px solid var(--acct); }
.btn.ghost:hover { color: var(--acct); background: var(--chip); }
.btn.quiet { background: transparent; color: var(--soft); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 700; }
.input { height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--ink); font-size: 16px; width: 100%; }
.error { min-height: 22px; font-size: 14px; font-weight: 700; color: var(--acct); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--acct); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.theme-corner { position: fixed; top: 16px; right: 16px; z-index: 5; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); }

/* Écrans centrés (accès, connexion) */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.stack { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.lock { width: 72px; height: 72px; border-radius: 20px; background: var(--chip); border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; color: var(--acct); margin: 0 auto; }

/* Écran titre (blanc, quel que soit le thème) */
.titre { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 48px 24px 32px; background: #fff; color: #141414; text-decoration: none; font-family: Manrope, Nunito, system-ui, sans-serif; }
.titre:hover { color: #141414; }

/* Connexion */
.split { min-height: 100vh; display: flex; flex-wrap: wrap; }
.split .art { flex: 1 1 520px; min-height: 360px; background: #2a1f15 url('/img/illustration.webp') center 40% / cover no-repeat; }
.split .form { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
@media (max-width: 760px) { .split .art { display: none; } }
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); }
.tabs button { height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--soft); font-weight: 700; }
.tabs button[aria-selected="true"] { background: var(--acc); color: #fff; }
.idbox { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--chip); border: 1px dashed var(--dash); }
.idbox b { font-size: 20px; color: var(--acct); letter-spacing: 1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--soft); }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }

/* Portail (choix du jeu) */
.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top .in { max-width: 1360px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand img { display: block; height: 56px; width: auto; }
.me { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 6px; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; font: 600 18px Fredoka, sans-serif; flex: none; }
.me .who b { display: block; font-size: 15px; }
.me .who span { display: block; font-size: 13px; color: var(--acct); }
.small-btn { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.layout { max-width: 1360px; margin: 0 auto; padding: 28px 24px 48px; display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.layout main { flex: 999 1 600px; display: flex; flex-direction: column; gap: 24px; }
.hero { position: relative; border-radius: 20px; overflow: hidden; min-height: 230px; display: flex; align-items: flex-end; padding: 28px; border: 1px solid var(--line2); background: #2a1f15 url('/img/illustration.webp') 50% 42% / cover no-repeat; }
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(23, 17, 12, 0.86), rgba(23, 17, 12, 0.12) 72%); }
.hero > div { position: relative; }
.hero .eyebrow { color: #f6c9b8; }
.hero h1 { color: #fff; font-size: clamp(28px, 4vw, 40px); }
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-radius: 16px; background: var(--banner); border: 1px solid var(--line2); }
.resume .l { display: flex; align-items: center; gap: 14px; }
.resume .ic { width: 48px; height: 48px; border-radius: 12px; background: var(--chip); color: var(--acct); display: flex; align-items: center; justify-content: center; flex: none; }
.resume small { display: block; font-size: 13px; color: var(--soft); }
.resume b { font-size: 16px; }
.grid { display: flex; flex-wrap: wrap; gap: 16px; }
.game { flex: 1 1 250px; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.game .head { display: flex; align-items: center; gap: 10px; color: var(--acct); }
.game h3 { font-size: 24px; color: var(--ink); }
.game .genre { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--acct); }
.game .desc { font-size: 14px; color: var(--soft); flex: 1; }
.game .players { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--soft); }
.game .soon { font-size: 13px; color: var(--soft); text-align: center; padding: 6px 0; }
.game .btn { min-height: 44px; font-size: 15px; }

/* Fourmilière */
.colony { flex: 1 1 320px; display: flex; flex-direction: column; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow: hidden; position: sticky; top: 16px; max-height: calc(100vh - 32px); }
.colony .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.colony .hd .t { display: flex; align-items: center; gap: 10px; }
.colony .hd img { width: 44px; height: auto; display: block; }
.colony .hd h2 { font-size: 22px; }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.dot.off { background: var(--line2); }
.sec { padding: 10px 16px 4px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--soft); }
.plist { list-style: none; margin: 0; padding: 0 10px 8px; max-height: 240px; overflow-y: auto; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 6px; }
.plist .av { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--bg); flex: none; }
.plist .nm { flex: 1; }
.plist .nm b { display: block; font-size: 14px; }
.plist .nm span { display: block; font-size: 12px; color: var(--soft); }
.lob { display: flex; align-items: center; gap: 10px; margin: 0 10px 8px; padding: 10px 12px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); }
.lob .nm { flex: 1; font-size: 14px; }
.lob .nm span { display: block; font-size: 12px; color: var(--soft); }
.chat { border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; flex: 1; }
.msgs { flex: 1; min-height: 180px; max-height: 340px; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.msg b { font-weight: 700; }
.msg time { font-size: 12px; color: var(--soft); margin-left: 4px; }
.msg p { color: var(--ink); }
.composer { display: flex; gap: 8px; padding: 10px 14px 14px; }
.composer .input { height: 44px; }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: var(--acc); color: #fff; display: flex; align-items: center; justify-content: center; }

/* Lobby */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(23, 17, 12, 0.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog { width: 100%; max-width: 580px; max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 20px; background: var(--card); border: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.dialog .hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog h2 { font-size: 28px; }
.codebox { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--chip); border: 1px dashed var(--dash); }
.codebox b { font-size: 20px; color: var(--acct); letter-spacing: 1px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.seg button { height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--soft); font-size: 13px; font-weight: 700; }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--acc); color: #fff; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .slots { grid-template-columns: minmax(0, 1fr); } }
.slot { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); }
.slot.free { background: transparent; border: 1px dashed var(--line2); }
.slot .n { width: 28px; height: 28px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--acc); color: #fff; }
.slot.free .n { background: transparent; color: var(--soft); border: 1px solid var(--line2); }
.slot .nm { flex: 1; }
.slot .nm b { display: block; font-size: 14px; }
.slot .nm span { display: block; font-size: 12px; color: var(--soft); }
.slot .x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* En jeu */
.play { position: fixed; inset: 0; background: #000; }
.play iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.back { position: fixed; top: 12px; left: 12px; z-index: 10; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; box-shadow: var(--shadow); }
.back:hover { color: var(--ink); }
.back img { height: 32px; width: auto; display: block; }
.pill { position: fixed; right: 16px; bottom: 16px; z-index: 10; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 6px; border-radius: 24px; background: var(--glass); border: 1px solid var(--line2); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.pill img { width: 36px; height: auto; display: block; }
.badge { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: var(--acc); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.mini { position: fixed; right: 16px; bottom: 16px; z-index: 10; width: 330px; max-width: calc(100% - 32px); display: flex; flex-direction: column; border-radius: 16px; background: var(--glass); border: 1px solid var(--line2); overflow: hidden; box-shadow: var(--shadow); }
.mini .hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 10px; border-bottom: 1px solid var(--line); }
.mini .hd .t { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.mini .hd img { width: 30px; height: auto; }
.mini .msgs { height: 230px; min-height: 0; max-height: none; padding: 10px 12px; gap: 6px; }
.mini .msg { font-size: 13px; }
.mini .composer { padding: 8px 10px 10px; gap: 6px; }
.mini .icon-btn { border: 0; background: transparent; color: var(--soft); }

/* Paramètres de partie */
.opts { display: flex; flex-direction: column; gap: 12px; }
.opt-row { display: flex; flex-direction: column; gap: 6px; }
.opt-l { font-size: 14px; font-weight: 700; }
.opt-sep { font-size: 13px; color: var(--soft); text-align: center; }
.seg.wrap { flex-wrap: wrap; align-self: flex-start; }
.seg button[role="radio"]:disabled { opacity: 0.45; }
.lob.btnlike, button.lob { border: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }

/* Cartes de choix (camp, classe…) : même esprit que l'écran de départ de Fourmageddon */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.choice:hover:not(:disabled):not([aria-checked="true"]) { border-color: var(--line2); }
.choice[aria-checked="true"] { border-color: var(--acc); background: var(--sel); }
.choice:disabled { cursor: default; opacity: 0.5; }
.choice[aria-checked="true"]:disabled { opacity: 1; }
.choice .ci, .toggle-card .ci { display: block; line-height: 0; color: var(--acct); }
.choice b { font: 600 18px Fredoka, Nunito, sans-serif; }
.choice small, .toggle-card small { font-size: 12px; line-height: 1.3; color: var(--soft); }
.toggle-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.toggle-card[aria-checked="true"] { border-color: var(--acc); background: var(--sel); }
.toggle-card:disabled { cursor: default; }
.toggle-card .ct { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toggle-card .ct b { font: 600 18px Fredoka, Nunito, sans-serif; }
.toggle-card .sw { width: 46px; height: 28px; flex: none; border-radius: 14px; background: var(--line2); position: relative; transition: background .15s; }
.toggle-card .sw i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.toggle-card[aria-checked="true"] .sw { background: var(--acc); }
.toggle-card[aria-checked="true"] .sw i { left: 21px; }
select.input { appearance: auto; }
