/*
  TTX v3.1: what ALE's styles need to carry V3's richer cards and the new screens.
*/

/* ------------------------------------------------------------------ rich cards */
.board.v31 .node.rich { width: 204px; height: 98px; }
.node.rich .band { flex: none; }
.node.rich .body { flex: 1; min-height: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px 7px 6px; }
.node.rich .art { width: 58px; height: 58px; border-radius: 5px; background: color-mix(in srgb, var(--fam) 18%, var(--paper-2)) center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(47,45,41,.08); }
.node.rich .title { padding: 0; font-size: 13px; line-height: 1.22; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.node.rich.shadow .back { margin: auto; }
.node.rich.shadow.fd { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; }
.node.rich.shadow.fd .back { margin: 0; width: 34px; height: 34px; flex: none; }
.node.shadow .fd-code { font: 750 13px/1 var(--f-sans); letter-spacing: .02em; color: color-mix(in srgb, var(--fam) 70%, var(--graphite)); }
.node.shadow .fd-needs { font-size: 11.5px; line-height: 1.25; text-align: center; color: var(--graphite); max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.node.shadow .fd-needs b { font-weight: 700; }
.node.shadow .fd-needs b.got { color: var(--ok, #2f7d4f); text-decoration: underline; text-underline-offset: 2px; }
.node.provided { background: color-mix(in srgb, var(--fam) 7%, var(--card)); border-style: dashed; }
.node.provided .band { background: color-mix(in srgb, var(--fam) 60%, var(--locked-text)); }
.node.out { background: var(--locked-bg); opacity: .55; box-shadow: none; }
.node.out .band { background: var(--locked-text); }
.node.out .art { filter: grayscale(1); opacity: .6; }
.node .seal.prov { background: var(--locked-text); }
.node .seal.out { background: var(--locked-text); }
.node.awaiting { background: color-mix(in srgb, var(--fam) 4%, var(--card)); border-style: dashed; opacity: .72; }
.node.awaiting .band { background: color-mix(in srgb, var(--fam) 35%, var(--locked-text)); }
.node.awaiting .art { filter: grayscale(.8); opacity: .7; }
.node .seal.wait { background: var(--locked-text); }
.node.on-path { box-shadow: 0 0 0 3px var(--graphite), var(--shadow-lift); }
.node .badge.wave { left: auto; right: -8px; top: -10px; background: var(--graphite); width: auto; padding: 0 6px; border-radius: 9px; font-size: 11px; }
.node.closed .art { filter: saturate(.4); opacity: .75; }

/* ------------------------------------------------------------------ team layout: board, inspector, objectives */
.team-main.v31 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.board-area { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.board-area .fam-nav { left: 210px; }
.obj-col { min-height: 0; overflow: auto; background: var(--paper-2); border-left: 1px solid var(--rule-2); padding: 14px 14px 20px; }
.obj-col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--stone-ink); margin: 0 0 8px; }
.mission { font-family: var(--f-serif); font-style: italic; font-size: 14px; line-height: 1.4; color: var(--ink-2); margin: 0 0 12px; }
.meter { height: 8px; border-radius: 4px; background: var(--linen-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.meter-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 650; margin-bottom: 14px; }
.meter-row .meter { flex: 1; }
.obj { background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--rule-2); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; }
.obj.met { border-left-color: var(--ok); }
.obj.partial { border-left-color: var(--warn); }
.obj.not_met { border-left-color: var(--bad); }
.obj-head { display: flex; gap: 8px; align-items: baseline; }
.obj-head b { font-size: 13.5px; line-height: 1.3; font-weight: 650; flex: 1; }
.obj-pct { font-size: 12px; font-weight: 700; color: var(--stone-ink); font-variant-numeric: tabular-nums; }
.obj .meter { height: 5px; margin: 7px 0 6px; }
.obj-need { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font: 600 11.5px var(--f-mono); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--rule-2); background: var(--paper); color: var(--ink-2); cursor: pointer; }
.chip.have { background: var(--ok-tint); border-color: var(--success-text); color: var(--ok); }
.chip.staged { background: var(--accent-soft); border-color: var(--clay); color: var(--clay-deep); }
.chip.or { border: 0; background: none; cursor: default; font-family: var(--f-sans); color: var(--stone); padding: 2px 1px; }
.obj-status { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.obj-status.met { color: var(--ok); } .obj-status.partial { color: var(--warn); } .obj-status.not_met { color: var(--bad); } .obj-status.unassessed { color: var(--stone); }
.obj-col .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* inspector: V3 content */
.insp-art { width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--paper-2) center / cover no-repeat; margin: 8px 0 4px; }
.insp-body h4 { margin: 14px 0 4px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--stone-ink); }
.insp-body ul { margin: 0 0 8px; padding-left: 18px; font-size: 14px; }
.insp-deps { display: flex; flex-wrap: wrap; gap: 4px; }
.insp-body .btn-wide { width: 100%; justify-content: center; margin: 4px 0 10px; }
.insp-lock { font-size: 13.5px; color: var(--warn); background: var(--warn-tint); border-radius: 5px; padding: 6px 9px; margin: 6px 0; }

/* tray */
.res-card[disabled] { opacity: .45; cursor: not-allowed; }
.res-card.used { opacity: .55; }
.tray .lock-msg { font-size: 14px; font-weight: 650; color: var(--warn); }
.sent-banner { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 6px; background: var(--ok-tint); color: var(--ok); font-weight: 700; }

/* event strip from V3 inject notices */
.ev .ev-tone-bad .ev-cost b { color: var(--bad); }

/* ------------------------------------------------------------------ sign in */

/* ------------------------------------------------------------------ staff screens */
.page { min-height: 100vh; display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.page-body { min-height: 0; overflow: auto; padding: 18px 22px 30px; }
.page-body.flush { padding: 0; overflow: hidden; position: relative; }
.room-head { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 16px; }
.room-head .phase { font-size: 15px; font-weight: 700; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.team-card { background: var(--card); border: 1px solid var(--rule); border-top: 5px solid var(--team); border-radius: 8px; padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.team-card h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.team-card .tag-line { display: flex; flex-wrap: wrap; gap: 6px; }
.team-card .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 13px; }
.team-card .stats div { background: var(--paper-2); border-radius: 5px; padding: 5px 7px; }
.team-card .stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.team-card .staged-list { font-size: 13px; color: var(--ink-2); min-height: 18px; }
.team-card .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--team); display: inline-block; flex: none; }

/* progress path */
.path-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: 100%; }
.path-side { overflow: auto; background: var(--paper-2); border-right: 1px solid var(--rule-2); padding: 16px; }
.path-side .big { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.path-sum { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 16px; }
.path-sum div { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; color: var(--stone-ink); }
.path-sum b { display: block; font-size: 19px; color: var(--graphite); font-variant-numeric: tabular-nums; }
.waves { list-style: none; margin: 0; padding: 0; }
.waves > li { margin-bottom: 12px; }
.waves h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--stone-ink); margin: 0 0 5px; }
.step { display: flex; width: 100%; text-align: left; font: inherit; color: inherit; align-items: center; gap: 8px; padding: 6px 8px; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--fam); border-radius: 5px; margin-bottom: 4px; font-size: 13.5px; cursor: pointer; }
.step .code { font: 600 11.5px var(--f-mono); color: var(--stone-ink); }
.step .nm { flex: 1; min-width: 0; }
.step .ct { font-size: 12px; color: var(--stone-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.step.staged { background: var(--accent-soft); }
.step.available .code::after { content: " · open"; color: var(--ok); }
.path-board { position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.path-board > .board-area { min-height: 0; }
.page:has(.path-board) { height: 100vh; height: 100dvh; }
.path-tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.path-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.path-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--rule-2); text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 650; background: var(--card); }
.path-tabs a.on { background: var(--slate-ink); color: var(--on-fill); border-color: var(--slate-ink); }
.done-banner { background: var(--ok-tint); color: var(--ok); border-radius: 6px; padding: 10px 12px; font-weight: 700; margin-bottom: 12px; }

/* projector: header, team grid, event strip; sized for a wall screen */
/* projector in V3's light ITU palette (V3 :root tokens in /css/app.css) */
body.v-screen { background: var(--bg-page); }
.screen { height: 100vh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: var(--bg-page); color: var(--text-primary); padding: 0; }
.screen::before { display: none; }
.screen-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 28px; padding: 2.4vh 2.5vw 1.4vh; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.screen-head h1 { margin: 0; font-size: clamp(22px, 2.4vw, 40px); color: var(--text-primary); line-height: 1.15; min-width: 0; flex: 1 1 420px; }
.screen-head .sp { display: none; }
.screen-round { font-size: clamp(16px, 1.6vw, 26px); font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
.screen-clock { font-size: clamp(26px, 3vw, 52px); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--accent); }
.screen-sent { font-size: clamp(14px, 1.3vw, 22px); color: var(--text-muted); white-space: nowrap; }
.screen-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.6vw; padding: 2vh 2.5vw; align-content: start; overflow: auto; }
.screen-body.many { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.screen-wait { font-size: 24px; color: var(--text-muted); }
.screen-team { background: var(--bg-panel); border: 1px solid var(--border); border-top: 6px solid var(--team); border-radius: 10px; padding: 16px 18px; min-width: 0; box-shadow: 0 1px 3px var(--shadow-modal); }
.screen-team h2 { color: var(--text-primary); font-size: clamp(18px, 1.7vw, 28px); margin: 0 0 4px; display: flex; gap: 10px; align-items: center; }
.screen-team .meter { height: 12px; background: var(--border-light); margin: 12px 0 6px; }
.screen-team .meter > i { background: var(--team); }
.screen-team .pct { font-size: clamp(32px, 3.4vw, 60px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--text-primary); }
.screen-team .sub { font-size: clamp(13px, 1.1vw, 18px); color: var(--text-muted); }
.screen-team .state { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 12px; font-size: clamp(13px, 1vw, 17px); font-weight: 700; background: var(--chip-neutral-bg); color: var(--chip-neutral-text); }
.screen-team .state.sent { background: var(--success-bg); color: var(--success-text); }
.screen-event { margin: 0 2.5vw 2vh; padding: 12px 16px; background: var(--accent-soft); color: var(--text-primary); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; font-size: clamp(15px, 1.4vw, 24px); }
.screen-tabs { margin: 0; padding: 0 2.5vw; background: var(--bg-panel); }
.screen-tabs .tab { font-size: clamp(14px, 1.1vw, 18px); padding: 10px 14px; }
.briefing-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.6vw; padding: 2vh 2.5vw; align-content: start; overflow: auto; }
.briefing-team { min-width: 0; background: var(--bg-panel); border: 1px solid var(--border); border-top: 6px solid var(--team); border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px var(--shadow-modal); }
.briefing-team > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: clamp(19px, 1.7vw, 28px); }
.briefing-submissions { display: grid; gap: 12px; }
.briefing-submission { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 8px 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.briefing-submission:first-child { padding-top: 0; border-top: 0; }
.briefing-submission h3 { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 0; font-size: clamp(16px, 1.25vw, 21px); }
.briefing-submission h4 { margin: 0 0 4px; font-size: clamp(13px, 1vw, 16px); color: var(--text-secondary); }
.briefing-detail { min-width: 0; }
.briefing-detail ol { margin: 0; padding-left: 22px; }
.briefing-detail li, .briefing-detail p { font-size: clamp(13px, 1vw, 17px); line-height: 1.4; }
.briefing-detail p { margin: 0; }

/* staff bar: never wrap; labels drop to icons on narrow windows */
.staff-nav { display: flex; gap: 6px; flex: none; }
.bar-title { flex: 1 1 auto; }
.bar-title span { overflow: hidden; text-overflow: ellipsis; }
.bar .bar-sp { flex: 0 0 0; }
.bar-user { white-space: nowrap; }
@media (max-width: 1180px) { .staff-nav .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .staff-nav .btn { padding: 0 9px; } .bar-user { display: none; } }

/* room: run strip above the team cards */
.run-strip { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--slate); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.run-strip > div { flex: 1 1 320px; min-width: 0; }
.run-strip .note { margin: 2px 0 0; }
.room-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.room-head .tag { display: inline-flex; align-items: center; gap: 5px; }

/* path: team tabs on top, side and board fill the rest */
.page-body.flush:has(> .path-tabs) { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.page-body.flush > .path-tabs { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--rule-2); background: var(--paper); }
.path-layout, .debrief-layout { min-height: 0; }
@media (max-width: 900px) { .path-layout { grid-template-columns: 280px minmax(0, 1fr); } .debrief-layout { grid-template-columns: 240px minmax(0, 1fr); } }

/* debrief */
.debrief-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100%; }
.debrief-side { overflow: auto; background: var(--paper-2); border-right: 1px solid var(--rule-2); padding: 16px; }
.debrief-side label { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 650; cursor: pointer; }
.debrief-side .row { display: flex; align-items: center; gap: 6px; }
.debrief-side .row button { margin-left: auto; }
.debrief-side .tl { font-size: 13px; color: var(--ink-2); margin: 2px 0 12px 28px; }
.debrief-side .tl li { margin-bottom: 2px; }
.node .mark { background: var(--team); }

