/* ==========================================================================
   Round 9 — redesigned screens (Cities, Trade, World, Bounties, Baseball), layout fixes, responsive tablet/phone layout.
   ========================================================================== */
/* ---------- shared: KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.kpi { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--r2); padding: 8px 12px; min-width: 0; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .7; }
.kpi.good::before { background: var(--good); } .kpi.bad::before { background: var(--bad); } .kpi.warn::before { background: var(--warn); }
.kpi small { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi b { display: block; font-size: 1.28rem; line-height: 1.25; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { display: block; font-size: .72rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.bad b { color: var(--bad); }
.sb { height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; flex: 1; min-width: 40px; }
.sb i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; box-shadow: 0 0 8px rgba(34,211,238,.25); }

/* ---------- Cities ---------- */
.c9 { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.c9-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 150px); }
.c9-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 2px; }
.c9-card { text-align: left; display: block; width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r2); padding: 9px 10px; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.c9-card:hover { border-color: var(--line2); background: var(--card); }
.c9-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim), 0 0 18px rgba(34,211,238,.12); background: var(--card2); }
.c9-ch { display: flex; align-items: center; gap: 6px; } .c9-ch b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw { display: inline-flex; } .pw.on { color: var(--warn); } .pw.off { color: var(--bad); }
.c9-kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0; }
.c9-kv small { display: block; font-size: .58rem; letter-spacing: .12em; color: var(--muted); } .c9-kv b { font-size: .84rem; }
.c9-foot { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: 5px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(9px, 1fr)); gap: 2px; }
.slots .slot { height: 9px; border-radius: 2px; display: block; }
.slots .slot.f { background: var(--c); opacity: .9; } .slots .slot.e { background: transparent; border: 1px dashed #2a3b55; }
.slots.big { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.slots.big .slot { height: 30px; display: flex; align-items: center; justify-content: center; font: 700 .62rem var(--mono); font-style: normal; color: #071019; letter-spacing: -.02em; }
.slots.big .slot.f { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 92%, white), var(--c)); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.slots.big .slot.e { color: #3f5675; font-size: .9rem; cursor: pointer; } .slots.big .slot.e:hover { border-color: var(--accent); color: var(--accent); }
.slot-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .72rem; color: var(--text2); }
.slot-leg i, .imp9-cat h4 i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.c9-new { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.c9-new input { width: 100%; }
.c9-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.c9-head .c9-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.c9-head .c9-title h2 { margin: 0; } .c9-head .row input { width: 150px; }
.pwtag { font: 700 .62rem var(--mono); letter-spacing: .12em; padding: 2px 6px; border-radius: 3px; border: 1px solid; }
.pwtag.on { color: var(--good); border-color: rgba(52,211,153,.4); } .pwtag.off { color: var(--bad); border-color: rgba(251,77,100,.5); }
.c9-grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.qbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.qb { display: flex; gap: 8px; align-items: center; text-align: left; padding: 7px 9px; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r2); color: var(--text); }
.qb:hover:not(:disabled) { border-color: var(--accent); }
.qb i { flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.qb span { min-width: 0; } .qb b { display: block; font-size: .8rem; } .qb small { display: block; font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qb.off { opacity: .45; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; margin: 4px 0 8px; }
.btnrow > button { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 5px 10px; }
.btnrow > button small { font-size: .64rem; color: var(--muted); font-family: var(--mono); }
.btnrow .cust { display: inline-flex; gap: 4px; } .btnrow .cust input { width: 80px; }
.c9-catalog > summary { list-style: none; cursor: pointer; } .c9-catalog > summary::-webkit-details-marker { display: none; }
.c9-catalog > summary h3 { margin: 0 0 6px; }
.imp9-cat { margin-top: 10px; } .imp9-cat h4 { margin: 4px 0 6px; }
.imp9-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.imp9 { border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--r2); padding: 7px 9px; background: var(--bg3); display: flex; flex-direction: column; gap: 4px; }
.imp9.dim { opacity: .45; }
.imp9-h { display: flex; justify-content: space-between; gap: 6px; font-size: .82rem; } .imp9-h .mono { color: var(--text2); }
.imp9-m small { color: var(--muted); font-size: .68rem; }
.imp9-a { display: flex; gap: 4px; } .imp9-a button { padding: 3px 10px; font-size: .74rem; }

/* ---------- Trade ---------- */
.t9 { display: flex; flex-direction: column; gap: 14px; }
.t9-tape { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r2); background: #050a10; height: 30px; position: relative; }
.t9-tape-in { display: inline-flex; gap: 26px; white-space: nowrap; padding: 6px 12px; font: 600 .74rem var(--mono); animation: t9tape 60s linear infinite; }
.t9-tape .tk { color: var(--text2); } .t9-tape .tk b { color: var(--text); } .t9-tape .tk.up { color: var(--good); } .t9-tape .tk.dn { color: var(--bad); }
@keyframes t9tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.t9-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; align-items: start; }
.t9-tbl tbody tr { cursor: pointer; } .t9-tbl tbody tr:hover td { background: rgba(34,211,238,.05); }
.t9-tbl tbody tr.sel td { background: rgba(34,211,238,.1); box-shadow: inset 0 1px 0 var(--accent-dim), inset 0 -1px 0 var(--accent-dim); }
.t9-tbl tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.msp { display: block; }
.t9-ch h2 { margin: 0 0 6px; } .t9-ch h2 .big { font-size: 1.4rem; color: var(--accent); margin-left: auto; }
.t9-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.t9-stats small { display: block; font-size: .6rem; letter-spacing: .14em; color: var(--muted); } .t9-stats b { font-size: .9rem; }
.pchart { width: 100%; height: 230px; display: block; background: #060b12; border: 1px solid var(--line); border-radius: var(--r2); }
.pchart .gl { stroke: #15233a; stroke-width: 1; } .pchart .base { stroke: #3a4f6e; stroke-dasharray: 4 4; } .pchart .gt { fill: #58708f; font: 9px var(--mono); }
.chart-empty { padding: 60px 10px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r2); }
.t9-ticket { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto auto; gap: 8px; align-items: center; margin-top: 10px; padding: 10px; border: 1px solid var(--line2); border-radius: var(--r2); background: var(--bg3); }
.t9-side small { display: block; font-size: .6rem; letter-spacing: .14em; color: var(--muted); } .t9-side b { font-size: 1.05rem; }
.t9-side.buy b { color: var(--good); } .t9-side.sell b { color: var(--bad); }
.t9-qty input { width: 100%; font-family: var(--mono); } .qpre { display: flex; gap: 4px; margin-top: 4px; } .qpre button { flex: 1; padding: 2px 4px; }

/* ---------- World ---------- */
.w9 { display: flex; flex-direction: column; gap: 14px; }
.w9-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.w9-rank .tblwrap { max-height: 620px; overflow: auto; }
.w9-tbl td.rk { color: var(--muted); width: 28px; }
.w9-bar { min-width: 150px; } .w9-bar { display: flex; align-items: center; gap: 8px; } .w9-bar .mono { width: 46px; text-align: right; font-size: .8rem; }
.w9-tbl tr.me td { background: rgba(34,211,238,.08); }
.w9-web .treatyweb { margin: 0; } .w9-web .twsvg { max-height: 540px; }
.w9-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.blocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bloc { border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--r2); padding: 8px 10px; background: var(--bg3); display: flex; flex-direction: column; gap: 5px; }
.bloc .sb i { background: var(--c); } .bloc-h { display: flex; align-items: center; gap: 6px; } .bloc-h b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theatres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.theatres li { display: grid; grid-template-columns: auto 1fr 60px 60px; gap: 8px; align-items: center; font-size: .8rem; padding: 5px 6px; border-radius: var(--radius); background: var(--bg3); }
.theatres li.imp { border: 1px solid rgba(251,77,100,.4); }
.theatres .res { height: 5px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; } .theatres .res i { display: block; height: 100%; background: var(--warn); } .theatres .res.d i { background: var(--info); }

/* ---------- Bounties: wanted board ---------- */
.b9 { display: flex; flex-direction: column; gap: 14px; }
.b9-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.b9-side { display: flex; flex-direction: column; gap: 14px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.wanted { position: relative; text-align: center; padding: 12px 12px 10px; border-radius: 3px; color: #2b1d0e;
  background: radial-gradient(circle at 30% 20%, #f3e2bd, #e2c891 70%, #cfae6c); box-shadow: 0 6px 16px rgba(0,0,0,.45), inset 0 0 30px rgba(120,80,30,.35); transform: rotate(-.6deg); }
.wanted:nth-child(2n) { transform: rotate(.7deg); } .wanted:nth-child(3n) { transform: rotate(-.2deg); }
.wanted::before { content: ''; position: absolute; top: 6px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8b8b, #a51d1d); box-shadow: 0 1px 2px rgba(0,0,0,.6); }
.wanted.me { background: radial-gradient(circle at 30% 20%, #ffd7d7, #f0a9a9 70%, #d97a7a); }
.w-h { font: 900 1.5rem/1 Georgia, 'Times New Roman', serif; letter-spacing: .18em; margin: 8px 0 8px; color: #3a220c; }
.w-flag { display: flex; justify-content: center; } .w-flag svg, .w-flag img { border: 3px solid #3a220c; box-shadow: 0 2px 0 rgba(0,0,0,.2); filter: sepia(.25) contrast(1.05); }
.w-name { font: 800 1.05rem Georgia, serif; margin-top: 8px; } .w-sub { font-size: .7rem; opacity: .8; }
.w-reward { margin: 8px 0 4px; border-top: 2px solid #3a220c; border-bottom: 2px solid #3a220c; padding: 4px 0; }
.w-reward small { display: block; font: 700 .62rem Georgia, serif; letter-spacing: .3em; } .w-reward b { font-size: 1.35rem; color: #6b1010; }
.w-types { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; } .w-types .chip { background: rgba(58,34,12,.12); color: #3a220c; border-color: rgba(58,34,12,.3); font-size: .66rem; }
.w-msg { font: italic .74rem Georgia, serif; margin-top: 6px; opacity: .85; }
.w-act { margin-top: 8px; display: flex; gap: 8px; align-items: center; justify-content: center; } .w-act .pos { color: #155d2c; } .w-act .muted { color: #6d5838; }
.formgrid.one { grid-template-columns: 1fr; }
.ledger { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .78rem; }
.ledger li { display: flex; gap: 8px; } .ledger .turn { color: var(--muted); flex: none; }

/* ---------- Baseball: scoreboard + league ---------- */
.bb9 { display: flex; flex-direction: column; gap: 14px; }
.bb9-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: stretch; }
.sboard { background: linear-gradient(180deg, #0b2a1a, #071c11); border: 6px solid #3b2b14; border-radius: 6px; box-shadow: inset 0 0 40px rgba(0,0,0,.6), 0 6px 18px rgba(0,0,0,.5); padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; gap: 10px; color: #f8f3d4; }
.sb-top, .sb-bot { text-align: center; font: 700 .72rem var(--mono); letter-spacing: .22em; color: #ffd76a; }
.sb-bot { color: #b9d8c2; letter-spacing: .08em; }
.sb-row { display: grid; grid-template-columns: 1fr auto auto auto 1fr; gap: 12px; align-items: center; }
.sb-team { font: 800 1rem var(--sans); text-transform: uppercase; letter-spacing: .04em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-team small { display: block; font: 700 .6rem var(--mono); letter-spacing: .2em; color: #8fbf9e; } .sb-team.r { text-align: right; }
.led { font: 700 2.6rem/1 var(--mono); color: #ffb020; background: #050505; padding: 4px 10px; border-radius: 4px; text-shadow: 0 0 10px rgba(255,176,32,.8); letter-spacing: .05em; border: 1px solid #222; }
.sb-vs { font: 700 1.6rem var(--mono); color: #6f8f7a; }
.bb9-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.bb9-grid aside { display: flex; flex-direction: column; gap: 14px; }
.roster9 { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 8px; }
.pcard { border: 1px solid var(--line); border-radius: var(--r2); padding: 8px; background: var(--bg3); display: flex; flex-direction: column; gap: 4px; }
.pc-h { display: flex; gap: 5px; align-items: center; } .pc-h .bbname { flex: 1; min-width: 0; padding: 2px 5px; font-size: .78rem; }
.pc-h .pos { font: 800 .7rem var(--mono); background: var(--accent); color: #031016; padding: 2px 5px; border-radius: 3px; }
.pst { display: grid; grid-template-columns: 46px 36px 1fr auto; gap: 6px; align-items: center; font-size: .74rem; }
.pst small { font-size: .58rem; letter-spacing: .12em; color: var(--muted); }
.statbar { height: 5px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; } .statbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.standings tr.me td { background: rgba(34,211,238,.1); }
.results9 { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: .78rem; }
.results9 li { display: grid; grid-template-columns: 38px 1fr auto 1fr; gap: 8px; align-items: center; padding: 3px 5px; border-radius: 3px; }
.results9 li.imp { background: rgba(34,211,238,.08); } .results9 li span:last-child { text-align: right; } .results9 .w { color: var(--good); font-weight: 650; } .results9 .turn { color: var(--muted); }

/* ---------- Rules & differences page ---------- */
.rules9 { display: flex; flex-direction: column; gap: 14px; max-width: 1200px; }
.rules9 table td:first-child { white-space: nowrap; font-weight: 600; }
.rules9 .src { font-size: .7rem; color: var(--muted); }
.rules9 .chg { color: var(--warn); } .rules9 .same { color: var(--good); }

/* ---------- layout fixes ---------- */
/* status-bar title: never truncate the nation name to "…" at common widths — let the name take what it needs and
   shrink the stat pills first; the sub-line can ellipsise. */
#topbar .brand { flex: 0 1 auto; min-width: 0; max-width: 34%; }
#hdr-name { font-size: .95rem; overflow: visible; text-overflow: clip; white-space: nowrap; }
#hdr-stats.statusbar { flex: 1 1 0; }
@media (max-width: 1360px) { #hdr-sub { display: none; } #hdr-name { font-size: .9rem; } }
.endday { margin-left: 4px; }
/* intel panel between 1100 and 1599 px: push content (a real grid column) instead of covering it */
@media (min-width: 1100px) and (max-width: 1599px) {
  :root { --intel-w: 280px; }
  #stage-body { grid-template-columns: minmax(0, 1fr) var(--intel-w); }
  body.intel-closed #stage-body { grid-template-columns: minmax(0, 1fr) 0; }
  #intel { position: relative; transform: none !important; box-shadow: none; width: auto; }
  body.intel-closed #intel { visibility: hidden; }
}
/* map credit: keep it clear of the legend on short screens (720 px tall) */
.sitroom .sit-credit { bottom: 6px; }
@media (max-height: 800px) {
  .sitroom .mapwrap > .maplegend { bottom: 26px; max-height: 64px; overflow: hidden; }
  .sit-credit { font-size: .62rem; }
}
@media (max-width: 1500px) { .c9 { grid-template-columns: 280px minmax(0, 1fr); } }
@media (max-width: 1360px) {
  .c9-grid2, .t9-grid, .w9-main, .w9-row, .bb9-top, .bb9-grid { grid-template-columns: minmax(0, 1fr); }
  .b9-grid { grid-template-columns: minmax(0, 1fr) 290px; }
}

/* ---------- tablet / phone: nav rail → bottom bar, panels stack, cutscenes scale ---------- */
@media (max-width: 900px) {
  :root { --bar-h: 58px; }
  html, body { overflow: hidden; }
  #shell, body.rail-collapsed #shell { grid-template-columns: minmax(0, 1fr); }
  #tabs.rail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: var(--bar-h); flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: none; border-top: 1px solid var(--line); z-index: 60;
    background: rgba(7,12,20,.97); backdrop-filter: blur(8px); scrollbar-width: none; }
  #tabs.rail::-webkit-scrollbar { display: none; }
  #tabs.rail .rail-brand, #tabs.rail .rail-foot, #tabs.rail .rail-gh { display: none; }
  #tabs.rail .rail-groups { display: flex; flex-direction: row; padding: 0; flex: none; }
  #tabs.rail .rail-group { display: flex; flex-direction: row; padding: 0; }
  #tabs.rail button, #tabs.rail .rail-item { flex-direction: column !important; justify-content: center; gap: 2px !important; min-width: 64px; height: var(--bar-h); padding: 4px 6px !important; font-size: .6rem !important; border-left: none !important; border-top: 2px solid transparent; border-radius: 0; }
  #tabs.rail button.active, #tabs.rail .rail-item.active { border-top-color: var(--accent); }
  #tabs.rail button .lbl, #tabs.rail .rail-item .lbl { display: block !important; white-space: nowrap; max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
  #stage { height: calc(100vh - var(--bar-h)); height: calc(100dvh - var(--bar-h)); }
  #rail-toggle { display: none; }
  #topbar .tb-main { flex-wrap: wrap; gap: 6px; padding: 6px 8px; height: auto; }
  #topbar .brand { max-width: 60%; order: 1; } .hdr-actions { order: 2; margin-left: auto; }
  #hdr-stats.statusbar { order: 3; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; } #hdr-stats::-webkit-scrollbar { display: none; }
  .hdr-actions #btn-sound { display: none; }
  .hdr-actions .endturn { padding: 6px 10px; }
  .tb-res { overflow-x: auto; } .resstrip { flex-wrap: nowrap; }
  main#view { padding: 10px 10px 16px; }
  #stage-body, body.intel-closed #stage-body { grid-template-columns: minmax(0, 1fr); }
  #intel { position: absolute; right: 0; top: 0; bottom: 0; width: min(88vw, 320px); z-index: 50; }
  body.intel-closed #intel { transform: translateX(100%); visibility: hidden; }
  #ticker { display: none; }
  .c9, .b9-grid, .grid2, .cities, .dip, .twlayout, .ops-grid, .mapview, .nb, .brief-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .c9-side { position: static; max-height: none; }
  .c9-cards { flex-direction: row; overflow-x: auto; } .c9-card { min-width: 220px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t9-ticket { grid-template-columns: 1fr 1fr; } .t9-qty { grid-column: 1 / -1; order: -1; }
  .tbl { font-size: .76rem; } .tblwrap, .t9-board, .w9-rank { overflow-x: auto; }
  .board { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .led { font-size: 1.9rem; } .sb-team { font-size: .8rem; }
  .sit-brief { display: none; } .sitroom .mapwrap > .maplegend { max-width: calc(100% - 16px); }
  #toasts { bottom: calc(var(--bar-h) + 8px); right: 8px; left: 8px; }
  .modal { width: calc(100vw - 16px) !important; max-width: none !important; max-height: calc(100dvh - 16px); }
  /* cutscenes scale to the viewport */
  .cs-frame { width: 100vw !important; max-width: 100vw !important; padding: 6px !important; }
  .cs-stage, .cs-stage canvas { max-width: 100% !important; height: auto !important; }
  .cs-hud { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .kpi b { font-size: 1.05rem; }
  #hdr-res .rchip .rl { display: none; }
  .w9-tbl th:nth-child(5), .w9-tbl td:nth-child(5), .w9-tbl th:nth-child(7), .w9-tbl td:nth-child(7) { display: none; }
  .t9-tbl th:nth-child(4), .t9-tbl td:nth-child(4), .t9-tbl th:nth-child(5), .t9-tbl td:nth-child(5) { display: none; }
}
#btn-end-day[hidden], [hidden].endday { display: none !important; }
.qb { width: 100%; justify-content: flex-start; }
/* world rankings: compact one-line rows */
.w9-main { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.w9-tbl td { vertical-align: middle; padding-top: 5px; padding-bottom: 5px; }
.w9-tbl td:nth-child(2) { max-width: 230px; white-space: nowrap; }
.w9-tbl td:nth-child(2) .tiny, .w9-tbl td:nth-child(2) > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w9-tbl td.w9-bar { min-width: 110px; }
.w9-tbl td:nth-child(5) { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w9-tbl td.nowrap .tag { margin-right: 3px; }
@media (max-width: 1360px) { .w9-main { grid-template-columns: minmax(0, 1fr); } }
.btn-sub { opacity: .75; font-weight: 500; }
button.primary .muted { color: rgba(3,16,22,.7) !important; }
.w9-tbl .tag { font-size: .56rem; padding: 1px 4px; letter-spacing: .02em; }
.w9-tbl td.w9-bar { min-width: 96px; } .w9-tbl td:nth-child(5) { max-width: 118px; } .w9-tbl td:nth-child(2) { max-width: 200px; }
.w9-tbl th, .w9-tbl td { padding-left: 6px; padding-right: 6px; }
.w9-tbl td.w9-bar { display: table-cell; } .w9b { display: flex; align-items: center; gap: 8px; } .w9b .mono { width: 46px; text-align: right; font-size: .8rem; }
/* bathymetry layer: sits between the flat sea and the graticule/land */
.worldmap .bathy { image-rendering: auto; opacity: .95; pointer-events: none; }
.mapwrap.pick .worldmap .bathy { opacity: .7; }
/* intel pushed open at 1100-1599 px: the main column is ~300 px narrower, so stack the two-column screens */
@media (max-width: 1599px) { body:not(.intel-closed) .w9-main, body:not(.intel-closed) .c9-grid2, body:not(.intel-closed) .t9-grid, body:not(.intel-closed) .bb9-top, body:not(.intel-closed) .bb9-grid, body:not(.intel-closed) .w9-row { grid-template-columns: minmax(0, 1fr); } }
/* phone cutscene HUD: narrower bars, smaller counters so both sides fit */
@media (max-width: 480px) {
  .cs-u, .cs-units.def .cs-u { grid-template-columns: minmax(0, 1fr) 36px auto; gap: 4px; padding: 3px 5px; }
  .cs-units.def .cs-u { grid-template-columns: auto 36px minmax(0, 1fr); }
  .cs-uc b { font-size: .5rem; } .cs-uc s { font-size: .55rem; margin-left: 3px; }
  .cs-un { font-size: .6rem; }
}
/* round 10: improvements beyond the city's slots after infrastructure loss */
.slots .slot.f.over { outline: 1px solid var(--bad); outline-offset: -1px; background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(251,77,100,.55) 3px 5px); }
.alert.warn9 { border-color: rgba(251,191,36,.45); background: rgba(251,191,36,.08); color: var(--text); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
