/* Dice Arena shares World Conquest's dark cards, gold actions and clear typography. */
body:not(.online-screen) .panel,body:not(.online-screen) .pop{
  --ink:#f3f1e8;--mute:#a4b6ba;--line:#ffffff26;--gold:#f8cf75;
  --att:#ff8964;--def:#66d9db;--win:#8ce3af;--lose:#f17171;
  --panel2:#ffffff08;--parch:none;
  color:var(--ink);background:#0c202bf5;border:1px solid #ffffff26;
  box-shadow:0 12px 40px #0004;backdrop-filter:none;-webkit-backdrop-filter:none;
}
body:not(.online-screen) .panel .card,body:not(.online-screen) .panel .special{background:transparent}
body:not(.online-screen) .panel h1,body:not(.online-screen) .panel h2{
  font-family:var(--f-display);font-weight:700;color:var(--ink);text-shadow:none;letter-spacing:-.025em;
}
body:not(.online-screen) .panel h1 span{color:var(--gold)}
body:not(.online-screen) .panel .kicker,body:not(.online-screen) .panel .kick,body:not(.online-screen) .panel .sp-kick{
  color:var(--gold);border-color:#f8cf7533;background:#f8cf750d;
}
body:not(.online-screen) .panel :is(.hint,.news,.mode span,.pitem small,.row .rk,.popline,.pts span){color:var(--mute)}
body:not(.online-screen) .panel :is(.news b,.popline b,.name,.result .big,.pts b,.row .vl,.stats3 b){color:var(--ink)}
body:not(.online-screen) .panel .pts.win b{color:var(--win)}
body:not(.online-screen) .panel :is(.mult,.tag){color:var(--gold)}
body:not(.online-screen) .panel :is(.mode,.pitem,.pickbtn,.board,.stats3 div,.tile,.side){
  background:#ffffff08;border:1px solid #ffffff26;color:var(--ink);box-shadow:0 1px 2px #0003;
}
body:not(.online-screen) .panel :is(.mode,.pitem,.pickbtn):hover,
body:not(.online-screen) .panel .pitem.hot{background:#ffffff14;border-color:#ffffff55}
body:not(.online-screen) .panel .mode::before{display:none}
body:not(.online-screen) .panel .mode.lead{background:#f8cf751f;border-color:#f8cf7559}
body:not(.online-screen) .panel .mode.lead:hover{background:#f8cf752b;border-color:var(--gold)}
body:not(.online-screen) .panel :is(.pitem img,.row img,.tile img){box-shadow:0 0 0 1px #ffffff26}
body:not(.online-screen) .panel .plist{scrollbar-color:#ffffff26 transparent}
body:not(.online-screen) .panel .search{background:#ffffff08;border-color:#ffffff26;color:var(--ink);box-shadow:0 1px 2px #0003}
body:not(.online-screen) .panel .search::placeholder{color:var(--mute)}
body:not(.online-screen) .panel .search:focus{border-color:var(--gold)}
body:not(.online-screen) .panel .row{border-bottom-color:#ffffff17}
body:not(.online-screen) .panel .board h3{color:var(--gold)}
body:not(.online-screen) .panel .flagbox{box-shadow:0 0 0 1px #ffffff26,0 4px 12px #0004}
body:not(.online-screen) .panel .flagbox.empty{background:repeating-linear-gradient(135deg,#203947 0 8px,#18313e 8px 16px)}
body:not(.online-screen) .panel .die i.on{background:#15242b}
body:not(.online-screen) .panel .btn,body:not(.online-screen) .pop .btn{
  background:#16313f;border:1px solid #ffffff26;color:var(--ink);box-shadow:0 1px 2px #0003;
}
body:not(.online-screen) .panel .btn:hover,body:not(.online-screen) .pop .btn:hover{background:#234451;border-color:#ffffff55}
body:not(.online-screen) .panel .btn.primary{background:var(--gold);border-color:var(--gold);color:#1c1606;box-shadow:0 4px 16px #0003}
body:not(.online-screen) .panel .btn.primary:hover{background:#ffdd92}
body:not(.online-screen) .panel .btn:disabled{opacity:.5;cursor:default}
body:not(.online-screen) .panel .btn.warn,body:not(.online-screen) .pop .btn.warn{border-color:var(--lose);color:var(--lose)}
body:not(.online-screen) .pop .btn.off{color:var(--mute)}
body:not(.online-screen) .panel :is(button,input):focus-visible{outline:2px solid var(--gold);outline-offset:3px}
body:not(.home-screen):not(.online-screen) #hudMatch:not(:empty){
  display:inline-block;padding:8px 14px;border-radius:12px;color:#f3f1e8;background:#0c202bed;
  border:1px solid #ffffff26;box-shadow:0 6px 24px #0003;font:600 12px/1.3 var(--f-display);letter-spacing:0;
}

/* zoom controls */
.map-hint{white-space:nowrap;bottom:calc(var(--ins-b,0px) + 18px)!important}
body:not(.online-screen) .hud{padding-right:calc(var(--ins-r,0px) + 28px)}

/* layout: the map fills the screen; the panel floats over it as a sidebar (desktop) or a bottom sheet (phones).
   The camera centres fights in the part of the map that stays visible (see measureInsets in html.html). */
@media (min-width:900px){
  body:not(.home-screen):not(.online-screen) .panel{top:76px;bottom:16px;right:16px;left:auto;transform:none;width:420px;height:auto;border-radius:18px}
}
@media (max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel{top:auto;left:0;right:0;bottom:0;transform:none;width:100%;height:min(56dvh,560px);border-radius:18px 18px 0 0;border-bottom:0}
}

/* Keep the flags and fight summary at the top of the card. */
body:not(.online-screen) .panel{justify-content:flex-start}
body:not(.online-screen) .panel .tag{font-family:var(--f-mono)}
body:not(.online-screen) .panel>.sides{order:0}
body:not(.online-screen) .panel>.act{position:static;order:1;margin:1.5cqw 0}
body:not(.online-screen) .panel>.dice{order:2}
body:not(.online-screen) .panel>.result{order:3}
@media (max-width:899px){body:not(.online-screen) #hudMatch{display:none!important}}

/* Country cards: a clear flag header, readable names and generous click targets. */
body:not(.online-screen) .panel .pitem{padding:12px;border-radius:12px;gap:10px;min-height:68px}
body:not(.online-screen) .panel .pitem>span{min-width:0}
body:not(.online-screen) .panel .pitem .pn{font-size:14px;font-weight:700;line-height:1.3;white-space:normal;overflow-wrap:anywhere}
body:not(.online-screen) .panel .pitem small{font-size:11px;line-height:1.4;margin-top:4px}
body:not(.online-screen) .panel .plist{gap:10px;padding:2px 3px 4px;scrollbar-gutter:stable}
body:not(.online-screen) .panel .pitem:focus-visible{outline:2px solid var(--att);outline-offset:1px}
.panel-toolbar,.panel-restore{display:none}
#map{touch-action:none}
@media (min-width:900px){
  body:not(.home-screen):not(.online-screen) .panel{width:clamp(360px,30vw,420px);padding:24px 20px;gap:14px}
  body:not(.online-screen) .panel .sides{flex:none;align-items:start;padding-bottom:18px;border-bottom:1px solid rgba(255,255,255,.12)}
  body:not(.online-screen) .panel .side{gap:7px}
  body:not(.online-screen) .panel .flagbox{order:-1;margin:0 0 4px;width:24cqw;max-width:108px;border-radius:6px}
  body:not(.online-screen) .panel .name{font-size:18px;height:auto;min-height:24px;margin:0}
  body:not(.online-screen) .panel .lbl{font-size:10px;height:auto;min-height:13px}
  body:not(.online-screen) .panel .popline{font-size:10px;height:auto;min-height:14px;margin:0}
  body:not(.online-screen) .panel .mult{font-size:12px;height:auto;min-height:16px}
  body:not(.online-screen) .panel .pitem{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-height:136px;padding:14px}
  body:not(.online-screen) .panel .pitem img{width:72px;height:48px;object-fit:cover;border-radius:5px}
}
@media (max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel{
    height:min(var(--sheet-height,56dvh),var(--sheet-max,calc(100dvh - 96px)));
    padding:64px 16px max(14px,env(safe-area-inset-bottom));gap:10px;
    overflow-y:auto;overscroll-behavior:contain;
    contain:layout paint;
    background:#102733;--parch:none;
    box-shadow:0 -6px 28px #03121a40,inset 0 1px #ffffff0d;
    transition:transform .2s ease,visibility .2s;
  }
  body:not(.online-screen) .panel>.card,body:not(.online-screen) .panel>.special{top:52px;padding:16px 18px max(16px,env(safe-area-inset-bottom));gap:12px;overflow-y:auto}
  body:not(.online-screen) .panel h1{font-size:clamp(25px,6vw,34px)}
  body:not(.online-screen) .panel h2{font-size:clamp(21px,5.5vw,28px)}
  body:not(.online-screen) .panel .hint{font-size:11px;line-height:1.4}
  body:not(.online-screen) .panel .search{height:44px;min-height:44px;border-radius:9px}
  body:not(.online-screen) .panel .btn{height:auto;min-height:44px;font-size:11px;padding:10px 12px;white-space:normal}
  body:not(.online-screen) .panel .prow{gap:8px;flex-wrap:wrap}
  body:not(.online-screen) .panel .prow .btn{flex:1 1 80px}
  body:not(.online-screen) .panel .pitem{grid-template-columns:40px minmax(0,1fr);padding:10px;gap:10px}
  body:not(.online-screen) .panel .pitem img{width:40px;height:28px;border-radius:4px}
  body:not(.online-screen) .panel .pitem .pn{font-size:13px}
  body:not(.online-screen) .panel .pitem small{font-size:10px}
  body:not(.online-screen) .panel .sides,body:not(.online-screen) .panel>.dice,body:not(.online-screen) .panel>.act,body:not(.online-screen) .panel>.result{flex-shrink:0}
  .panel-toolbar{position:absolute;top:0;left:0;right:0;height:52px;z-index:10;display:flex;align-items:center;gap:12px;padding:0 12px;border-bottom:1px solid #ffffff26;background:#102733;border-radius:17px 17px 0 0}
  .panel-grip{flex:1;display:flex;align-items:center;gap:12px;min-width:0;height:48px;padding:0 8px;border:0;background:none;color:#a4b6ba;cursor:ns-resize;touch-action:none;text-align:left;font:600 12px var(--f-display);user-select:none;-webkit-user-select:none}
  .panel-handle{flex:none;width:30px;height:4px;border-radius:4px;background:#a4b6ba}
  #panelTitle{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  .panel-hide{display:flex;align-items:center;gap:8px;height:44px;padding:0 12px;border:0;border-radius:8px;background:none;color:#a4b6ba;font:600 12px var(--f-display);cursor:pointer}
  .panel-grip:focus-visible,.panel-hide:focus-visible{outline:2px solid #f8cf75;outline-offset:-2px}
  body:not(.home-screen):not(.online-screen) .panel.is-hidden{transform:translateY(calc(100% + 20px));visibility:hidden;pointer-events:none}
  .panel.is-dragging{transition:none!important}
  .panel-restore{position:absolute;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);z-index:6;display:flex;align-items:center;gap:16px;min-height:48px;padding:12px 20px;border:1px solid #ffffff26;border-radius:999px;background:#102733;color:#f3f1e8;box-shadow:0 6px 24px #03121a40;font:600 13px var(--f-display);cursor:pointer}
  .panel-restore[hidden],.home-screen .panel-toolbar,.online-screen .panel-toolbar,.home-screen .panel-restore,.online-screen .panel-restore{display:none}
  .home-screen #map{filter:none;transform:none;opacity:.5}
  .home-option,.zoomctl,.shell-home{backdrop-filter:none;-webkit-backdrop-filter:none}
  #map{transition:none}
}
@media (max-width:359px){body:not(.online-screen) .panel .plist{grid-template-columns:1fr}}
@media (max-height:500px) and (max-width:899px){body:not(.online-screen) .panel .plist{min-height:76px;flex-shrink:0}}
@media (prefers-reduced-motion:reduce){body:not(.online-screen) .panel{transition:none}}

/* a lighter vignette so pale flags stay clean; the save note sits on the map, clear of the panel */
body:not(.home-screen):not(.online-screen) .mapwrap::after{background:radial-gradient(ellipse at 40% 45%,transparent 45%,rgba(3,13,22,.32) 100%)}
body:not(.home-screen):not(.online-screen) .account-sync{right:calc(var(--ins-r,0px) + 76px);bottom:calc(var(--ins-b,0px) + 24px)}

/* Battle: skill minigames replace the dice */
.mg{order:1;flex:1;min-height:0;display:flex;flex-direction:column;gap:2.2cqw}
.mg[hidden]{display:none}
.panel.mg-on>.sides,.panel.mg-on>.dice,.panel.mg-on>.result,.panel.mg-on>.act{display:none!important}
.mg-top{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:2cqw}
.mg-side{display:flex;align-items:center;gap:2cqw}.mg-side.d{justify-content:flex-end}
.mg-side img{width:10cqw;height:7.5cqw;object-fit:cover;border-radius:.8cqw;box-shadow:0 0 0 1px rgba(60,40,15,.4)}
.mg-side b{font:700 8.5cqw/1 var(--f-display);font-variant-numeric:tabular-nums;display:inline-block}
.mg-side.a b{color:var(--att)}.mg-side.d b{color:var(--def)}
.mg-side.up b{animation:mgUp .3s}
.mg-mid{display:flex;flex-direction:column;align-items:center;text-align:center;min-width:0}
.mg-title{font:700 4.8cqw/1.1 var(--f-display);color:#f3f1e8}
.mg-mid small{font:500 2.5cqw var(--f-mono);letter-spacing:.12em;text-transform:uppercase;color:var(--mute);margin-top:.6cqw}
.mg.sudden .mg-mid small{color:var(--att)}
.mg-bar{height:1.5cqw;border-radius:1cqw;background:rgba(255,255,255,.12);overflow:hidden;flex:none}
.mg-bar i{display:block;height:100%;background:linear-gradient(90deg,#1f6f78,#2f9095);transform-origin:left}
.mg-bar.low i{background:linear-gradient(90deg,#a3402a,#c4573a)}
.mg-body{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:3.2cqw}
.mg-count{font:700 24cqw/1 var(--f-display);text-align:center;color:#f8cf75;animation:mgUp .45s}
.mg-q{text-align:center;font:700 7.4cqw/1.1 var(--f-display);color:#f3f1e8;overflow-wrap:anywhere}
.mg-flag img{width:48cqw;height:36cqw;object-fit:cover;border-radius:1.2cqw;box-shadow:0 0 0 1px rgba(60,40,15,.4),0 1cqw 3cqw rgba(60,40,10,.3);display:block;margin:0 auto}
.mg-opts{display:grid;grid-template-columns:1fr 1fr;gap:2.4cqw}
.mg-o{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.6cqw;min-height:15cqw;padding:2.4cqw;border-radius:1.8cqw;border:1px solid rgba(255,255,255,.18);background:rgba(16,44,58,.95);box-shadow:0 1px 2px #0003;font:700 4.2cqw/1.15 var(--f-display);color:var(--ink);cursor:pointer;text-align:center;transition:transform .1s,background .15s,border-color .15s}
.mg-o:hover{background:#1b3b49;border-color:#f8cf75}
.mg-o:active{transform:scale(.97)}
.mg-o img{display:block;object-fit:cover;border-radius:.8cqw;box-shadow:0 0 0 1px rgba(60,40,15,.35)}
.mg-opts.flags .mg-o{padding:2cqw}
.mg-opts.flags .mg-o img{width:min(100%,34cqw);aspect-ratio:4/3;height:auto}
.mg-opts.two .mg-o img{width:28cqw;height:21cqw}
.mg-o.ok{background:#173e35;border-color:var(--win);box-shadow:0 0 0 .5cqw rgba(46,125,58,.35)}
.mg-o.rival{background:#173b46;border-color:var(--def);box-shadow:0 0 0 .5cqw rgba(31,111,120,.35)}
.mg-o:disabled{cursor:default}
.mg-o.bad{background:#4b292d;border-color:var(--lose);animation:mgShake .3s}
.mg-o kbd{position:absolute;top:1cqw;left:1.6cqw;font:500 2.4cqw var(--f-mono);color:var(--mute)}
@media (pointer:coarse){.mg-o kbd{display:none}}
.mg-track{position:relative;height:16cqw;border-radius:2cqw;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.18);box-shadow:inset 0 1cqw 2cqw rgba(80,50,10,.15);cursor:pointer;touch-action:manipulation}
.mg-zone{position:absolute;top:0;bottom:0;background:#f8cf75;box-shadow:inset 0 0 0 1px rgba(110,74,16,.5);transition:left .2s,width .2s}
.mg-needle{position:absolute;top:-1.4cqw;bottom:-1.4cqw;width:1.4cqw;margin-left:-.7cqw;border-radius:1cqw;background:#f3f1e8;box-shadow:0 0 0 .5cqw rgba(255,251,238,.75)}
.mg-track.hit{box-shadow:0 0 0 .7cqw rgba(46,125,58,.55)}
.mg-track.miss{box-shadow:0 0 0 .7cqw rgba(168,50,42,.5);animation:mgShake .3s}
.mg-hit{touch-action:manipulation}
.result .tally{font:600 .62em var(--f-mono);color:var(--mute);letter-spacing:.06em}
@keyframes mgUp{0%{transform:scale(1.5)}100%{transform:scale(1)}}
@keyframes mgShake{0%,100%{transform:translateX(0)}25%{transform:translateX(-1.2cqw)}75%{transform:translateX(1.2cqw)}}
@media (prefers-reduced-motion:reduce){.mg-count,.mg-side b,.mg-o.bad,.mg-track.miss{animation:none}}

/* Large actions on phones; desktop uses separate floating controls below. */
@media (min-width:900px){
  body:not(.home-screen):not(.online-screen) .panel{
    top:auto;right:auto;bottom:16px;left:50%;transform:translateX(-50%);
    width:min(680px,calc(100% - 32px));height:min(46dvh,440px);min-height:280px;
    padding:20px;gap:12px;
  }
}
body:not(.home-screen):not(.online-screen) .panel .card{
  padding:20px;gap:12px;text-align:center;
}
body:not(.home-screen):not(.online-screen) .panel h1,
body:not(.home-screen):not(.online-screen) .panel h2{
  font:800 clamp(22px,3vw,30px)/1.15 var(--f-display);letter-spacing:-.025em;
}
body:not(.home-screen):not(.online-screen) .panel .hint:empty{display:none}
body:not(.home-screen):not(.online-screen) .panel .hint{font:400 12px/1.4 var(--f-display)}
body:not(.home-screen):not(.online-screen) .panel .kicker{font:600 11px/1.2 var(--f-mono);letter-spacing:.1em}
body:not(.home-screen):not(.online-screen) .panel .modes{
  margin-top:auto;display:grid;grid-template-columns:1fr 1fr;gap:12px;
}
body:not(.home-screen):not(.online-screen) .panel .mode{
  min-height:88px;display:flex;align-items:center;justify-content:center;padding:18px;text-align:center;
}
body:not(.home-screen):not(.online-screen) .panel .mode b{font:800 24px/1.15 var(--f-display)}
body:not(.home-screen):not(.online-screen) .panel .mode i{display:none}
body:not(.home-screen):not(.online-screen) .panel .btn{
  display:inline-flex;align-items:center;justify-content:center;min-height:64px;height:auto;
  padding:14px 20px;border-radius:14px;font:700 19px/1.2 var(--f-display);
  text-align:center;white-space:normal;
}
body:not(.home-screen):not(.online-screen) .panel .prow{
  flex:none;display:flex;justify-content:center;gap:12px;margin-top:auto;
  position:sticky;bottom:0;padding-top:12px;background:#102733;
}
body:not(.home-screen):not(.online-screen) .panel .prow .btn{flex:1;min-width:0}
body:not(.home-screen):not(.online-screen) .panel>.act{
  order:10;margin-top:auto;margin-bottom:0;width:100%;flex:none;text-align:center;
}
body:not(.home-screen):not(.online-screen) .panel>.act .btn{width:min(100%,480px);min-height:76px;font-size:24px;margin-inline:auto;letter-spacing:0}
body:not(.home-screen):not(.online-screen) #turn .plist{margin-top:auto;flex:0 1 auto}
body:not(.home-screen):not(.online-screen) #turn>.hint{display:none}
body:not(.home-screen):not(.online-screen) .panel .plist{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:10px;
  overflow-y:auto;min-height:0;flex:1;text-align:center;
}
body:not(.home-screen):not(.online-screen) .panel .pitem{
  min-height:82px;display:flex;flex-direction:row;align-items:center;justify-content:center;
  gap:12px;padding:14px;text-align:center;
}
body:not(.home-screen):not(.online-screen) .panel .pitem img{width:48px;height:32px;flex:none}
body:not(.home-screen):not(.online-screen) .panel .pitem .pn{font-size:17px}
body:not(.home-screen):not(.online-screen) .panel .pitem small{font-size:11px}
body:not(.home-screen):not(.online-screen) .panel .search{height:48px;min-height:48px;font-size:16px;border-radius:12px}
body:not(.home-screen):not(.online-screen) .panel .sides{padding-bottom:8px}
body:not(.home-screen):not(.online-screen) .panel .flagbox{width:64px;max-width:64px}
body:not(.home-screen):not(.online-screen) .panel .name{font-size:17px;min-height:20px;height:auto}
body:not(.home-screen):not(.online-screen) .panel .lbl{font-size:10px;min-height:12px;height:auto}
body:not(.home-screen):not(.online-screen) .panel .result .big{font-size:24px}
body:not(.home-screen):not(.online-screen) .panel .vs{padding-top:16px}
body:not(.home-screen):not(.online-screen) .panel .vs svg{width:44px;height:44px}
body:not(.home-screen):not(.online-screen) .panel>.dice{
  grid-template-columns:minmax(0,1fr) 28px minmax(48px,1fr) 28px minmax(0,1fr);
  grid-template-rows:repeat(3,28px);gap:5px 10px;justify-items:center;
  padding:10px;min-width:0;
}
body:not(.home-screen):not(.online-screen) .panel .die{width:28px;height:28px;padding:4px;gap:1px;border-radius:6px}
body:not(.home-screen):not(.online-screen) .panel .pts b{font-size:32px}
body:not(.home-screen):not(.online-screen) .panel .pts{min-width:0;gap:4px}
body:not(.home-screen):not(.online-screen) .panel .pts span{font-size:10px;letter-spacing:.1em}
body:not(.home-screen):not(.online-screen) .panel .tag{font-size:13px;line-height:1.2;min-width:0}
body:not(.home-screen):not(.online-screen) .panel>.result{min-height:0;flex-shrink:1}
body:not(.home-screen):not(.online-screen) .panel>.result:not(.on){display:none}
body:not(.home-screen):not(.online-screen) .panel:has(>#act:not([hidden]))>.dice{display:none}
body:not(.home-screen):not(.online-screen) .panel .side>.hidden-soft{display:none}
body:not(.home-screen):not(.online-screen) .panel .news{font-size:13px;line-height:1.4}
body:not(.home-screen):not(.online-screen) .panel .pickbtn{min-height:76px;padding:14px;gap:8px}
body:not(.home-screen):not(.online-screen) .panel .pickbtn span{font-size:18px}
body:not(.home-screen):not(.online-screen) .panel .mg-opts{margin-top:auto}
body:not(.home-screen):not(.online-screen) .panel .mg-o{min-height:64px;font-size:18px}
body:not(.home-screen):not(.online-screen) .panel .mg-hit{margin-top:auto}
@media(max-width:599px){
  body:not(.home-screen):not(.online-screen) .panel .card{padding:16px;gap:10px}
  body:not(.home-screen):not(.online-screen) .panel .btn{min-height:60px;padding:12px;font-size:17px}
  body:not(.home-screen):not(.online-screen) .panel .prow{gap:8px}
  body:not(.home-screen):not(.online-screen) .panel .pitem{min-height:76px;padding:10px;gap:8px}
  body:not(.home-screen):not(.online-screen) .panel .pitem img{width:36px;height:24px}
  body:not(.home-screen):not(.online-screen) .panel .pitem .pn{font-size:14px}
  body:not(.home-screen):not(.online-screen) .panel .mode{min-height:76px;padding:14px}
  body:not(.home-screen):not(.online-screen) .panel .mode b{font-size:22px}
}
@media(max-height:500px){
  body:not(.home-screen):not(.online-screen) #picker{
    display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto minmax(76px,1fr) auto;gap:10px;
  }
  body:not(.home-screen):not(.online-screen) #picker .kicker,
  body:not(.home-screen):not(.online-screen) #picker .hint{display:none}
  body:not(.home-screen):not(.online-screen) #picker h2{grid-column:1;grid-row:1;font-size:21px}
  body:not(.home-screen):not(.online-screen) #picker .search{grid-column:1;grid-row:2}
  body:not(.home-screen):not(.online-screen) #picker .plist{grid-column:2;grid-row:1/3;min-height:0;grid-template-columns:1fr}
  body:not(.home-screen):not(.online-screen) #picker .prow{grid-column:1/-1;grid-row:3;padding-top:0}
  body:not(.home-screen):not(.online-screen) .panel .side>.popline,
  body:not(.home-screen):not(.online-screen) .panel .side>.mult{display:none}
  body:not(.home-screen):not(.online-screen) .panel .flagbox{width:44px;max-width:44px}
}

/* Desktop: the map stays full-screen, with independent controls floating over it. */
@media(min-width:900px) and (min-height:501px){
  body:not(.home-screen):not(.online-screen) .panel{
    inset:0;transform:none;width:100%;height:100%;min-height:0;padding:0;gap:0;
    border:0;border-radius:0;background:none;box-shadow:none;overflow:visible;
    pointer-events:none;container-type:normal;
  }
  body:not(.home-screen):not(.online-screen) .panel>.card,
  body:not(.home-screen):not(.online-screen) .panel>.special{
    inset:auto auto 28px 50%;transform:translateX(-50%);width:min(860px,calc(100% - 64px));
    height:auto;max-height:calc(100dvh - 150px);container-type:inline-size;
    border-radius:20px;pointer-events:auto;
  }
  body:not(.home-screen):not(.online-screen) .panel>#picker{height:min(42dvh,360px);background:#0c202bf2;box-shadow:0 12px 40px #0004}
  body:not(.home-screen):not(.online-screen) .panel>#intro,
  body:not(.home-screen):not(.online-screen) .panel>#turn{
    padding:0;background:none;overflow:visible;pointer-events:none;
  }
  body:not(.home-screen):not(.online-screen) .panel>#intro{
    padding:16px;border:1px solid #ffffff26;border-radius:20px;background:#0c202bed;
    box-shadow:0 12px 40px #0004;
  }
  body:not(.home-screen):not(.online-screen) #intro>h1,
  body:not(.home-screen):not(.online-screen) #turn>h2,
  body:not(.home-screen):not(.online-screen) #turn>.kicker,
  body:not(.home-screen):not(.online-screen) #turn>.news:not(:empty){
    align-self:center;padding:10px 18px;border-radius:14px;background:#0c202bed;
    box-shadow:0 6px 24px #0003;
  }
  body:not(.home-screen):not(.online-screen) #intro>h1{background:none;box-shadow:none;padding:4px 0;font-size:26px}
  body:not(.home-screen):not(.online-screen) #intro .modes{margin-top:8px}
  body:not(.home-screen):not(.online-screen) #turn .plist{max-height:260px;margin-top:8px;pointer-events:auto}
  body:not(.home-screen):not(.online-screen) .panel .mode,
  body:not(.home-screen):not(.online-screen) .panel .pitem{background:#102c3af2;box-shadow:0 8px 28px #0004;pointer-events:auto}
  body:not(.home-screen):not(.online-screen) .panel .mode.lead{background:#f8cf751f}
  body:not(.home-screen):not(.online-screen) .panel .prow{background:none}
  body:not(.home-screen):not(.online-screen) .panel>.sides{
    position:absolute;top:92px;left:50%;transform:translateX(-50%);width:720px;
    container-type:inline-size;border:0;padding:0;gap:18px;grid-template-columns:1fr 52px 1fr;
  }
  body:not(.home-screen):not(.online-screen) .panel .side{display:grid;grid-template-columns:64px minmax(0,1fr);gap:3px 14px;padding:12px 18px;background:#0c202bed;border-radius:16px;box-shadow:0 8px 28px #0003;text-align:left}
  body:not(.home-screen):not(.online-screen) .panel .side>.flagbox{grid-column:1;grid-row:1/5;align-self:center;margin:0;order:0}
  body:not(.home-screen):not(.online-screen) .panel .side>:not(.flagbox){grid-column:2;text-align:left;margin:0}
  body:not(.home-screen):not(.online-screen) .panel .plist{grid-template-columns:repeat(3,minmax(0,1fr))}
  body:not(.home-screen):not(.online-screen) .panel .pitem{min-height:68px;padding:10px 14px}
  body:not(.home-screen):not(.online-screen) .panel .mode{min-height:72px}
  body:not(.home-screen):not(.online-screen) .panel>.dice{
    position:absolute;top:var(--battle-dice-top,200px);left:50%;transform:translateX(-50%);width:440px;
    container-type:inline-size;padding:12px;border-radius:16px;background:#0c202bed;
  }
  body:not(.home-screen):not(.online-screen) .panel>.result{
    position:absolute;top:var(--battle-result-top,330px);bottom:auto;left:50%;transform:translateX(-50%);
    width:max-content;max-width:640px;padding:14px 24px;border-radius:16px;background:#0c202bed;
  }
  body:not(.home-screen):not(.online-screen) .panel>.act{
    position:absolute;inset:auto auto 28px 50%;transform:translateX(-50%);
    width:min(800px,calc(100% - 64px));margin:0;container-type:inline-size;
  }
  body:not(.home-screen):not(.online-screen) .panel>.act button{pointer-events:auto;box-shadow:0 10px 32px #0005}
  body:not(.home-screen):not(.online-screen) .panel>.act .btn{width:min(100%,640px);min-height:64px;font-size:22px}
  body:not(.home-screen):not(.online-screen) .panel>.mg{
    position:absolute;inset:100px auto 28px 50%;transform:translateX(-50%);
    width:640px;max-height:calc(100dvh - 128px);container-type:inline-size;
    padding:20px;border-radius:20px;background:#0c202bed;pointer-events:auto;
  }
  body:not(.home-screen):not(.online-screen) .panel>.special{height:min(60dvh,560px);background:#0c202bed}
  body:not(.home-screen):not(.online-screen) .panel>#over,
  body:not(.home-screen):not(.online-screen) .panel>#board{height:min(48dvh,440px);background:#0c202bed}
}
@media(max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel:has(>#intro:not([hidden])){
    height:min(240px,calc(100dvh - 88px));
  }
}
@media(max-width:899px) and (max-height:500px){
  body:not(.home-screen):not(.online-screen) .panel:has(>#act:not([hidden])){height:calc(100dvh - 88px)}
}

/* Fixed mobile cards keep most of the screen available for the map. */
@media(max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel{
    height:clamp(230px,30dvh,280px);max-height:calc(100dvh - 88px);
    padding:44px 12px max(10px,env(safe-area-inset-bottom));gap:8px;
  }
  .panel-toolbar{height:34px;padding:0 10px}
  .panel-grip{height:34px;padding:0 6px;cursor:default;touch-action:auto;font-size:11px}
  .panel-hide{height:32px;padding:0 10px;font-size:11px}
  body:not(.home-screen):not(.online-screen) .panel>.card,
  body:not(.home-screen):not(.online-screen) .panel>.special{top:34px;padding:12px;gap:8px}
  body:not(.home-screen):not(.online-screen) .panel:has(>#intro:not([hidden])){height:180px}
  body:not(.home-screen):not(.online-screen) .panel:has(>#picker:not([hidden])){height:clamp(280px,38dvh,340px)}
  body:not(.home-screen):not(.online-screen) #picker>.kicker,
  body:not(.home-screen):not(.online-screen) #picker>.hint{display:none}
  body:not(.home-screen):not(.online-screen) .panel h1,
  body:not(.home-screen):not(.online-screen) .panel h2{font-size:22px}
  body:not(.home-screen):not(.online-screen) .panel .search{height:40px;min-height:40px}
  body:not(.home-screen):not(.online-screen) .panel .btn{min-height:48px;padding:10px 12px;font-size:16px}
  body:not(.home-screen):not(.online-screen) .panel .prow{padding-top:4px}
  body:not(.home-screen):not(.online-screen) .panel .mode{min-height:60px;padding:10px}
  body:not(.home-screen):not(.online-screen) .panel .pitem{min-height:60px;padding:8px}
  body:not(.home-screen):not(.online-screen) .panel .side{display:grid;grid-template-columns:36px minmax(0,1fr);gap:2px 6px;padding:7px;text-align:left}
  body:not(.home-screen):not(.online-screen) .panel .side>.flagbox{grid-column:1;grid-row:1/4;width:36px;max-width:36px;align-self:center;margin:0;order:0}
  body:not(.home-screen):not(.online-screen) .panel .side>:not(.flagbox){grid-column:2;text-align:left;margin:0}
  body:not(.home-screen):not(.online-screen) .panel .side>.popline{display:none}
  body:not(.home-screen):not(.online-screen) .panel .name{font-size:13px;min-height:16px}
  body:not(.home-screen):not(.online-screen) .panel .lbl{font-size:8px;min-height:10px;letter-spacing:.06em}
  body:not(.home-screen):not(.online-screen) .panel .mult{font-size:10px;height:auto}
  body:not(.home-screen):not(.online-screen) .panel .sides{grid-template-columns:1fr 28px 1fr;padding:0}
  body:not(.home-screen):not(.online-screen) .panel .vs{padding-top:12px}
  body:not(.home-screen):not(.online-screen) .panel .vs svg{width:26px;height:26px}
  body:not(.home-screen):not(.online-screen) .panel>.dice{grid-template-columns:minmax(0,1fr) 24px minmax(40px,1fr) 24px minmax(0,1fr);grid-template-rows:repeat(3,24px);padding:6px;gap:4px 8px}
  body:not(.home-screen):not(.online-screen) .panel .die{width:24px;height:24px;padding:3px}
  body:not(.home-screen):not(.online-screen) .panel>.act .btn{min-height:52px;font-size:20px}
  body:not(.home-screen):not(.online-screen) .panel>.result .big{font-size:19px}
  body:not(.home-screen):not(.online-screen) .panel:has(>#act:not([hidden])){height:clamp(210px,28dvh,250px)}
}

/* A real die is the roll action; its accessible name retains keyboard support. */
.roll-trigger{position:relative;display:grid;place-items:center;width:128px;height:128px;margin:auto;padding:24px;border:0;border-radius:24px;background:none;color:#183541;cursor:pointer;perspective:600px;touch-action:manipulation;isolation:isolate}
.roll-trigger::before{content:"";position:absolute;inset:2px;border-radius:50%;background:radial-gradient(circle,#f8cf7538,transparent 68%);z-index:-1}
.roll-surface{position:absolute;left:50%;top:calc(50% + 52px);width:220px;height:72px;transform:translate(-50%,-50%);border:1px solid #b59a6655;border-radius:50%;background:repeating-linear-gradient(5deg,#a5764217 0 2px,transparent 2px 7px),radial-gradient(ellipse,#473b2def,#142c36dd);box-shadow:0 10px 20px #0003;opacity:0;transition:opacity .12s;pointer-events:none;z-index:-1}
.roll-shadow{position:absolute;left:50%;top:calc(50% + 47px);width:105px;height:22px;transform:translateX(-50%);border-radius:50%;background:#020b13;filter:blur(3px);opacity:0;pointer-events:none;z-index:-1}
.roll-trigger.is-dropping .roll-surface{opacity:1}
.roll-trigger.is-dropping .roll-cube{animation:none}
.roll-trigger.is-dropping{cursor:default;pointer-events:none}
.roll-cube{position:relative;display:block;width:80px;height:80px;transform-style:preserve-3d;transform:rotateX(-18deg) rotateY(24deg) rotateZ(-8deg);animation:die-invite 3s ease-in-out infinite}
.roll-face{position:absolute;inset:0;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:5px;padding:12px;border:1px solid #c1d6d8;border-radius:13px;background:linear-gradient(145deg,#fffdf4,#dcebe9);backface-visibility:hidden;box-shadow:inset 0 -3px 0 #1735411a}
.roll-face i{display:block;border-radius:50%;background:transparent}
.roll-face i.on{background:#183541;box-shadow:inset 0 1px 2px #06101866}
.roll-face.face-0{transform:translateZ(40px)}
.roll-face.face-1{transform:rotateY(180deg) translateZ(40px)}
.roll-face.face-2{transform:rotateY(90deg) translateZ(40px)}
.roll-face.face-3{transform:rotateY(-90deg) translateZ(40px)}
.roll-face.face-4{transform:rotateX(90deg) translateZ(40px)}
.roll-face.face-5{transform:rotateX(-90deg) translateZ(40px)}
.roll-trigger:hover .roll-face{border-color:#f8cf75}
.roll-trigger:active{scale:.94}
.roll-trigger:focus-visible{outline:2px solid #f8cf75;outline-offset:5px}
body:not(.home-screen):not(.online-screen) .panel>.act button.roll-trigger{box-shadow:none}
@keyframes die-invite{0%,100%{transform:translateY(0) rotateX(-18deg) rotateY(24deg) rotateZ(-8deg)}50%{transform:translateY(-9px) rotateX(-25deg) rotateY(38deg) rotateZ(-3deg)}}
@media(min-width:900px) and (min-height:501px){
  body:not(.home-screen):not(.online-screen) .panel>.act:has(>.roll-trigger){inset:50% auto auto 50%;transform:translate(-50%,-50%);width:128px}
}

/* Phone battles float over the map instead of living in a bottom card. */
@media(max-width:899px){
  body.dice-playing:not(.home-screen):not(.online-screen) .panel,
  body.dice-playing:not(.home-screen):not(.online-screen) .panel:has(>#act:not([hidden])){
    inset:0;transform:none;width:100%;height:100%;max-height:none;padding:0;gap:0;
    background:none;border:0;border-radius:0;box-shadow:none;overflow:visible;
    contain:none;container-type:normal;pointer-events:none;
  }
  body.dice-playing .panel-toolbar,body.dice-playing .panel-restore{display:none}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel>.sides{
    position:absolute;top:calc(80px + env(safe-area-inset-top,0px));left:12px;right:12px;
    width:auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;
    padding:0;border:0;container-type:inline-size;
  }
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .vs{display:none}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .side{
    display:grid;grid-template-columns:40px minmax(0,1fr);gap:3px 8px;padding:9px;
    background:#18313ded;border:1px solid #ffffff26;border-radius:12px;box-shadow:0 6px 20px #0003;
  }
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .side>.flagbox{width:40px;max-width:40px;grid-row:1/4}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .name{font-size:14px;line-height:1.2;min-height:17px}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .lbl{font-size:9px}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .mult{font-size:12px}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel>.act{
    position:absolute;inset:50% auto auto 50%;transform:translate(-50%,-50%);
    width:128px;margin:0;container-type:inline-size;pointer-events:none;
  }
  body.dice-playing .roll-trigger{pointer-events:auto;box-shadow:none}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel>.dice{
    position:absolute;inset:var(--battle-dice-top,160px) auto auto 50%;transform:translateX(-50%);
    width:min(360px,calc(100% - 24px));padding:12px;background:none;container-type:inline-size;
  }
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .pts{padding:8px;border-radius:12px;background:#0c202bed}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel>.result{
    position:absolute;inset:var(--battle-result-top,280px) auto auto 50%;transform:translateX(-50%);
    width:max-content;max-width:calc(100% - 32px);padding:12px 20px;border-radius:14px;background:#0c202bed;
  }
  body.dice-playing:not(.home-screen):not(.online-screen) .panel>#turn{
    inset:auto auto 20px 50%;transform:translateX(-50%);width:calc(100% - 24px);
    height:auto;max-height:38dvh;padding:0;background:none;border:0;overflow:visible;pointer-events:none;
  }
  body.dice-playing #turn>.kicker,body.dice-playing #turn>h2,body.dice-playing #turn>.news:not(:empty){align-self:center;padding:6px 12px;border-radius:12px;background:#0c202bed}
  body.dice-playing:not(.home-screen):not(.online-screen) #turn .plist{max-height:24dvh;pointer-events:auto;overflow-y:auto;margin-top:4px}
  body.dice-playing:not(.home-screen):not(.online-screen) .panel .pitem{background:#18313df2}
}
@media(prefers-reduced-motion:reduce){.roll-cube{animation:none}}
body.reduced-motion .roll-cube{animation:none}

/* Reserve two full nation rows; the footer never overlaps the scrolling list. */
body:not(.home-screen):not(.online-screen) .panel>#picker{
  display:grid;grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto auto minmax(120px,1fr) auto;
  gap:8px;padding:14px;overflow:hidden;
}
body:not(.home-screen):not(.online-screen) #picker>.kicker,
body:not(.home-screen):not(.online-screen) #picker>.hint{display:none}
body:not(.home-screen):not(.online-screen) #picker>h2{
  grid-column:1;grid-row:1;font-size:23px;margin:0;
}
body:not(.home-screen):not(.online-screen) #picker>.search{
  grid-column:1;grid-row:2;height:36px;min-height:36px;padding:0 12px;
}
body:not(.home-screen):not(.online-screen) #picker>.plist{
  grid-column:1;grid-row:3;grid-template-columns:repeat(2,minmax(0,1fr));
  grid-auto-rows:minmax(56px,auto);gap:6px;min-height:0;margin:0;padding:2px;
}
body:not(.home-screen):not(.online-screen) #picker .pitem{
  min-height:56px;padding:6px 8px;gap:8px;justify-content:flex-start;text-align:left;
}
body:not(.home-screen):not(.online-screen) #picker .pitem img{width:32px;height:22px}
body:not(.home-screen):not(.online-screen) #picker .pitem .pn{font-size:13px;line-height:1.2}
body:not(.home-screen):not(.online-screen) #picker .pitem small{font-size:10px;margin-top:3px}
body:not(.home-screen):not(.online-screen) #picker>.prow{
  grid-column:1;grid-row:4;position:static;margin:0;padding:0;gap:8px;background:none;flex-wrap:nowrap;
}
body:not(.home-screen):not(.online-screen) #picker>.prow .btn{
  flex:0 1 auto;min-height:40px;height:40px;padding:6px 12px;border-radius:9px;
  font-size:13px;line-height:1.2;letter-spacing:0;
}
body:not(.home-screen):not(.online-screen) #picker>.prow .primary{margin-left:auto}
@media(min-width:900px) and (min-height:501px){
  body:not(.home-screen):not(.online-screen) .panel>#picker{
    width:min(640px,calc(100% - 48px));height:310px;
  }
  body:not(.home-screen):not(.online-screen) #picker>.plist{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:899px), (max-height:500px){
  body:not(.home-screen):not(.online-screen) .panel:has(>#picker:not([hidden])){
    height:320px;min-height:0;max-height:calc(100dvh - 88px);
  }
  body:not(.home-screen):not(.online-screen) .panel>#picker{padding:10px;gap:6px}
  body:not(.home-screen):not(.online-screen) #picker>h2{font-size:21px}
}

/* Standings actions sit above the entire mobile card, including its toolbar. */
@media(max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel:has(>#board:not([hidden])){overflow:visible;contain:layout}
  body:not(.home-screen):not(.online-screen) .panel>#standingsActions{
    position:absolute;top:auto;bottom:calc(100% + 12px);left:12px;right:12px;
    margin:0!important;padding:0;background:none;z-index:11;pointer-events:auto;
  }
  .panel:not(:has(>#board:not([hidden])))>#standingsActions{display:none!important}
}

/* Phones: the mode menu and the nation picker float over the map like the turn screen,
   with no card behind them: a title pill, then the buttons themselves. */
@media(max-width:899px){
  body:not(.home-screen):not(.online-screen) .panel:is(:has(>#intro:not([hidden])),:has(>#picker:not([hidden]))){
    top:auto;bottom:0;left:0;right:0;width:100%;height:auto;max-height:none;
    padding:0 12px calc(16px + env(safe-area-inset-bottom,0px));
    background:none;border:0;border-radius:0;box-shadow:none;overflow:visible;pointer-events:none;
  }
  body:not(.home-screen):not(.online-screen) .panel:is(:has(>#intro:not([hidden])),:has(>#picker:not([hidden])))>:is(.panel-toolbar,.sides,.dice,.result){display:none}
  body:not(.home-screen):not(.online-screen) .panel>:is(#intro,#picker){position:relative;inset:auto;width:100%;height:auto;padding:0;gap:10px;background:none;overflow:visible;pointer-events:none}
  body:not(.home-screen):not(.online-screen) .panel>:is(#intro,#picker)>:is(h1,h2,.kicker){
    align-self:center;margin:0;padding:6px 14px;border-radius:12px;background:#0c202bed;box-shadow:0 6px 20px #0003;
  }
  body:not(.home-screen):not(.online-screen) .panel>#intro h1{font-size:20px}
  body:not(.home-screen):not(.online-screen) .panel>#picker>.kicker{display:none}
  body:not(.home-screen):not(.online-screen) .panel>#picker>h2{font-size:18px}
  body:not(.home-screen):not(.online-screen) .panel>:is(#intro,#picker) :is(.mode,.btn,.pitem,.search,#pCont){
    pointer-events:auto;background:#18313df2;border:1px solid #ffffff2e;box-shadow:0 8px 24px #03121a59;
  }
  body:not(.home-screen):not(.online-screen) .panel>#intro .mode.lead{background:#3a3a26f2;border-color:#f8cf7599}
  body:not(.home-screen):not(.online-screen) .panel>#intro .modes{margin-top:4px}
  body:not(.home-screen):not(.online-screen) .panel>#intro .mode{min-height:72px}
  body:not(.home-screen):not(.online-screen) .panel>#picker .plist{max-height:30dvh;background:none;overflow-y:auto;pointer-events:auto;margin-top:0;padding:2px}
  body:not(.home-screen):not(.online-screen) .panel>#picker .prow{position:static;background:none;padding-top:2px}
  body:not(.home-screen):not(.online-screen) .panel>#picker .prow .btn{min-height:52px}
  body:not(.home-screen):not(.online-screen) .panel>#picker .btn.primary{background:var(--gold)}
}
