/* Direction : le cloisonné. Champs d'émail lapis séparés par des fils d'or, comme un bijou votif.
   Type : Almendra pour les noms et les titres, Asap Condensed pour les données denses. */
:root {
  --lapis: #182d5c;
  --lapis-deep: #0e1b3a;
  --lapis-up: #27437f;
  --gold: #d6a63c;
  --gold-hi: #f3d27a;
  --gold-lo: #8a6a22;
  --ivory: #f6ecd2;
  --ivory-dim: #c6c2b4;
  --verm: #c8412c;
  --jade: #2f8f73;
  --turq: #237d92;
  --plum: #6a3f8f;
  --ok: #7dd58a;
  --bad: #ff8d7a;
  --display: 'Almendra', 'Palatino Linotype', Georgia, serif;
  --ui: 'Asap Condensed', 'Trebuchet MS', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--lapis-deep); color: var(--ivory); font: 500 15px/1.32 var(--ui); user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: 0.01em; }
.glyph { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

#scene { position: fixed; inset: 0; }
#scene::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 58%, rgba(8, 12, 30, 0.42) 100%); }
#scene canvas { display: block; }
#selbox { position: fixed; border: 1.5px solid var(--gold-hi); background: rgba(243, 210, 122, 0.14); pointer-events: none; z-index: 3; }

/* Plaque d'émail : champ bleu, fil d'or, double trait intérieur. */
.enamel {
  background: linear-gradient(170deg, var(--lapis-up) 0%, var(--lapis) 46%, var(--lapis-deep) 100%);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 1px var(--lapis-deep), inset 0 0 0 2px rgba(243, 210, 122, 0.3), 0 5px 14px rgba(5, 10, 26, 0.55);
  border-radius: 12px 3px 12px 3px;
}

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
#hud > * { pointer-events: auto; }
#log, #toast, #wonder { pointer-events: none !important; }

/* Barre du haut */
#top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 5px 14px; white-space: nowrap; max-width: calc(100vw - 16px); }
#res { display: flex; gap: 14px; }
.rc { display: flex; align-items: center; gap: 5px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 66px; font-size: 16px; cursor: default; }
.rc .glyph { width: 19px; height: 19px; }
.rc.f .glyph { color: #f0c04a; } .rc.w .glyph { color: #c58a4e; } .rc.g .glyph { color: #ffdf6b; } .rc.v .glyph { color: #a7d4ff; }
.rc.pop .glyph { color: var(--ivory); }
.rc small { font-weight: 500; color: var(--ivory-dim); font-size: 12px; }
.rc.warn { color: var(--bad); }
#top-mid { font-family: var(--display); font-size: 16px; color: var(--gold-hi); padding: 0 14px; border-left: 1px solid rgba(243, 210, 122, 0.4); border-right: 1px solid rgba(243, 210, 122, 0.4); }
#top-mid .sub { font: 500 12px var(--ui); color: var(--ivory-dim); display: block; line-height: 1.1; }
#top-right { display: flex; gap: 5px; align-items: center; }
.tbtn { padding: 2px 9px; border: 1px solid rgba(243, 210, 122, 0.5); border-radius: 6px 2px 6px 2px; font-weight: 700; min-width: 34px; background: rgba(14, 27, 58, 0.5); }
.tbtn:hover { background: var(--lapis-up); color: var(--gold-hi); }
.tbtn.on { background: var(--gold); color: var(--lapis-deep); border-color: var(--gold-hi); }
#clock { font-variant-numeric: tabular-nums; min-width: 48px; text-align: center; color: var(--ivory); }
#daynight { display: inline-block; width: 18px; height: 18px; }

/* Journal */
#fps { position: absolute; right: 12px; bottom: 182px; padding: 2px 8px; background: rgba(8, 14, 34, .72); border-radius: 3px; color: var(--ivory); font: 500 14px var(--ui); pointer-events: none; }
#log { position: absolute; left: 12px; top: 58px; width: 340px; display: flex; flex-direction: column; gap: 3px; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,.6); }
.lg { font-size: 15px; animation: lgin .2s ease-out; }
.lg.alert { color: #ffb3a2; font-weight: 700; }
.lg.chat i { color: var(--gold-hi); font-style: normal; font-weight: 700; }
.lg.good { color: #bff0c0; }
@keyframes lgin { from { opacity: 0; transform: translateX(-6px); } }

#goals { position: absolute; top: 58px; right: 12px; width: 268px; padding: 10px 12px; }
#goals h3 { font-size: 17px; color: var(--gold-hi); margin-bottom: 5px; display: flex; justify-content: space-between; }
#goals ol { margin: 0; padding: 0; list-style: none; }
#goals li { padding: 3px 0 3px 21px; position: relative; line-height: 1.22; font-size: 14px; color: var(--ivory-dim); }
#goals li::before { content: ''; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px; border: 1.5px solid var(--gold); transform: rotate(45deg); }
#goals li.now { color: var(--ivory); font-weight: 700; }
#goals li.done { color: var(--ok); text-decoration: line-through; text-decoration-color: rgba(125,213,138,.5); }
#goals li.done::before { background: var(--ok); border-color: var(--ok); }
#goals button { color: var(--ivory-dim); font: 500 13px var(--ui); }

#toast { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); font: 700 30px var(--display); color: var(--gold-hi); text-shadow: 0 2px 6px #000; text-align: center; animation: toast 3.2s both; white-space: nowrap; }
#toast.err { font: 700 16px var(--ui); color: #ffd2c8; top: auto; bottom: 218px; animation: err 1.5s both; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 12% { opacity: 1; transform: translate(-50%, 0); } 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes err { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#wonder { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); padding: 4px 14px; background: rgba(14,27,58,.85); border: 1px solid var(--gold); border-radius: 8px 2px; color: var(--gold-hi); font-weight: 700; }

/* Bas d'écran : minicarte en losange, sélection, commandes */
#bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 0 8px 8px; pointer-events: none !important; }
#bottom > * { pointer-events: auto; }
#mini-wrap { position: relative; width: 312px; height: 312px; flex: none; margin: 0 0 -4px -4px; pointer-events: none !important; }
#minimap { position: absolute; left: 46px; top: 46px; width: 220px; height: 220px; pointer-events: auto; border: 3px solid var(--gold); background: var(--lapis-deep); box-shadow: 0 0 0 1px var(--lapis-deep), 0 0 0 3px rgba(243,210,122,.35), 0 6px 18px rgba(0,0,0,.6); cursor: crosshair; image-rendering: pixelated; transform: rotate(45deg); }
.seal { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--gold); background: radial-gradient(circle at 35% 30%, var(--lapis-up), var(--lapis-deep)); display: grid; place-items: center; position: relative; box-shadow: 0 3px 8px rgba(0,0,0,.6); }
.seal:hover { border-color: var(--gold-hi); }
#idle-btn { position: absolute; left: 8px; bottom: 8px; pointer-events: auto; background-size: cover; background-position: center; }
#idle-btn b { position: absolute; right: -4px; top: -4px; font-size: 13px; min-width: 20px; height: 20px; line-height: 18px; background: var(--verm); border-radius: 10px; padding: 0 5px; border: 1px solid var(--ivory); }
#idle-btn.none { filter: saturate(.2) brightness(.72); }
#powers { position: absolute; left: 296px; bottom: 172px; display: flex; gap: 9px; pointer-events: auto; }
.pw { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; position: relative; color: #1f1408; background: radial-gradient(circle at 34% 30%, #ffefc0, #e8b84f 56%, #8a5f1a 100%); border: 2px solid #5e3f0e; box-shadow: 0 0 0 2px rgba(243,210,122,.55), 0 3px 9px rgba(0,0,0,.65); }
.pw.ver { background: radial-gradient(circle at 34% 30%, #e0f7b9, #79b84f 56%, #2c5f2c 100%); border-color: #1e4a22; }
.pw.kar { background: radial-gradient(circle at 34% 30%, #ffd2a2, #e0702a 56%, #6d1f10 100%); border-color: #4d1409; }
.pw.noc { background: radial-gradient(circle at 34% 30%, #e4dcff, #8473d8 56%, #322667 100%); border-color: #221a4c; }
.pw.off { filter: grayscale(.8) brightness(.62); }
.pw.ready { animation: pulse 2.4s infinite; }
.pw:hover { transform: scale(1.06); }
.pw .cd { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 700 16px var(--ui); color: var(--ivory); background: rgba(14,27,58,.68); }
.pw.armed { box-shadow: 0 0 0 3px var(--ivory), 0 0 16px 5px var(--gold-hi); }
.pw .pc { position: absolute; bottom: -4px; right: -6px; font: 700 12px var(--ui); color: var(--ivory); background: var(--lapis-deep); border: 1px solid var(--gold); border-radius: 8px; padding: 0 5px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px rgba(243,210,122,.55), 0 0 15px 4px rgba(243,210,122,.7); } }

#sel { flex: 1; min-width: 300px; max-width: 620px; height: 164px; margin-left: -28px; padding: 9px 12px; overflow: hidden; display: flex; gap: 12px; }
#sel .por { flex: none; width: 88px; height: 88px; border: 2px solid var(--gold); border-radius: 10px 2px 10px 2px; background: radial-gradient(circle at 50% 42%, #efe2bb 0%, #a99a70 100%); object-fit: contain; }
#sel .col { flex: none; display: flex; flex-direction: column; gap: 4px; width: 88px; align-items: center; }
#sel .info { flex: 1; min-width: 0; }
#sel h3 { font-size: 21px; color: var(--gold-hi); line-height: 1.05; }
#sel .who { font-size: 13px; color: var(--ivory-dim); }
#sel p { margin: 3px 0 0; font-size: 14px; color: var(--ivory-dim); line-height: 1.22; }
.hpb { width: 100%; height: 8px; background: var(--lapis-deep); border: 1px solid var(--gold-lo); border-radius: 2px; overflow: hidden; }
.hpb i { display: block; height: 100%; background: var(--ok); }
.hpt { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ivory); text-align: center; }
.stats { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 5px; font-size: 14px; }
.stats span b { color: var(--ivory); font-variant-numeric: tabular-nums; }
.stats span { color: var(--ivory-dim); }
.prog { margin-top: 6px; }
.prog-t { font-size: 13px; line-height: 1.3; min-height: 17px; }
.prog-b { height: 9px; margin-top: 3px; background: #16202c; border: 1px solid var(--gold, #c9a14e); border-radius: 2px; overflow: hidden; }
.prog-b i { display: block; height: 100%; width: 0; background: var(--ok); }
.queue { display: flex; gap: 4px; margin-top: 6px; align-items: center; }
.qi { width: 40px; height: 40px; border: 1.5px solid var(--gold); border-radius: 7px 2px; position: relative; overflow: hidden; background: #a99a70; }
.qi img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qi .bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--ok); }
.qi:hover { border-color: var(--bad); }
.qi em { position: absolute; inset: 0; display: grid; place-items: center; font: 700 15px var(--ui); background: rgba(14,27,58,.6); color: var(--gold-hi); }
.multi { display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 3px; align-content: start; overflow: hidden; flex: 1; }
.mi { width: 38px; height: 38px; position: relative; border: 1px solid var(--gold-lo); border-radius: 5px 1px; background: #a99a70; }
.mi img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mi .h { position: absolute; left: 1px; right: 1px; bottom: 1px; height: 3px; background: var(--lapis-deep); }
.mi .h i { display: block; height: 100%; background: var(--ok); }
.mi em { position: absolute; top: 0; right: 2px; font: 700 12px var(--ui); color: #fff; text-shadow: 0 0 3px #000; font-style: normal; }
.mi:hover { border-color: var(--gold-hi); }

#cmd { flex: none; margin-left: auto; padding: 8px; display: grid; grid-template-columns: repeat(5, 54px); grid-auto-rows: 48px; gap: 4px; height: 164px; }
.c { position: relative; border-radius: 8px 2px 8px 2px; border: 1.5px solid var(--gold-lo); background: linear-gradient(170deg, #2b4a84, #1b3163); display: grid; place-items: center; overflow: hidden; }
.c:hover:not(.empty) { border-color: var(--gold-hi); background: linear-gradient(170deg, #36599a, #223b75); }
.c:active:not(.empty) { transform: translateY(1px); }
.c.empty { background: rgba(14,27,58,.35); border-color: rgba(138,106,34,.35); cursor: default; }
.c img { width: 100%; height: 100%; object-fit: contain; }
.c .glyph { width: 26px; height: 26px; color: var(--ivory); }
.c.jade { background: linear-gradient(170deg, #2f8f73, #1a5e4c); }
.c.verm { background: linear-gradient(170deg, #c8412c, #842417); }
.c.turq { background: linear-gradient(170deg, #237d92, #135466); }
.c.gold { background: linear-gradient(170deg, #d6a63c, #94701f); }
.c.gold .glyph { color: var(--lapis-deep); }
.c.dis img, .c.dis .glyph { filter: grayscale(1) brightness(.62); }
.c.dis { background: #1a2746; border-color: rgba(138,106,34,.5); }
.c .hk { position: absolute; left: 3px; top: 1px; font: 700 11px var(--ui); color: var(--ivory); text-shadow: 0 0 3px #000, 0 0 2px #000; }
.c .n { position: absolute; right: 3px; bottom: 0; font: 700 13px var(--ui); color: var(--gold-hi); text-shadow: 0 0 3px #000; }
.c .prog { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--ok); }

#tip { position: fixed; z-index: 8; pointer-events: none !important; width: 290px; padding: 9px 12px; background: var(--lapis-deep); border: 2px solid var(--gold); border-radius: 10px 2px; box-shadow: 0 6px 18px rgba(0,0,0,.65); }
#tip h4 { margin: 0; font: 700 18px var(--display); color: var(--gold-hi); }
#tip .cost { display: flex; flex-wrap: wrap; gap: 3px 10px; margin: 3px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
#tip .cost .no { color: var(--bad); }
#tip p { margin: 2px 0 0; font-size: 14px; color: var(--ivory); line-height: 1.25; }
#tip .why { color: var(--bad); font-weight: 700; margin-top: 4px; }
#tip .stat { color: var(--ivory-dim); font-size: 13px; margin-top: 3px; }

/* ---------- Menus ---------- */
#menu { position: fixed; inset: 0; z-index: 10; overflow: auto; }
#menu:empty { display: none; }
.pageback { position: absolute; inset: 0; background-size: cover; background-position: center; }
.title-screen { min-height: 100%; position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 max(5vw, 28px) 7vh; background: var(--lapis-deep); }
.title-screen .art { position: absolute; inset: 0; background: url('../assets/title.jpg') center/cover no-repeat; }
.title-screen .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,27,58,.92) 0%, rgba(14,27,58,.62) 30%, rgba(14,27,58,0) 60%); }
.title-screen > * { position: relative; }
.logo { font: 700 clamp(64px, 11vw, 148px)/0.92 var(--display); color: var(--gold-hi); text-shadow: 0 3px 0 var(--gold-lo), 0 8px 26px rgba(0,0,0,.65); margin-bottom: 2px; }
.tagline { font: 400 clamp(18px, 1.7vw, 25px) var(--display); color: var(--ivory); max-width: 28em; margin: 0 0 3vh; text-shadow: 0 1px 6px #000; }
.mainbtns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mbtn { font: 700 clamp(22px, 2.1vw, 30px) var(--display); color: var(--ivory); padding: 1px 0; text-shadow: 0 2px 6px #000; text-align: left; }
.mbtn:hover { color: var(--gold-hi); transform: translateX(5px); transition: transform .12s; }
.mbtn small { font: 500 14px var(--ui); color: var(--ivory-dim); display: block; margin-top: -1px; }
.credit { position: absolute !important; right: 18px; bottom: 12px; font-size: 13px; color: var(--ivory-dim); text-shadow: 0 1px 3px #000; }

.screen { min-height: 100%; background: radial-gradient(ellipse at 20% 0%, #2b4a8a 0%, var(--lapis) 40%, var(--lapis-deep) 100%); padding: 22px max(3vw, 18px) 30px; }
.screen > h2 { font-size: clamp(30px, 3vw, 44px); color: var(--gold-hi); margin-bottom: 12px; }
.bar-back { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; }
.btn { font: 700 21px var(--display); padding: 7px 22px; background: linear-gradient(170deg, #36599a, #1b3163); border: 2px solid var(--gold); border-radius: 12px 3px 12px 3px; color: var(--ivory); }
.btn:hover { border-color: var(--gold-hi); color: var(--gold-hi); }
.btn.primary { background: linear-gradient(170deg, #f3d27a, #c08f2a); color: var(--lapis-deep); padding: 9px 34px; font-size: 25px; }
.btn.primary:hover { color: #000; filter: brightness(1.08); }
.btn.quiet { background: none; border-color: rgba(214,166,60,.5); font-size: 18px; padding: 5px 16px; }

/* Choix du peuple : quatre sceaux, le choisi prend toute sa place. */
.factions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fcard { position: relative; text-align: left; padding: 0 0 10px; border: 2px solid var(--gold-lo); border-radius: 14px 3px 14px 3px; overflow: hidden; background: var(--lapis-deep); display: flex; flex-direction: column; }
.fcard:hover { border-color: var(--gold-hi); }
.fcard.on { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--gold-hi), 0 0 22px rgba(243,210,122,.45); }
.fcard .pic { height: 19vh; min-height: 120px; background-size: cover; background-position: center 22%; }
.fcard h3 { font-size: 27px; padding: 8px 12px 0; }
.fcard .ft { padding: 0 12px; font: 400 16px var(--display); color: var(--gold-hi); }
.fcard p { margin: 5px 12px 0; font-size: 14.5px; color: var(--ivory); line-height: 1.26; }
.fcard .lbl { color: var(--gold-hi); font-weight: 700; }
.fcard.aur h3 { color: #ffd76a; } .fcard.ver h3 { color: #b6f27a; } .fcard.kar h3 { color: #ff9a55; } .fcard.noc h3 { color: #b9c8ff; }
.oath { font: italic 400 15px var(--display) !important; color: var(--ivory-dim) !important; }

.setup { display: grid; grid-template-columns: minmax(330px, 1.1fr) minmax(290px, 1fr); gap: 16px; margin-top: 14px; }
.panel { padding: 12px 14px; }
.panel h3 { font-size: 22px; color: var(--gold-hi); margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.row label { min-width: 118px; color: var(--ivory-dim); }
select, input[type=range] { font: 500 15px var(--ui); color: var(--ivory); background: var(--lapis-deep); border: 1px solid var(--gold-lo); border-radius: 6px 2px; padding: 4px 7px; accent-color: var(--gold); }
select:hover { border-color: var(--gold-hi); }
.rival { display: grid; grid-template-columns: 24px 1fr 1fr 1.2fr 86px 26px; gap: 5px; align-items: center; margin-bottom: 5px; }
.rival .sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--ivory); }
.rival button { color: var(--bad); font-size: 19px; line-height: 1; }
.hint { color: var(--ivory-dim); font-size: 14px; margin: 5px 0 0; line-height: 1.3; }
.mapchoice { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 5px; margin-bottom: 8px; }
.mc { padding: 6px 9px; border: 1.5px solid var(--gold-lo); border-radius: 8px 2px; text-align: left; background: var(--lapis-deep); }
.mc b { font: 700 16px var(--display); display: block; }
.mc.on { border-color: var(--gold-hi); background: var(--lapis-up); }

/* Comment jouer */
.help { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.help section { padding: 12px 15px; }
.help h3 { font-size: 22px; color: var(--gold-hi); }
.help ul { margin: 6px 0 0; padding-left: 16px; }
.help li { margin-bottom: 3px; line-height: 1.32; }
.help kbd { font: 700 13px var(--ui); background: var(--lapis-deep); border: 1px solid var(--gold-lo); border-radius: 4px; padding: 0 5px; }

/* Fin de partie, pause */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(9, 16, 36, .72); z-index: 12; overflow: auto; }
.modal .box { width: min(760px, calc(100vw - 24px)); padding: 18px 22px; max-height: calc(100vh - 24px); overflow: auto; }
.modal h2 { font-size: 42px; color: var(--gold-hi); margin-bottom: 2px; }
.modal .sub { font: 400 20px var(--display); color: var(--ivory); }
.modal .btns { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.endtable { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; }
.endtable th { font-weight: 500; color: var(--ivory-dim); text-align: right; padding: 2px 6px; }
.endtable td { text-align: right; padding: 3px 6px; border-top: 1px solid rgba(214,166,60,.3); }
.endtable td:first-child, .endtable th:first-child { text-align: left; }
.endtable i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
#endchart { width: 100%; height: 165px; margin-top: 10px; display: block; }

/* Conquête */
.world { position: relative; aspect-ratio: 16 / 9; max-height: 74vh; width: 100%; background: #10204a url('../assets/world.jpg') center/cover no-repeat; border: 2px solid var(--gold); border-radius: 18px 4px 18px 4px; overflow: hidden; }
.world svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.region { position: absolute; transform: translate(-50%, -50%); width: 124px; text-align: center; color: var(--ivory); font: 700 16px/1.05 var(--display); text-shadow: 0 1px 3px #000, 0 0 8px #000, 0 0 2px #000; }
.region .dot { display: block; width: 36px; height: 36px; margin: 0 auto 3px; border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 2px 6px #000; }
.region.locked { cursor: default; color: var(--ivory-dim); }
.region.locked .dot { filter: saturate(.6) brightness(.7); }
.region.open .dot { animation: pulse 2s infinite; border-color: var(--ivory); }
.region.mine .dot { border-color: var(--ok); }
.region.capital .dot { width: 50px; height: 50px; }
.boons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.boon { padding: 12px; text-align: left; border: 2px solid var(--gold-lo); border-radius: 12px 2px; background: var(--lapis-deep); }
.boon:hover { border-color: var(--gold-hi); }
.boon b { font: 700 19px var(--display); color: var(--gold-hi); display: block; }

@media (max-width: 1180px) {
  .factions { grid-template-columns: repeat(2, 1fr); }
  .setup { grid-template-columns: 1fr; }
  #sel { margin-left: -28px; min-width: 210px; }
  #cmd { grid-template-columns: repeat(5, 46px); grid-auto-rows: 42px; height: 148px; }
  #sel { height: 148px; }
  #log { width: 260px; }
}
@media (max-width: 880px) {
  .factions { grid-template-columns: 1fr; }
  #top { gap: 6px; padding: 4px 6px; font-size: 13px; }
  .rc { min-width: 42px; font-size: 13px; gap: 2px; }
  #res { gap: 5px; }
  #top-mid { display: none; }
  #bottom { flex-wrap: wrap; }
  #mini-wrap { transform: scale(.68); transform-origin: left bottom; margin: 0 -96px -26px -14px; }
}
@media (prefers-reduced-motion: reduce) {
  .pw.ready, .region.open .dot { animation: none; }
  #toast { animation-duration: 3.2s; }
  .mbtn:hover { transform: none; }
}

.loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--lapis-deep) url('../assets/title.jpg') center/cover no-repeat; }
.loading::before { content: ''; position: absolute; inset: 0; background: rgba(9, 16, 36, 0.62); }
.loading > * { position: relative; }
.loading h2 { font-size: 64px; color: var(--gold-hi); text-shadow: 0 3px 0 var(--gold-lo), 0 8px 24px #000; }
.loading p { font: 400 22px var(--display); margin: 0 0 14px; color: var(--ivory); text-shadow: 0 1px 4px #000; }
.ld-bar { width: min(460px, 70vw); height: 12px; border: 2px solid var(--gold); border-radius: 8px 2px; background: var(--lapis-deep); overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi)); }

/* ---------- Multijoueur ---------- */
.net input { font: 500 17px var(--ui); color: var(--ivory); background: var(--lapis-deep); border: 1.5px solid var(--gold-lo); border-radius: 8px 2px; padding: 7px 10px; flex: 1 1 160px; min-width: 0; }
.net input:focus { outline: none; border-color: var(--gold-hi); }
.net input::placeholder { color: var(--ivory-dim); opacity: .75; }
.net .setup { align-items: start; }
.net .panel > * + h3.net-sub { margin-top: 14px; }
.net .btn:disabled { opacity: .45; cursor: not-allowed; }
.net-field { flex-wrap: nowrap; }
.net-field .btn { flex: none; }
.net-who { font: 400 19px var(--display); color: var(--ivory); margin: -4px 0 4px; }
.net-who b { color: var(--gold-hi); }
.hint.bad { color: var(--bad); }
.net-wait { max-width: 560px; margin-top: 14px; font-size: 18px; }
.net-code { font: 700 clamp(22px, 3.4vw, 32px) var(--ui); letter-spacing: .06em; color: var(--gold-hi); background: var(--lapis-deep); border: 1.5px solid var(--gold); border-radius: 10px 3px; padding: 12px; margin-top: 12px; text-align: center; user-select: all; }
.net-player { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(214,166,60,.18); flex-wrap: wrap; }
.net-player > b { font: 700 18px var(--display); }
.net-player .hint { margin: 0; flex: 1; min-width: 90px; }
.net-player > span:not(.hint):not(.net-dot) { flex: 1; }
.net-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ivory-dim); flex: none; }
.net-dot.online { background: var(--ok); }
.net-dot.playing { background: var(--gold); }
.net-dot.offline { background: transparent; border: 1.5px solid var(--ivory-dim); }
.net-dot.wait { background: var(--gold-hi); animation: netwait 1.2s ease-in-out infinite; }
@keyframes netwait { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .net-dot.wait { animation: none; } }
.net-x { font-size: 14px; color: var(--ivory-dim); text-decoration: underline; }
.net-x:hover { color: var(--bad); }
.net-row { align-items: center; min-height: 30px; }
.net-name { font: 700 17px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-val { color: var(--ivory-dim); font-size: 15px; }
.net-val.ok { color: var(--ok); }
.net-link { justify-content: space-between; margin-top: 10px; }
.net-link .hint { margin: 0; }
.net-link b { color: var(--gold-hi); letter-spacing: .08em; }
.net-blocked { display: flex; gap: 5px; flex-wrap: wrap; }
.net-settings { font-size: 16px; }
.net-chat { height: 150px; overflow-y: auto; background: var(--lapis-deep); border: 1.5px solid var(--gold-lo); border-radius: 8px 2px; padding: 6px 9px; margin-bottom: 7px; font-size: 15px; overflow-wrap: anywhere; }
.net-chat b { color: var(--gold-hi); font-weight: 600; }
.net-go { display: flex; align-items: center; gap: 12px; }
.net-go .hint { margin: 0; }
#net-banner { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20; width: min(440px, calc(100vw - 24px)); padding: 12px 16px; }
#net-banner p { margin: 0; font: 400 20px var(--display); color: var(--ivory); }
#net-banner p b { color: var(--gold-hi); }
#net-banner .hint { font: 500 14px var(--ui); color: var(--ivory-dim); margin-top: 2px; }
#net-banner .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; align-items: center; }
#net-banner .btn.primary { font-size: 21px; padding: 7px 24px; }
#net-notice { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 21; font: 600 16px var(--ui); color: var(--ivory); background: var(--lapis-deep); border: 1.5px solid var(--gold); border-radius: 10px 3px; padding: 8px 16px; max-width: calc(100vw - 24px); }
#net-notice.bad { border-color: var(--verm); color: #ffd2c8; }
#net-status { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); font: 600 15px var(--ui); color: var(--gold-hi); background: rgba(14,27,58,.85); border: 1px solid var(--gold-lo); border-radius: 8px 2px; padding: 4px 12px; pointer-events: none; }
#chat-in { position: absolute; left: 12px; bottom: 236px; width: min(460px, calc(100vw - 24px)); font: 500 16px var(--ui); color: var(--ivory); background: var(--lapis-deep); border: 1.5px solid var(--gold); border-radius: 8px 2px; padding: 6px 10px; pointer-events: auto; }
.net .hint + .net-field, .net .hint + .row { margin-top: 8px; }
