/* ============================================================
   CYBER RANGE: RED vs BLUE — style.css
   ============================================================ */

:root {
  --bg:        #0a0e16;
  --bg-2:      #0f1522;
  --panel:     #141c2c;
  --panel-2:   #1a2335;
  --line:      #27334c;
  --line-soft: #1e2941;
  --text:      #e9eef9;
  --muted:     #94a2c0;
  --dim:       #6b7a99;

  --red:       #ff5068;
  --red-soft:  rgba(255, 80, 104, 0.14);
  --blue:      #45a8ff;
  --blue-soft: rgba(69, 168, 255, 0.14);
  --green:     #35dc9a;
  --green-soft:rgba(53, 220, 154, 0.14);
  --amber:     #ffb545;
  --amber-soft:rgba(255, 181, 69, 0.14);
  --violet:    #b07cff;

  --radius:    14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(255, 80, 104, 0.10), transparent 60%),
    radial-gradient(1100px 600px at 88% -10%, rgba(69, 168, 255, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; }
p { margin: 0 0 .7em; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- screens ---------- */
.screen { display: none; }
.screen.is-active { display: block; }

/* ============================================================
   START SCREEN
   ============================================================ */
.start-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) 20px 80px;
}

.logo-row {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--dim);
}
.logo-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 12px var(--green);
  animation: pulse 2.2s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.hero-title {
  margin: 18px 0 6px;
  font-size: clamp(38px, 8vw, 76px);
  letter-spacing: -0.03em;
  line-height: .98;
}
.hero-title .vs {
  font-family: var(--mono); font-size: .42em; vertical-align: .35em;
  color: var(--dim); margin: 0 .25em;
}
.t-red  { color: var(--red); }
.t-blue { color: var(--blue); }

.hero-sub {
  max-width: 62ch; color: var(--muted);
  font-size: clamp(15px, 2.1vw, 18px);
}

.scenario-card {
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
}
.scenario-card .kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--violet); margin-bottom: 6px;
}
.scenario-card h3 { font-size: 19px; margin-bottom: 6px; }
.scenario-card p { color: var(--muted); margin: 0; }

.section-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--dim);
  margin: 30px 0 12px;
}

/* role picker */
.roles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.role-card {
  position: relative; text-align: left;
  padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  transition: transform .16s, border-color .16s, background .16s;
}
.role-card:hover { transform: translateY(-3px); }
.role-card .role-icon { font-size: 30px; }
.role-card h3 { font-size: 22px; margin: 10px 0 2px; }
.role-card .role-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
}
.role-card p { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.role-card ul {
  margin: 12px 0 0; padding-left: 18px; color: var(--muted);
  font-size: 13.5px;
}
.role-card li { margin: 3px 0; }

.role-card[data-role="red"]:hover,
.role-card[data-role="red"][aria-pressed="true"] {
  border-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--panel));
}
.role-card[data-role="blue"]:hover,
.role-card[data-role="blue"][aria-pressed="true"] {
  border-color: var(--blue); background: linear-gradient(180deg, var(--blue-soft), var(--panel));
}
.role-card[aria-pressed="true"]::after {
  content: "SELECTED"; position: absolute; top: 14px; right: 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  padding: 4px 8px; border-radius: 99px;
  background: rgba(255, 255, 255, .1); color: var(--text);
}

/* difficulty */
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  padding: 11px 16px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); transition: .15s;
  display: flex; align-items: center; gap: 8px;
}
.pill:hover { border-color: var(--dim); color: var(--text); }
.pill[aria-pressed="true"] {
  background: var(--text); color: #0a0e16; border-color: var(--text); font-weight: 600;
}
.pill-note { color: var(--muted); font-size: 13.5px; margin-top: 10px; min-height: 1.5em; }

