/* ==========================================================================
   PITBORN — views.css
   Per-view styles layered on app.css (tokens + shared components live there).
   Sections: 1 body-map extras · 2 roster (fighters) · 3 fighter page ·
   4 lab layout · 5 lab controls & lock rows · 6 lab centre · 7 lab side panels
   (portrait, card, history, compare, breed, mod editor) · 8 responsive · 9 motion
   ========================================================================== */

/* 1. Body-map extras ------------------------------------------------------ */
/* the engine emits `class="injury acute sev-N pulse"` for fresh wounds; app.css only defines the hook */
.bodymap .pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: bm-pulse 1.6s ease-in-out infinite;
}
@keyframes bm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.45); }
}
.bodymap svg .part.hl { filter: drop-shadow(0 0 4px rgba(245, 207, 133, 0.7)); }
.bodymap-legend li[data-part] { cursor: default; }
.bodymap-legend li.hot { background: rgba(224, 164, 88, 0.08); border-radius: 4px; }

/* 2. Roster ---------------------------------------------------------------- */
.fighters-filters { margin-bottom: 12px; }
.search-wrap { position: relative; display: flex; align-items: center; flex: 1 1 220px; min-width: 180px; }
.search-wrap .ico { position: absolute; left: 10px; color: var(--text-faint); pointer-events: none; }
.search-wrap .input { width: 100%; padding-left: 32px; }
.fighters-count { white-space: nowrap; }
.fighters-empty { max-width: 720px; margin: 4vh auto 0; text-align: center; padding: 36px 28px; }
.fighters-empty h1 { color: var(--gold-bright); }
.fighters-empty .lede { font-size: 1.05rem; max-width: 46ch; margin: 0 auto 16px; }
.fighters-empty .row { justify-content: center; }
.row-name { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.row-name em { font-style: italic; }

/* 3. Fighter page ---------------------------------------------------------- */
.fighter-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-bottom: 18px; }
.fighter-head.dead .fighter-name { color: var(--text-muted); }
.fighter-title { flex: 1 1 320px; min-width: 0; }
.fighter-name { margin: 0 0 6px; font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.1; }
.fighter-name .epithet, .lab-name .epithet { font-style: italic; font-weight: 400; color: var(--gold); font-size: 0.72em; white-space: nowrap; }
.fighter-actions { flex: none; }
.badges { gap: 6px; }
.fighter-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) minmax(0, 340px); gap: var(--gap); align-items: start; }
.stats-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.fighter-portrait { max-width: 300px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
/* the Body panel sits in a 300-px column: stack the map above its legend instead of squeezing them side by side */
.fighter-grid .bodymap-panel { grid-template-columns: minmax(0, 1fr); }
.fighter-grid .bodymap-panel .bodymap { max-width: 240px; margin: 0 auto; }
.fighter-portrait svg { width: 100%; height: auto; }
.card-box { display: flex; justify-content: center; }
.kv > .kv-row { display: contents; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.6); box-shadow: 0 0 0 1px var(--line); vertical-align: middle; }
.marks-list, .quirks, .titles { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.86rem; }
.marks-list li, .titles li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--line-soft); }
.marks-list li:last-child, .titles li:last-child { border-bottom: 0; }
.quirks li { padding: 2px 0 2px 14px; position: relative; }
.quirks li::before { content: "◆"; position: absolute; left: 0; top: 4px; font-size: 0.55rem; color: var(--gold-dim); }
.mark-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--parchment); align-self: center; }
.mark-dot.mark-scarification { background: #c9a58a; border-radius: 1px; }
.mark-dot.mark-brand { background: var(--ember); border-radius: 2px; }
.mark-dot.mark-piercing { background: #c8c8c8; width: 6px; height: 6px; }
.mark-dot.mark-paint { background: #7fa3d8; }
.values-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.value-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  background: var(--bg-2); border: 1px solid var(--line);
}
.value-pill i { display: inline-block; width: 44px; height: 4px; border-radius: 2px; background: #0a0706; position: relative; overflow: hidden; }
.value-pill i::after { content: ""; position: absolute; inset: 0; width: calc(var(--v, 0) * 1%); background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.btn.on { color: var(--gold-bright); border-color: var(--gold-dim); }

/* 4. Lab layout ------------------------------------------------------------ */
.lab-view .view-head { align-items: center; }
.lab-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-head-actions kbd { margin-left: 2px; }
.lab-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.lab-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lab-col .panel { padding: 12px 14px; }
.lab-col .panel-head { margin: -2px 0 10px; }
.lab-col .panel-head h2 { font-size: 0.72rem; }
.lab-seedline { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.lab-seedline code { color: var(--gold-bright); }

/* 5. Lab controls & lock rows --------------------------------------------- */
.lab-fields { display: flex; flex-direction: column; gap: 2px; }
.lab-field { border-radius: var(--radius); border: 1px solid transparent; transition: background var(--t-fast), border-color var(--t-fast); }
.lab-field.locked { background: rgba(224, 164, 88, 0.06); border-color: rgba(224, 164, 88, 0.22); }
.lab-field.open { background: var(--bg-2); border-color: var(--line); }
.lab-field-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; }
.lab-field-label { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; line-height: 1.2; }
.lab-field.locked .lab-field-label { color: var(--gold); }
.lab-field-value { font-size: 0.86rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.lab-field-value.faint { color: var(--text-faint); font-style: italic; }
.lab-field-set { padding: 2px 8px; font-size: 0.68rem; }
.lab-field-set[aria-expanded="true"] { color: var(--gold-bright); border-color: var(--gold-dim); }
.lab-picker { padding: 6px 8px 10px 34px; display: flex; flex-direction: column; gap: 6px; }
.lab-picker .select, .lab-picker .input { width: 100%; }
.lab-picker .hint { font-size: 0.72rem; color: var(--text-faint); }
.lab-picker .row { gap: 6px; }
.lab-picker .row > .input, .lab-picker .row > .select { flex: 1 1 100px; }
.lab-check-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); }
.lab-check-list .check { font-size: 0.8rem; padding: 1px 0; }
.lab-check-list .check.off { opacity: 0.45; }
.lab-check-list .check .faint { margin-left: auto; }
.lab-list { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; display: flex; flex-direction: column; gap: 3px; }
.lab-list li { display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: var(--bg-1); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.lab-list li .grow { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-list li .btn-icon.btn-sm { width: 22px; height: 22px; }
.lab-tags .textarea { min-height: 54px; font-family: var(--font-mono); font-size: 0.8rem; }
.lab-warnings { margin: 0; padding: 0 0 0 16px; font-size: 0.78rem; color: #ffd88a; }
.lab-warnings li { margin: 2px 0; }
.lab-changes { font-size: 0.76rem; color: var(--text-muted); }

/* 6. Lab centre ------------------------------------------------------------ */
.lab-hero { text-align: center; padding: 14px 16px 12px; }
.lab-name { margin: 0 0 4px; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.1; }
.lab-name .epithet { display: inline-block; }
.lab-hero .badges { justify-content: center; margin-bottom: 8px; }
.lab-summary { font-family: var(--font-display); font-style: italic; color: var(--parchment); font-size: 0.98rem; line-height: 1.55; margin: 0; }
.lab-stage { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.lab-bodymap { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lab-bodymap .bodymap { width: 320px; max-width: 100%; }
.lab-bodymap .bodymap svg { max-height: none; }
.lab-bodymap-caption { font-size: 0.72rem; color: var(--text-faint); text-align: center; }
.lab-stage .bodymap-legend { font-size: 0.8rem; }
.lab-legend-wrap { max-height: 560px; overflow: auto; }
.lab-body-desc { font-size: 0.86rem; color: var(--parchment); margin: 10px 0 0; line-height: 1.55; }
.lab-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lab-detail-grid .panel { min-width: 0; }
.lab-detail-grid .radar { --s: 220px; display: block; margin: 0 auto; }
.lab-detail-grid .statbars { font-size: 0.78rem; }
.lab-detail-grid .axis { font-size: 0.64rem; grid-template-columns: 5em 1fr 5em; }
.lab-detail-grid .kv { font-size: 0.84rem; gap: 3px 10px; }
.lab-style-name { color: var(--gold); font-family: var(--font-display); font-size: 0.95rem; }

/* 7. Lab side panels ------------------------------------------------------- */
.lab-portrait { position: relative; aspect-ratio: 3 / 4; max-width: 240px; margin: 0 auto; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: radial-gradient(ellipse 70% 60% at 50% 30%, rgba(217, 116, 42, 0.18), transparent 70%), var(--bg-1); }
.lab-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lab-portrait .placeholder-text { padding: 16px; text-align: center; color: var(--text-faint); font-size: 0.78rem; font-style: italic; font-family: var(--font-display); }
.lab-portrait .spinner { position: absolute; right: 8px; top: 8px; }
.lab-prompt {
  margin: 0; padding: 10px 12px;
  max-height: 320px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.5; color: var(--parchment-soft);
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
}
.lab-prompt .k { color: var(--gold-dim); }
.lab-prompt mark { background: rgba(224, 164, 88, 0.22); color: var(--gold-bright); padding: 0 2px; border-radius: 2px; }
.lab-prompt .neg { color: #c99a9c; }
.lab-card .pb-card { --w: 250px; margin: 0 auto; }
.lab-history { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.lab-history-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px 3px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-1);
  cursor: pointer; color: var(--text-muted); font: 0.58rem/1.1 var(--font-ui); text-align: center;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.lab-history-item:hover, .lab-history-item:focus-visible { border-color: var(--gold); box-shadow: var(--glow-gold); }
.lab-history-item.current { border-color: var(--gold-bright); background: #221a10; }
.lab-history-item.pinned::after { content: "📌"; position: absolute; right: 1px; top: 0; font-size: 0.6rem; }
.lab-history-item svg { width: 34px; height: auto; }
.lab-history-item .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-pins { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.lab-pin { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.8rem; }
.lab-pin svg { width: 22px; height: auto; flex: none; }
.lab-pin .grow { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-pin .slot { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-dim); font-weight: 700; }
.lab-compare { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.lab-compare th, .lab-compare td { padding: 3px 5px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.lab-compare th { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.lab-compare th:first-child, .lab-compare td:first-child { text-align: left; color: var(--text-muted); width: 34%; }
.lab-compare th:last-child, .lab-compare td:last-child { width: 18%; }
.lab-compare tr.section td { padding-top: 8px; color: var(--gold-dim); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; text-align: left; border-bottom: 0; width: auto; }
.lab-compare .pos { color: var(--ok-bright); }
.lab-compare .neg { color: var(--blood-bright); }
.lab-compare .zero { color: var(--text-faint); }
.lab-compare-wrap { max-height: 420px; overflow: auto; }
.lab-breed-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; margin-bottom: 8px; }
.lab-breed-form .field { margin-bottom: 0; gap: 3px; }
.lab-breed-form .field > label { font-size: 0.62rem; }
.lab-breed-form .full { grid-column: 1 / -1; }
.lab-children { display: flex; flex-direction: column; gap: 6px; }
.lab-child { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.8rem; }
.lab-child svg { width: 100%; height: auto; }
.lab-child .nm { font-family: var(--font-display); color: var(--text-strong); font-size: 0.95rem; }
.lab-child .row { gap: 4px; margin-top: 4px; }
.lab-mods .field { margin-bottom: 6px; gap: 3px; }
.lab-mods .field > label { font-size: 0.62rem; }
.lab-mods-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.lab-mods-form .full { grid-column: 1 / -1; }
.lab-caps { width: 100%; border-collapse: collapse; font-size: 0.74rem; font-variant-numeric: tabular-nums; margin-top: 8px; }
.lab-caps th, .lab-caps td { padding: 2px 6px; text-align: right; border-bottom: 1px solid var(--line-soft); }
.lab-caps th:first-child, .lab-caps td:first-child { text-align: left; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.64rem; }
.lab-caps .pos { color: var(--ok-bright); } .lab-caps .neg { color: var(--blood-bright); }
.lab-import-box { display: flex; flex-direction: column; gap: 8px; }
.lab-import-box .textarea { min-height: 140px; font-family: var(--font-mono); font-size: 0.74rem; }
.lab-sub { font-size: 0.74rem; color: var(--text-faint); margin: 0 0 6px; }

/* 8. Responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .lab-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .lab-grid > .lab-col:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .fighter-grid { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
  .fighter-grid > .stack:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-grid > .lab-col:nth-child(3) { grid-template-columns: minmax(0, 1fr); }
  .lab-stage { grid-template-columns: minmax(0, 1fr); }
  .lab-bodymap .bodymap { width: min(320px, 100%); margin: 0 auto; }
  .lab-legend-wrap { max-height: none; }
  .fighter-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .lab-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-breed-form, .lab-mods-form { grid-template-columns: minmax(0, 1fr); }
  .lab-picker { padding-left: 10px; }
  .lab-history { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .lab-card .pb-card { --w: 220px; }
}

/* 9. Motion ---------------------------------------------------------------- */
.lab-flash { animation: lab-flash 360ms var(--ease); }
@keyframes lab-flash { from { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(224, 164, 88, 0.35); } }
@media (prefers-reduced-motion: reduce) {
  .bodymap .pulse, .lab-flash { animation: none !important; }
}
