/* The debrief: one page to scan, figures first, then what cost you, what landed, the drills. */

.debrief { --red: var(--danger); --cost: var(--warn); --good: var(--ok); display: grid; gap: 1.25rem; margin-top: 0.5rem; }
.debrief h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
.debrief h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.debrief p { margin: 0.25rem 0; }
.fine { color: var(--muted); font-size: 0.82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header and summary */
.db-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  padding-bottom: 0.9rem; border-bottom: 1px solid var(--border);
}
.db-header h2 { font-size: 1.35rem; margin: 0.1rem 0 0.2rem; }
.db-kicker { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.db-overall {
  display: grid; justify-items: end; gap: 0.2rem; padding: 0.55rem 0.9rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.db-overall .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.db-overall strong { font-size: 1.15rem; }
.pips { display: flex; gap: 4px; }
.pips i { width: 18px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.db-overall.overall-1 { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.db-overall.overall-2 { border-color: color-mix(in srgb, var(--cost) 45%, var(--border)); }
.db-overall.overall-3, .db-overall.overall-4 { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.db-overall.overall-1 .pips i.on { background: var(--red); }
.db-overall.overall-2 .pips i.on { background: var(--cost); }
.db-overall.overall-3 .pips i.on, .db-overall.overall-4 .pips i.on { background: var(--good); }
.db-summary { font-size: 1.12rem; line-height: 1.55; margin: 0; max-width: 70ch; }

/* Measured by code: one even row of tiles when the strip is wide enough for all of them (at least
   8.5rem a tile), else two even rows, and two columns on a phone. A label stays on one line. */
.db-metrics { container-type: inline-size; }
.metric-grid { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.metric {
  flex: 1 1 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.6rem 0.75rem 0.65rem; display: grid; gap: 0.1rem; align-content: start;
}
.metric .label { font-size: 0.78rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.metric strong { font-size: 1.35rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.metric .hint { font-size: 0.8rem; color: var(--muted); line-height: 1.35; text-wrap: balance; }
.metric-break { display: none; flex-basis: 100%; height: 0; }
@container (max-width: 59.5rem) { .metric-grid[data-count="7"] .metric-break, .metric-grid[data-count="8"] .metric-break { display: block; } }
@container (max-width: 51rem) { .metric-grid[data-count="6"] .metric-break { display: block; } }
@container (max-width: 42.5rem) { .metric-grid[data-count="5"] .metric-break { display: block; } }
@container (max-width: 34rem) { .metric-grid[data-count="4"] .metric-break { display: block; } }
@container (max-width: 30rem) {
  .metric-grid .metric-break { display: none !important; }
  .metric { flex-basis: calc(50% - 0.3rem); }
}
@container (max-width: 36rem) {
  .metric-grid:is([data-count="7"], [data-count="8"]) .metric-break { display: none !important; }
  .metric-grid:is([data-count="7"], [data-count="8"]) .metric { flex-basis: calc(50% - 0.3rem); }
}
.db-metrics .fine { margin-top: 0.45rem; }
.db-meta span { white-space: nowrap; }

/* Stages of an open case */
.db-stages { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 1rem; }
.stage-bar { position: relative; height: 18px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.stage-seg { position: absolute; top: 0; bottom: 0; }
.stage-seg.none { background: repeating-linear-gradient(45deg, transparent 0 4px, color-mix(in srgb, var(--muted) 18%, transparent) 4px 8px); }
.stage-legend { list-style: none; padding: 0; margin: 0.6rem 0 0.2rem; display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font-size: 0.85rem; }
.stage-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; vertical-align: baseline; }
.stage-legend strong { font-variant-numeric: tabular-nums; }

/* Cards: red flags, what cost you, what landed, drills */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card-item {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 12px; padding: 0.85rem 1rem; display: grid; gap: 0.45rem; align-content: start;
}
.card-item.red { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--surface)); }
.card-item.cost { border-left-color: var(--cost); }
.card-item.landed { border-left-color: var(--good); }
.card-item.drill { border-left-color: var(--accent); }
/* A long title wraps beside its turn chip or duration, which stay on its first line. */
.item-head { display: flex; align-items: baseline; gap: 0.55rem; }
.item-head > strong, .item-head > .criterion { flex: 1 1 auto; min-width: 0; }
.item-head > * { flex: none; }
.item-head .num {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: color-mix(in srgb, var(--cost) 20%, var(--surface)); font-weight: 700; font-size: 0.85rem;
}
.criterion { font-weight: 600; font-size: 0.9rem; }
.turn-chip {
  margin-left: auto; font-size: 0.75rem; font-variant-numeric: tabular-nums; text-decoration: none;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.5rem; white-space: nowrap;
}
.turn-chip:hover, .turn-chip:focus-visible { color: var(--accent); border-color: var(--accent); }
td .turn-chip { margin: 0 0.25rem 0.25rem 0; display: inline-block; }
.db-quote {
  margin: 0; padding: 0.15rem 0 0.15rem 0.8rem; border-left: 3px solid var(--border);
  font-style: italic; color: var(--text);
}
.tag { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin-bottom: 0.1rem; text-wrap: balance; }
.item-head > strong, .item-head > .criterion, .debrief h2, .db-header h2 { text-wrap: balance; }
.done .tag { display: inline; }
.reading p { color: var(--text); }
.better { background: color-mix(in srgb, var(--good) 7%, var(--surface)); border-radius: 8px; padding: 0.5rem 0.7rem; }
.stronger { margin: 0; }
mark.slot {
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text);
  border-radius: 4px; padding: 0 0.15rem; font-style: normal;
}
.minutes {
  margin-left: auto; font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.55rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.drill .done { margin-top: auto; padding-top: 0.35rem; border-top: 1px dashed var(--border); }

/* Folded sections: rubric, planted errors, transcript, checks */
.db-fold { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 1rem; }
.db-fold > summary {
  display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; margin: 0;
  color: var(--text); font-weight: 600; list-style: none;
}
.db-fold > summary::-webkit-details-marker { display: none; }
.db-fold > summary::after { content: "Show"; color: var(--accent); font-weight: 500; font-size: 0.85rem; }
.db-fold[open] > summary::after { content: "Hide"; }
.db-fold > summary .muted { margin-left: auto; font-weight: 400; font-size: 0.9rem; }
.db-fold[open] { padding-bottom: 0.8rem; }
.table-wrap { overflow-x: auto; }
.rubric-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.rubric-table th, .rubric-table td { text-align: left; vertical-align: top; padding: 0.55rem 0.5rem; border-top: 1px solid var(--border); }
.rubric-table thead th { border-top: 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rubric-table tbody th { font-weight: 600; width: 22%; }
.rubric-table .evidence { width: 16%; }
.level { font-size: 0.8rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap; display: inline-block; }
.level-4 { background: color-mix(in srgb, var(--ok) 85%, black); color: var(--surface); }
.level-3 { background: color-mix(in srgb, var(--ok) 25%, var(--surface)); }
.level-2 { background: color-mix(in srgb, var(--warn) 25%, var(--surface)); }
.level-1 { background: color-mix(in srgb, var(--danger) 22%, var(--surface)); }
.planted-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.planted-list li { border-left: 4px solid var(--cost); padding: 0.2rem 0 0.2rem 0.75rem; }
.planted-list li.spotted { border-left-color: var(--good); }
.planted-list .badge { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.turns { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; font-size: 0.92rem; }
.turns li { padding: 0.25rem 0.5rem; border-radius: 6px; transition: background 0.4s; }
.turns li.candidate b { color: var(--you); }
.turns li.flash { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.turn-id { display: inline-block; min-width: 5.6rem; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.checks ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; font-size: 0.9rem; }

/* The whiteboard */
.board-grid { display: grid; gap: 0.9rem; }
.board-grid .final-board svg { max-height: 460px; }
.board-critique { display: grid; gap: 0.5rem; }
.board-critique .criteria { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.3rem 1rem; margin: 0; }

.db-footer { display: grid; gap: 0.6rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.db-footer .actions { margin-top: 0; }

@media (max-width: 720px) {
  .db-overall { display: flex; align-items: center; gap: 0.65rem; padding: 0.4rem 0.85rem; }
  .db-overall strong { font-size: 1.05rem; }
  .rubric-table thead { display: none; }
  .rubric-table tr { display: grid; gap: 0.25rem; padding: 0.55rem 0; border-top: 1px solid var(--border); }
  .rubric-table th, .rubric-table td { border: 0; padding: 0; width: auto; }
}

@media print {
  .db-fold { break-inside: avoid; }
  .db-fold:not([open]) > *:not(summary) { display: block; }
  .turn-chip { border: 0; }
  .db-footer .actions { display: none; }
}