.start-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 32px; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2);
  padding: 12px 18px; border-radius: var(--radius-sm);
  transition: .15s; font-weight: 600;
}
.btn:hover:not(:disabled) { border-color: var(--dim); background: var(--line-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 15px 28px; font-size: 17px; }
.btn-primary {
  background: linear-gradient(135deg, var(--green), #1fb87c);
  color: #04120c; border: none;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255,80,104,.4); color: var(--red); background: transparent; }

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px;
}

/* ============================================================
   GAME SCREEN
   ============================================================ */
.hud {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(10, 14, 22, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.hud-brand {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim); white-space: nowrap;
}
.hud-turn {
  font-family: var(--mono); font-size: 13px;
  padding: 6px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel); white-space: nowrap;
}
.hud-phase {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; padding: 6px 11px; border-radius: 99px; white-space: nowrap;
}
.hud-phase.is-red  { background: var(--red-soft);  color: var(--red);  border: 1px solid rgba(255,80,104,.35); }
.hud-phase.is-blue { background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(69,168,255,.35); }

.meters { display: flex; gap: 14px; flex: 1; min-width: 220px; }
.meter { flex: 1; min-width: 100px; }
.meter-top {
  display: flex; justify-content: space-between; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 4px;
}
.meter-bar { height: 7px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; transition: width .45s ease; }
.meter-fill.safe   { background: linear-gradient(90deg, var(--green), #8ef0c4); }
.meter-fill.warn   { background: linear-gradient(90deg, var(--amber), #ffd79a); }
.meter-fill.danger { background: linear-gradient(90deg, var(--red), #ff93a2); }

.hud-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel);
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
}
.icon-btn:hover { border-color: var(--dim); }

/* layout */
.layout {
  display: grid; gap: 14px; padding: 14px;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .95fr);
  align-items: start;
}
.col-left { display: grid; gap: 14px; min-width: 0; }

.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  background: var(--bg-2);
}
.panel-head h2 {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.panel-head .hint { font-size: 12px; color: var(--dim); }
.panel-body { padding: 14px; }

/* ---------- network map ---------- */
.map {
  position: relative; width: 100%; aspect-ratio: 4 / 3.35;
  min-height: 340px;
  background:
    linear-gradient(rgba(39,51,76,.35) 1px, transparent 1px) 0 0 / 100% 7.6%,
    linear-gradient(90deg, rgba(39,51,76,.35) 1px, transparent 1px) 0 0 / 8.3% 100%,
    var(--bg-2);
}
.map.is-targeting { cursor: crosshair; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-link { stroke: var(--line); stroke-width: 1.2; }
.map-link.is-hot { stroke: var(--red); stroke-width: 2; stroke-dasharray: 4 3; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -14; } }

.node {
  position: absolute; transform: translate(-50%, -50%);
  width: 76px; padding: 7px 4px 6px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--text);
  text-align: center; transition: .16s; z-index: 2;
}
.node:hover { border-color: var(--dim); transform: translate(-50%, -50%) scale(1.06); z-index: 5; }
.node-icon { font-size: 21px; line-height: 1.1; }
.node-name { font-size: 9.6px; line-height: 1.2; color: var(--muted); margin-top: 2px; }
.node-chips {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px; font-size: 9px;
}
.node-chip {
  padding: 1px 4px; border-radius: 99px; font-family: var(--mono);
  background: var(--bg); border: 1px solid var(--line);
}
.node-chip.edr  { color: var(--blue);  border-color: rgba(69,168,255,.5); }
.node-chip.seg  { color: var(--violet); border-color: rgba(176,124,255,.5); }
.node-chip.pat  { color: var(--green); border-color: rgba(53,220,154,.5); }

.node-badge {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 99px; white-space: nowrap;
}
.node.is-crown { box-shadow: inset 0 0 0 1px rgba(255,181,69,.35); }
.node.is-objective { border-color: var(--amber); }

.node.owned-user  { border-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--panel-2)); }
.node.owned-admin { border-color: var(--red); background: linear-gradient(180deg, rgba(255,80,104,.3), var(--panel-2));
                    box-shadow: 0 0 0 3px rgba(255,80,104,.12), 0 0 22px rgba(255,80,104,.25); }
.node.is-known    { outline: 2px dashed rgba(255,181,69,.75); outline-offset: 2px; }
.node.is-isolated { opacity: .5; filter: grayscale(.65); border-style: dashed; }
.node.is-encrypted { border-color: var(--violet); box-shadow: 0 0 18px rgba(176,124,255,.35); }

.map.is-targeting .node { opacity: .35; pointer-events: none; }
.map.is-targeting .node.is-targetable {
  opacity: 1; pointer-events: auto;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(53,220,154,.2), 0 0 24px rgba(53,220,154,.35);
  animation: bob 1.4s ease-in-out infinite;
}
@keyframes bob {
  50% { transform: translate(-50%, calc(-50% - 4px)) scale(1.05); }
}
.node-odds {
  position: absolute; top: -10px; right: -12px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 99px;
  background: var(--green); color: #04120c;
}
.node-odds.mid { background: var(--amber); color: #1a1000; }
.node-odds.low { background: var(--red); color: #fff; }

.map-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 10px 14px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--dim); background: var(--bg-2);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }

/* ---------- console / actions ---------- */
.col-right { display: grid; gap: 14px; min-width: 0; }

.turn-banner {
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.turn-banner.is-red  { border-left: 3px solid var(--red); }
.turn-banner.is-blue { border-left: 3px solid var(--blue); }
.turn-banner .who { font-weight: 700; }
.turn-banner .sub { color: var(--muted); font-size: 13px; }

.ap-row { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ap-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim);
}
.ap-pips { display: flex; gap: 4px; }
.ap-pip {
  width: 13px; height: 13px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg);
}
.ap-pip.on.red  { background: var(--red);  border-color: var(--red); }
.ap-pip.on.blue { background: var(--blue); border-color: var(--blue); }

.phase-group {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
  margin: 14px 0 7px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}
.phase-group:first-child { margin-top: 0; }

.card {
  width: 100%; text-align: left; margin-bottom: 7px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  transition: .14s; position: relative;
}
.card:hover:not(.is-locked) { border-color: var(--dim); background: var(--line-soft); }
.card.is-locked { opacity: .45; cursor: not-allowed; }
.card.is-armed {
  border-color: var(--green); background: var(--green-soft);
  box-shadow: 0 0 0 2px rgba(53,220,154,.16);
}
/* padding-right keeps the cost pips clear of the absolute ⓘ button */
.card-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-right: 26px; }
.card-name { font-weight: 650; font-size: 14.5px; }
.card-mitre {
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 5px;
  background: var(--bg); color: var(--dim); border: 1px solid var(--line);
}
.card-cost { margin-left: auto; display: flex; gap: 3px; }
.card-cost i {
  width: 9px; height: 9px; border-radius: 3px; display: block;
  background: var(--dim);
}
.card-blurb { font-size: 12.8px; color: var(--muted); margin-top: 4px; }
.card-why { font-size: 12px; color: var(--amber); margin-top: 5px; font-family: var(--mono); }
.card-noise {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--dim); margin-top: 6px;
}
.noise-bar { display: inline-flex; gap: 2px; }
.noise-bar i { width: 5px; height: 9px; border-radius: 2px; background: var(--line); display: block; }
.noise-bar i.on { background: var(--amber); }
.info-btn {
  position: absolute; top: 8px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--muted); font-size: 11px;
  display: grid; place-items: center; line-height: 1;
}
.info-btn:hover { color: var(--text); border-color: var(--blue); }

