/* Imperium */
main.main:has(.imperium){max-width:1500px}
.imperium{--g:#004225;--gold:#b8963e;--wine:#7a2338;--ink:#1d2320;--muted:#5d6862;--line:#dde5df;--card:#fff;--paper:#fbf8f0;color:var(--ink);font-size:16px}
html[data-theme="dark"] .imperium{--ink:#e6ece8;--muted:#9fb0a6;--line:#33403a;--card:#1c221f;--paper:#1f2521}
.imperium .lat,.imperium .grc{font-family:"Gentium Book Plus",Georgia,serif}
.imperium [hidden]{display:none !important}
.im-btn{font:inherit;font-size:.92rem;padding:.45rem .9rem;border-radius:9px;border:1px solid var(--line);background:var(--card);color:var(--ink);cursor:pointer}
.im-btn:hover:not(:disabled){border-color:var(--g)}
.im-btn.pri{background:var(--g);border-color:var(--g);color:#fff;font-weight:700}
.im-btn.big{font-size:1.1rem;padding:.7rem 1.6rem}
.im-btn.sm{padding:.25rem .6rem;font-size:.82rem}
.im-btn:disabled{opacity:.5;cursor:default}
.im-btn.right{background:#1a8a4a;color:#fff;border-color:#1a8a4a}.im-btn.wrong{background:#c0392b;color:#fff;border-color:#c0392b}
.im-seg{display:inline-flex;flex-wrap:wrap;border:1px solid var(--line);border-radius:9px;overflow:hidden;background:var(--card)}
.im-seg button{border:0;border-right:1px solid var(--line);background:transparent;color:var(--ink);padding:.4rem .75rem;font:inherit;font-size:.88rem;cursor:pointer}
.im-seg button:last-child{border-right:0}.im-seg button.on{background:var(--g);color:#fff}
/* setup */
.im-setup{max-width:1050px;margin:0 auto}
.im-head{background:linear-gradient(135deg,#5c1320,#8c1d2c 60%,#a3462f);color:#fff;border-radius:16px;padding:1.4rem 1.6rem;margin-bottom:1rem}
.im-head h1{margin:0 0 .3rem;font:700 2.4rem Georgia,serif;color:#f3dfa3;letter-spacing:.04em}
.im-head p{margin:0;max-width:46rem;color:#f4e3e3;line-height:1.5}
.im-setup h2{font:700 1.15rem Georgia,serif;color:var(--g);margin:1.3rem 0 .6rem}
html[data-theme="dark"] .im-setup h2{color:#a8d5b8}
.im-scens{display:grid;grid-template-columns:3fr 2fr;gap:1rem}
.im-grp h3{margin:0 0 .4rem;font-size:.8rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);width:100%}
.im-grp h3 small{text-transform:none;letter-spacing:0;font-weight:400}
.im-grp{display:flex;flex-wrap:wrap;gap:.5rem;align-content:flex-start;align-items:stretch}
.im-scen,.im-fac{flex:1 1 180px;text-align:left;display:flex;flex-direction:column;gap:.15rem;border:2px solid var(--line);background:var(--card);color:var(--ink);border-radius:12px;padding:.7rem .8rem;cursor:pointer;font:inherit}
.im-scen b{font-size:1.25rem;color:var(--wine)}html[data-theme="dark"] .im-scen b{color:#e08a9e}
.im-scen span,.im-fac span{font-size:.85rem}.im-scen small,.im-fac small{font-size:.76rem;color:var(--muted);line-height:1.35}
.im-scen.on,.im-fac.on{border-color:var(--gold);box-shadow:0 0 0 3px rgba(184,150,62,.25)}
.im-blurb{background:var(--paper);border:1px solid var(--line);border-left:4px solid var(--gold);border-radius:10px;padding:.7rem .9rem;line-height:1.55;font-size:.95rem}
.im-facs{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:.5rem}
.im-fac{position:relative;padding-left:1.5rem}.im-fac i{position:absolute;left:.5rem;top:.85rem;width:.6rem;height:.6rem;border-radius:50%}
.im-opts{display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:.7rem 1.2rem}
.im-opt{display:flex;flex-direction:column;gap:.25rem}.im-opt>span{font-size:.76rem;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:700}
.im-note{font-size:.9rem;color:var(--muted)}.im-resume span{color:var(--muted);font-size:.9rem;margin-left:.4rem}
.im-help{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:.3rem 1rem;margin-top:1rem;text-align:left}
.im-help summary{cursor:pointer;font-weight:700;padding:.4rem 0;color:var(--g)}html[data-theme="dark"] .im-help summary{color:#a8d5b8}
.im-help ol{margin:.2rem 0 .8rem;padding-left:1.2rem;font-size:.9rem;line-height:1.55}
/* game */
.im-game{position:relative}
.im-top{display:flex;align-items:center;gap:.8rem;flex-wrap:wrap;background:linear-gradient(135deg,#5c1320,#8c1d2c);color:#fff;border-radius:12px 12px 0 0;padding:.5rem .8rem}
.im-title{display:flex;flex-direction:column;line-height:1.15}.im-title b{font-size:1.25rem;color:#f3dfa3}.im-title small{font-size:.72rem;color:#f0d6da}
.im-phases{list-style:none;display:flex;gap:.3rem;margin:0;padding:0;flex:1;flex-wrap:wrap}
.im-phases li{display:flex;flex-direction:column;align-items:center;padding:.2rem .7rem;border-radius:8px;background:rgba(255,255,255,.1);color:#f0d6da;line-height:1.2;margin:0}
.im-phases li b{font-size:.95rem}.im-phases li small{font-size:.66rem}
.im-phases li.on{background:#f3dfa3;color:#3a1a12}
.im-tbtns{display:flex;gap:.3rem}
.im-msg{background:var(--paper);border:1px solid var(--line);border-top:0;padding:.5rem .8rem;font-size:.95rem;min-height:1.5rem}
.im-body{display:grid;grid-template-columns:minmax(0,1fr) 370px;gap:.8rem;margin-top:.6rem;align-items:start}
.im-mapwrap{display:flex;touch-action:pan-x pan-y;-webkit-overflow-scrolling:touch;border:1px solid var(--line);border-radius:10px;overflow:auto;background:#7fa9bd;height:calc(100vh - 128px);min-height:300px}
.im-game{scroll-margin-top:6px}
@media (min-width:901px){.im-side{max-height:calc(100vh - 128px);overflow:auto}}
#im-map{display:block;flex:none;margin:auto;user-select:none;-webkit-user-select:none}
.im-t{stroke:#5a4a2c;stroke-width:1;transition:fill .25s}
.im-t.can{cursor:pointer}.im-t.can:hover{filter:brightness(1.08)}
.im-t.sel{stroke:#fff;stroke-width:3}.im-t.tgt{stroke:#b3261e;stroke-width:3}
#im-links line{stroke:#fff;stroke-width:1.3;stroke-dasharray:4 4;opacity:.75}
#im-arrow line{stroke:#b3261e;stroke-width:4;stroke-linecap:round;opacity:.8}
.im-tok{cursor:pointer}.im-tok circle{stroke:#fff;stroke-width:1.6}
.im-tok.sel circle{stroke:#f3dfa3;stroke-width:3}.im-tok.tgt circle{stroke:#000;stroke-width:3}
.im-n{font:700 11px system-ui,sans-serif;fill:#fff;text-anchor:middle;pointer-events:none}
.im-nm{font:600 8.5px Georgia,serif;fill:#2a2212;text-anchor:middle;paint-order:stroke;stroke:#f3ead2;stroke-width:2.4px;pointer-events:none}
.im-nm.grc{font-family:"Gentium Book Plus",Georgia,serif;font-size:9.5px}
.im-side{display:flex;flex-direction:column;gap:.6rem;flex-wrap:nowrap}
.im-panel{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:.6rem .7rem;font-size:.86rem}
.im-panel:empty{display:none}
.im-panel h3{margin:0 0 .4rem;font:700 .74rem system-ui,sans-serif;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);width:auto}
.im-panel h3 small{text-transform:none;letter-spacing:0;font-weight:400}
#im-info h3,#im-battle h3{font:700 1rem Georgia,serif;letter-spacing:0;text-transform:none;color:var(--ink)}
#im-info p{margin:0;line-height:1.45}
.im-pl{display:flex;align-items:center;gap:.4rem;padding:.25rem .3rem;border-radius:7px}
.im-pl.cur{background:rgba(184,150,62,.2)}.im-pl.dead{opacity:.4;text-decoration:line-through}
.im-pl i{width:.8rem;height:.8rem;border-radius:50%;flex:none}.im-pl div{flex:1;min-width:0;line-height:1.15}.im-pl b{font-size:.86rem}.im-pl em{font-style:normal;font-size:.66rem;background:var(--g);color:#fff;border-radius:99px;padding:0 .35rem}
.im-pl small{display:block;color:var(--muted);font-size:.7rem}.im-pl span{font-size:.74rem;color:var(--muted);white-space:nowrap}
.im-reg{display:flex;gap:.4rem;align-items:baseline;padding:.1rem 0}.im-reg span{flex:1}.im-reg small{color:var(--muted)}.im-reg b{font-size:.8rem}
.im-log{max-height:220px;overflow:auto}.im-log p{margin:0 0 .3rem;line-height:1.3}.im-log small{color:var(--muted)}
.im-card{display:inline-flex;flex-direction:column;align-items:center;border:1px solid var(--line);border-radius:8px;padding:.25rem .45rem;margin:0 .25rem .25rem 0;background:var(--paper);min-width:4.2rem;line-height:1.2}
.im-card b{font-size:.98rem}.im-card small{font-size:.68rem;color:var(--muted)}.im-card i{font-style:normal}
.im-hint{display:block;color:var(--muted);font-size:.74rem;margin-top:.2rem}
.im-row{display:flex;align-items:center;gap:.4rem;margin-bottom:.4rem;font-size:.84rem}
.im-wait{margin:0;color:var(--muted);font-style:italic}
#im-actions .im-btn{width:100%}
.im-brow{display:flex;justify-content:space-between;align-items:center;gap:.5rem;min-height:2.1rem}
.im-dice{display:flex;gap:.25rem}
.im-die{width:1.9rem;height:1.9rem;border-radius:5px;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);padding:3px;box-sizing:border-box;background:#f1e7cd;border:1px solid #9c8a5c;box-shadow:inset -2px -2px 0 rgba(0,0,0,.12)}
.im-die.def{background:#3a332a;border-color:#1c1812}
.im-die i{width:5px;height:5px;border-radius:50%;background:#5c1320;place-self:center}.im-die.def i{background:#f1e7cd}
.d1 i{grid-area:2/2}.d2 i:nth-child(1){grid-area:1/1}.d2 i:nth-child(2){grid-area:3/3}
.d3 i:nth-child(1){grid-area:1/1}.d3 i:nth-child(2){grid-area:2/2}.d3 i:nth-child(3){grid-area:3/3}
.d4 i:nth-child(1){grid-area:1/1}.d4 i:nth-child(2){grid-area:1/3}.d4 i:nth-child(3){grid-area:3/1}.d4 i:nth-child(4){grid-area:3/3}
.d5 i:nth-child(1){grid-area:1/1}.d5 i:nth-child(2){grid-area:1/3}.d5 i:nth-child(3){grid-area:2/2}.d5 i:nth-child(4){grid-area:3/1}.d5 i:nth-child(5){grid-area:3/3}
.d6 i:nth-child(1){grid-area:1/1}.d6 i:nth-child(2){grid-area:2/1}.d6 i:nth-child(3){grid-area:3/1}.d6 i:nth-child(4){grid-area:1/3}.d6 i:nth-child(5){grid-area:2/3}.d6 i:nth-child(6){grid-area:3/3}
.im-bres{margin:.3rem 0;font-size:.82rem;color:var(--muted)}.im-bbtns{display:flex;gap:.3rem;flex-wrap:wrap}.im-bbtns .im-btn{flex:1;padding:.4rem .3rem}
.im-vs{color:#b3261e}
.im-modal{position:fixed;inset:0;z-index:300;background:rgba(0,0,0,.55);display:grid;place-items:center;padding:1rem;overflow:auto}
.im-mbox{background:var(--card);color:var(--ink);border-radius:14px;padding:1.2rem 1.4rem;max-width:520px;width:100%;text-align:center;box-shadow:0 20px 50px rgba(0,0,0,.4);max-height:90vh;overflow:auto}
.im-mbox h2{margin:.2rem 0 .6rem;font:700 1.5rem Georgia,serif}.im-mbox h2.grc,.im-mbox h2.lat{font-size:2.2rem;font-family:"Gentium Book Plus",Georgia,serif}
.im-slide{display:flex;align-items:center;gap:.5rem;justify-content:center}.im-slide input{flex:1;accent-color:var(--g)}.im-slide b{font-size:1.3rem;min-width:2ch}
.im-qopts{display:grid;grid-template-columns:1fr 1fr;gap:.4rem;margin:.6rem 0}.im-q{margin:0;color:var(--muted);font-size:.9rem}.im-qres{min-height:1.4rem;font-size:.92rem}.im-qoff{font-size:.8rem;color:var(--muted);margin-left:.6rem}
@media (max-width:900px){.im-body{grid-template-columns:1fr}.im-scens{grid-template-columns:1fr}.im-head h1{font-size:1.8rem}
}
.im-stats{width:100%;border-collapse:collapse;font-size:.82rem;margin:0;display:table}
.im-stats th{font-size:.66rem;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700;text-align:right;padding:.15rem .25rem;border-bottom:1px solid var(--line)}
.im-stats th:first-child,.im-stats td:first-child{text-align:left}
.im-stats td{text-align:right;padding:.3rem .25rem;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums;font-weight:600;vertical-align:top}
.im-stats td:first-child{font-weight:400;line-height:1.2}.im-stats td i{display:inline-block;width:.7rem;height:.7rem;border-radius:50%;margin-right:.3rem}
.im-stats td small{display:block;color:var(--muted);font-size:.68rem;margin-left:1rem}.im-stats em{font-style:normal;font-size:.62rem;background:var(--g);color:#fff;border-radius:99px;padding:0 .35rem}
.im-stats tr.cur td{background:rgba(184,150,62,.2)}.im-stats tr.dead td{opacity:.4;text-decoration:line-through}.im-stats tr.neu td{color:var(--muted);font-weight:400}
.im-reg{display:block;padding:.25rem 0;border-bottom:1px solid var(--line)}.im-reg>div:first-child{display:flex;justify-content:space-between;gap:.4rem}.im-reg span{font-weight:600}
.im-bar{display:flex;height:7px;border-radius:99px;overflow:hidden;margin:.2rem 0;gap:1px}.im-bar i{display:block}
.im-langbtn{background:#f3dfa3 !important;color:#3a1a12 !important;font-weight:700}
.im-langseg{border-color:#f3dfa3}.im-langseg button{padding:.25rem .55rem;font-size:.8rem;color:var(--ink)}.im-langseg button.on{background:#f3dfa3;color:#3a1a12;font-weight:700}
/* ---- phones and small screens: the game takes over the screen; map in the middle, status and buttons always visible */
.im-menubtn,.im-drawerhead,.im-hud{display:none}
html.im-lock,html.im-lock body{overflow:hidden !important;overscroll-behavior:none}
.im-game.im-compact{position:fixed;inset:0;z-index:500;background:var(--paper);display:flex;flex-direction:column;padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left)}
.im-compact .im-top{border-radius:0;padding:.3rem .45rem;gap:.35rem;flex:none}
.im-compact .im-title,.im-compact .im-desk{display:none}
.im-compact .im-menubtn{display:inline-block}
.im-compact .im-phases{gap:.2rem;flex-wrap:nowrap}
.im-compact .im-phases li{padding:.2rem .45rem}.im-compact .im-phases li b{font-size:.8rem}.im-compact .im-phases li small{display:none}
.im-compact .im-msg{flex:none;font-size:.84rem;padding:.3rem .55rem;border:0;border-bottom:1px solid var(--line)}
.im-compact .im-body{flex:1;min-height:0;display:block;margin:0;position:relative}
.im-compact .im-mapwrap{height:100%;min-height:0;max-height:none;border:0;border-radius:0}
.im-compact .im-side{display:none}
.im-compact.menu-open .im-side{display:flex;position:absolute;inset:0;z-index:5;overflow:auto;max-height:none;background:var(--paper);padding:.5rem}
.im-compact .im-drawerhead{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;position:sticky;top:-.5rem;z-index:2}
.im-compact .im-langseg button{color:var(--ink)}
.im-dock{display:none}
.im-compact .im-dock{display:flex;flex-direction:column;gap:.3rem;flex:none;background:var(--card);border-top:1px solid var(--line);padding:.35rem .5rem max(.4rem,env(safe-area-inset-bottom))}
.im-compact .im-dock .im-panel{border:0;padding:0;background:none}
.im-compact .im-hud{display:flex;flex-wrap:wrap;gap:.15rem .7rem;font-size:.78rem;color:var(--muted);align-items:center}
.im-hud i{display:inline-block;width:.65rem;height:.65rem;border-radius:50%;margin-right:.25rem}.im-hud b{color:var(--ink)}
.im-hud-info{flex-basis:100%}
.im-compact #im-battle h3{font-size:.9rem;margin:0}
.im-compact .im-brow{min-height:1.7rem;font-size:.82rem}.im-compact .im-die{width:1.5rem;height:1.5rem}.im-compact .im-die i{width:4px;height:4px}
.im-compact .im-bres{margin:.1rem 0;font-size:.76rem}
.im-compact .im-row{margin:0}
.im-compact #im-actions{display:flex;gap:.4rem;align-items:center;flex-wrap:wrap}.im-compact #im-actions .im-btn{width:auto;flex:1}
.im-compact .im-modal{z-index:600}
@media (orientation:landscape){
  .im-game.im-compact{display:grid;grid-template-columns:minmax(0,1fr) min(270px,42vw);grid-template-rows:auto auto minmax(0,1fr)}
  .im-compact .im-body{grid-column:1;grid-row:1/4}
  .im-compact .im-top{grid-column:2;grid-row:1;flex-wrap:wrap}.im-compact .im-msg{grid-column:2;grid-row:2}
  .im-compact .im-dock{grid-column:2;grid-row:3;border-top:0;border-left:1px solid var(--line);overflow:auto;justify-content:flex-start}
  .im-compact .im-top,.im-compact .im-msg{border-left:1px solid var(--line)}
}
.im-compact #im-battle:not([hidden]){display:grid;grid-template-columns:1fr 1fr;gap:0 .7rem}
.im-compact #im-battle h3,.im-compact #im-battle .im-bres,.im-compact #im-battle .im-bbtns{grid-column:1/3}
.im-compact .im-bbtns .im-btn,.im-compact #im-actions .im-btn{padding:.45rem .3rem;font-size:.86rem;white-space:nowrap}
@media (orientation:landscape){.im-compact .im-phases li:not(.on){display:none}.im-compact .im-top{flex-wrap:nowrap}.im-compact .im-dock{padding-bottom:.4rem}}

html[data-theme="dark"] .imperium{--g:#6cc79a;--card:#272e2a;--paper:#2d3630;--line:#48574e}
html[data-theme="dark"] .im-btn.pri,html[data-theme="dark"] .im-seg button.on,html[data-theme="dark"] .im-stats em,html[data-theme="dark"] .im-pl em{color:#0b1f14}
