/* Postround flow: global element styles, the shell header and shared components. Owner: WP2.
   Shared classes (CONTRACTS.md 3.10): .btn, .btn.primary, .field, .toast, .panel, .seam.
   WP2 also provides layout primitives and the styles for ui/dom.js controls; see
   dev/postround/notes/WP2.md for the full list. Screen CSS stays scoped under .screen-<key>. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--c-seam); scrollbar-color: var(--c-raised) var(--c-seam); }
html, body { margin: 0; color: var(--c-ink); }
body {
  min-height: 100vh;
  background: var(--c-seam);
  font-family: var(--font-ui);
  font-size: var(--fs-m);
  line-height: 20px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, dl, dd, figure, blockquote { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
a { color: inherit; }
kbd { font: inherit; }
[hidden] { display: none !important; }
svg.icon { display: inline-block; flex: none; vertical-align: middle; overflow: visible; }
::placeholder { color: var(--c-edge); opacity: 1; }
:where(button, input, textarea, select, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }
:where(button, input, textarea, select, a, summary, [tabindex]):focus:not(:focus-visible) { outline: none; }
h1[tabindex="-1"]:focus { outline: none; }
.app { min-height: 100vh; }
.boot-error, .noscript { margin: 0; padding: var(--gutter); color: var(--c-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--c-seam); user-select: none; -webkit-user-select: none; }
.shell input, .shell textarea, .shell .selectable { user-select: text; -webkit-user-select: text; }
.shell-header {
  position: relative;
  z-index: 5;
  flex: none;
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  background: var(--c-panel);
  border-bottom: 1px solid var(--c-seam);
}
.shell-left { align-self: stretch; min-width: 0; display: flex; align-items: stretch; gap: 4px; padding-left: var(--gutter); }
.shell-name { align-self: center; margin-right: 8px; padding: 0; border: 0; background: transparent; color: var(--c-ink); cursor: pointer; font-family: var(--font-display); font-size: var(--fs-l); line-height: 20px; font-weight: 700; white-space: nowrap; }
.shell-steps { justify-self: center; align-self: stretch; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.shell-steps li { display: flex; }
.shell-step, .shell-clips {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-s);
  font-weight: 400;
  color: var(--c-disabled);
  white-space: nowrap;
  cursor: default;
}
.shell-step.is-visited { color: var(--c-muted); }
.shell-clips { align-self: center; height: 32px; padding: 0 12px; gap: 6px; border-radius: 4px; background: var(--c-field, #2b2b2b); color: var(--c-ink); font-weight: 600; }
.shell-clips:hover { background: var(--c-selected, #383838); }
.shell-clips[aria-current="page"] { background: var(--c-selected, #383838); box-shadow: none; }
.shell-step:not(:disabled), .shell-clips { cursor: pointer; }
.shell-step:not(:disabled):hover, .shell-clips:hover { color: var(--c-ink); }
.shell-step[aria-current="step"], .shell-clips[aria-current="page"] { color: var(--c-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--c-ink); }
.shell-step:focus-visible, .shell-clips:focus-visible { outline-offset: -2px; }
.shell-right { min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-right: var(--gutter); }
.shell-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-s); color: var(--c-muted); }
.shell-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.shell-next { padding: 0 16px; }
.shell-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.shell-slot:focus { outline: none; }

/* ---------- Layout primitives (flush panels, 1px seams) ---------- */
.panel { background: var(--c-panel); }
.seam { display: flex; gap: 1px; background: var(--c-seam); }
.screen { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.split { flex: 1; min-height: 0; display: flex; gap: 1px; }
.side { width: var(--sidebar-w); flex: none; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px 0; background: var(--c-panel); overflow: auto; scrollbar-width: thin; }
.work { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 1px; }
.stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 16px; background: var(--c-stage); }
.sec { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.sec-label { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
.hint { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
.title { margin: 0; font-family: var(--font-display); font-size: 26px; line-height: 30px; font-weight: 700; }
.display { margin: 0; font-family: var(--font-display); font-size: 40px; line-height: 44px; font-weight: 700; }
.lede { font-size: var(--fs-l); line-height: 22px; color: var(--c-muted); }
.num { font-family: var(--font-display); font-size: 30px; line-height: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tc { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--c-muted); }
.faint { color: var(--c-edge); }
.meta { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: var(--fs-s); line-height: 16px; }
.meta dt { color: var(--c-muted); }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.btn {
  --btn-hover: var(--c-selected);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--c-field);
  color: var(--c-ink);
  font: inherit;
  font-size: var(--fs-m);
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.btn:not(:disabled):hover { background: var(--btn-hover); }
.btn:disabled { background: var(--c-field); color: var(--c-disabled); cursor: default; }
.btn.primary { background: var(--c-pink); color: var(--c-on-pink); }
.btn.primary:not(:disabled):hover { background: var(--c-pink-hover); }
.btn.primary:not(:disabled):active { background: var(--c-pink-active); }
.btn.primary:disabled { background: var(--c-field); color: var(--c-disabled); }
.btn.raised { --btn-hover: var(--c-raised-hover); background: var(--c-raised); }
.btn.raised:disabled, .btn.ghost, .btn.ghost:disabled { background: transparent; }
.btn.ghost { --btn-hover: var(--c-field); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-s); }
.btn.lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.btn.icon-only { width: 32px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn kbd { margin-left: 2px; font-size: var(--fs-xs); font-weight: 400; color: var(--c-muted); }
.btn:disabled kbd { display: none; }

/* List rows (quick cuts, kill list, files) and choice tiles */
.row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 0 16px; border: 0; background: transparent; color: var(--c-ink); font: inherit; font-size: var(--fs-m); text-align: left; cursor: pointer; }
.row:not([aria-checked="true"]):not(:disabled):hover { background: var(--c-hover); }
.row[aria-checked="true"] { background: var(--c-selected); font-weight: 600; }
.row:disabled { color: var(--c-disabled); cursor: default; }
.tile { border: 0; border-radius: var(--r-control); background: var(--c-seam); color: var(--c-ink); font: inherit; cursor: pointer; }
.tile:not(:disabled):hover { background: var(--c-hover); }
.tile[aria-checked="true"], .tile[aria-pressed="true"] { box-shadow: var(--ring-pick); }

/* ---------- Fields: filled, with a bottom edge ---------- */
.field {
  display: block;
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-control) var(--r-control) 0 0;
  background: var(--c-field);
  box-shadow: var(--edge-field);
  color: var(--c-ink);
  font: inherit;
  font-size: var(--fs-m);
  user-select: text;
  -webkit-user-select: text;
}
.field:disabled { color: var(--c-disabled); box-shadow: inset 0 -1px 0 var(--c-disabled); cursor: default; }
.field.sm { height: 24px; padding: 0 8px; }
.field.lg { height: 40px; font-size: 14px; }
.field.tc { font-family: var(--font-display); text-align: right; }
textarea.field { height: auto; padding: 8px 10px; line-height: 18px; resize: none; }
select.field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-color: var(--c-field);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c0c0' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
select.field option { background: var(--c-panel); color: var(--c-ink); }
.field-label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
input[type="range"].range { width: 100%; height: 20px; margin: 0; background: transparent; accent-color: var(--c-ink); cursor: pointer; }

/* ---------- Segmented control (ui/dom.js segmented) ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 2px; border-radius: var(--r-control); background: var(--c-seam); }
.seg-opt { min-width: 0; height: 28px; padding: 0 6px; border: 0; border-radius: var(--r-chip); background: transparent; color: var(--c-muted); font: inherit; font-size: var(--fs-s); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.seg-opt:not([aria-checked="true"]):not(:disabled):hover { color: var(--c-ink); }
.seg-opt[aria-checked="true"] { background: var(--c-selected); color: var(--c-ink); font-weight: 600; }
.seg-opt:disabled { cursor: default; }
.seg-opt:focus-visible { outline-offset: 0; }
.seg.l .seg-opt { height: 30px; font-size: var(--fs-m); }
.seg.s .seg-opt { height: 26px; }
.seg[aria-disabled="true"] { opacity: 0.45; }

/* ---------- Swatches (ui/dom.js swatches) ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; flex: none; padding: 0; border: 0; border-radius: var(--r-chip); box-shadow: var(--ring-swatch-off); cursor: pointer; }
.swatch[aria-checked="true"] { box-shadow: var(--ring-swatch); }
.swatches.s .swatch { width: 24px; height: 24px; }
.swatch:disabled { cursor: default; opacity: 0.45; }

/* ---------- Checkbox (ui/dom.js checkbox) ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--c-ink); font: inherit; font-size: var(--fs-m); text-align: left; cursor: pointer; }
.check-box { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: var(--r-chip); background: transparent; box-shadow: var(--ring-off); color: var(--c-on-light); }
.check-box svg { visibility: hidden; }
.check[aria-checked="true"] .check-box { background: var(--c-ink); box-shadow: none; }
.check[aria-checked="true"] .check-box svg { visibility: visible; }
.check.pink { min-height: 18px; }
.check.pink .check-box { width: 18px; height: 18px; }
.check.pink[aria-checked="true"] .check-box { background: var(--c-pink); }
.check:disabled { color: var(--c-disabled); cursor: default; }
.check:disabled .check-box { opacity: 0.45; }

/* ---------- Portraits and the headshot badge ---------- */
.portrait { position: relative; display: inline-block; flex: none; vertical-align: middle; }
.portrait > img, .portrait-fallback { display: block; width: 100%; height: 100%; border-radius: var(--r-chip); background: var(--c-field); object-fit: cover; }
.portrait-fallback { display: grid; place-items: center; overflow: hidden; color: var(--c-muted); font-size: var(--fs-xs); font-weight: 600; }
.portrait-fallback svg { width: 70%; height: 70%; }
.hs-badge { position: absolute; right: -5px; bottom: -4px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--c-ink); color: var(--c-on-light); box-shadow: 0 0 0 2px var(--hs-ring, var(--c-panel)); }
.hs-badge.inline { position: relative; right: auto; bottom: auto; display: inline-grid; vertical-align: middle; }