/* ---------- alert queue ---------- */
.alert-row {
  width: 100%; text-align: left; margin-bottom: 7px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  border-left: 3px solid var(--dim); transition: .14s;
}
.alert-row.conf-high   { border-left-color: var(--red); }
.alert-row.conf-medium { border-left-color: var(--amber); }
.alert-row.conf-low    { border-left-color: var(--dim); }
.alert-row.is-pickable { cursor: pointer; }
.alert-row.is-pickable:hover { border-color: var(--green); background: var(--green-soft); }
.alert-row.st-confirmed { background: var(--red-soft);  border-left-color: var(--red); }
.alert-row.st-dismissed { opacity: .5; }
.alert-row.st-stale     { opacity: .5; border-left-color: var(--violet); }
.alert-row.st-erased    { opacity: .35; text-decoration: line-through; }
.alert-top {
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
}
.alert-where { font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--text); }
.alert-text { font-size: 12.6px; color: var(--muted); margin-top: 3px; }
.tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 99px; border: 1px solid var(--line);
  text-transform: uppercase;
}
.tag.high   { color: var(--red);   border-color: rgba(255,80,104,.4); background: var(--red-soft); }
.tag.medium { color: var(--amber); border-color: rgba(255,181,69,.4); background: var(--amber-soft); }
.tag.low    { color: var(--dim); }
.tag.ok     { color: var(--green); border-color: rgba(53,220,154,.4); background: var(--green-soft); }