/* round brief deliverable in the one-line strip */
.ev-cost .ev-deliv { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-cost:has(.ev-deliv) { flex-wrap: nowrap; min-width: 0; }

/* ------------------------------------------------------------------ one staff bar: v3.1 screens + V3 console menus */
.staff-nav .btn.on, .console-nav .btn.on { background: color-mix(in srgb, var(--on-bar) 16%, transparent); border-color: color-mix(in srgb, var(--on-bar) 60%, transparent); }
.console-nav { display: flex; gap: 4px; flex: none; }
.menu-trigger { gap: 4px; }
.menu-trigger[hidden] { display: none; }
.menu-trigger svg { opacity: .8; }
.menu-trigger[aria-expanded="true"] { background: color-mix(in srgb, var(--on-bar) 16%, transparent); }
.bar .burger { display: none; }
@media (max-width: 1280px) {
  .staff-nav .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .staff-nav .btn { padding: 0 9px; }
  .bar-user { display: none; }
}
@media (max-width: 860px) {
  .staff-bar .staff-nav, .staff-bar .console-nav, .staff-bar .bar-div, .staff-bar .bar-out { display: none; }
  .bar .burger { display: inline-flex; gap: 6px; }
}

/* the console lives in a fixed iframe under the bar; hidden (but running) on other screens */
#console-host { position: fixed; left: 0; right: 0; top: var(--bar-h); bottom: 0; visibility: hidden; pointer-events: none; z-index: 0; background: var(--paper); }
#console-host.on { visibility: visible; pointer-events: auto; z-index: 5; }
#console-host iframe { display: block; width: 100%; height: 100%; border: 0; }
.console-page .console-slot { display: grid; place-items: center; }
body.console-on { overflow: hidden; }

/* menus: a popover under the trigger on wide screens, a drawer on phones */
.menu-layer { position: fixed; inset: 0; z-index: 200; }
.menu-scrim { position: absolute; inset: 0; }
.menu-pop { position: fixed; background: var(--paper); border: 1px solid var(--rule-2); border-radius: 8px; box-shadow: var(--shadow-lift); padding: 6px; max-height: min(70vh, 520px); overflow: auto; }
.menu-pop .note { margin: 8px 10px; }
.menu-item { display: flex; flex-direction: row; align-items: center; gap: 10px; width: 100%; min-height: 44px; justify-content: flex-start; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 6px; padding: 7px 10px; cursor: pointer; text-decoration: none; }
.menu-item > svg { flex: none; color: var(--accent); }
.mi-text { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.menu-sec { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--stone-ink); padding: 10px 10px 3px; }
.menu-sec:first-child { padding-top: 4px; }
.menu-item b { font-weight: 650; font-size: 14.5px; }
.menu-item .mi-text span { font-size: 12.5px; color: var(--stone-ink); line-height: 1.3; }
.menu-item:hover, .menu-item:focus-visible { background: var(--paper-2); }
.menu-item.on { background: var(--linen-2); }
.menu-item.on b::before { content: "• "; color: var(--clay); }
.menu-link { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
body.drawer-open .menu-scrim { background: rgba(31,30,27,.42); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); background: var(--paper); box-shadow: -10px 0 30px rgba(31,30,27,.25); overflow: auto; padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 8px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.drawer h3 { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--stone-ink); margin: 14px 10px 4px; }
.drawer-out { width: 100%; justify-content: center; margin-top: 18px; }

/* ------------------------------------------------------------------ phones and small tablets */
@media (max-width: 760px) {
  .bar { padding: 0 10px; gap: 8px; }
  .bar-title b { font-size: 15px; }
  .bar-title span { font-size: 12px; }
  .page-body { padding: 14px 12px 24px; }
  .room-head { gap: 8px 10px; }
  .room-head h2 { width: 100%; margin: 0; }
  .run-strip { padding: 12px; }
  .run-strip .btn { width: 100%; justify-content: center; }
  .team-card .stats { grid-template-columns: repeat(2, 1fr); }
  /* path and debrief: the side panel above the tree */
  .path-layout, .debrief-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 42%) minmax(0, 1fr); }
  .path-side, .debrief-side { border-right: 0; border-bottom: 1px solid var(--rule-2); padding: 12px; }
  .page-body.flush > .path-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; -webkit-overflow-scrolling: touch; }
  .path-tabs a { flex: none; }
  .path-side .big { font-size: 22px; }
  /* team board: objectives below the tree */
  .team-main.v31 { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 34%); }
  .obj-col { border-left: 0; border-top: 1px solid var(--rule-2); }
  .board-area .fam-nav { left: 8px; }
  .team-bar { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .team-bar::-webkit-scrollbar { display: none; }
  .team-bar > * { flex: none; }
  .team-bar .bar-stat .v { font-size: 16px; }
  /* projector on a phone: one column, smaller margins */
  .screen { height: auto; min-height: 100vh; min-height: 100dvh; }
  .screen-head { padding: 14px 14px 8px; }
  .screen-head h1 { flex-basis: 100%; }
  .screen-tabs { padding: 0 14px; }
  .screen-body, .screen-body.many { padding: 8px 14px 14px; gap: 10px; }
  .briefing-body { grid-template-columns: 1fr; padding: 8px 14px 14px; gap: 10px; }
  .briefing-submission { grid-template-columns: 1fr; }
  .screen-event { margin: 0 14px 14px; }
}
@supports (height: 100dvh) {
  .page { min-height: 100dvh; }
  .team-screen { height: 100dvh; }
}

