/* Four Capitals. Built on shared/css/tsm.css tokens only (light, dark and the Trailer skin come from there).
   Country colours: --us, --roc, --prc, --jp. */
body { --k-us: var(--us, #2f6db3); --k-tw: var(--roc, #17917f); --k-cn: var(--prc, #c8352b); --k-jp: var(--jp, #a8457f); }
[hidden] { display: none !important; }
.mt { margin-top: 14px !important; }
.k4-actions { max-width: 1400px; margin: 12px auto 0; padding: 0 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.k4-actions > div { display: flex; gap: 8px; flex-wrap: wrap; }
.k4-flag { margin: 0; font-size: 13px; padding: 5px 10px; border: 1px dashed var(--warn); border-radius: 4px; max-width: 80ch; }
.k4-flag b { color: var(--warn); }
.k4-main { max-width: 1400px; margin: 12px auto 0; padding: 0 16px 24px; display: flex; flex-direction: column; gap: 12px; }

/* Start */
.k4-start, .k4-type, .k4-resolve, .k4-end, .k4-about { padding: 14px 16px; }
.k4-start { border-left: 4px solid var(--accent); }
.k4-start h2, .k4-type h2 { margin: 0 0 6px; font-size: 22px; }
.k4-lede { margin: 0 0 12px; max-width: 90ch; }
.k4-starthead { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; align-items: start; margin-bottom: 12px; }
.k4-starthead .k4-lede { grid-column: 1 / 4; margin: 0; max-width: none; }
.k4-opts { grid-column: 4; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.k4-staffx { margin: 0; }
.k4-diff { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-wrap: wrap; }
.k4-diff legend { width: 100%; padding: 0; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.k4-diff label { flex: 1 1 0; cursor: pointer; position: relative; }
.k4-diff input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.k4-diff span { display: block; text-align: center; padding: 7px 4px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 14px; }
.k4-diff label + label span { border-left: 0; }
.k4-diff label:first-of-type span { border-radius: 4px 0 0 4px; }
.k4-diff label:last-of-type span { border-radius: 0 4px 4px 0; }
.k4-diff input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.k4-diff input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; }
.k4-seats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.k4-seat { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 2px solid var(--rule); border-top: 6px solid var(--c); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.k4-seat b { font: 700 21px var(--display); color: var(--c); }
.k4-seat small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.k4-seat[aria-checked="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--panel)); }
.k4-seat:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.k4-setup h3 { margin: 16px 0 2px; }
.k4-weights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; margin: 10px 0; }
.k4-w { display: grid; grid-template-columns: minmax(0, 1fr) 120px 1.5em; gap: 8px; align-items: center; font-size: 14px; }
.k4-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 8px; }
.k4-row select { font: inherit; padding: 4px 6px; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 3px; }
.k4-type { border-left: 4px solid var(--c, var(--accent)); max-width: 680px; }

/* Play */
.k4-play { display: flex; flex-direction: column; gap: 12px; }
.k4-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 8px 12px; border-top: 3px solid var(--c, var(--accent)); }
.k4-month { margin: 0; } .k4-month b { font: 700 24px var(--display); margin-right: 4px; }
.k4-event { margin: 0; flex: 1 1 260px; font-size: 13.5px; }
.k4-event b { display: block; }
.k4-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; align-items: start; }
.k4-crisis, .k4-decide, .k4-intel, .k4-feed { padding: 12px 14px; }
.k4-centre { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.k4-theatre { padding: 0; overflow: hidden; }
.k4-mapwrap { position: relative; background: var(--sea, #dfe9f1); }
.k4-theatre svg { display: block; width: 100%; height: auto; max-height: 380px; }

.k4-track { margin: 6px 0; font-size: 12.5px; }
.k4-track > div { display: flex; justify-content: space-between; gap: 6px; }
.k4-track .bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 2px; }
.k4-track .bar span { display: block; height: 100%; background: var(--tc, var(--accent)); transition: width .5s ease; }
.k4-caps { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.k4-caps th, .k4-caps td { padding: 3px 4px; text-align: right; border-bottom: 1px solid var(--rule); }
.k4-caps th:first-child, .k4-caps td:first-child { text-align: left; }
.k4-caps td:first-child b { color: var(--c); }

.k4-postures { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 4px 0; }
.k4-postures button { font: 600 12px var(--body); padding: 7px 2px; border: 1px solid var(--rule); border-radius: 3px; background: var(--chip); color: var(--ink); cursor: pointer; line-height: 1.15; }
.k4-postures button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #111; }
.k4-postures button:disabled { opacity: .35; cursor: not-allowed; }
.k4-pexp { min-height: 2.6em; margin: 2px 0 10px; }
.k4-lineh { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.k4-tabs { display: flex; gap: 2px; }
.k4-tabs button { font: 600 12px var(--body); padding: 4px 8px; border: 1px solid var(--rule); background: transparent; color: var(--ink); border-radius: 3px; cursor: pointer; }
.k4-tabs button[aria-selected="true"] { background: var(--ink); color: var(--panel); }
.k4-tabs button small { font-weight: 400; opacity: .8; }
.k4-actlist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.k4-act { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); }
.k4-acth { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: start; }
.k4-acth label { display: grid; grid-template-columns: 1.3em minmax(0, 1fr); gap: 4px 8px; cursor: pointer; align-items: start; }
.k4-act input[type="checkbox"] { margin: 3px 0 0; accent-color: var(--accent); }
.k4-act b { font-size: 14px; }
.k4-act .p { font: 600 13px var(--mono); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.k4-act > small { display: block; margin: 2px 0 0 calc(1.3em + 8px); color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.k4-act .why { display: block; margin-left: calc(1.3em + 8px); font-size: 12px; color: var(--muted); }
.k4-act.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.k4-act.off { opacity: .5; } .k4-act.off .k4-acth label { cursor: not-allowed; }
.k4-act.used { opacity: .62; }
.k4-act.tag-esc .k4-acth b::after { content: " ▲"; color: var(--bad); font-size: 11px; }
.k4-act.tag-soft .k4-acth b::after { content: " ▼"; color: var(--good); font-size: 11px; }
.k4-opp, .k4-dep, .k4-gray, .k4-once { font-style: normal; font-weight: 600; font-size: 11.5px; padding: 0 5px; border-radius: 3px; }
.k4-opp { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.k4-gray { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.k4-once { background: color-mix(in srgb, var(--k-us) 16%, transparent); }
/* Info buttons and their floating tooltip (js/tips.js). Badges that carry a tip are buttons too. */
.k4-info { font: 700 11px var(--mono); color: var(--ink); border: 1px solid var(--rule); background: var(--panel); border-radius: 50%; width: 22px; height: 22px; padding: 0; cursor: help; line-height: 1; vertical-align: middle; flex: none; }
.k4-info.k4-opp, .k4-info.k4-gray, .k4-info.k4-once, .k4-info.k4-used { width: auto; height: auto; min-height: 22px; border-radius: 3px; border: 0; padding: 1px 6px; font: 600 11.5px var(--body); color: var(--ink); }
.k4-info.k4-opp { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.k4-info.k4-gray { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.k4-info.k4-once { background: color-mix(in srgb, var(--k-us) 16%, transparent); }
.k4-info.k4-used { font: 700 11px var(--mono); letter-spacing: .06em; background: var(--ink); color: var(--panel); }
.k4-ieg { display: inline-grid; place-items: center; width: 17px; height: 17px; border: 1px solid var(--rule); border-radius: 50%; font: 700 10px var(--mono); vertical-align: 1px; }
.k4-info i { font-style: normal; opacity: .75; }
.k4-info:hover, .k4-info[aria-expanded="true"] { border-color: var(--accent); outline: 1px solid var(--accent); }
.k4-info:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.k4-tip { position: fixed; z-index: 70; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: 5px; padding: 8px 11px; font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 22px rgba(0, 0, 0, .25); }
.k4-tip[hidden] { display: none; }
.k4-tip b { display: block; margin-bottom: 3px; font-size: 13px; }
.k4-tip ul { margin: 0 0 5px; padding-left: 16px; }
.k4-tip p { margin: 3px 0 0; color: var(--muted); }
/* Fog of war: rival contacts and the key */
.k4-fog { padding: 8px 12px; font-size: 13px; }
.k4-fogd summary { cursor: pointer; font-weight: 700; }
.k4-contacts { margin: 6px 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
.k4-lvl { font: 600 10.5px var(--mono); padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.k4-lvl.exact { background: color-mix(in srgb, var(--good) 22%, transparent); }
.k4-lvl.near { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.k4-lvl.far { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.k4-dep { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.k4-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 3px; vertical-align: 1px; }
.k4-follow { margin: 8px 0 2px calc(1.3em + 8px); display: flex; flex-direction: column; gap: 8px; }
.k4-fq { border: 0; padding: 0; margin: 0; }
.k4-fq legend { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.k4-fq label { display: grid; grid-template-columns: 1.2em minmax(0, 1fr); gap: 0 6px; font-size: 12.5px; padding: 4px 6px; border-radius: 3px; cursor: pointer; }
.k4-fq label input { grid-row: span 2; margin: 2px 0 0; accent-color: var(--accent); }
.k4-fq label span { color: var(--muted); }
.k4-fq label.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.k4-tabs { flex-wrap: wrap; }
.k4-ftab { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.k4-ftab th, .k4-ftab td { padding: 3px 4px; border-bottom: 1px solid var(--rule); text-align: left; }
.k4-ftab td.num { text-align: right; width: 3em; }
.k4-log li.battle { border-left-color: var(--bad); }
.k4-tb { font-size: 12.5px; }
.k4-tb .who { font-weight: 600; color: var(--c); }
.k4-tb .stack { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin: 3px 0; background: var(--chip); }
.k4-tb .stack span { display: block; height: 100%; transition: width .5s ease; }
.k4-tb .stack .resolute { background: var(--bad); } .k4-tb .stack .cautious { background: var(--good); } .k4-tb .stack .opportunist { background: var(--warn); }
.k4-key { grid-column: 1 / -1; font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.k4-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.k4-feed h3 { margin: 0 0 4px; font-size: 15px; }
.k4-feed ul { margin: 0; padding-left: 18px; font-size: 13px; }

/* Logistics, formations, emphasis */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.k4-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.k4-logiw { border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; margin: 0 0 10px; background: var(--chip); }
.k4-logi { width: 100%; border-collapse: collapse; font-size: 13px; }
.k4-logi caption { text-align: left; font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; }
.k4-logi th, .k4-logi td { padding: 3px 5px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.k4-logi th[scope="row"], .k4-logi thead th:first-child { text-align: left; }
.k4-logi thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: normal; vertical-align: bottom; line-height: 1.15; }
.k4-logi small { color: var(--muted); font-weight: 400; }
.bad, .k4-logi td.bad { color: var(--bad); font-weight: 700; }
.k4-logi-sum { margin: 6px 0 0; }
.k4-cost { font-style: normal; font-weight: 600; font-size: 11.5px; padding: 0 5px; border-radius: 3px; background: color-mix(in srgb, var(--warn) 16%, transparent); }
.k4-act .why.bad { color: var(--bad); }
.k4-units th[scope="row"] { font-weight: 600; min-width: 9.5em; }
.k4-units thead small { font-weight: 400; color: var(--muted); }
.k4-units th[scope="row"] small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.k4-units td.low { color: var(--bad); font-weight: 700; }
.k4-units select { font: inherit; font-size: 12.5px; max-width: 13em; padding: 3px 4px; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 3px; }
.k4-emph { border: 1px solid var(--rule); border-radius: 4px; padding: 6px 10px 8px; margin: 8px 0; }
.k4-emph legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.k4-emph p { margin: 0 0 4px; }
.k4-emph label { display: block; font-size: 13px; padding: 3px 4px; border-radius: 3px; cursor: pointer; }
.k4-emph label.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.k4-emph label span { font-size: 11.5px; }
.k4-notice { border: 1px solid var(--warn); border-radius: 4px; padding: 6px 10px; margin: 0 0 10px; font-size: 14px; }
.k4-endf { width: 100%; }
.k4-endf th { text-align: left; font-weight: 600; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule); }
.k4-endf thead th { font-size: 12px; color: var(--muted); }
.k4-endf td.num { text-align: right; padding-right: 14px; }

/* Resolve */
.k4-resolve { border-left: 4px solid var(--accent); }
.k4-resolve h2 { margin: 0 0 8px; }
.k4-reveal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.k4-mv { border: 1px solid var(--rule); border-top: 4px solid var(--c); border-radius: 4px; padding: 8px 10px; font-size: 13px; }
.k4-mv b { color: var(--c); display: block; font: 700 16px var(--display); }
.k4-mv .po { font-weight: 600; }
.k4-mv ul { margin: 4px 0 0; padding-left: 16px; }
.k4-log { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.k4-log li { padding: 6px 8px; border-left: 4px solid var(--c, var(--rule)); background: var(--chip); border-radius: 0 3px 3px 0; }
.k4-log .st { font: 600 12px var(--mono); padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
.k4-log .success { background: color-mix(in srgb, var(--good) 25%, transparent); }
.k4-log .partial { background: color-mix(in srgb, var(--warn) 25%, transparent); }
.k4-log .failure, .k4-log .blocked { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.k4-log .fx { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.k4-log li.note { border-left-color: var(--warn); font-weight: 600; }

/* End */
.k4-end { border-left: 4px solid var(--c, var(--accent)); }
.k4-end h2 { margin: 0 0 4px; font-size: 26px; }
.k4-score { display: flex; gap: 28px; flex-wrap: wrap; margin: 10px 0; }
.k4-big { font: 700 44px var(--display); margin: 0; line-height: 1; }
.k4-parts { border-collapse: collapse; font-size: 13.5px; margin-bottom: 8px; }
.k4-parts td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--rule); }
.k4-parts td.num { text-align: right; }
.k4-types { display: flex; gap: 10px; flex-wrap: wrap; }
.k4-types div { border: 1px solid var(--rule); border-top: 4px solid var(--c); padding: 6px 10px; border-radius: 4px; font-size: 13.5px; }
#beliefs { width: 100%; max-width: 760px; height: auto; display: block; margin-bottom: 12px; }
.k4-about summary { cursor: pointer; }
.k4-about ul { margin: 8px 0; padding-left: 18px; font-size: 14px; }

/* Batch B: constraint chips, the shock line, the ceasefire banner, the "at home" line and the peace-forum dialog. */
.k4-info.k4-chip { width: auto; height: auto; min-height: 22px; border-radius: 3px; border: 1px dashed var(--rule); padding: 1px 6px; font: 600 11.5px var(--body); color: var(--ink); background: color-mix(in srgb, var(--k-jp) 10%, transparent); }
.k4-info.k4-chip-no { border-style: solid; border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.k4-shockx { margin: 3px 0 0; font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.k4-cease { display: block; margin-top: 6px; padding: 5px 8px; border-left: 3px solid var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); font-size: 13px; }
.k4-cease b { display: inline; }
.k4-home { margin: -4px 0 10px; color: var(--muted); }
.k4-home:empty { display: none; }
.k4-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--rule); border-top: 4px solid var(--accent); border-radius: 6px; background: var(--panel); color: var(--ink); padding: 16px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.k4-dialog::backdrop { background: rgba(10, 14, 20, .55); }
.k4-dialog h2 { margin: 2px 0 8px; font-size: 20px; }
.k4-dialog p { font-size: 14px; }
.k4-forumt { width: 100%; border-collapse: collapse; font-size: 13px; }
.k4-forumt caption { text-align: left; font-weight: 600; margin-bottom: 4px; }
.k4-forumt th, .k4-forumt td { padding: 4px 6px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.k4-forumt th small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.k4-forumt td.num { text-align: right; white-space: nowrap; }
.k4-forumt .bad { color: var(--bad); } .k4-forumt .good { color: var(--good); }
.k4-forump { font-size: 15px; }
.k4-play:has(#resolve:not([hidden])) .k4-bar #end-turn { visibility: hidden; }
.k4-play:has(#resolve:not([hidden])) .k4-theatre svg { max-height: 240px; }
@media (max-width: 760px) {
  .k4-seats, .k4-reveal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k4-starthead { grid-template-columns: minmax(0, 1fr); }
  .k4-starthead .k4-lede, .k4-opts { grid-column: 1; }
  .k4-weights { grid-template-columns: minmax(0, 1fr); }
  .k4-bar { position: static; }
}
@media (max-width: 420px) {
  .k4-logi { font-size: 12px; } .k4-long { display: none; } .k4-logi th, .k4-logi td { padding: 3px 3px; } .k4-logi thead th { white-space: normal; }
  .k4-units th[scope="row"] { min-width: 8em; }
  .k4-postures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .k4-tabs button { padding: 4px 6px; }
  .k4-units select { max-width: 8.5em; }
  .k4-actions .btn { padding-left: 8px; padding-right: 8px; }
}

/* Batch C: the traits question and scenario picker, the month's one-sentence summary, the after-action replay and
   the nuclear review. */
.k4-ask { border: 1px solid var(--rule); border-radius: 4px; padding: 8px 12px 10px; margin: 12px 0 0; }
.k4-ask legend { font-weight: 700; padding: 0 4px; }
.k4-ask label { display: grid; grid-template-columns: 1.2em minmax(0, 1fr); gap: 0 6px; font-size: 13.5px; padding: 4px 6px; border-radius: 3px; cursor: pointer; }
.k4-ask label input { grid-row: span 2; margin: 3px 0 0; accent-color: var(--accent); }
.k4-ask label span { color: var(--muted); font-size: 12.5px; }
.k4-ask label:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.k4-scens { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; margin: 8px 0 4px; }
.k4-scen { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 2px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.k4-scen b { font: 700 15px var(--display); }
.k4-scen b small { font: 400 11.5px var(--body); color: var(--muted); }
.k4-scen > small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.k4-scen[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.k4-scen:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.k4-tldr { margin: 0 0 10px; padding: 8px 10px; border-left: 4px solid var(--accent); background: var(--chip); border-radius: 0 3px 3px 0; font-size: 14.5px; line-height: 1.45; }
.k4-tldr:empty { display: none; }
.k4-trait { font: 600 11.5px var(--mono); padding: 0 5px; border-radius: 3px; background: color-mix(in srgb, var(--warn) 22%, transparent); white-space: nowrap; }
.k4-traitkey { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; font-size: 12.5px; margin: 6px 0 8px; }
.k4-traitkey dt { font-weight: 700; } .k4-traitkey dd { margin: 0; color: var(--muted); }
.k4-sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 3px 0 4px; vertical-align: -1px; }
.k4-sw.resolute { background: var(--bad); } .k4-sw.cautious { background: var(--good); } .k4-sw.opportunist { background: var(--warn); }
.k4-rp { border: 1px solid var(--rule); border-radius: 4px; margin: 6px 0; }
.k4-rp summary { cursor: pointer; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.k4-rp summary small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.k4-rp[open] summary { border-bottom: 1px solid var(--rule); }
.k4-rpgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.k4-rps { border-top: 3px solid var(--c); padding: 4px 2px 0; font-size: 13px; min-width: 0; }
.k4-rps p { margin: 0 0 3px; }
.k4-rps p b { color: var(--c); font: 700 15px var(--display); margin-right: 4px; }
.k4-rps ul { margin: 0 0 4px; padding-left: 16px; }
.k4-rps .st { font: 600 11px var(--mono); padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.k4-rps .success { background: color-mix(in srgb, var(--good) 25%, transparent); }
.k4-rps .partial { background: color-mix(in srgb, var(--warn) 25%, transparent); }
.k4-rps .failure, .k4-rps .blocked { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.k4-why { font-size: 12.5px; }
.k4-nukechart { width: 100%; max-width: 560px; height: auto; display: block; margin: 6px 0; }
.k4-nukerev { list-style: none; margin: 6px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 6px; }
.k4-nukerev > li { border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 3px; padding: 6px 8px; font-size: 13px; }
.k4-nukerev > li.hot { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.k4-nukerev > li > p { margin: 0 0 3px; }
.k4-nukerev ul { list-style: none; margin: 0; padding: 0; }
.k4-nukerev ul li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; border-top: 1px dotted var(--rule); }
.k4-nukerev .good { color: var(--good); font-weight: 700; }
.k4-cross { font: 600 11.5px var(--mono); font-style: normal; color: var(--bad); }
@media (max-width: 760px) { .k4-rpgrid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Streamlined play screen: one "State of the crisis" card, the reads table, stance popovers on the map,
   the move in three steps, the Simple / Detailed view and phone tabs. One accent for your own controls: --mine,
   your country's colour (text on it uses --panel, which reads in light, dark and Trailer). ---------- */
.k4-play { --mine: var(--c, var(--accent)); }
.k4-h { margin: 0 0 10px; font: 700 18px var(--display); }
.k4-sub { margin: 0 0 4px; font: 600 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.k4-info.k4-how { width: auto; height: auto; border: 0; border-radius: 3px; background: transparent; padding: 1px 2px; font: 500 12px var(--body); color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; text-transform: none; letter-spacing: 0; }
.k4-info.k4-how:hover, .k4-info.k4-how[aria-expanded="true"] { color: var(--ink); outline: 0; }

/* Bar: the view switch */
.k4-viewsw { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.k4-viewhint { color: var(--muted); }
.k4-seg2 { display: inline-flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.k4-seg2 button { font: 600 12.5px var(--body); padding: 6px 10px; border: 0; background: var(--panel); color: var(--ink); cursor: pointer; }
.k4-seg2 button + button { border-left: 1px solid var(--rule); }
.k4-seg2 button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }

/* State of the crisis: a horizontal ladder, then tracks beside the capitals table */
.k4-crisis { container-type: inline-size; }
.k4-ladder { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.k4-ladder li { display: flex; flex-direction: column; gap: 1px; padding: 5px 7px; border-radius: 3px; background: var(--chip); color: var(--muted); font-size: 12px; line-height: 1.2; min-height: 54px; min-width: 0; }
.k4-ladder li i { font: 500 11px var(--mono); font-style: normal; }
.k4-ladder li.gz { background: repeating-linear-gradient(135deg, var(--chip) 0 7px, color-mix(in srgb, var(--muted) 12%, var(--chip)) 7px 10px); }
.k4-ladder li.past { color: var(--ink); }
.k4-ladder li.on { background: color-mix(in srgb, var(--bad) calc(14% + var(--r) * 10%), var(--panel)); color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--bad); }
.k4-ladder .k4-gz { margin-top: auto; font: 500 9px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.k4-crisis2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px 22px; }
.k4-tracks .k4-track { margin: 0 0 8px; }
.k4-caps th, .k4-caps td { border-bottom-color: color-mix(in srgb, var(--rule) 60%, transparent); }
.k4-caps th { font-weight: 600; color: var(--muted); font-size: 11.5px; }
@container (max-width: 560px) {
  .k4-crisis2 { grid-template-columns: minmax(0, 1fr); }
  .k4-ladder li { font-size: 10.5px; padding: 4px 4px; hyphens: auto; -webkit-hyphens: auto; }
  .k4-ladder .k4-gz { font-size: 8px; letter-spacing: 0; }
}

/* Reading the others: one table, two thin bars per rival */
.k4-intel h3, .k4-feed h3 { margin: 0 0 6px; font-size: 15px; }
.k4-reads { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.k4-reads th, .k4-reads td { padding: 4px 8px 4px 0; text-align: left; vertical-align: middle; }
.k4-reads thead th { font-weight: 600; color: var(--muted); font-size: 11.5px; }
.k4-reads thead th:first-child { width: 5.5em; }
.k4-reads th[scope="row"] { color: var(--c); font-weight: 700; }
.k4-reads .stack { display: flex; height: 8px; border-radius: 2px; overflow: hidden; background: var(--chip); }
.k4-reads .stack span { display: block; height: 100%; transition: width .5s ease; }
.k4-reads .stack .resolute { background: var(--bad); } .k4-reads .stack .cautious { background: var(--good); } .k4-reads .stack .opportunist { background: var(--warn); }
.k4-reads small { color: var(--muted); font-size: 11.5px; }
.k4-intel .k4-key { margin: 6px 0 0; }

/* Map: sea areas are buttons; the stance popover; the fog key under the map */
.k4-theatre { overflow: visible; }
.k4-mapwrap { border-radius: 4px 4px 0 0; }
.k4-mapwrap svg { border-radius: 4px 4px 0 0; }
.k4-zone { cursor: pointer; outline: none; }
.k4-zone .k4-zring { transition: stroke-width .15s; }
.k4-zone:hover .k4-zring, .k4-zone[aria-expanded="true"] .k4-zring { stroke: var(--mine); stroke-width: 2.5; stroke-dasharray: none; stroke-opacity: 1; }
.k4-zone:focus-visible .k4-zhit { stroke: var(--focus); stroke-width: 2.5; }
.k4-pop { position: absolute; z-index: 15; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-top: 3px solid var(--mine); border-radius: 6px; padding: 6px 10px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-size: 13px; }
.k4-poph { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.k4-poph .x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); min-width: 40px; min-height: 40px; margin-right: -8px; }
.k4-pop .fine { margin: 0 0 6px; }
.k4-popx { color: var(--muted); }
.k4-popseg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 2px 0 6px; }
.k4-popseg button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 3px; min-height: 44px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; font: 600 13px var(--body); }
.k4-popseg button small { font: 400 10.5px var(--mono); color: var(--muted); }
.k4-popseg button[aria-pressed="true"] { background: var(--mine); border-color: var(--mine); color: var(--panel); }
.k4-popseg button[aria-pressed="true"] small { color: inherit; opacity: .85; }
.k4-popseg button:disabled { opacity: .4; cursor: not-allowed; }
.k4-popu { margin: 0; padding-left: 16px; font-size: 12.5px; }
.k4-fog { padding: 8px 12px 10px; font-size: 13px; background: var(--panel); border-radius: 0 0 4px 4px; }
.k4-fog > .fine { margin: 0 0 4px; }
.k4-fogkey { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; }
.k4-fogkey .k4-sub { margin: 0 4px 0 0; }
.k4-info.k4-lvlb { width: auto; height: auto; min-height: 22px; border: 0; border-radius: 3px; padding: 1px 6px; font: 600 11px var(--mono); }
.k4-info.k4-lvlb.exact { background: color-mix(in srgb, var(--good) 22%, transparent); }
.k4-info.k4-lvlb.near { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.k4-info.k4-lvlb.far { background: color-mix(in srgb, var(--bad) 16%, transparent); }
.k4-info.k4-lvlb.dec { background: color-mix(in srgb, var(--muted) 18%, transparent); }
.k4-fog .k4-maphint { margin: 4px 0 0; color: var(--muted); }
.k4-fogd summary { padding: 4px 0; font-weight: 600; }
.k4-fogd summary .muted { font-weight: 400; }
.k4-play:has(#resolve:not([hidden])) .k4-maphint { display: none; }

/* Your move: the step bar, the steps, Back / Next */
.k4-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 0 12px; }
.k4-steps button { display: flex; align-items: flex-start; gap: 6px; text-align: left; padding: 7px 7px; min-height: 48px; min-width: 0; border: 1px solid transparent; border-radius: 5px; background: var(--chip); color: var(--ink); cursor: pointer; font: inherit; }
.k4-steps button[aria-selected="true"] { border-color: var(--mine); background: color-mix(in srgb, var(--mine) 9%, var(--panel)); box-shadow: inset 0 -3px 0 var(--mine); }
.k4-stn { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); border: 1px solid var(--rule); font: 700 11px var(--mono); flex: none; }
.k4-steps button[aria-selected="true"] .k4-stn { background: var(--mine); border-color: var(--mine); color: var(--panel); }
.k4-steps button.warn .k4-stn { background: var(--bad); border-color: var(--bad); color: var(--panel); }
.k4-steps button.warn small { color: var(--bad); }
.k4-stl { display: flex; flex-direction: column; min-width: 0; }
.k4-stl b { font-size: 13px; line-height: 1.2; }
.k4-stl small { font: 400 11px var(--mono); color: var(--muted); line-height: 1.3; }
.k4-sh { margin: 0 0 8px; font: 700 15px var(--body); }
.k4-sh:focus { outline: none; } .k4-sh:focus-visible { outline: 2px solid var(--focus); }
.k4-sh .muted { font-weight: 500; font-size: 13px; }
.k4-lineh .k4-sh { margin: 0; }
.k4-lineh { margin-bottom: 4px; }
.k4-left { font: 500 12px var(--mono); padding: 2px 8px; border-radius: 10px; background: var(--chip); white-space: nowrap; }
.k4-stepnav { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.k4-stepnav #step-next { margin-left: auto; }

/* One accent for your own controls; fewer borders; lighter secondary boxes */
.k4-postures button { border-color: transparent; }
.k4-postures button[aria-checked="true"], .k4-tabs button[aria-selected="true"] { background: var(--mine); border-color: var(--mine); color: var(--panel); }
.k4-tabs button { border-color: transparent; background: var(--chip); }
.k4-act { border-color: transparent; background: color-mix(in srgb, var(--chip) 55%, var(--panel)); }
.k4-act.on { border-color: var(--mine); background: color-mix(in srgb, var(--mine) 8%, var(--panel)); }
.k4-act input[type="checkbox"], .k4-fq label input, .k4-emph input { accent-color: var(--mine); }
.k4-fq label.on, .k4-emph label.on { background: color-mix(in srgb, var(--mine) 11%, transparent); }
.k4-cost.free { background: transparent; color: var(--muted); font-weight: 500; padding: 0 2px; }
.k4-logiw { border: 0; background: color-mix(in srgb, var(--chip) 60%, var(--panel)); margin: 6px 0 4px; }
.k4-logi th, .k4-logi td, .k4-ftab th, .k4-ftab td { border-bottom-color: color-mix(in srgb, var(--rule) 60%, transparent); }
.k4-logi-sum:empty { display: none; }
.k4-logi-sum { margin: 4px 0 8px; }
.k4-emph { border: 0; background: color-mix(in srgb, var(--chip) 60%, var(--panel)); padding: 8px 10px; }
.k4-emph legend { float: left; width: 100%; padding: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.k4-stsum { margin: 10px 0; }
.k4-stchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 4px; }
.k4-stchip { display: flex; flex-direction: column; align-items: flex-start; padding: 5px 6px; min-height: 44px; border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; font: 600 12.5px var(--body); text-align: left; }
.k4-stchip b { font: 600 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.k4-stchip small { font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; }
.k4-stchip:hover { border-color: var(--mine); }
.k4-feed ul { padding-left: 16px; }

/* Simple view: hides the belief bars, the fog detail and the logistics breakdown. The game runs the same. */
body.k4-simple .k4-intel, body.k4-simple .k4-fogd, body.k4-simple #logi-wrap { display: none; }

/* During the month's reveal: one column */
.k4-play:has(#resolve:not([hidden])) .k4-grid { grid-template-columns: minmax(0, 1fr); }

/* Phone tabs (Map | Your move | Situation), hidden on wider screens */
.k4-ptabs { display: none; }
@media (max-width: 1180px) { .k4-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 900px) { .k4-grid { grid-template-columns: minmax(0, 1fr) 330px; } }
@media (max-width: 760px) {
  .k4-main { padding-inline: 0; }
  .k4-grid { grid-template-columns: minmax(0, 1fr); }
  .k4-ptabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 4px 0; }
  .k4-ptabs button { min-height: 44px; font: 600 14px var(--body); border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--ink); cursor: pointer; }
  .k4-ptabs button[aria-selected="true"] { background: var(--mine); border-color: var(--mine); color: var(--panel); }
  .k4-play[data-tab="map"] [data-pane]:not([data-pane="map"]), .k4-play[data-tab="move"] [data-pane]:not([data-pane="move"]),
  .k4-play[data-tab="sit"] [data-pane]:not([data-pane="sit"]) { display: none; }
  .k4-play:has(#resolve:not([hidden])) .k4-ptabs { display: none; }
  .k4-play:has(#resolve:not([hidden])) #pane-map, .k4-play:has(#resolve:not([hidden])) #crisis { display: block; }
  .k4-bar { gap: 6px 10px; }
  .k4-month b { font-size: 20px; }
  .k4-dhead > .k4-h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* the tab already says it */
  .k4-viewsw { margin-left: auto; }
  /* Tap targets of at least 40 px */
  #end-turn, .k4-stepnav .btn, .k4-actions .btn { min-height: 44px; }
  .k4-seg2 button, .k4-tabs button { min-height: 40px; min-width: 40px; }
  .k4-postures button { min-height: 44px; }
  .k4-acth label { min-height: 40px; align-items: center; }
  .k4-fq label, .k4-emph label { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .k4-units select { min-height: 40px; }
  .k4-fogd summary { padding: 12px 0; }
  .k4-info { position: relative; }
  .k4-info::after { content: ""; position: absolute; inset: -9px -4px; }
  .k4-info.k4-how::after, .k4-info.k4-lvlb::after { inset: -9px 0; }
}

/* While the lesson runs on a phone its card covers the bottom of the screen: room to scroll anything above it. */
@media (max-width: 760px) { body.k4-learning { padding-bottom: 50vh; } }

/* Ask your staff: the computer's plan for your seat, filled in for you to change. */
.k4-dhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.k4-dhead .k4-h { margin: 0; }
.k4-advise { border-color: var(--mine, var(--c)); }
.k4-advice { margin: -4px 0 10px; padding: 6px 10px; border-left: 3px solid var(--mine, var(--c)); background: color-mix(in srgb, var(--mine, var(--c)) 7%, transparent); }
.k4-fhint { margin: 0 0 8px; }
.k4-fhint .btn { padding: 2px 10px; margin: 0 4px; }
@media (max-width: 760px) { .k4-dhead { justify-content: flex-end; } }
.k4-about h3 { margin: 10px 0 4px; font-size: 15px; }
.k4-basics { margin: 4px 0 8px; padding-left: 20px; font-size: 14px; }
.k4-basics li { margin: 3px 0; }
.k4-full { margin-top: 8px; }

/* Staff advice off: no Ask your staff button, hint or suggestion line. */
body.k4-nostaff #advise, body.k4-nostaff #advice, body.k4-nostaff .k4-fhint { display: none; }
.k4-edge { margin: 8px 0 0; }
.k4-sign { display: inline-block; margin: 2px 6px 0 0; color: var(--muted); }
.k4-sign.on { color: var(--ink); font-weight: 600; }
