/* ==========================================================================
   Regnivar — thème bois, parchemin et or
   ========================================================================== */

:root {
  --wood-950: #140d07;
  --wood-900: #1c130b;
  --wood-800: #2a1c10;
  --wood-700: #3a2716;
  --wood-600: #4d341d;
  --wood-500: #6b4826;
  --wood-400: #8b6236;
  --parch-50: #fbf4e2;
  --parch-100: #f4e8c9;
  --parch-200: #ead9b0;
  --parch-300: #dcc591;
  --parch-400: #c6a96d;
  --ink: #2b1d0e;
  --ink-soft: #5e4529;
  --ink-mute: #8a6f4c;
  --gold: #d4a73a;
  --gold-light: #f0cf6a;
  --gold-dark: #8a6516;
  --red: #a8322a;
  --red-light: #d9534f;
  --green: #3f7d34;
  --blue: #2f5f9e;
  --cream: #f6ecd2;
  --font-title: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-body: 'EB Garamond', Garamond, Georgia, serif;
  --topbar-h: 58px;
  --banner-h: 0px;
  /* Barre de boutons et dock (mesurés par le jeu), mini-carte et discussion. */
  --side-h: 56px;
  --dock-h: 116px;
  --mini: clamp(240px, 16.5vw, 320px);
  --chat-w: 300px;
  --radius: 7px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--wood-950);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button, input, select { font: inherit; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Icônes
   -------------------------------------------------------------------------- */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; vertical-align: middle; }
.ico svg { width: 100%; height: 100%; display: block; }
.ico > img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ico.lg { width: 26px; height: 26px; }
.ico.xl { width: 38px; height: 38px; }

/* --------------------------------------------------------------------------
   Parchemin & boutons
   -------------------------------------------------------------------------- */
.parchment {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.55), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(140, 100, 40, 0.18), transparent 60%),
    linear-gradient(160deg, var(--parch-50), var(--parch-200) 60%, var(--parch-300));
  border: 2px solid var(--wood-600);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 245, 210, 0.7), inset 0 0 0 4px rgba(138, 101, 22, 0.35), inset 0 0 40px rgba(120, 80, 30, 0.18);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--wood-900);
  border-radius: 5px;
  background: linear-gradient(#8b5d31, #6a431f 55%, #5a3818);
  color: var(--cream);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.35), 0 2px 3px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
  transition: filter 0.12s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; filter: grayscale(0.85) brightness(0.85); opacity: 0.65; }
