/* Immune Defense: the Immune Command Center. The evidence monitor (activity.js / art.js) keeps its own colours in both
 * themes, like a lit screen; the ticket panel and controls follow the site theme. */
html {
  --im-accent: #5b3f86; --im-accent-ink: #ffffff; --im-card: #ffffff; --im-ink: #2a2238; --im-line: #a99bbd;
  --im-panel1: #f6f3fa; --im-panel2: #ebe5f3; --im-muted: #5d536d; --im-focus: #b77a00;
}
html[data-theme="dark"] {
  --im-accent: #c7b4f0; --im-accent-ink: #1d1530; --im-card: #241f2e; --im-ink: #ece7f5; --im-line: #5d5272;
  --im-panel1: #231e2c; --im-panel2: #1b1723; --im-muted: #c3b9d4; --im-focus: #f4d35e;
}

.im { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 10px; padding: 8px 10px;
  color: var(--im-ink); font-size: 16px; overflow: hidden; }
.im *, .im *::before, .im *::after { box-sizing: border-box; }
.im p { margin: 0; line-height: 1.3; }
.im input, .im button, .im select { font: inherit; font-size: 16px; }
.im-left { display: flex; flex-direction: column; gap: 7px; min-width: 0; min-height: 0; }

/* evidence monitor */
.im-scene { position: relative; flex: none; min-width: 0; overflow: auto hidden; border-radius: 12px; background: #1b1629;
  box-shadow: 0 0 0 3px #2b2340, 0 3px 8px rgba(0,0,0,.25); }
.im-svg { display: block; width: 100%; min-width: 640px; height: auto; aspect-ratio: 2 / 1; }
.im-svg text { font-family: var(--tlg-font, system-ui, sans-serif); }
.im-svg .im-lab { fill: #3b2b2b; font-weight: 700; paint-order: stroke; stroke: #fff6f2; stroke-width: 4px; stroke-linejoin: round; }
.im-svg .im-lab--lt { fill: #fff; stroke: #8c211b; }
.im-svg .im-lab-d { paint-order: stroke; stroke: #161a26; stroke-width: 5px; stroke-linejoin: round; }
.im-svg .im-lab-w { paint-order: stroke; stroke: #e6f4d4; stroke-width: 4px; stroke-linejoin: round; }
.im-stamp rect { stroke: currentColor; }
.im-stamp.is-ok { color: #13704a; } .im-stamp.is-bad { color: #b3261e; }
.im-stamp text { fill: currentColor; }
.im-scene:focus-visible { outline: 3px solid var(--im-focus); outline-offset: 2px; }

.im-shutter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: repeating-linear-gradient(0deg, #2b2340 0 22px, #241d36 22px 24px); color: #fff; text-align: center; padding: 16px;
  transition: transform .42s ease-in, opacity .42s ease-in; }
.im-shutter.is-open { transform: translateY(-100%); opacity: .2; }
.im-shutter-k { font-size: 16px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #c7b4f0; }
.im-shutter-t { font-size: 20px; font-weight: 700; }
.im .im-open { min-height: 48px; padding: 8px 22px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 800;
  background: linear-gradient(#f4d35e, #d9a92b); color: #2b2340; box-shadow: 0 3px 0 #8a6417, 0 4px 10px rgba(0,0,0,.35); }
.im .im-open:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #8a6417; }
.im .im-open:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.im-obs { font-weight: 600; color: var(--im-muted); min-height: 21px; }

/* tiles (radio groups) */
.im-tiles { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 4px; }
.im-l { font-weight: 700; font-size: 16px; line-height: 1.2; padding: 0; }
.im-tiles-g { display: grid; grid-template-columns: 1fr; gap: 5px; }
.im-tiles--row .im-tiles-g { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.im-tiles--primary .im-tiles-g { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.im-tile { position: relative; display: block; min-width: 0; cursor: pointer; }
.im-tile input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.im-tile-b { pointer-events: none; display: flex; align-items: center; gap: 8px; min-height: 42px; height: 100%; padding: 4px 9px;
  border: 2px solid var(--im-line); border-radius: 9px; background: var(--im-card); color: var(--im-ink); line-height: 1.18; }
.im-tile-t { min-width: 0; overflow-wrap: anywhere; }
.im-tile.has-ico .im-tile-b { padding: 3px 6px 3px 4px; gap: 5px; }
.im-ico { flex: none; width: 44px; height: 38px; border-radius: 7px; background: #f7f2ec; }
.im-ico--tip { width: 34px; background: #eef3fb; }
.im-tile.is-on .im-tile-b { border-color: var(--im-accent); background: var(--im-accent); color: var(--im-accent-ink); box-shadow: 0 2px 6px rgba(70,40,110,.35); }
.im-tile .im-tile-b::before { content: '○'; font-size: 16px; opacity: .6; flex: none; }
.im-tile.is-on .im-tile-b::before { content: '●'; opacity: 1; }
.im-tile.has-ico .im-tile-b::before { display: none; }
.im-tile.has-ico.is-on .im-tile-b .im-tile-t::before { content: '✓ '; font-weight: 800; }
.im-tile input:focus-visible + .im-tile-b { outline: 3px solid var(--im-focus); outline-offset: 2px; }
.im-tile input:disabled { cursor: default; }
.im-tile input:disabled + .im-tile-b { opacity: .62; }
.im-tile.is-on input:disabled + .im-tile-b { opacity: .9; }
.im-tile:hover input:not(:disabled) + .im-tile-b { border-color: var(--im-accent); }

/* evidence table */
.im-table:empty { display: none; }
.im table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; background: var(--im-card); }
.im caption { text-align: left; font-weight: 700; padding-bottom: 3px; }
.im td, .im th { border: 1px solid var(--im-line); padding: 3px 8px; text-align: left; line-height: 1.25; }
.im thead th, .im tr:first-child th { background: var(--im-panel2); }

/* panel */
.im-panel { align-self: start; max-height: 100%; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; padding: 8px 10px;
  background: linear-gradient(var(--im-panel1), var(--im-panel2)); border: 3px solid var(--im-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.im-kicker, .im-k2 { font-size: 16px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--im-accent); }
.im-k2 { margin-top: 2px !important; }
.im-ticket { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 8px; margin: 0; padding: 5px 8px; line-height: 1.22;
  background: var(--im-card); border: 2px dashed var(--im-line); border-radius: 10px; }
.im-ticket dt { font-weight: 800; }
.im-ticket dd { margin: 0; }
.im-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.im-num { display: grid; gap: 2px; align-content: end; }
.im-num-in { display: flex; align-items: center; gap: 6px; }
.im-num-in input { flex: 1 1 0; width: 0; min-width: 0; min-height: 42px; padding: 4px 8px; border: 2px solid var(--im-line); border-radius: 8px;
  background: var(--im-card); color: var(--im-ink); font-variant-numeric: tabular-nums; }
.im-num-in input:disabled { opacity: .7; }
.im-unit { font-weight: 700; }
.im-eq { font-size: 16px; padding: 3px 8px; border-left: 4px solid var(--im-accent); background: var(--im-card); border-radius: 0 8px 8px 0; }
.im :focus-visible { outline: 3px solid var(--im-focus); outline-offset: 2px; }
.im-about summary { font-weight: 700; cursor: pointer; }
.im-about p { margin-top: 4px !important; font-size: 16px; }

/* Briefing example */
.im-ex { display: block; width: 100%; height: auto; }
.im-ex text { font-family: var(--tlg-font, system-ui, sans-serif); }

/* narrower screens: one column, the stage scrolls; the monitor scrolls sideways (focusable) */
@media (max-width: 900px) {
  .im { position: static; display: flex; flex-direction: column; height: 100%; overflow: auto; }
  .im-panel { overflow: visible; flex: none; }
  .im-left { flex: none; }
}
@media (max-width: 600px) {
  .im { padding: 6px; }
  .im-tiles--primary .im-tiles-g { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .im-nums { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .im *, .im-shutter { animation: none !important; transition: none !important; } }

/* the shell's hint footnote, kickers and badges render at 14 px; keep them at 16 px here (board request filed) */
body[data-activity="immune-defense"] .ps-hint-note,
body[data-activity="immune-defense"] .ps-kicker,
body[data-activity="immune-defense"] .ps-badge { font-size: 16px; }