/* ---------- Progress and stage checklists (honest: real % or indeterminate) ---------- */
.progress { position: relative; display: block; height: 3px; overflow: hidden; background: var(--c-selected); }
.progress > span { display: block; width: 0; height: 100%; background: var(--c-ink); transition: width var(--t-med); }
.progress.is-indeterminate > span { width: 30%; animation: pr-indeterminate 1.3s ease-in-out infinite; }
@keyframes pr-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.checklist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-m); color: var(--c-edge); }
.checklist .cl-mark { width: 14px; height: 14px; flex: none; display: grid; place-items: center; }
.checklist .cl-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.checklist li[data-status="done"], .checklist li[data-status="active"], .checklist li[data-status="failed"] { color: var(--c-ink); }
.checklist li[data-status="active"] { font-weight: 600; }
.checklist .cl-label { min-width: 0; }
.checklist .cl-pct { margin-left: auto; font-weight: 400; color: var(--c-muted); font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1000;
  max-width: calc(100vw - 2 * var(--gutter));
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--r-control);
  background: var(--c-ink);
  color: var(--c-on-light);
  font-size: var(--fs-m);
  line-height: 18px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.toast.is-empty { opacity: 0; pointer-events: none; padding: 0; box-shadow: none; }

/* ---------- Phone width: panels stack ---------- */
@media (max-width: 899.98px) {
  .shell-header {
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "left actions" "steps steps" "note note";
  }
  .shell-left { grid-area: left; height: var(--header-h); }
  .shell-right { display: contents; }
  .shell-actions { grid-area: actions; height: var(--header-h); padding-right: var(--gutter); }
  .shell-steps { grid-area: steps; justify-self: stretch; justify-content: center; height: 40px; border-top: 1px solid var(--c-seam); overflow-x: auto; scrollbar-width: none; }
  .shell-note { grid-area: note; padding: 0 var(--gutter) 8px; text-align: center; }
  .shell-note:empty { display: none; }
  .split { flex-direction: column; }
  .side { width: auto; overflow: visible; }
  .stage { min-height: 220px; padding: 12px; }
}
@media (max-width: 599.98px) {
  .shell-step { padding: 0 6px; }
  .shell-clips { padding: 0 6px; }
  .shell-name { margin-right: 4px; }
  .display { font-size: 32px; line-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress > span { transition: none; }
  .progress.is-indeterminate > span { animation-duration: 3s; }
}

/* Bigger stepper: numbered chips, mint when done, white chip + underline for the current step. */
.shell-steps { gap: 8px; }
.shell-step { gap: 8px; padding: 0 12px; font-size: 14px; }
.shell-step .icon[data-icon="check"] { display: none; }
.shell-step-num { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--c-field); color: var(--c-muted); font-family: var(--font-display); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; transition: background .2s, color .2s; }
.shell-step.is-done .shell-step-num { background: #4fd1a5; color: #0d1f18; font-size: 0; }
.shell-step.is-done .shell-step-num .icon[data-icon="check"] { display: block; width: 12px; height: 12px; }
.shell-step[aria-current="step"] .shell-step-num { background: var(--c-ink); color: #111111; }
.shell-step[aria-current="step"] { box-shadow: inset 0 -3px 0 var(--c-ink); }
@media (max-width: 899.98px) { .shell-step { padding: 0 6px; font-size: 13px; } .shell-step > span:not(.shell-step-num) { display: none; } .shell-step[aria-current="step"] > span { display: inline; } }
.shell-step-num > * { grid-area: 1 / 1; }
.shell-step.is-done .shell-step-n { visibility: hidden; }
.shell-step.is-done .shell-step-num { font-size: 12px; }
.shell-name { display: inline-flex; align-items: center; gap: 8px; }
.shell-logo { width: 32px; height: 32px; flex: none; }

/* Preview listening volume (ui/volume.js): never affects the export. */
.vol { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.vol input[type="range"].vol-slider { width: 84px; }
.sub-vol, .phone-vol { margin-left: auto; }
@media (max-width: 600px) { .vol input[type="range"].vol-slider { display: none; } }

/* "Whose kills?" (ui/pov-picker.js): Reading and Trim, replays and spectator clips only.
   The team chips use Valorant's own killfeed colours, the only place they appear. */
.pov { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--c-seam); }
.pov[hidden] { display: none; }
.pov-text { margin: 0; font-size: var(--fs-m); color: var(--c-muted); line-height: 1.4; }
.pov-text strong { color: var(--c-ink); font-weight: 600; }
.pov-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pov-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.pov-list[hidden] { display: none; }
.pov-choice {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  min-height: 36px; padding: 4px 8px; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--c-ink); font: inherit; font-size: var(--fs-m); text-align: left; cursor: pointer;
}
.pov-choice:not(:disabled):hover { background: var(--c-hover); }
.pov-choice.is-selected { background: var(--c-selected); }
.pov-choice:disabled { cursor: default; color: var(--c-disabled); }
.pov-agent { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pov-count { color: var(--c-muted); font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.pov-team { padding: 1px 6px; border-radius: var(--r-chip); font-size: var(--fs-xs); color: var(--c-on-light); }
.pov-team.is-red { background: #f0575a; }
.pov-team.is-teal { background: #5fc4a4; }
.pov-error { margin: 0; font-size: var(--fs-s); color: var(--c-ink); }
.pov-error[hidden] { display: none; }