.empty { color: var(--dim); font-size: 13px; padding: 6px 0; }

/* ---------- intel panel (red) ---------- */
.intel-grid { display: grid; gap: 8px; }
.intel-row {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft);
}
.intel-row:last-child { border-bottom: none; padding-bottom: 0; }
.intel-k {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); min-width: 112px;
}
.intel-v { color: var(--text); }
.intel-v.off { color: var(--dim); }

.steps { display: grid; gap: 5px; margin-top: 4px; }
.step { display: flex; gap: 8px; align-items: center; font-size: 12.6px; color: var(--dim); }
.step .box {
  width: 15px; height: 15px; border-radius: 4px; flex: none;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px;
}
.step.done { color: var(--green); }
.step.done .box { border-color: var(--green); background: var(--green-soft); }

/* ---------- log ---------- */
.log {
  height: 236px; overflow-y: auto; padding: 10px 14px;
  font-family: var(--mono); font-size: 12.1px; line-height: 1.58;
  background: #070a11;
}
.log p { margin: 0 0 1px; white-space: pre-wrap; word-break: break-word; }
.log .l-system { color: var(--dim); }
.log .l-turn   { color: var(--text); font-weight: 700; margin: 9px 0 3px; letter-spacing: .04em; }
.log .l-red    { color: var(--red); }
.log .l-blue   { color: var(--blue); }
.log .l-good   { color: var(--green); }
.log .l-fail   { color: #ff9aa8; }
.log .l-alert  { color: var(--amber); }
.log .l-info   { color: var(--muted); }
.log .l-meter  { color: var(--violet); }
.log .l-ai     { color: var(--violet); font-style: italic; }

/* ---------- coach ---------- */
.coach {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 28px));
  z-index: 60;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(20, 28, 44, .97); backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  padding: 13px 44px 13px 15px;
  display: flex; gap: 12px; align-items: flex-start;
  animation: rise .26s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 14px); } }
.coach.tone-good { border-left: 3px solid var(--green); }
.coach.tone-bad  { border-left: 3px solid var(--red); }
.coach.tone-info { border-left: 3px solid var(--blue); }
.coach-emoji { font-size: 22px; line-height: 1; }
.coach-title { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.coach-body { font-size: 13.2px; color: var(--muted); }
.coach-body strong { color: var(--text); }
.coach-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--dim); font-size: 17px; line-height: 1;
}