/* team reference dialogs: Your state, Region, Rules */
.guide-text section { margin-top: 16px; }
.guide-text h3 { font-size: 15px; margin: 14px 0 6px; }
.guide-text p.lead { font-size: 16px; line-height: 1.5; }
.guide-text ul { padding-left: 18px; }
.guide-text li { margin: 3px 0; }
.guide-text .callout { margin: 8px 0; }
.tbl-wrap { overflow-x: auto; }
.state-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 6px 24px; }
.state-dlg ul.objectives { list-style: none; padding: 0; margin: 0; }
.state-dlg ul.objectives li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.state-dlg .obj-state { font-size: 12.5px; color: var(--stone-ink); white-space: nowrap; }
.state-dlg li.met .obj-state { color: var(--good, var(--success-text)); font-weight: 600; }
.state-dlg li.partial .obj-state { color: var(--clay); }
.region-map { margin: 10px 0; }
.region-map img { max-width: 100%; height: auto; border-radius: var(--r-panel); display: block; }
.region .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.region .actor { margin: 8px 0; }
.region .actor p { margin: 2px 0 0; }
@media (max-width: 640px) {
  .state-grid { grid-template-columns: 1fr; }
  .team-bar .btn-small .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .team-bar .btn-small { position: relative; }
}

/* inject notice (captain popup, mirrors V3's overlay card) */
.inj-card { border-left: 5px solid var(--warn); padding-left: 14px; }
.inj-card.opportunity { border-left-color: var(--ok); }
.inj-art { width: 100%; aspect-ratio: 16 / 7; max-height: 30vh; border-radius: 6px; background: var(--paper) center / cover no-repeat; margin: 0 0 10px; }
.inj-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; }
.inj-kicker { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); }
.inj-card.opportunity .inj-kicker { color: var(--ok); }
.inj-alert { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: var(--on-fill); }
.inj-card.opportunity .inj-alert { background: var(--ok); }
.inj-code { color: var(--text-muted); }
.inj-queue { margin: 8px 0 0; padding: 4px 10px; border-radius: 12px; background: var(--warn-tint); color: var(--text-primary); font-size: 13px; font-weight: 700; display: inline-block; }
.inj-queue[hidden] { display: none; }
.inj-card h3 { margin: 10px 0 4px; }
.inj-outcome { margin: 10px 0; padding: 10px 12px; background: var(--accent-soft); border-radius: 6px; }
.inj-outcome h4 { margin: 0 0 4px; }
.inj-outcome p { margin: 0; }
.inj-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.inj-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.inj-stats .k, .inj-reqs .k { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.inj-stats small { color: var(--text-secondary); }
.inj-reqs .req-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.inj-reqs .req-item { padding: 2px 8px; border-radius: 10px; font-size: 13px; background: var(--warn-tint); }
.inj-reqs .req-item.met { background: var(--ok-tint); }

/* projector: each team's inject */
.screen-inj { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--warn); background: var(--warn-tint); border-radius: 0 8px 8px 0; color: var(--text-primary); }
.screen-inj.opportunity { border-left-color: var(--ok); background: var(--ok-tint); }
.screen-inj.done { border-left-color: var(--border); background: var(--chip-neutral-bg); }
.screen-inj .si-kicker { font-size: clamp(11px, .85vw, 14px); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.screen-inj .si-title { font-size: clamp(15px, 1.3vw, 22px); font-weight: 700; margin: 2px 0; }
.screen-inj .si-desc { font-size: clamp(12px, 1vw, 16px); color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.screen-inj .si-effect { font-size: clamp(13px, 1.05vw, 17px); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.screen-inj .si-ack { font-size: clamp(12px, .95vw, 15px); margin-top: 4px; color: var(--success-text); font-weight: 700; }
.screen-inj .si-ack.wait { color: var(--text-primary); }

/* Region dialog for staff: team names open the team pop-up */
.team-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; margin: -4px -6px; border: 0; border-radius: 6px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.team-link b { text-decoration: underline; text-decoration-color: var(--accent, currentColor); text-underline-offset: 3px; }
.team-link:hover, .team-link:focus-visible { background: var(--accent-soft); }
.team-link .tag { font-size: 11px; }
.team-now { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; margin-bottom: 12px;
  border-radius: 8px; background: var(--chip-neutral-bg); }
.team-now p { flex-basis: 100%; margin: 4px 0 0; }
.team-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.team-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--team); border-radius: 999px;
  background: none; color: inherit; font: inherit; cursor: pointer; }
.team-chip .dot { background: var(--team); }
.team-chip .small { opacity: .75; font-size: 12px; }
.team-chip:hover, .team-chip:focus-visible { background: var(--accent-soft); }

/* resource cards (R1-R4): card dialog with the art */
.res-dlg { max-width: 460px; }
.res-dlg-art { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; margin-bottom: 12px; background: var(--paper-2); }
.res-dlg-meta { font-weight: 700; margin: 0 0 6px; }
.res-dlg-left { color: var(--stone-ink); font-size: 13px; }

/* ------------------------------------------------------------------ Board | Cards switch and the read-only catalogue */
.view-switch { display: inline-flex; gap: 2px; padding: 2px; margin-left: 14px; border-radius: 8px; background: color-mix(in srgb, var(--graphite) 8%, transparent); }
.view-switch button { appearance: none; border: 0; background: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 6px; font: 650 13px var(--f-sans); color: var(--stone-ink); cursor: pointer; }
.view-switch button.on { background: var(--paper); color: var(--graphite); box-shadow: var(--shadow-card); }
.view-switch button:focus-visible { outline: 2px solid var(--accent, var(--clay-ink)); outline-offset: 1px; }
.catalogue { min-width: 0; min-height: 0; overflow: auto; padding: 16px 20px 28px; }
.catalogue[hidden], .board-area[hidden] { display: none; }
.cat-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 280px); gap: 10px 16px; align-items: end; margin-bottom: 14px; }
.cat-head h2 { margin: 0 0 2px; font-size: 20px; }
.cat-head .note { margin: 0; }
.cat-search { width: 100%; }
.cat-lanes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-lane { appearance: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--fam) 45%, var(--rule-2)); background: var(--paper); color: var(--graphite); font: 600 13px var(--f-sans); cursor: pointer; }
.cat-lane.on { background: color-mix(in srgb, var(--fam) 16%, var(--paper)); border-color: var(--fam); }
.cat-group { margin: 18px 0 6px; }
.cat-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding-bottom: 6px; font-size: 15px; border-bottom: 2px solid var(--fam); color: color-mix(in srgb, var(--fam) 75%, var(--graphite)); }
.cat-group-title .count { margin-left: auto; font: 600 12px var(--f-sans); color: var(--stone-ink); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cat-card { background: var(--card, var(--paper)); border: 1px solid var(--rule-2); border-top: 4px solid var(--fam); border-radius: 8px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; scroll-margin: 20px; }
button.cat-card { appearance: none; width: 100%; margin: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.cat-card:hover { border-color: var(--fam); }
button.cat-card:focus-visible { outline: 2px solid var(--fam); outline-offset: 2px; }
.cat-card.face-down .cat-name { color: var(--stone-ink); }
.cat-card.ping { animation: catping 1.2s ease; }
@keyframes catping { 0%, 40% { box-shadow: 0 0 0 3px var(--fam); } 100% { box-shadow: none; } }
.cat-top { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: start; }
.cat-art { width: 64px; height: 64px; border-radius: 6px; background: color-mix(in srgb, var(--fam) 18%, var(--paper-2)) center / cover no-repeat; }
.cat-id .cat-name { display: block; margin: 4px 0; font-size: 14px; font-weight: 750; line-height: 1.25; }
.cat-cost { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--stone-ink); }
.cat-cost span { display: inline-flex; align-items: center; gap: 4px; }
.cat-empty { margin-top: 20px; }
@media (max-width: 760px) {
  .view-switch { margin-left: 6px; }
  .view-switch .lbl { display: none; }
  .cat-head { grid-template-columns: 1fr; }
  .catalogue { padding: 12px; }
}