.btn.primary {
  background: linear-gradient(#f2d06c, #d4a73a 50%, #b58620);
  border-color: #6b4b10;
  color: #2b1a05;
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 250, 220, 0.8), 0 2px 4px rgba(0, 0, 0, 0.35);
}
.btn.danger { background: linear-gradient(#c24a3c, #9c2f24 55%, #82251c); border-color: #3d0f0a; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 11px 18px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn .ico { width: 17px; height: 17px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(212, 167, 58, 0.45);
  background: rgba(20, 13, 7, 0.55);
  color: var(--parch-100);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(60, 40, 20, 0.8); color: #fff; }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn .ico { width: 17px; height: 17px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-family: var(--font-title); font-size: 12.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; }
.field input, .field select, input.qty {
  padding: 9px 11px;
  border: 1px solid var(--parch-400);
  border-radius: 5px;
  background: rgba(255, 252, 240, 0.85);
  color: var(--ink);
  box-shadow: inset 0 1px 3px rgba(80, 50, 10, 0.18);
  outline: none;
  user-select: text;
}
.field input:focus, .field select:focus, input.qty:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(212, 167, 58, 0.3); }
input.qty { width: 62px; padding: 5px 6px; text-align: center; }
textarea.fb-text {
  width: 100%;
  min-height: 150px;
  padding: 9px 11px;
  resize: vertical;
  border: 1px solid var(--parch-400);
  border-radius: 5px;
  background: rgba(255, 252, 240, 0.85);
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  box-shadow: inset 0 1px 3px rgba(80, 50, 10, 0.18);
  outline: none;
  user-select: text;
}
textarea.fb-text:focus { border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(212, 167, 58, 0.3); }
.fb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 10px; }
.fb-attach { margin: 0 0 10px; }
.fb-attach .field { margin-bottom: 5px; }
.fb-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 9px 10px;
  border: 2px dashed var(--parch-400);
  border-radius: 6px;
  background: rgba(255, 252, 240, 0.5);
  font-size: 13.5px;
  color: var(--ink-soft);
}
.feedback.dragging .fb-drop { border-color: var(--gold-dark); background: rgba(240, 207, 106, 0.25); }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.fb-thumbs:empty { display: none; }
.fb-thumb { position: relative; width: 86px; }
.fb-thumb img {
  display: block;
  width: 86px;
  height: 64px;
  object-fit: cover;
  border: 2px solid var(--wood-500);
  border-radius: 6px;
  background: #2b2418;
}
.fb-thumb span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-soft); text-align: center; }
.fb-thumb button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--wood-600);
  border-radius: 50%;
  background: var(--parch-100);
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.fb-thumb button:hover { background: #f3d4c8; }
.fb-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Écran de connexion
   -------------------------------------------------------------------------- */
#auth-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.auth-bg { position: fixed; inset: 0; width: 100%; height: 100%; }
.auth-bg .clouds { animation: drift 60s linear infinite alternate; }
.auth-bg .banner { animation: wave 2.6s ease-in-out infinite alternate; transform-origin: left center; transform-box: fill-box; }
@keyframes drift { to { transform: translateX(80px); } }
@keyframes wave { to { transform: skewY(4deg) scaleX(0.94); } }

.auth-card { position: relative; width: min(420px, 100%); padding: 34px 32px 22px; text-align: center; }
.auth-crest { width: 64px; height: 64px; margin: -70px auto 6px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
.auth-crest svg { width: 100%; height: 100%; }
.auth-card h1 { margin: 0; font-family: var(--font-title); font-weight: 800; font-size: 32px; letter-spacing: 0.04em; color: #4a2a0c; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
.tagline { margin: 2px 0 20px; font-style: italic; color: var(--ink-soft); font-size: 17px; }
.auth-tabs { display: flex; margin-bottom: 18px; border-bottom: 2px solid var(--parch-400); }
.auth-tab { flex: 1; padding: 8px; border: 0; background: none; font-family: var(--font-title); font-weight: 700; color: var(--ink-mute); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.auth-tab.active { color: var(--ink); border-color: var(--gold-dark); }
#auth-form { text-align: left; }
.auth-error { min-height: 22px; color: var(--red); font-weight: 600; font-size: 15px; margin: -2px 0 8px; }
.auth-error.ok { color: var(--green); }
.auth-world { margin: 16px 0 0; font-size: 14px; color: var(--ink-mute); }

/* --------------------------------------------------------------------------
   Écran de jeu
   -------------------------------------------------------------------------- */
#game-screen { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing !important; }

/* Barre supérieure */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 6px 14px;
  padding: 5px 14px;
  background: linear-gradient(#3e2a17, #2a1c10 60%, #21160c);
  border-bottom: 2px solid var(--gold-dark);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.55), inset 0 -1px 0 rgba(240, 207, 106, 0.35);
  color: var(--cream);
  z-index: 20;
}
.brand { min-width: 0; flex: none; }
.brand-title { font-family: var(--font-title); font-weight: 800; font-size: 17px; letter-spacing: 0.05em; color: var(--gold-light); text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6); white-space: nowrap; }
.brand-sub { font-size: 13px; color: var(--parch-300); font-style: italic; white-space: nowrap; }

#resources { display: flex; gap: 6px; flex: 1; justify-content: center; min-width: 0; }
.res {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 92px;
  padding: 4px 10px 4px 6px;
  border-radius: 6px;
  background: rgba(10, 6, 2, 0.45);
  border: 1px solid rgba(212, 167, 58, 0.25);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.res .ico { width: 24px; height: 24px; }
.res-text { display: flex; flex-direction: column; line-height: 1.05; }
.res .val { font-family: var(--font-title); font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.res .inc { font-size: 11.5px; color: #9fd47f; min-height: 0; }
.res .progress.mini { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border: 0; border-radius: 0; background: transparent; opacity: 0; }
.res.producing { border-color: var(--gold); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 10px rgba(240, 207, 106, 0.35); }
.res.producing .progress.mini { opacity: 1; }

/* Raccourci : lancer une ressource dans toutes les villes libres */
.prod-all {
  flex: none;
  padding: 4px 8px 5px;
  border-radius: 7px;
  border: 1px solid rgba(212, 167, 58, 0.45);
  background: rgba(10, 6, 2, 0.45);
}
.prod-all.idle { border-color: #e2683f; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px rgba(226, 104, 63, 0.35), 0 0 16px rgba(226, 104, 63, 0.5); } }
.pa-title { font-family: var(--font-title); font-size: 12px; font-weight: 700; color: var(--gold-light); white-space: nowrap; line-height: 1.2; }
.prod-all.idle .pa-title { color: #ffb08a; }
.pa-count { font-family: var(--font-body); font-weight: 600; color: var(--parch-200); }
.pa-btns { display: flex; gap: 4px; margin-top: 3px; }
.pa-res { width: 30px; height: 26px; padding: 2px; border-radius: 4px; border: 1px solid rgba(212, 167, 58, 0.5); background: rgba(70, 46, 22, 0.9); cursor: pointer; display: grid; place-items: center; }
.pa-res:hover:not(:disabled) { background: #8b5d31; }
.pa-res:disabled { opacity: 0.35; cursor: default; }
.pa-res .ico { width: 20px; height: 20px; }

/* Villes : nom et quatre pastilles (production, amélioration, recherche, formation) */
.cities { flex: 1 1 0; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.cities::-webkit-scrollbar { display: none; }
.city { flex: none; padding: 3px 6px 4px; border-radius: 6px; cursor: pointer; background: rgba(10, 6, 2, 0.45); border: 1px solid rgba(212, 167, 58, 0.25); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
.city:hover { border-color: var(--gold); }
.city-name { display: flex; align-items: center; gap: 3px; max-width: 160px; font-family: var(--font-title); font-size: 11.5px; font-weight: 700; line-height: 1.25; color: var(--cream); }
.city-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-name .ico { width: 12px; height: 12px; flex: none; }
.city-slots { display: flex; gap: 4px; margin-top: 3px; }
.slot { --deg: 0deg; position: relative; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: conic-gradient(var(--gold-light) var(--deg), rgba(240, 207, 106, 0.22) 0); }
.slot::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: #2a1c10; }
.slot > .ico { position: relative; width: 16px; height: 16px; }
.slot > .ico img { width: 100%; height: 100%; object-fit: contain; }
.slot.empty { background: none; box-shadow: inset 0 0 0 1.5px rgba(212, 167, 58, 0.4); }
.slot.empty::before { display: none; }
.slot.empty:first-child { box-shadow: inset 0 0 0 1.5px #e2683f; }
.slot:hover { filter: brightness(1.25); }
.warn-text { color: #c0492f; }

.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.player-chip { display: flex; align-items: center; gap: 8px; }
.player-chip .dot { width: 14px; height: 14px; }
.chip-name { font-family: var(--font-title); font-weight: 700; font-size: 14px; line-height: 1.1; }
.chip-sub { font-size: 12px; color: var(--parch-300); }
.prot-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; background: rgba(47, 95, 158, 0.55); border: 1px solid #6fa0e0; font-size: 12px; white-space: nowrap; }
.prot-badge .ico { width: 14px; height: 14px; }

.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(20, 12, 4, 0.8); flex: none; }

/* Barre de boutons, en haut à gauche */
#sidebar {
  position: absolute;
  top: calc(var(--topbar-h) + var(--banner-h) + 10px);
  left: 12px;
  display: flex;
  flex-direction: row;
  gap: 6px;
  z-index: 15;
}
.side-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 68px;
  padding: 7px 4px 5px;
  border-radius: 8px;
  border: 1px solid var(--gold-dark);
  background: linear-gradient(#3e2a17, #24180d);
  color: var(--parch-100);
  font-family: var(--font-title);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(240, 207, 106, 0.25);
}
.side-btn:hover { background: linear-gradient(#5a3d20, #33220f); color: #fff; }
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--gold);
  color: #2b1a05;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  border: 1.5px solid var(--wood-900);
}
.badge.red { background: var(--red-light); color: #fff; animation: pulse 1.4s infinite; }

/* Panneau */
#panel {
  position: absolute;
  top: calc(var(--topbar-h) + var(--banner-h) + 12px);
  right: 12px;
  bottom: calc(var(--mini) + 10px);
  width: 384px;
  display: flex;
  flex-direction: column;
  z-index: 16;
  overflow: hidden;
  animation: slide-in 0.18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.panel-head {
  --owner: var(--gold-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--parch-400);
  background: linear-gradient(90deg, color-mix(in srgb, var(--owner) 26%, transparent), transparent 70%);
}
.panel-titles { flex: 1; min-width: 0; }
.panel-head h2 { margin: 0; font-family: var(--font-title); font-size: 18px; font-weight: 800; color: #3b2108; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-sub { font-size: 14px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head .icon-btn.close { background: rgba(60, 40, 20, 0.12); color: var(--ink-soft); border-color: var(--parch-400); }
.panel-head .icon-btn.close:hover { background: rgba(60, 40, 20, 0.25); color: var(--ink); }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 14px 16px; scrollbar-width: thin; scrollbar-color: var(--parch-400) transparent; }

.section { padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px dashed var(--parch-400); }
.sub-title { margin: 12px 0 6px; font-family: var(--font-title); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.section .btn.wide { margin-top: 10px; }
.muted { color: var(--ink-mute); }
.small { font-size: 13.5px; }
.hint { margin: 6px 0 10px; padding: 7px 10px; border-left: 3px solid var(--gold); background: rgba(212, 167, 58, 0.12); font-size: 14.5px; color: var(--ink-soft); border-radius: 0 4px 4px 0; }
.empty { padding: 10px 2px; font-style: italic; }

.stat-bar { margin-bottom: 4px; }
.stat-head { display: flex; align-items: center; gap: 6px; font-family: var(--font-title); font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.stat-head .muted { margin-left: auto; font-family: var(--font-body); font-weight: 600; font-variant-numeric: tabular-nums; }

.progress { height: 9px; border-radius: 5px; background: rgba(60, 40, 18, 0.25); border: 1px solid rgba(60, 40, 18, 0.35); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(#f2d06c, #c9951f); border-radius: 4px; transition: width 0.25s linear; }
.progress.walls > i { background: linear-gradient(#cfd5dc, #8b97a3); }
.progress.walls.low > i { background: linear-gradient(#e4826a, #b33a2a); }
.progress.thin { height: 6px; margin: 3px 0; }

.unit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.unit-cell { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; background: rgba(255, 252, 240, 0.55); border: 1px solid rgba(160, 125, 70, 0.35); }
.unit-cell .ico { width: 22px; height: 22px; }
.unit-cell b { font-family: var(--font-title); font-size: 14px; font-variant-numeric: tabular-nums; }
.unit-cell.zero { opacity: 0.45; }

.tabs { display: flex; gap: 4px; margin: 6px 0 10px; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; border: 1px solid var(--parch-400); border-radius: 6px 6px 0 0; background: rgba(120, 85, 35, 0.12); font-family: var(--font-title); font-size: 12.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer; border-bottom-width: 3px; }
.tab.active { background: rgba(255, 250, 230, 0.7); color: var(--ink); border-bottom-color: var(--gold-dark); }

.card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border-radius: 6px; background: rgba(255, 252, 240, 0.6); border: 1px solid var(--parch-400); }
.card-title { font-family: var(--font-title); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card .grow, .grow { flex: 1; min-width: 0; }
.prod-current.idle { border-color: #d0784f; background: rgba(226, 104, 63, 0.1); }

.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(255, 252, 240, 0.45); border: 1px solid rgba(160, 125, 70, 0.3); }
.row.active, .build-row.active { border-color: var(--gold); background: rgba(240, 207, 106, 0.22); box-shadow: inset 0 0 0 1px rgba(212, 167, 58, 0.4); }
.row-title { font-family: var(--font-title); font-weight: 700; font-size: 14px; }
.lvl { font-family: var(--font-body); font-weight: 600; color: var(--ink-mute); }
.yield { font-family: var(--font-title); font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.lvl-badge { display: inline-block; padding: 0 7px; border-radius: 9px; background: var(--wood-600); color: var(--cream); font-size: 11.5px; vertical-align: 2px; }

.build-row, .unit-card { padding: 10px; border-radius: 6px; background: rgba(255, 252, 240, 0.5); border: 1px solid rgba(160, 125, 70, 0.32); position: relative; }
.build-head, .unit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.effect { font-size: 14px; color: var(--ink-soft); margin: 4px 0 6px; font-style: italic; }
.build-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.build-foot .btn { margin-left: auto; }
.costs { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cost { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.cost .ico { width: 17px; height: 17px; }
.cost.lack { color: var(--red); }
.time { font-size: 13.5px; color: var(--ink-mute); white-space: nowrap; }

.stats { display: flex; gap: 10px; font-weight: 600; font-size: 14px; }
.stats span { display: inline-flex; align-items: center; gap: 3px; }
.stats .ico { width: 15px; height: 15px; }
.train-ctl { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.train-ctl .btn.primary { margin-left: auto; }
.unit-card.locked > *:not(.lock) { opacity: 0.45; }
.unit-card .lock { display: none; }
.unit-card.locked .lock { display: block; position: absolute; right: 10px; top: 10px; padding: 2px 8px; border-radius: 10px; background: var(--wood-700); color: var(--cream); font-size: 12px; font-family: var(--font-title); }

.queue { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.queue-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; background: rgba(255, 252, 240, 0.55); border: 1px solid rgba(160, 125, 70, 0.3); }
.queue-item .icon-btn { background: rgba(60, 40, 20, 0.12); color: var(--red); border-color: var(--parch-400); }
.card .cancel-btn, .queue-item .cancel-btn { flex: none; align-self: center; }

.owner-line { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 15.5px; }
.status-lines { margin-top: 6px; }
.status { padding: 4px 8px; border-radius: 4px; margin-top: 4px; font-weight: 600; font-size: 14.5px; }
.status.bad { background: rgba(168, 50, 42, 0.15); color: var(--red); }
.status.good { background: rgba(63, 125, 52, 0.15); color: var(--green); }
.status.info { background: rgba(47, 95, 158, 0.13); color: var(--blue); }
.status.muted { background: rgba(120, 90, 50, 0.1); }

.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }

.army-row { cursor: pointer; }
.army-row:hover { background: rgba(240, 207, 106, 0.2); }
.army-row.threat { border-color: rgba(168, 50, 42, 0.5); background: rgba(168, 50, 42, 0.08); }

.report { border-radius: 6px; border: 1px solid rgba(160, 125, 70, 0.32); background: rgba(255, 252, 240, 0.5); overflow: hidden; }
.report.unread { border-left: 4px solid var(--gold); }
.report.victory .report-head .ico, .report.capture .report-head .ico { filter: drop-shadow(0 0 3px rgba(240, 207, 106, 0.7)); }
.report.defeat { background: rgba(168, 50, 42, 0.07); }
.report-head { display: flex; align-items: center; gap: 9px; padding: 8px 10px; cursor: pointer; }
.report-head .chev { color: var(--ink-mute); transition: transform 0.15s; }
.report.open .chev { transform: rotate(180deg); }
.report-lines { display: none; padding: 0 12px 10px 45px; font-size: 14.5px; color: var(--ink-soft); }
.report-lines div { margin-top: 3px; }
.report.open .report-lines { display: block; }
.report-lines a, .report-text a { color: var(--blue); }
.report-lines .sign, .report-text .sign { text-align: right; font-style: italic; color: var(--ink); }

/* Rapport en grand */
.modal.report-view { width: min(680px, 100%); display: flex; flex-direction: column; overflow: hidden; padding: 18px 22px; }
.report-view .modal-head h2 { font-size: 22px; }
.report-text { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; font-size: 16px; line-height: 1.55; color: var(--ink-soft); user-select: text; }
.report-text > div + div { margin-top: 10px; }
.report-view .btn-row { flex: none; margin-top: 16px; }

.ranking { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 34px 1fr 52px 64px; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid rgba(160, 125, 70, 0.25); cursor: pointer; }
.rank-row:hover:not(.head) { background: rgba(240, 207, 106, 0.18); }
.rank-row.head { font-family: var(--font-title); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); cursor: default; }
.rank-row.me { background: rgba(240, 207, 106, 0.3); font-weight: 600; }
.rank-row .rank { font-family: var(--font-title); font-weight: 800; text-align: center; }
.rank-row .name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row b { text-align: right; font-variant-numeric: tabular-nums; }

.world.current { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(212, 167, 58, 0.5); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 8px; background: var(--gold); color: #2b1a05; font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; }
.world .progress { margin: 5px 0 3px; }


/* Mini-carte, collée au coin en bas à droite */
#minimap-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--mini);
  height: var(--mini);
  padding: 5px;
  border-radius: 8px 0 0 0;
  background: linear-gradient(#3e2a17, #21160c);
  border: 2px solid var(--gold-dark);
  border-right: 0;
  border-bottom: 0;
  box-shadow: var(--shadow);
  z-index: 15;
}
#minimap { width: 100%; height: 100%; display: block; border-radius: 4px; cursor: crosshair; touch-action: none; }
#minimap.panning { cursor: grabbing; }
.mini-zoom { position: absolute; top: 11px; left: 11px; display: flex; flex-direction: column; gap: 4px; }
.mini-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--gold-dark);
  background: linear-gradient(rgba(62, 42, 23, 0.92), rgba(36, 24, 13, 0.92));
  color: var(--parch-100);
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.mini-btn:hover:not(:disabled) { background: linear-gradient(#5a3d20, #33220f); color: #fff; }
.mini-btn:disabled { opacity: 0.4; cursor: default; }

/* Journal du royaume */
#feed { position: absolute; left: calc(var(--chat-w) + 24px); bottom: 14px; display: flex; flex-direction: column; gap: 4px; max-width: min(460px, calc(100vw - 340px)); z-index: 12; pointer-events: none; }
.feed-item { padding: 5px 11px; border-radius: 5px; background: rgba(20, 13, 7, 0.78); border: 1px solid rgba(212, 167, 58, 0.35); color: var(--parch-100); font-size: 14.5px; text-shadow: 0 1px 1px #000; animation: fade-in 0.4s ease-out; transition: opacity 0.8s; }
.feed-item.out { opacity: 0; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* Notifications */
#toasts { position: absolute; top: calc(var(--topbar-h) + var(--banner-h) + 12px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; padding: 8px 16px; border-radius: 6px; background: rgba(28, 19, 11, 0.95); border: 1px solid var(--gold-dark); color: var(--cream); font-size: 15.5px; box-shadow: var(--shadow); cursor: pointer; animation: toast-in 0.25s ease-out; transition: opacity 0.45s, transform 0.45s; max-width: min(520px, 90vw); text-align: center; }
.toast.good { border-color: #6fbf5a; box-shadow: var(--shadow), inset 3px 0 0 #6fbf5a; }
.toast.bad { border-color: var(--red-light); box-shadow: var(--shadow), inset 3px 0 0 var(--red-light); }
.toast.warn { border-color: #e2a33f; box-shadow: var(--shadow), inset 3px 0 0 #e2a33f; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* Choix de cible */
#pick-banner { position: absolute; top: calc(var(--topbar-h) + var(--banner-h) + 14px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 8px; background: rgba(28, 19, 11, 0.95); border: 2px solid #e0533c; color: var(--cream); font-family: var(--font-title); font-weight: 700; z-index: 30; box-shadow: var(--shadow); }

/* Rappel de vérification de l'adresse e-mail */
#game-screen.has-banner { --banner-h: 42px; }
#verify-banner { position: absolute; top: var(--topbar-h); left: 0; right: 0; height: var(--banner-h); display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; background: linear-gradient(#4a3216, #33220f); border-bottom: 1px solid var(--gold-dark); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), inset 3px 0 0 #e2a33f; color: var(--cream); font-size: 15px; z-index: 19; }
#verify-banner .ico { width: 22px; height: 22px; }
.vb-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-text > b { font-family: var(--font-title); font-size: 13.5px; color: var(--gold-light); letter-spacing: 0.02em; }
.vb-detail b { color: #fff; font-weight: 600; }
.vb-form { display: flex; align-items: center; gap: 6px; flex: 0 1 460px; min-width: 0; }
.vb-input { flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--parch-400); border-radius: 5px; background: rgba(255, 252, 240, 0.94); color: var(--ink); outline: none; user-select: text; }
.vb-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 167, 58, 0.35); }
#verify-banner .vb-close { flex: none; }
#game-screen.blocked #verify-banner { z-index: 61; }
#game-screen.blocked #toasts { z-index: 62; }
#conn-overlay.static .spinner { display: none; }

/* Boîtes de dialogue */
.modal-backdrop { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8, 5, 2, 0.55); z-index: 50; animation: fade 0.15s; }
.modal-backdrop.soft { background: rgba(8, 5, 2, 0.25); }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(500px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px 18px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-family: var(--font-title); font-size: 19px; color: #3b2108; }
.modal-head .icon-btn.close { background: rgba(60, 40, 20, 0.12); color: var(--ink-soft); border-color: var(--parch-400); }
.send-tools { display: flex; align-items: center; gap: 6px; }
.send-tools .sub-title { flex: 1; margin: 4px 0; }
.send-units { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 12px; }
.send-row { display: grid; grid-template-columns: 28px 1fr 110px 62px auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; background: rgba(255, 252, 240, 0.55); border: 1px solid rgba(160, 125, 70, 0.3); }
.send-name { font-family: var(--font-title); font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send-row input[type='range'] { width: 100%; accent-color: var(--gold-dark); }
.send-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border-radius: 6px; background: rgba(60, 40, 18, 0.09); border: 1px solid var(--parch-400); }
.send-summary > div { display: flex; align-items: center; gap: 6px; font-size: 14.5px; }
.send-summary b { margin-left: auto; font-variant-numeric: tabular-nums; }
.send-summary .lack b { color: var(--red); }
.warns { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.warn { padding: 5px 9px; border-radius: 4px; background: rgba(226, 163, 63, 0.18); border-left: 3px solid #d18b1f; font-size: 14.5px; }
.eliminated { text-align: center; }
.eliminated h2 { font-family: var(--font-title); color: var(--red); margin: 6px 0; }
.modal-ico .ico { width: 56px; height: 56px; }

/* Connexion perdue */
#conn-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(12, 8, 4, 0.82); color: var(--parch-100); font-family: var(--font-title); font-size: 18px; z-index: 60; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(212, 167, 58, 0.25); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Écrans étroits
   -------------------------------------------------------------------------- */
@media (max-width: 1440px) {
  .brand { display: none; }
  .res { min-width: 0; padding-right: 8px; }
  /* Les villes passent sur une deuxième ligne. */
  .cities { order: 5; flex: 1 1 100%; }
}
@media (max-width: 980px) {
  #topbar { padding: 6px 10px; gap: 6px 10px; }
  #resources { order: 3; flex: 1 1 100%; justify-content: space-between; gap: 4px; }
  .cities { order: 0; flex: 1 1 0; }
  .res { flex: 1; gap: 4px; padding: 3px 5px; }
  .res .ico { width: 20px; height: 20px; }
  .res .inc { display: none; }
  .chip-sub, .prot-badge span { display: none; }
}
@media (max-width: 760px) {
  #sidebar { top: auto; bottom: 10px; left: 10px; right: 10px; flex-direction: row; justify-content: space-between; gap: 4px; }
  .side-btn { flex: 1; width: auto; font-size: 9px; padding: 5px 2px 4px; }
  .side-btn .ico.lg { width: 22px; height: 22px; }
  #panel { left: 10px; right: 10px; top: auto; bottom: 74px; width: auto; height: min(62vh, 560px); }
  #minimap-wrap { width: 120px; height: 120px; top: calc(var(--topbar-h) + var(--banner-h) + 10px); right: 10px; bottom: auto; }
  #feed { left: 10px; bottom: 78px; max-width: calc(100vw - 20px); }
  .send-row { grid-template-columns: 26px 1fr 62px auto; }
  .send-row input[type='range'] { display: none; }
  .player-chip > div { display: none; }
  .vb-detail { display: none; }
  #verify-banner { gap: 6px; padding: 0 8px; }
  .vb-text { white-space: normal; line-height: 1.1; }
  .vb-text > b { font-size: 11.5px; }
  #verify-banner .btn.small { padding: 4px 7px; font-size: 11.5px; }
  #verify-banner.editing .vb-text { display: none; }
  .vb-form { flex: 1; }
}
@media (max-width: 440px) {
  #topbar { padding: 5px 6px; gap: 5px 6px; }
  .res { padding: 2px 4px; gap: 3px; }
  .res .ico { width: 16px; height: 16px; }
  .res .val { font-size: 12px; }
  .res-text { min-width: 0; overflow: hidden; }
  .prod-all { padding: 3px 5px 4px; }
  .pa-count { display: none; }
  .pa-res { width: 23px; height: 22px; }
  .pa-res .ico { width: 17px; height: 17px; }
  .city { padding: 2px 4px 3px; }
  .city-name { max-width: 92px; font-size: 10.5px; }
  .slot { width: 21px; height: 21px; }
  .slot > .ico { width: 13px; height: 13px; }
  .side-btn > span:not(.ico):not(.badge) { display: none; }
  .side-btn { padding: 7px 2px; }
  .tab .ico { display: none; }
  .tab { font-size: 11px; padding: 6px 2px; }
  .panel-head h2 { font-size: 16px; }
  .panel-body { padding: 10px 10px 14px; }
  .unit-cell { padding: 3px 5px; gap: 3px; }
  .train-ctl { flex-wrap: wrap; }
  #minimap-wrap { width: 96px; height: 96px; }
}

/* --------------------------------------------------------------------------
   Bases complètes, groupes, alliance (version 2)
   -------------------------------------------------------------------------- */
.unit-ico { display: inline-flex; align-items: flex-end; justify-content: center; overflow: visible; }
.unit-ico img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.unit-ico.lg { width: 30px; height: 30px; }
.unit-ico.xl { width: 42px; height: 42px; }
.unit-cell .unit-ico { width: 24px; height: 24px; }

.res.pop .val { font-size: 13.5px; }
.res.pop.full { border-color: var(--red-light); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(217, 83, 79, 0.45); }

.tabs { gap: 3px; }
.tab { flex-direction: column; gap: 2px; padding: 5px 2px; font-size: 10.5px; min-width: 0; }
.tab span:not(.ico) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.tag.class { margin-left: 6px; background: var(--wood-600); color: var(--cream); vertical-align: 2px; }
.tag.ally { margin-left: 6px; background: #3d7fb3; color: #fff; }

.tower-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.tower-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; background: rgba(255, 252, 240, 0.5); border: 1px solid rgba(160, 125, 70, 0.3); }
.tower-row .progress { margin-top: 3px; }
.occ { letter-spacing: 1px; color: var(--gold-dark); font-size: 12px; }
.tower-buy { align-items: flex-end; }

.tech-chips, .bld-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 11px; background: rgba(255, 252, 240, 0.65); border: 1px solid rgba(160, 125, 70, 0.35); font-size: 13px; font-weight: 600; }
.chip .ico { width: 16px; height: 16px; }

.stats { flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }

.split-menu { position: fixed; z-index: 70; width: 250px; padding: 10px 12px; animation: fade 0.12s; }
.split-ctl { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.split-ctl input[type='range'] { flex: 1; accent-color: var(--gold-dark); }

.chat-log { height: 220px; overflow-y: auto; padding: 8px; border-radius: 6px; background: rgba(255, 252, 240, 0.7); border: 1px solid var(--parch-400); box-shadow: inset 0 1px 4px rgba(80, 50, 10, 0.18); user-select: text; }
.chat-msg { font-size: 14.5px; line-height: 1.35; margin-bottom: 3px; word-wrap: break-word; }
.chat-msg.me b { text-decoration: underline; text-decoration-color: var(--gold); }
.chat-msg.sys { font-style: italic; color: var(--ink-mute); }
.chat-time { font-size: 11.5px; color: var(--ink-mute); margin-right: 5px; font-variant-numeric: tabular-nums; }
.chat-form { display: flex; gap: 6px; margin: 6px 0 4px; }
.chat-form input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--parch-400); border-radius: 5px; background: rgba(255, 252, 240, 0.85); user-select: text; }
.chat-form input:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(212, 167, 58, 0.3); }
.panel-head .unit-ico.xl { width: 44px; height: 44px; }

/* --------------------------------------------------------------------------
   Fenêtre de garnison (en bas, du bord gauche à la mini-carte) : population
   et unités par lieu, sur le même parchemin que le panneau de droite
   -------------------------------------------------------------------------- */
#dock {
  position: absolute;
  left: 0;
  right: var(--mini);
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 14;
}
.dock-head { display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.dock-pop {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px 5px;
  margin-bottom: -2px;
  border: 2px solid var(--wood-600);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(var(--parch-50), var(--parch-200));
  box-shadow: inset 0 1px 0 rgba(255, 245, 210, 0.8);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
}
.dock-pop .ico { width: 18px; height: 18px; }
.dock-pop.full { color: var(--red); }
.dock-tabs { display: flex; gap: 3px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.dock-tabs::-webkit-scrollbar { display: none; }
.dock-tab {
  flex: none;
  max-width: 200px;
  padding: 5px 12px 3px;
  margin-top: 2px;
  border: 2px solid var(--wood-600);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(var(--parch-200), var(--parch-400));
  font-family: var(--font-title);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.dock-tab:hover { background: linear-gradient(var(--parch-100), var(--parch-300)); color: var(--ink); }
.dock-tab.active {
  margin-top: 0;
  margin-bottom: -2px;
  padding-bottom: 7px;
  background: linear-gradient(var(--parch-50), var(--parch-100));
  color: var(--ink);
  box-shadow: inset 0 3px 0 var(--gold-dark);
  position: relative;
  z-index: 1;
}
.dock-body {
  display: flex;
  gap: 8px;
  height: 86px;
  padding: 5px 10px 3px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 0 var(--radius) 0 0;
  border-left: 0;
  border-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--parch-400) transparent;
}
.dock-body .empty { align-self: center; padding-left: 4px; }
.dock-unit {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 78px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.dock-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 74px;
  height: 60px;
  padding: 3px 3px 2px;
  border: 2px solid var(--wood-500);
  border-radius: 8px;
  background: rgba(255, 252, 240, 0.7);
  box-shadow: 0 1px 3px rgba(60, 35, 10, 0.25);
}
.dock-unit:hover .dock-frame { border-color: var(--gold-dark); background: rgba(240, 207, 106, 0.25); }
.dock-frame .unit-ico { width: 40px; height: 38px; }
.dock-name { font-size: 11.5px; line-height: 1.1; max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-n { font-family: var(--font-title); font-size: 17px; line-height: 1.1; }
#feed { bottom: calc(var(--dock-h) + 10px); }

/* Menu Admin (comptes développeur) */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; margin: 4px 0; }
.admin-field { display: flex; align-items: center; gap: 5px; }
.admin-field .qty { flex: 1; min-width: 0; width: 100%; }
.admin-label { margin: 8px 0 2px; font-family: var(--font-title); font-weight: 700; font-size: 12.5px; color: var(--ink-soft); }
.admin-select { width: 100%; padding: 5px 7px; border: 1px solid var(--parch-400); border-radius: 5px; background: rgba(255, 252, 240, 0.9); }
.admin .btn-row .admin-select { width: auto; flex: 1; }
.admin .btn-row .qty { width: 80px; }

@media (max-width: 760px) {
  #dock { left: 10px; right: 10px; width: auto; bottom: 74px; }
  .dock-body { border: 2px solid var(--wood-600); border-radius: 0 var(--radius) var(--radius) var(--radius); }
  #feed { left: 10px; bottom: calc(74px + var(--dock-h) + 8px); }
  #chat { left: 10px; width: min(var(--chat-w), calc(100vw - 20px)); top: calc(var(--topbar-h) + var(--banner-h) + 140px); bottom: calc(74px + var(--dock-h) + 8px); }
  #minimap-wrap { border: 2px solid var(--gold-dark); border-radius: 8px; }
  .mini-btn { width: 22px; height: 22px; font-size: 15px; }
  .mini-zoom { top: 8px; left: 8px; gap: 3px; }
}

@media (min-width: 761px) {
  .side-btn { flex: none; }
  #panel { width: 404px; }
}
@media (min-width: 761px) and (max-height: 900px) {
  #sidebar { gap: 4px; }
  .side-btn { padding: 4px 4px 3px; font-size: 9.5px; }
  .side-btn .ico.lg { width: 21px; height: 21px; }
}
.tab span:not(.ico) { letter-spacing: -0.02em; }
/* Six onglets de base : deux rangées de trois, libellés complets. */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tab { flex-direction: row; gap: 5px; padding: 6px 4px; font-size: 12px; border-radius: 6px; border-bottom-width: 1px; }
.tab.active { box-shadow: inset 0 -3px 0 var(--gold-dark); }
.tab-content .send-row { grid-template-columns: 26px minmax(72px, 1fr) 72px 56px auto; gap: 6px; }
.tab-content .send-name { font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Discussion (à gauche, entre la barre de boutons et le dock) : salon global,
   alliance et conversations privées, en onglets sous les messages
   -------------------------------------------------------------------------- */
#chat {
  position: absolute;
  left: 12px;
  top: calc(var(--topbar-h) + var(--banner-h) + 10px + var(--side-h) + 10px);
  bottom: calc(var(--dock-h) + 10px);
  width: var(--chat-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 14;
}
/* Réduite, elle se range au-dessus du dock : seuls le titre et les onglets restent. */
#chat.closed { top: auto; }
#chat.closed .chat-log, #chat.closed .chat-form { display: none; }
/* Déplacée par le joueur : position et hauteur fixées par le jeu (style en ligne). */
#chat.moved { bottom: auto; height: var(--chat-h, 420px); }
#chat.moved.closed { height: auto; }
#chat.dragging { opacity: 0.94; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }
#chat.dragging .chat-head { cursor: grabbing; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px 5px 11px;
  border-bottom: 1px solid var(--parch-400);
  font-family: var(--font-title);
  font-size: 13.5px;
  font-weight: 700;
  color: #3b2108;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.chat-head > .ico { width: 18px; height: 18px; pointer-events: none; }
.chat-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.chat-head .chat-count { position: static; flex: none; }
.chat-toggle.icon-btn { width: 26px; height: 26px; background: rgba(60, 40, 20, 0.12); color: var(--ink-soft); border-color: var(--parch-400); }
.chat-toggle.icon-btn:hover { background: rgba(60, 40, 20, 0.22); color: var(--ink); }
.chat-toggle .ico { width: 15px; height: 15px; }
#chat .chat-log { flex: 1; height: auto; min-height: 0; margin: 8px 8px 0; scrollbar-width: thin; scrollbar-color: var(--parch-400) transparent; }
#chat .chat-form { margin: 6px 8px 6px; }
#chat .chat-form input { padding: 6px 8px; }
.chat-msg b.who { cursor: pointer; }
.chat-msg b.who:hover { text-decoration: underline; }
.chat-msg .chat-time { margin-right: 4px; }
.chat-msg.sys .chat-time { font-style: normal; }
.chat-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 7px;
  border-top: 1px solid var(--parch-400);
  background: rgba(120, 80, 30, 0.08);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  padding: 4px 9px;
  border: 1px solid var(--parch-400);
  border-radius: 6px;
  background: linear-gradient(var(--parch-200), var(--parch-400));
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
}
.chat-tab:hover { background: linear-gradient(var(--parch-100), var(--parch-300)); color: var(--ink); }
.chat-tab.active { background: linear-gradient(var(--parch-50), var(--parch-100)); border-color: var(--gold-dark); color: var(--ink); box-shadow: inset 0 -3px 0 var(--gold-dark); }
.chat-tab.dm { padding-right: 4px; }
.chat-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-tab-close { padding: 0 4px; border-radius: 4px; font-size: 15px; line-height: 1; color: var(--ink-mute); }
.chat-tab-close:hover { background: rgba(168, 50, 42, 0.15); color: var(--red); }
.chat-unread { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red-light); color: #fff; font-size: 10.5px; line-height: 16px; text-align: center; }
.chat-tab.add { padding: 2px 10px 3px; font-size: 16px; }
.chat-who { flex: none; width: 150px; padding: 4px 7px; border: 1px solid var(--gold-dark); border-radius: 6px; background: rgba(255, 252, 240, 0.95); color: var(--ink); outline: none; user-select: text; }