/* ---------- inspector drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(390px, 100vw);
  z-index: 70; background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .24s ease;
}
.drawer.is-open { transform: none; }
.drawer-head {
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  border-bottom: 1px solid var(--line-soft); background: var(--bg-2);
  display: flex; gap: 12px; align-items: flex-start;
}
.drawer-head .big { font-size: 28px; line-height: 1; }
.drawer-head h3 { font-size: 17px; }
.drawer-head .sub { font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .1em; }
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.drawer-close {
  margin-left: auto; background: none; border: none; color: var(--dim); font-size: 22px; line-height: 1;
}
.kv { margin-bottom: 14px; }
.kv h4 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 5px;
}
.kv p, .kv ul { font-size: 13.4px; color: var(--muted); margin: 0; }
.kv ul { padding-left: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 10.5px; padding: 4px 8px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
}
.chip.on   { color: var(--green); border-color: rgba(53,220,154,.45); background: var(--green-soft); }
.chip.bad  { color: var(--red);   border-color: rgba(255,80,104,.45); background: var(--red-soft); }
.chip.warn { color: var(--amber); border-color: rgba(255,181,69,.45); background: var(--amber-soft); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 7, 12, .78); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 18px;
  overflow-y: auto;
}
.modal {
  width: min(720px, 100%); max-height: calc(100vh - 36px); overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: 0 24px 70px rgba(0,0,0,.6);
}
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft); background: var(--bg-2);
}
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 18px; }
.modal-body h4 { margin: 16px 0 5px; font-size: 14px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p, .modal-body li { color: var(--muted); font-size: 14px; }
.modal-body ol, .modal-body ul { padding-left: 20px; }
.modal-body li { margin: 4px 0; }

.teach-block {
  border-left: 3px solid var(--blue); background: var(--bg-2);
  padding: 11px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 10px 0;
}
.teach-block.defend { border-left-color: var(--green); }
.teach-block.real   { border-left-color: var(--amber); }
.teach-block h5 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--dim); margin: 0 0 4px;
}
.teach-block p { margin: 0; color: var(--text); font-size: 13.6px; }

.gloss { display: grid; gap: 2px; }
.gloss-row {
  display: grid; grid-template-columns: minmax(130px, 170px) 1fr; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
}
.gloss-row dt { font-weight: 650; font-size: 13.6px; }
.gloss-row dd { margin: 0; color: var(--muted); font-size: 13.4px; }

/* ============================================================
   DEBRIEF
   ============================================================ */
.debrief-wrap { max-width: 920px; margin: 0 auto; padding: clamp(22px, 5vw, 56px) 20px 70px; }
.verdict {
  text-align: center; padding: 30px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); margin-bottom: 22px;
}
.verdict.red  { border-top: 4px solid var(--red); }
.verdict.blue { border-top: 4px solid var(--blue); }
.verdict .who {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--dim);
}
.verdict h2 { font-size: clamp(28px, 6vw, 46px); margin: 8px 0; letter-spacing: -.02em; }
.verdict p { color: var(--muted); max-width: 60ch; margin: 0 auto; }
.grade {
  display: inline-grid; place-items: center; width: 74px; height: 74px;
  border-radius: 50%; font-size: 34px; font-weight: 800; margin-top: 18px;
  border: 2px solid var(--line); background: var(--bg-2);
}
.score-line { font-family: var(--mono); color: var(--muted); margin-top: 10px; font-size: 13px; }

.stat-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 22px;
}
.stat {
  padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
}
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim); margin-top: 3px;
}

.chain { display: grid; gap: 7px; }
.chain-row {
  display: flex; gap: 11px; align-items: center;
  padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel);
}
.chain-row.hit { border-color: rgba(255,80,104,.45); background: var(--red-soft); }
.chain-row .n {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  width: 22px; flex: none;
}
.chain-row .k { font-weight: 600; font-size: 14px; }
.chain-row .s { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.chain-row.hit .s { color: var(--red); }

.lesson {
  padding: 13px 15px; border-radius: var(--radius); margin-bottom: 9px;
  border: 1px solid var(--line); border-left: 3px solid var(--green); background: var(--panel);
}
.lesson h4 { font-size: 14.5px; margin-bottom: 3px; }
.lesson p { color: var(--muted); font-size: 13.4px; margin: 0; }

.timeline { font-family: var(--mono); font-size: 12px; }
.timeline div { padding: 3px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .col-right { order: 2; }
}
@media (max-width: 700px) {
  .hud { gap: 9px; padding: 9px 12px; }
  .meters { order: 3; flex-basis: 100%; }
  .hud-actions { order: 2; margin-left: auto; }
  .layout { padding: 10px; gap: 10px; }
  .map { aspect-ratio: 1 / 1.08; min-height: 400px; }
  .node { width: 62px; }
  .node-icon { font-size: 17px; }
  .node-name { font-size: 8.4px; }
  .log { height: 190px; }
  .gloss-row { grid-template-columns: 1fr; gap: 2px; }
  .coach { padding-right: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
