:root {
  --wood-0: #1c150f;
  --wood-1: #261d15;
  --wood-2: #33271c;
  --wood-3: #47372a;
  --edge: #6d5536;
  --edge-soft: rgba(109, 85, 54, 0.55);
  --gold: #d8b25e;
  --gold-hi: #f2d68a;
  --text: #f3e6c8;
  --muted: #b8a684;
  --pos: #7fdc6a;
  --neg: #ff7a66;
  --mid: #f2c14a;
  --ally: #8fc8ff;
  --panel: rgba(30, 23, 16, 0.95);
  --panel-raised: rgba(44, 34, 24, 0.97);
  --well: rgba(0, 0, 0, 0.24);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  --radius: 6px;
  /* Boutons : planche de bois, relief donné par une bordure basse plus sombre (pas de dégradé) */
  --btn: #4a3826;
  --btn-hi: #5b4630;
  --btn-edge: #8a6c43;
  --btn-low: #241910;
  --btn-primary: #8a5d2c;
  --btn-primary-hi: #9c6a33;
  --btn-primary-edge: #c99a4c;
  --btn-primary-low: #43290f;
  --btn-danger: #6e2a20;
  --btn-danger-hi: #7f3226;
  --btn-danger-edge: #a5493a;
  --btn-danger-low: #34100a;
  --title: 'Cinzel', 'Times New Roman', serif;
  --body: 'Alegreya Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0f1520; color: var(--text); font-family: var(--body); font-size: 15px; }
button { font-family: inherit; font-size: inherit; color: inherit; }
kbd { display: inline-block; padding: 0 5px; border-radius: 3px; background: rgba(0,0,0,0.35); border: 1px solid rgba(242,214,138,0.3); font-size: 12px; font-family: var(--body); line-height: 17px; color: var(--muted); }
small { color: var(--muted); }
h4 { font-family: var(--title); color: var(--gold-hi); margin: 14px 0 6px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .mid { color: var(--mid); } .muted { color: var(--muted); } .ally { color: var(--ally); }
.center { text-align: center; margin-top: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ico { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

#view { position: fixed; inset: 0; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 1; box-shadow: inset 0 0 160px rgba(10,6,2,0.45); }

/* ------------------------------------------------------------ panneaux (ils flottent au-dessus du monde) */
#topbar, #left section, #selection, #build-bar, #minimap-wrap, #chat, .toast, #placement-hint, #modal .panel, .login-card, #tooltip, #sound-panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------ boutons */
.btn, .login-card button.primary, #connecting button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 32px; padding: 4px 12px 3px;
  background: var(--btn); color: var(--text);
  border: 1px solid var(--btn-edge); border-bottom: 3px solid var(--btn-low); border-radius: 4px;
  font: 600 14px var(--body); cursor: pointer; text-align: left;
  transition: background-color 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover:not(:disabled), #connecting button:hover { background: var(--btn-hi); border-color: var(--gold); border-bottom-color: var(--btn-low); }
.btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1px; margin-bottom: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary, .login-card button.primary { background: var(--btn-primary); border-color: var(--btn-primary-edge); border-bottom-color: var(--btn-primary-low); color: #fff3d4; }
.btn.primary:hover:not(:disabled), .login-card button.primary:hover:not(:disabled) { background: var(--btn-primary-hi); border-color: var(--gold-hi); border-bottom-color: var(--btn-primary-low); }
.btn.danger { background: var(--btn-danger); border-color: var(--btn-danger-edge); border-bottom-color: var(--btn-danger-low); }
.btn.danger:hover:not(:disabled) { background: var(--btn-danger-hi); border-color: #d46a58; border-bottom-color: var(--btn-danger-low); }
.btn.on { background: #5a2a20; border-color: #ff7060; border-bottom-color: #2d0f0a; color: #ffe0d6; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: rgba(242,214,138,0.08); border-color: var(--edge); color: var(--text); }
.btn.sm { min-height: 26px; padding: 2px 9px 1px; font-size: 13px; gap: 5px; }
.btn.xs { min-height: 22px; padding: 1px 6px 0; font-size: 12px; gap: 4px; border-bottom-width: 2px; }
.btn.big { font-family: var(--title); font-size: 17px; padding: 9px 26px 7px; }
.btn.wide { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
.btn kbd { margin-left: auto; }
.btn .costs { display: flex; flex-wrap: wrap; gap: 2px 8px; width: 100%; font-size: 13px; font-weight: 500; }
.btn.big .costs { width: auto; font-family: var(--body); }
.btn .why { width: 100%; font-size: 12px; color: var(--neg); font-weight: 500; }

/* Boutons-icônes de la barre du haut */
.ibtn { position: relative; width: 36px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 4px; color: #dcc9a0; cursor: pointer; transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
.ibtn:hover { background: rgba(242,214,138,0.1); border-color: var(--edge); color: var(--gold-hi); }
.ibtn:active { transform: translateY(1px); }
.ibtn.on { background: rgba(242,214,138,0.16); border-color: var(--gold); color: var(--gold-hi); }
.ibtn.badge::after { content: ''; position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #e0533e; border: 1.5px solid var(--wood-1); }

/* Mise en avant du tutoriel */
.pulse { outline: 2px solid var(--gold-hi); outline-offset: 1px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { outline-color: rgba(242,214,138,0.95); } 50% { outline-color: rgba(242,214,138,0.15); } }

/* ------------------------------------------------------------ connexion */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,8,5,0.45); z-index: 50; padding: 16px; }
.login-card { width: 400px; max-width: 100%; padding: 28px 30px 22px; text-align: center; background: var(--panel-raised); border-color: #8a6c43; }
.login-card h1 { font-family: var(--title); font-weight: 700; color: var(--gold-hi); margin: 6px 0 4px; font-size: 32px; letter-spacing: 1px; }
.tagline { color: var(--muted); margin: 0 0 18px; }
.login-card .tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--edge); }
.login-card .tab { flex: 1; background: none; border: none; padding: 8px; cursor: pointer; color: var(--muted); font-family: var(--title); font-weight: 600; border-bottom: 2px solid transparent; }
.login-card .tab.active { color: var(--gold-hi); border-bottom-color: var(--gold); }
.login-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input, #modal input, #modal select { background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 4px; padding: 8px 10px; color: var(--text); font-family: var(--body); font-size: 15px; outline: none; }
.login-card input:focus, #modal input:focus, #modal select:focus { border-color: var(--gold); }
.login-card button.primary { margin-top: 6px; padding: 10px; font-family: var(--title); font-size: 15px; justify-content: center; }
#login-error { color: var(--neg); min-height: 20px; margin-top: 10px; font-size: 14px; }
#login-error button.link { display: inline; margin-left: 4px; }
#login-info { color: var(--pos); font-size: 14px; }
#login-info:empty { display: none; }
.login-card button.link { background: none; border: none; padding: 2px; color: var(--gold-hi); cursor: pointer; font-family: var(--body); font-size: 13px; text-decoration: underline; align-self: center; }
.login-card .pw-rule { color: var(--muted); font-size: 12px; margin-top: -6px; }
.login-card .auth-note { margin: 0; color: var(--text); font-size: 14px; text-align: center; }
.login-card .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.login-card .or::before, .login-card .or::after { content: ''; flex: 1; border-top: 1px solid var(--edge); }
.login-card .oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 8px; padding: 9px; border-radius: 4px; border: 1px solid var(--edge); background: rgba(0,0,0,0.3); color: var(--text); font-family: var(--body); font-size: 15px; cursor: pointer; }
.login-card .oauth-btn:hover:not(:disabled) { border-color: var(--gold); background: rgba(0,0,0,0.45); }
.login-card .oauth-btn:disabled { opacity: 0.6; cursor: default; }
#connecting .msg button { margin-top: 8px; }
#world-stats { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ------------------------------------------------------------ barre du haut */
#topbar { position: fixed; top: 8px; left: 8px; right: 8px; height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 10px; z-index: 10; }
.brand { font-family: var(--title); font-weight: 700; white-space: nowrap; }
#player-name { color: var(--gold-hi); padding-left: 10px; border-left: 4px solid var(--pc, var(--gold)); }
#resources { display: flex; gap: 4px; flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
.res { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 4px; background: var(--well); min-width: 64px; cursor: default; border: 1px solid transparent; }
.res svg { flex: none; }
.res .rv { display: flex; flex-direction: column; line-height: 1.05; }
.res .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.res .rate { font-size: 11px; font-variant-numeric: tabular-nums; }
.res.full { border-color: rgba(242,193,74,0.6); }
.res.full .v { color: var(--mid); }
.res.empty .v { color: var(--neg); }
.top-stats { display: flex; gap: 4px; }
.stat { display: flex; align-items: center; gap: 5px; padding: 4px 8px; background: var(--well); border-radius: 4px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; border: 1px solid transparent; }
.stat.warn { color: var(--neg); border-color: rgba(255,122,102,0.5); }
.stat.shield { color: #a9c8ff; }
.top-actions { display: flex; gap: 1px; align-items: center; }
.top-actions .sep { width: 1px; height: 22px; background: var(--edge-soft); margin: 0 4px; }
#sound-panel { position: fixed; top: 64px; right: 60px; z-index: 30; width: 290px; padding: 10px 12px; }
#sound-panel .sp-title { font-family: var(--title); color: var(--gold-hi); font-weight: 600; margin: 4px 0 6px; }
#sound-panel label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; margin-bottom: 7px; color: #e8dcc0; }
#sound-panel input[type=range] { width: 100%; accent-color: var(--gold); }
#sound-panel .sp-mute { flex-direction: row; align-items: center; gap: 6px; }
#sound-panel .sp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 7px; }
#sound-panel .sp-credit { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 4px; overflow: hidden; }
.seg button { background: transparent; border: none; padding: 4px 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--edge); }
.seg button.on { background: var(--btn-primary); color: #fff3d4; }
#warnings { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 6px; background: rgba(110, 28, 18, 0.92); border: 1px solid #c0553f; color: #ffe0d6; padding: 5px 14px; border-radius: 4px; font-weight: 600; pointer-events: none; }

/* ------------------------------------------------------------ colonne gauche */
#left { position: fixed; top: 66px; left: 8px; width: 258px; display: flex; flex-direction: column; gap: 8px; z-index: 6; max-height: calc(100vh - 290px); overflow-y: auto; scrollbar-width: thin; }
#left section { padding: 8px 10px; overflow: hidden; flex: none; }
.panel-head, .army-head, .tuto-head { font-family: var(--title); font-weight: 600; color: var(--gold-hi); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; user-select: none; }
.panel-head { cursor: pointer; }
.ph-ico { display: inline-flex; color: var(--gold); }
.panel-head > span:last-child, .army-head span { margin-left: auto; color: var(--muted); font-family: var(--body); font-size: 13px; }
#quests.collapsed #quest-list { display: none; }
#quests.collapsed .panel-head { margin-bottom: 0; }
.quest { padding: 7px 0; border-top: 1px solid rgba(109,85,54,0.5); }
.quest:first-child { border-top: none; padding-top: 0; }
.qt { font-weight: 700; color: #ffe9b8; }
.qd { font-size: 13px; color: #dccfb2; margin: 2px 0 5px; line-height: 1.4; }
.qr { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.quest.done { color: var(--gold-hi); font-style: italic; }
#tutorial { border-color: var(--gold); background: var(--panel-raised); }
.tuto-head .dots { margin-left: auto; display: flex; gap: 4px; }
.tuto-head .dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,0.45); border: 1px solid var(--edge); }
.tuto-head .dots i.done { background: var(--pos); border-color: var(--pos); }
.tuto-head .dots i.cur { background: var(--gold-hi); border-color: var(--gold-hi); }
.tuto-acts { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.prog { position: relative; height: 12px; background: rgba(0,0,0,0.45); border-radius: 3px; overflow: hidden; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; background: #d1a43e; transition: width 0.3s; }
.prog span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 12px; font-weight: 700; text-shadow: 0 1px 1px #000; }
#army .empty { font-size: 13px; color: var(--muted); }
.army-head .btn { margin-left: 6px; }
.army-row { display: flex; align-items: center; gap: 6px; width: 100%; background: var(--well); border: 1px solid transparent; border-radius: 4px; padding: 2px 6px; margin-top: 3px; cursor: pointer; text-align: left; }
.army-row:hover { border-color: var(--gold); }
.army-row img { width: 26px; height: 26px; }
.army-row .an { flex: 1; }
.army-row .ac { font-weight: 700; font-variant-numeric: tabular-nums; }
.tagi { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: #a9d4ff; }
.tagi.idle { color: var(--muted); }

/* ------------------------------------------------------------ notifications */
#notifications { position: fixed; top: 100px; left: 50%; transform: translateX(-50%); width: 460px; max-width: calc(100vw - 600px); display: flex; flex-direction: column; align-items: stretch; gap: 6px; z-index: 12; pointer-events: none; }
.toast { display: flex; gap: 9px; align-items: flex-start; padding: 8px 12px; font-size: 14px; pointer-events: auto; opacity: 0; transform: translateY(-12px); transition: opacity 0.3s, transform 0.3s; border-left: 4px solid var(--gold); text-align: left; line-height: 1.35; }
.toast.show { opacity: 1; transform: none; }
.toast .ti { color: var(--gold); margin-top: 1px; }
.toast .tx { flex: 1; }
.toast small { display: block; font-size: 11px; margin-top: 2px; }
.toast.good { border-left-color: var(--pos); } .toast.good .ti { color: var(--pos); }
.toast.bad { border-left-color: #d0703a; } .toast.bad .ti { color: #f0a060; }
.toast.war { border-left-color: #ff4a3a; background: rgba(78, 22, 15, 0.96); } .toast.war .ti { color: #ff7a66; }
.toast.quest { border-left-color: #c58bff; background: rgba(48, 34, 60, 0.96); } .toast.quest .ti { color: #d8b4ff; }
#error-flash { position: fixed; bottom: 186px; left: 50%; transform: translate(-50%, -6px); background: rgba(90, 22, 14, 0.94); border: 1px solid #d0553f; color: #ffe6dc; padding: 6px 16px; border-radius: 4px; z-index: 30; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; font-weight: 600; max-width: 80vw; text-align: center; }
#error-flash.show { opacity: 1; transform: translate(-50%, 0); }
#error-flash.info { background: rgba(30, 50, 30, 0.94); border-color: #5fa84f; color: #e6ffe0; }

/* ------------------------------------------------------------ barre de construction */
#build-bar { position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 8; padding: 0 6px 6px; max-width: calc(100vw - 600px); min-width: 420px; transition: transform 0.25s; }
#build-bar.hidden { transform: translate(-50%, calc(100% - 34px)); }
#build-tabs { display: flex; gap: 2px; padding-top: 4px; }
#build-tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 5px 12px; font-family: var(--title); font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 3px 3px 0 0; }
#build-tabs button:hover { color: var(--text); }
#build-tabs button.active { color: var(--gold-hi); border-bottom-color: var(--gold); }
#build-tabs .collapse { display: inline-flex; align-items: center; padding: 4px 8px; }
#build-tabs .ctx { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
#build-tabs .ctx svg { color: var(--gold); }
.build-empty { padding: 26px 14px; color: var(--muted); font-size: 14px; }
.store { display: flex; flex-direction: column; gap: 3px; }
.srow { display: grid; grid-template-columns: 18px 92px 1fr auto auto auto; align-items: center; gap: 5px; font-size: 13px; font-variant-numeric: tabular-nums; }
.srow small { font-size: 11px; }
.sbar { height: 6px; background: rgba(0,0,0,0.45); border-radius: 3px; overflow: hidden; min-width: 30px; }
.sbar.wide { flex: 0 0 120px; }
.sbar i { display: block; height: 100%; background: #d1a43e; }
/* Une rangée tant qu'elle tient, puis deux au plus ; défilement vertical au-delà (la molette y suffit) */
#build-items { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px; max-height: 189px; overflow-y: auto; padding: 6px 2px 2px; scrollbar-width: thin; }
#build-items.many { max-height: 161px; }
#build-items.many .build-item { width: 70px; height: 72px; }
#build-items.many .build-item img { width: 46px; height: 46px; }
#build-items.many .build-item .bn { font-size: 11px; }
#build-items .build-empty { flex: 1 0 100%; }
#build-search { flex: 0 1 160px; min-width: 90px; margin: 2px 6px 2px auto; padding: 3px 8px; font: inherit; font-size: 13px; color: var(--text); background: var(--well); border: 1px solid #5a4630; border-radius: 4px; }
#build-search:focus { outline: none; border-color: var(--gold); }
#build-search + .ctx { margin-left: 0; }
#build-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 2px 0; }
#build-filters button { background: var(--well); border: 1px solid #5a4630; border-radius: 12px; padding: 2px 10px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
#build-filters button small { opacity: 0.7; }
#build-filters button:hover { color: var(--text); }
#build-filters button.on { color: var(--gold-hi); border-color: var(--gold); background: rgba(242,214,138,0.12); }
.build-item { flex: none; width: 82px; height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; background: var(--well); border: 1px solid #5a4630; border-bottom-width: 3px; border-bottom-color: #1a120b; border-radius: 4px; cursor: pointer; padding: 3px; transition: background-color 0.12s, border-color 0.12s; }
.build-item img { width: 60px; height: 60px; object-fit: contain; }
.build-item .bn { font-size: 12px; line-height: 1.1; text-align: center; }
.build-item:hover { border-color: var(--gold); background: rgba(242,214,138,0.08); }
.build-item.active { border-color: var(--gold-hi); background: rgba(242,214,138,0.14); }
.build-item.poor img { opacity: 0.55; filter: grayscale(0.6); }
.build-item.poor .bn { color: var(--muted); }
#placement-hint { position: fixed; bottom: 136px; left: 50%; transform: translateX(-50%); z-index: 9; padding: 7px 14px; text-align: center; pointer-events: none; white-space: nowrap; }
#placement-hint small { display: block; font-size: 12px; }
#placement-hint .hint-cost { display: inline-flex; gap: 6px; vertical-align: -3px; }
.tag-guild { font-size: 11px; padding: 0 5px; border: 1px solid var(--gold); color: var(--gold-hi); border-radius: 3px; vertical-align: 1px; }

/* ------------------------------------------------------------ sélection */
#selection { position: fixed; right: 8px; bottom: 246px; width: 350px; z-index: 7; padding: 10px 12px; max-height: calc(100vh - 330px); overflow-y: auto; scrollbar-width: thin; }
.sel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sel-head img.big { width: 58px; height: 58px; object-fit: contain; background: var(--well); border-radius: 4px; border: 1px solid #5a4630; }
.sel-head h3 { margin: 0; font-family: var(--title); font-size: 17px; color: var(--gold-hi); }
.sel-head h3 small { font-family: var(--body); font-size: 13px; }
.sel-head .sub { font-size: 13px; font-weight: 600; }
.hp { position: relative; height: 16px; background: rgba(0,0,0,0.5); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.hp i { position: absolute; left: 0; top: 0; bottom: 0; transition: width 0.25s; }
.hp span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; font-weight: 700; text-shadow: 0 1px 1px #000; }
.state { margin: 4px 0 8px; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.state .prog { margin-top: 2px; width: 100%; }
.state small { width: 100%; }
.info { font-size: 14px; line-height: 1.6; padding: 6px 8px; background: var(--well); border-radius: 4px; margin-bottom: 8px; }
.info svg { vertical-align: -3px; display: inline-block; }
.stats { font-size: 13px; margin: 6px 0; line-height: 1.45; }
.actions { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cost { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.cost.miss { color: var(--neg); }
.time { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.section-title { font-family: var(--title); color: var(--gold-hi); font-size: 14px; margin: 10px 0 5px; }
.unit-cards { display: flex; flex-wrap: wrap; gap: 5px; }
.unit-card { position: relative; width: 56px; height: 62px; background: var(--well); border: 1px solid #5a4630; border-radius: 4px; cursor: pointer; padding: 2px; display: flex; flex-direction: column; align-items: center; }
.unit-card:hover { border-color: var(--gold); }
.unit-card img { width: 42px; height: 42px; }
.unit-card .n { position: absolute; top: 1px; right: 4px; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px #000; }
.mini-bar { width: 44px; height: 4px; background: rgba(0,0,0,0.6); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.mini-bar i { display: block; height: 100%; background: var(--pos); }
.trains { display: flex; flex-direction: column; gap: 4px; }
.train { display: flex; align-items: center; gap: 6px; background: var(--well); border-radius: 4px; padding: 3px 5px; }
.train img { width: 38px; height: 38px; flex: none; }
.train .tinfo { flex: 1; display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.train .costs { display: flex; flex-wrap: wrap; gap: 1px 6px; font-size: 12px; }
.train small { font-size: 11px; }
.train.locked { opacity: 0.55; }
.tbtns { display: flex; flex-direction: column; gap: 3px; }
.queue { display: flex; flex-wrap: wrap; gap: 4px; }
.qitem { position: relative; width: 38px; height: 40px; background: rgba(0,0,0,0.3); border: 1px solid #5a4630; border-radius: 4px; padding: 0; cursor: pointer; overflow: hidden; display: inline-block; }
.qitem.other { cursor: default; opacity: 0.6; }
.qitem img { width: 34px; height: 34px; }
.qitem i { position: absolute; left: 0; bottom: 0; height: 4px; background: #d9a3ff; }
.qitem:not(.other):hover { border-color: var(--neg); }
.market { display: flex; flex-direction: column; gap: 6px; }
.market label { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.market select { background: rgba(0,0,0,0.4); color: var(--text); border: 1px solid var(--edge); border-radius: 4px; padding: 4px; font-family: var(--body); width: 150px; }
.amounts { display: flex; gap: 4px; }
.amounts .btn { flex: 1; justify-content: center; }
.preview { text-align: center; font-size: 15px; }
.preview svg { vertical-align: -3px; display: inline-block; }

/* ------------------------------------------------------------ minicarte et discussion */
#minimap-wrap { position: fixed; right: 8px; bottom: 8px; width: 232px; height: 232px; padding: 5px; z-index: 7; }
#minimap { width: 220px; height: 220px; display: block; cursor: pointer; }
#chat { position: fixed; left: 8px; bottom: 8px; width: 330px; height: 196px; z-index: 7; display: flex; flex-direction: column; padding: 4px 8px 8px; }
#chat .tabs { display: flex; gap: 2px; }
#chat .tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 3px 8px; font-size: 13px; color: var(--muted); cursor: pointer; position: relative; }
#chat .tabs button.active { color: var(--gold-hi); border-bottom-color: var(--gold); }
#chat .tabs button[data-unread]::after { content: attr(data-unread); position: absolute; top: -2px; right: -6px; background: #c0392b; color: #fff; border-radius: 8px; font-size: 10px; padding: 0 4px; }
#chat-log { flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.35; padding: 4px 0; scrollbar-width: thin; }
#chat-log .line { padding: 1px 0; overflow-wrap: anywhere; }
#chat-log .time { color: #8f7d5f; font-size: 11px; }
#chat-log .war { color: #ffb0a4; } #chat-log .good { color: #c9f5b8; } #chat-log .quest { color: #e3c8ff; } #chat-log .bad { color: #ffcf9e; }
.gtag { color: var(--gold); font-weight: 700; font-size: 0.92em; }
#chat-input { background: rgba(0,0,0,0.35); border: 1px solid #5a4630; border-radius: 4px; padding: 5px 8px; color: var(--text); font-family: var(--body); font-size: 13px; outline: none; }
#chat-input:focus { border-color: var(--gold); }

/* ------------------------------------------------------------ infobulle, fenêtres */
#tooltip { position: fixed; left: 0; top: 0; z-index: 40; padding: 8px 11px; max-width: 330px; font-size: 13.5px; pointer-events: none; opacity: 0; transition: opacity 0.12s; line-height: 1.4; }
#tooltip.show { opacity: 1; }
#tooltip .tt-title { font-family: var(--title); color: var(--gold-hi); font-weight: 700; font-size: 15px; }
#tooltip .tt-desc { color: #e5d6b5; margin: 3px 0 5px; }
#tooltip .tt-lines { color: #cfe8c0; font-size: 13px; margin-bottom: 5px; }
#tooltip .tt-cost { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
#tooltip .tt-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
#tooltip .tt-src { margin: 5px 0; padding: 4px 0; border-top: 1px solid var(--edge-soft); border-bottom: 1px solid var(--edge-soft); }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#modal { position: fixed; inset: 0; z-index: 35; display: none; align-items: center; justify-content: center; background: rgba(5, 4, 2, 0.6); padding: 16px; }
#modal .panel { width: 760px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel-raised); }
#modal .panel.map-panel { width: auto; }
#modal .panel.confirm-panel { width: 420px; }
#modal .mhead { display: flex; align-items: center; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--edge); }
#modal .mhead h2 { margin: 0; font-family: var(--title); color: var(--gold-hi); font-size: 20px; flex: 1; }
#modal .mbody { padding: 12px 16px 16px; overflow-y: auto; scrollbar-width: thin; }
#modal .mbody > h4:first-child { margin-top: 0; }
#modal .lead { font-size: 15px; line-height: 1.5; margin-top: 0; color: #e8dcc0; }
#modal p { line-height: 1.5; }
#worldmap { display: block; width: min(720px, calc(100vh - 140px)); height: min(720px, calc(100vh - 140px)); border-radius: 4px; cursor: crosshair; background: #0f1d33; }
.map-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 8px; justify-content: center; flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.map-legend i.sq { border-radius: 0; background: #e8dcc0; transform: rotate(45deg); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.help-grid h4 { margin: 10px 0 4px; }
.help-grid h4 svg { color: var(--gold); }
.help-grid p { margin: 0 0 6px; line-height: 1.45; font-size: 14px; color: #e8dcc0; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 14px; }
table.rank { width: 100%; border-collapse: collapse; }
table.rank th, table.rank td { padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(109,85,54,0.5); vertical-align: middle; }
table.rank th { font-family: var(--title); color: var(--gold-hi); font-weight: 600; font-size: 13px; }
table.rank th.num, table.rank td.num { text-align: right; }
table.rank tr.me td { background: rgba(242,214,138,0.1); }
table.rank td svg { display: inline-block; vertical-align: -4px; }
table.rank .dot, .grow .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; flex: none; }
.online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pos); vertical-align: 1px; margin-left: 4px; }
#connecting { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: rgba(8, 6, 4, 0.72); }
#connecting .msg { font-family: var(--title); font-size: 20px; color: var(--gold-hi); text-align: center; line-height: 1.8; }
#connecting button { margin-top: 10px; font-size: 15px; font-family: var(--body); }
#debug { position: fixed; left: 50%; top: 62px; transform: translateX(-50%); font-size: 11px; color: #ccc; pointer-events: none; z-index: 5; text-shadow: 0 1px 1px #000; }

/* Tableau du royaume */
.kgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kgrid.small .kstat b { font-size: 20px; }
.kstat { background: var(--well); border-radius: 4px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kstat span { font-size: 12px; color: var(--muted); }
.kstat b { font-family: var(--title); font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.kstat small { font-size: 12px; line-height: 1.3; }
.ktable td svg { vertical-align: -4px; display: inline-block; }
.ktable tr.sub td { font-size: 12px; color: var(--muted); padding-top: 0; border-bottom-color: rgba(109,85,54,0.25); }
.ktable tr:has(+ tr.sub) td { border-bottom: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--well); border-radius: 4px; padding: 2px 8px 2px 2px; font-size: 13px; }
.chip img { width: 26px; height: 26px; }

/* Bourse */
.offer-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; padding: 10px; background: var(--well); border-radius: 4px; }
.offer-form label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.offer-form input { width: 90px; padding: 5px 8px !important; }
.offer-form select { padding: 5px 6px !important; }
#offer-preview svg { vertical-align: -3px; display: inline-block; }

/* Guilde */
.ghead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ghead h3 { margin: 0; font-family: var(--title); color: var(--gold-hi); font-size: 20px; }
.gtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--edge); margin-bottom: 10px; }
.gtabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 6px 12px; font-family: var(--title); font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.gtabs button:hover { color: var(--text); }
.gtabs button.active { color: var(--gold-hi); border-bottom-color: var(--gold); }
.pill { display: inline-block; min-width: 17px; padding: 0 4px; border-radius: 9px; background: #c0392b; color: #fff; font-family: var(--body); font-size: 11px; text-align: center; }
.glist { display: flex; flex-direction: column; gap: 3px; }
.grow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: var(--well); border-radius: 4px; min-height: 36px; }
.grow.me { outline: 1px solid var(--edge); }
.grow .gn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow .flag { flex: none; }
.gacts { display: flex; gap: 3px; }
.rank-chip { font-size: 12px; padding: 1px 7px; border-radius: 3px; border: 1px solid var(--edge); color: var(--muted); }
.rank-chip.r0 { border-color: var(--gold); color: var(--gold-hi); }
.rank-chip.r1 { border-color: #a9884e; color: #ead8a8; }
.rel { font-size: 13px; font-weight: 700; min-width: 64px; text-align: right; color: var(--muted); }
.rel.neg { color: var(--neg); } .rel.pos { color: var(--pos); } .rel.ally { color: var(--ally); }
.invite-form { display: flex; gap: 6px; margin-top: 8px; }
.invite-form input { flex: 1; }
.found-form { display: flex; gap: 10px; margin-bottom: 10px; }
.found-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.found-form label:first-child { flex: 1; }
.found-form .tag-in { width: 110px; text-transform: uppercase; }
.flag-edit { display: flex; gap: 16px; align-items: flex-start; padding: 10px; background: var(--well); border-radius: 4px; }
.flag-big { flex: none; display: flex; justify-content: center; }
.flag-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ff { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ff > span { width: 112px; flex: none; }
.ff select { flex: 1; padding: 4px 6px !important; font-size: 14px !important; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 22px; height: 22px; border-radius: 3px; border: 2px solid rgba(0,0,0,0.5); cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--gold-hi); }
.treasury { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tres { display: flex; align-items: center; gap: 6px; background: var(--well); padding: 6px 8px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.donate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.donate label { display: flex; align-items: center; gap: 4px; }
.donate input { width: 100%; padding: 4px 6px !important; font-size: 14px !important; }
.gfoot { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--edge-soft); }

/* ------------------------------------------------------------ écrans moyens */
@media (max-width: 1720px) {
  .res { min-width: 0; padding: 3px 5px; }
  .top-actions .ibtn { width: 31px; }
  .stat { padding: 4px 6px; }
}
@media (max-width: 1500px) {
  .res .rate { display: none; }
}
@media (max-width: 1200px) {
  #build-bar { max-width: calc(100vw - 20px); min-width: 0; bottom: 214px; }
  #chat { width: 280px; height: 196px; }
  #left { width: 220px; }
  .brand { display: none; }
  .ibtn { width: 30px; }
}
@media (max-width: 760px) {
  #resources { justify-content: flex-start; overflow-x: auto; }
  .top-stats { display: none; }
  #chat, #left { display: none; }
  #selection { width: calc(100vw - 16px); }
  .help-grid, .keys, .kgrid, .treasury, .donate { grid-template-columns: 1fr 1fr; }
  .flag-edit { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  .toast, #build-bar, #error-flash, .btn { transition: none; }
}

/* ------------------------------------------------------------ mise à jour 2.0 */

/* Or précieux et trésor de guilde dans la barre du haut */
.stat.orp { color: #e7c8ff; }
.stat.orp svg { width: 20px; height: 20px; }
#res-label { font-family: var(--title); font-size: 12px; color: var(--gold-hi); white-space: nowrap; }
#res-label:empty { display: none; }
#resources.guild-view .res { background: rgba(120, 90, 30, 0.28); border-color: rgba(216, 178, 94, 0.45); }

/* Panneaux repliables : discussion, carte, armée */
.fold { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 4px; display: inline-flex; align-items: center; border-radius: 3px; }
.fold:hover { color: var(--gold-hi); background: rgba(242,214,138,0.08); }
#chat .tabs .fold { margin-left: auto; }
#chat.folded { height: auto; }
#chat.folded #chat-log, #chat.folded #chat-input { display: none; }
#chat.folded .fold svg, #minimap-wrap.folded .fold svg { transform: rotate(180deg); }
#minimap-wrap .fold { position: absolute; top: 4px; right: 4px; z-index: 2; background: rgba(20,14,10,0.7); }
#minimap-wrap.folded { width: auto; height: auto; padding: 3px; }
#minimap-wrap.folded #minimap { display: none; }
#minimap-wrap.folded .fold { position: static; }
#army .army-head .fold { margin-left: -4px; }
#army .army-head .seg.mini { margin-left: auto; }
#army .army-head .seg.mini button { padding: 1px 6px; font-size: 11px; }
#army .army-head .seg.mini + .btn { margin-left: 4px; }
.army-row kbd { min-width: 18px; text-align: center; }

/* Notifications plus discrètes */
#notifications { width: 380px; gap: 4px; top: 96px; }
.toast { padding: 5px 10px; font-size: 12.5px; gap: 7px; line-height: 1.3; }
.toast .ti svg { width: 15px; height: 15px; }
.toast small { font-size: 10.5px; }

/* Mode cinématique : plus aucune interface */
body.cinema #hud, body.cinema #sound-panel, body.cinema #tooltip { display: none !important; }
body.cinema #vignette { box-shadow: inset 0 0 220px rgba(10,6,2,0.55); }
#cine-hint { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 70; background: rgba(20,14,10,0.8); border: 1px solid var(--edge); color: var(--text); padding: 6px 14px; border-radius: 4px; font-size: 13px; opacity: 0; pointer-events: none; }
#cine-hint.show { animation: cinehint 3.2s ease forwards; }
@keyframes cinehint { 0% { opacity: 0; } 10%, 70% { opacity: 1; } 100% { opacity: 0; } }
#cine-hint small { opacity: 0.8; font-size: 12px; }
#cine-toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 70; background: rgba(20,14,10,0.8); border: 1px solid var(--edge); color: var(--text); padding: 6px 14px; border-radius: 4px; font-size: 13px; opacity: 0; pointer-events: none; white-space: nowrap; }
#cine-toast.show { animation: cinehint 2.6s ease forwards; }

/* Démolition de zone */
#build-tabs .area-btn { display: inline-flex; align-items: center; padding: 4px 8px; color: #f0a090; }
#build-tabs .area-btn:hover { color: #ffd0c4; }
#area-panel { position: fixed; bottom: 136px; left: 50%; transform: translateX(-50%); z-index: 9; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--panel); border: 1px solid #a5493a; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 520px; }
#area-panel small { font-size: 12px; color: var(--muted); }
#area-panel .area-sum { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; align-items: center; font-size: 14px; }
#area-panel .area-acts { display: flex; gap: 6px; }

/* Graphique du bilan */
.chart-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.chart-filters .seg button { font-size: 12.5px; padding: 4px 9px; }
.rchips { display: flex; gap: 3px; }
.rchip { background: var(--well); border: 1px solid transparent; border-radius: 4px; padding: 3px 4px; cursor: pointer; display: inline-flex; }
.rchip.on { border-color: var(--gold); background: rgba(242,214,138,0.12); }
.rchip:hover { border-color: var(--edge); }
.chart-card { background: var(--well); border-radius: 4px; padding: 8px 10px 10px; }
.chart-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.chart-title small { font-weight: 400; margin-left: 4px; }
.chart-wrap { position: relative; }
#kchart { display: block; width: 100%; height: 210px; }
#kchart .grid { stroke: rgba(243,230,200,0.08); stroke-width: 1; vector-effect: non-scaling-stroke; }
#kchart .zero { stroke: rgba(243,230,200,0.35); stroke-width: 1; vector-effect: non-scaling-stroke; }
#kchart .cross { stroke: rgba(243,230,200,0.5); stroke-width: 1; vector-effect: non-scaling-stroke; }
#kchart text { fill: var(--muted); font-size: 11px; font-family: var(--body); }
#kchart .ylab { text-anchor: end; }
.ch-tip { position: absolute; display: none; pointer-events: none; background: rgba(20,14,10,0.94); border: 1px solid var(--edge); border-radius: 4px; padding: 4px 8px; white-space: nowrap; }
.ch-tip b { display: block; color: var(--text); font-size: 14px; }
.ch-tip small { font-size: 11px; }
.chart-stats { margin-top: 8px; }
.chart-stats .kstat b { font-size: 17px; }

/* Guilde : niveau, recrutement, blason visuel */
.glevel { font-family: var(--body); font-size: 12px; font-weight: 700; color: #e7c8ff; border: 1px solid rgba(199,139,255,0.5); border-radius: 3px; padding: 0 5px; }
.ghead .gh-main { flex: 1; min-width: 0; }
.xpbar { position: relative; height: 13px; margin-top: 5px; background: rgba(0,0,0,0.45); border-radius: 3px; overflow: hidden; }
.xpbar i { position: absolute; left: 0; top: 0; bottom: 0; background: #8a5ec7; }
.xpbar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 13px; font-weight: 700; text-shadow: 0 1px 1px #000; }
.small { font-size: 12px; }
.ffl { font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.fpicks { display: flex; flex-wrap: wrap; gap: 4px; }
.fpick { position: relative; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; background: var(--well); border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 11px; color: var(--text); }
.fpick:hover:not(:disabled) { border-color: var(--edge); }
.fpick.on { border-color: var(--gold-hi); background: rgba(242,214,138,0.12); }
.fpick:disabled { opacity: 0.4; cursor: not-allowed; }
.fpick .ptier { position: absolute; top: 2px; right: 3px; }
.ptier.t1, .title-chip.t1, .ptitle.t1 { color: #d08a4a; }
.ptier.t2, .title-chip.t2, .ptitle.t2 { color: #c9d3dc; }
.ptier.t3, .title-chip.t3, .ptitle.t3 { color: #f2c94c; }
.gset { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; background: var(--well); border-radius: 4px; cursor: pointer; }
.radio span { display: flex; flex-direction: column; }
.radio small { font-size: 12px; }
#modal .ff input[type=number] { width: 120px; }

/* Discussion : grade, titre, noms cliquables */
#chat-log .rank-chip { font-size: 10px; padding: 0 4px; }
.title-chip { display: inline-flex; vertical-align: -1px; margin-right: 2px; }
.pname, .plink { cursor: pointer; }
.pname:hover, .plink:hover { text-decoration: underline; }
a.plink { color: inherit; }

/* Panneaux : vestiges, maîtres */
.big-ico { flex: none; width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; background: var(--well); border-radius: 4px; border: 1px solid #5a4630; }
.big-ico svg { width: 44px; height: 44px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.spec-grid .btn { justify-content: flex-start; }
.spec-grid img { width: 26px; height: 26px; }
.hint.mid { color: var(--mid); }

/* Compte et profils */
#modal .panel.profile-panel { width: 640px; }
.phead { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.phead h3 { margin: 0; font-family: var(--title); color: var(--gold-hi); font-size: 20px; }
.phead .flag { display: inline-block; vertical-align: -4px; }
.pdot { width: 40px; height: 40px; border-radius: 50%; flex: none; border: 2px solid rgba(0,0,0,0.45); }
.ptitle { font-family: var(--title); font-size: 13px; display: flex; align-items: center; gap: 4px; }
.kgrid.small { grid-template-columns: repeat(3, 1fr); }
.chart-stats.kgrid.small { grid-template-columns: repeat(4, 1fr); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.badge { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--well); border-radius: 4px; opacity: 0.38; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; border: 1px solid rgba(216,178,94,0.5); }
.badge svg { color: var(--gold-hi); }
.badge b { font-size: 13px; }
.badge small { font-size: 11px; line-height: 1.3; }
.skins { display: flex; flex-direction: column; gap: 4px; }
.skin-row, .shop-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: var(--well); border-radius: 4px; flex-wrap: wrap; }
.skin-row img, .shop-row img { width: 34px; height: 34px; object-fit: contain; }
.skin-row .gn, .shop-row .gn { flex: 1; min-width: 120px; }
.shop-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.shop-type { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; background: var(--well); border: 1px solid var(--edge); border-radius: 6px; color: inherit; font: inherit; cursor: pointer; }
.shop-type:hover { border-color: var(--gold-hi); }
.shop-type img { width: 44px; height: 44px; object-fit: contain; }
.shop-type .gn { font-size: 13px; text-align: center; }
.gallery { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.gal-row { background: var(--well); border-radius: 4px; padding: 4px 8px; }
.gal-levels, .gal-units { display: flex; flex-wrap: wrap; gap: 6px; }
.gal-cell { display: flex; flex-direction: column; align-items: center; font-size: 11px; width: 80px; }
.gal-cell img { width: 72px; height: 72px; object-fit: contain; }
.shop-back { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.skin-cat { margin-top: 8px; padding: 2px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-hi); border-bottom: 1px solid rgba(216,178,94,0.35); }
.skin-cat:first-child { margin-top: 0; }
.skin-cat small { margin-left: 4px; opacity: 0.6; font-weight: 400; }
.btn.on-sel { border-color: var(--gold-hi); background: var(--btn-primary); }

/* Boutique */
#modal .panel.shop-panel { width: 820px; }
.shop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pack { padding: 10px; border-radius: 6px; background: var(--well); border: 1px solid var(--edge); display: flex; flex-direction: column; gap: 6px; }
.pack h3 { margin: 0; font-family: var(--title); font-size: 16px; color: var(--gold-hi); }
.pack p { margin: 0; font-size: 13px; }
.pack.t-sombre { border-color: #6b3fa8; background: linear-gradient(rgba(70,40,110,0.25), rgba(0,0,0,0.2)); }
.pack.t-lumiere { border-color: #c9a044; background: linear-gradient(rgba(220,200,140,0.12), rgba(0,0,0,0.2)); }
.pack.t-classique { border-color: #5d8c3b; background: linear-gradient(rgba(60,110,50,0.22), rgba(0,0,0,0.2)); }
.pack.t-halloween { border-color: #d46a16; background: linear-gradient(rgba(180,80,20,0.2), rgba(0,0,0,0.2)); }
.pack-imgs { display: flex; flex-wrap: wrap; gap: 2px; }
.pack-imgs img { width: 44px; height: 44px; object-fit: contain; }
.pack-buy { display: flex; gap: 6px; align-items: center; margin-top: auto; }
.subs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sub-card { padding: 12px; border-radius: 6px; background: var(--well); border: 1px solid var(--edge); display: flex; flex-direction: column; gap: 6px; }
.sub-card h3 { margin: 0; font-family: var(--title); font-size: 16px; display: flex; align-items: center; gap: 6px; }
.sub-card .price { font-family: var(--title); font-size: 22px; color: var(--text); }
.sub-card ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.sub-card.t1 { border-color: #a8693a; } .sub-card.t1 h3 { color: #e0a06a; }
.sub-card.t2 { border-color: #9aa6b0; } .sub-card.t2 h3 { color: #dbe3ea; }
.sub-card.t3 { border-color: #d9a521; } .sub-card.t3 h3 { color: #f2c94c; }
.sub-card.cur { box-shadow: 0 0 0 2px var(--gold-hi) inset; }
.sub-card .btn { margin-top: auto; justify-content: center; }
@media (max-width: 760px) {
  .packs, .subs, .kgrid.small, .spec-grid { grid-template-columns: 1fr; }
  #notifications { width: calc(100vw - 32px); max-width: none; }
}

/* ------------------------------------------------------------ administration, paiement, liens légaux */
.legal-links { margin-top: 12px; font-size: 12px; color: var(--muted); }
.legal-links a, #modal .hint a, #modal p a { color: var(--gold-hi); }
#modal .panel.admin-panel { width: 860px; }
#modal .panel.pay-panel { width: 520px; }
.ad-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.ad-row input, .ad-row select { padding: 5px 8px !important; font-size: 14px !important; }
.ad-row input[type=number] { width: 110px; }
.ad-row label.small { display: inline-flex; align-items: center; gap: 4px; }
#modal textarea { width: 100%; background: rgba(0,0,0,0.35); border: 1px solid var(--edge); border-radius: 4px; padding: 8px 10px; color: var(--text); font-family: var(--body); font-size: 15px; resize: vertical; }
.warn-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid #a5493a; background: rgba(110,28,18,0.35); border-radius: 4px; margin-bottom: 10px; line-height: 1.45; }
.warn-box svg { color: #ff9a86; flex: none; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 14px; line-height: 1.4; cursor: pointer; }
.check input { margin-top: 3px; flex: none; accent-color: var(--gold); }
.check a { color: var(--gold-hi); }
.pay-sum { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--well); border-radius: 4px; margin-bottom: 8px; }
.pay-price { font-family: var(--title); font-size: 22px; color: var(--text); }
.promo-in { display: inline-flex; gap: 4px; align-items: center; }
.promo-in input { width: 140px; padding: 4px 8px !important; font-size: 13px !important; text-transform: uppercase; }
.btn s { opacity: 0.6; font-weight: 400; }
.shop-head { flex-wrap: wrap; gap: 8px; }
.pack-imgs .more { align-self: center; font-size: 13px; color: var(--muted); padding: 0 4px; }
.pack-imgs.units img { width: 36px; height: 36px; }

/* Choix de la langue : drapeaux en SVG */
.lang-switch { display: flex; gap: 8px; justify-content: center; margin: 0 0 12px; }
.lang-row { flex-wrap: wrap; gap: 8px; }
.flag-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--edge); border-radius: 6px; background: rgba(0,0,0,0.25); color: inherit; font: inherit; cursor: pointer; }
.flag-btn:hover { border-color: var(--gold); }
.flag-btn svg { width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.flag-btn.on { border-color: var(--gold-hi); box-shadow: inset 0 0 0 1px var(--gold-hi); }

/* Logo, invitation d'un seigneur */
.crest img { display: block; margin: 0 auto 4px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
#ref-note { background: rgba(242,214,138,0.1); border: 1px solid var(--edge); border-radius: 4px; padding: 6px 10px; margin-bottom: 12px; font-size: 13px; }

/* Guerres et rapports de bataille */
.war-card { background: var(--well); border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; }
.war-card.ended { opacity: 0.86; }
.war-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.war-head h3 { margin: 0; font-family: var(--title); font-size: 17px; color: var(--gold-hi); }
.rep-verdict { color: var(--gold); font-weight: 700; }
.rep-meta { font-size: 12px; margin: 2px 0 6px; }
.war-table { margin-top: 4px; }
.rep-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rep-side { background: rgba(0,0,0,0.2); border-left: 3px solid transparent; border-radius: 3px; padding: 6px 10px; min-width: 0; }
.rep-side.won { border-left-color: var(--gold); }
.rep-side h4 { margin: 0 0 4px; font-size: 14px; overflow-wrap: anywhere; }
.rep-side dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.rep-side dt { color: var(--muted); }
.rep-side dd { margin: 0; overflow-wrap: anywhere; }
.rep-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
a.rep-link { color: var(--gold-hi); }
@media (max-width: 640px) { .rep-sides { grid-template-columns: 1fr; } }
