/* Damage Ledger page styles (docs/design/redesign.md). Tokens are in
   tokens.css. Mobile first: top bar, one view, bottom bar; from 1024 px a
   left rail. */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* Type roles (visual-refresh.md 3.1): page title, eyebrow, panel title,
   micro-label. Body is 15 px on phones and touch, 14 px with a mouse on a
   wide screen; inputs stay 16 px on touch so iOS doesn't zoom. */
body { font: var(--w-regular) 0.9375rem/var(--lh-body) var(--sans); -webkit-font-smoothing: antialiased; }
@media (pointer: fine) and (min-width: 1024px) { body { font-size: var(--fs-md); } }
h1 { font: var(--w-semi) var(--fs-xl)/var(--lh-tight) var(--sans); letter-spacing: -0.015em; margin: 0; }
h2 { font: var(--w-semi) var(--fs-base)/var(--lh-snug) var(--sans); color: var(--text); margin: 0 0 var(--s3); }
.eyebrow { font: var(--w-medium) var(--fs-xs)/var(--lh-snug) var(--sans); color: var(--muted); margin: 0 0 var(--s1); }
.label { display: block; font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.lede { color: var(--muted); font-size: var(--fs-sm); margin: 0; max-width: 70ch; }
code { font-family: var(--mono); font-size: 0.9em; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
/* Line icons from the sprite in index.html (html.js icon()). */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.inv-chip .ico { margin-right: var(--s1); }
.pick .ico { width: 1em; height: 1em; margin-right: var(--s0); }

/* ---- shell ---- */
.app { min-height: 100vh; padding-bottom: 72px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); height: var(--topbar); padding: 0 var(--s4); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { color: var(--text); text-decoration: none; font: 500 1rem var(--sans); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.brand b { color: var(--accent); font-weight: 600; }
.brand svg { width: 18px; height: 18px; fill: var(--accent); }
.acct { margin-left: auto; display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.acct select { width: auto; max-width: 38vw; font-weight: var(--w-semi); background-color: var(--surface); padding: 0 var(--s5) 0 var(--s2); background-position: right var(--s2) center; }
.save-state { font: 0.75rem var(--mono); color: var(--muted); white-space: nowrap; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }
.save-state::before { content: "● "; }
.save-state.ok { color: var(--up); }
/* Phone width: the account picker gives way and the save state is just its
   dot (the words stay in its title and for screen readers), so nothing in
   the top bar overlaps. */
@media (max-width: 719.98px) {
  .topbar { gap: var(--s2); }
  .acct select { min-width: 0; flex: 0 1 auto; }
  .save-state { flex: none; width: 0.75em; max-width: none; text-overflow: clip; }
}
.save-state.error { color: var(--down); }
.engine-state { display: inline-flex; align-items: center; font: 0.75rem var(--mono); color: var(--muted); white-space: nowrap; background: none; border: 0; padding: 0 4px; min-height: 44px; cursor: help; }
.engine-state .long { display: none; }
.engine-state.slow { color: var(--warn); }
.engine-state::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-right: 6px; vertical-align: 1px; }
.engine-state.native::before { background: var(--accent); }
.engine-state.slow::before { background: var(--warn); }
.topbar .icon-btn { flex: none; background: transparent; }
.topbar .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 30; min-width: 240px; display: grid; gap: var(--s1); padding: var(--s2); background: var(--overlay); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.menu-pop button { justify-content: flex-start; text-align: left; border-color: transparent; background: transparent; min-height: var(--ctl-h); }
.menu-pop button:hover { background: var(--raised); }
.menu-pop .status { padding: 4px var(--s3); font-size: 0.78rem; }

/* one line for long jobs and messages, under the top bar */
.jobbar { position: sticky; top: var(--topbar); z-index: 19; display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 4px var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); }
.jobbar { flex-wrap: wrap; }
.jobbar:has(#status:empty):has(#acct-notice[hidden]) { display: none; }
.acct-notice { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s2) 0; }
.acct-notice[hidden] { display: none; }
.acct-notice p { flex: 1 1 240px; margin: 0; color: var(--warn); font-size: 0.88rem; }
.acct-notice button { min-height: var(--ctl-h-sm); }
/* Read-only tab, or a reload pending: the views can be read but not used. */
main.view[inert] { opacity: 0.6; }
.jobbar .status { flex: 1; margin: 0; font: 0.82rem/1.4 var(--mono); }
.jobbar #stop { min-height: var(--ctl-h-sm); }

.rail { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 64px; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.rail a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font: 500 0.68rem var(--cond); letter-spacing: 0.06em; text-transform: uppercase; }
.rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail a[aria-current="page"] { color: var(--accent); }
.rail .more-item { display: none; }
.rail.open .more-item { display: flex; }
.rail.open { grid-template-columns: repeat(4, 1fr); height: auto; grid-auto-rows: 64px; }

.view { padding: var(--s4); min-width: 0; display: grid; gap: var(--s4); align-content: start; max-width: 1280px; }
@media (min-width: 1024px) { .view { gap: var(--gap-stack); } }
.view-head { display: grid; gap: var(--s3); }
.view-head .actions { margin: 0; }
/* Level 1: panels. Things inside use --r-md and at most one more level. */
section { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); padding: var(--pad-panel); margin: 0; min-width: 0; }
section > h2:first-child { margin-bottom: var(--s3); }
footer { color: var(--faint); font-size: 0.8rem; padding: var(--s4); max-width: 1280px; }
footer a { color: var(--muted); }

/* Buttons (visual-refresh.md 3.6). Default is secondary; .primary is the one
   accent fill per view; .ghost has no box until hovered; .danger is red text,
   filled only in a confirm dialog. .sm is the small size, .icon-btn square.
   --ctl-h is 36 px with a mouse and 44 px on touch and narrow screens. */
button { font: var(--w-medium) var(--fs-md)/var(--lh-tight) var(--sans); color: var(--text); background: var(--raised); border: var(--bw) solid var(--line-input); border-radius: var(--r-md); min-height: var(--ctl-h); padding: 0 var(--s4); cursor: pointer; transition: background 120ms, border-color 120ms, color 120ms; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:active:not(:disabled) { background: var(--overlay); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: var(--w-semi); }
button.primary:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 88%, var(--text)); }
button.primary:active:not(:disabled) { background: color-mix(in oklab, var(--accent) 80%, var(--bg)); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: var(--raised); border-color: transparent; color: var(--text); }
button.danger, button.ghost.danger { color: var(--down); }
button.sm { min-height: var(--ctl-h-sm); padding: 0 var(--s3); font-size: var(--fs-sm); }
button.icon-btn { min-height: var(--ctl-h); width: var(--ctl-h); padding: 0; display: inline-grid; place-items: center; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
/* A running action: aria-busy="true" adds a 12 px spinner before the label. */
button[aria-busy="true"] { cursor: wait; }
button[aria-busy="true"]::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: var(--s2); vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Inputs and selects: inset on --bg, sans; numbers in mono. */
input, select, textarea { font: var(--w-regular) var(--fs-md)/var(--lh-tight) var(--sans); color: var(--text); background-color: var(--bg); border: var(--bw) solid var(--line-input); border-radius: var(--r-md); min-height: var(--ctl-h); padding: 0 var(--s3); width: 100%; transition: border-color 120ms, box-shadow 120ms; }
input[type=number], input[inputmode=numeric], input[inputmode=decimal] { font-family: var(--num); font-variant-numeric: tabular-nums; }
@media (pointer: coarse), (max-width: 1023px) { input, select, textarea { font-size: var(--fs-base); } }
input:hover:not(:disabled, :focus), select:hover:not(:disabled, :focus), textarea:hover:not(:disabled, :focus) { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); outline: none; }
input:user-invalid, input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--down); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.45; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
select { appearance: none; background-image: var(--chev); background-repeat: no-repeat; background-position: right var(--s3) center; padding-right: var(--s6); cursor: pointer; }
input[type=radio], input[type=checkbox] { width: auto; min-height: 0; padding: 0; accent-color: var(--accent); box-shadow: none; }
input[type=radio]:focus, input[type=checkbox]:focus { box-shadow: none; }
input[type=radio]:focus-visible, input[type=checkbox]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
details.more > summary { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: 0 var(--s4); font: var(--w-medium) var(--fs-md)/var(--lh-tight) var(--sans); background: var(--raised); border: var(--bw) solid var(--line-input); border-radius: var(--r-md); cursor: pointer; list-style: none; }
details.more > summary:hover { border-color: var(--muted); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { border-color: var(--accent); color: var(--accent-text); }
/* A More menu: a level-3 popover under its summary. */
details.more { position: relative; }
.more-body { position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 30; width: max-content; max-width: min(92vw, 520px); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s3); background: var(--overlay); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.more-body.menu-list { display: grid; gap: var(--s1); min-width: 200px; padding: var(--s2); }
.more-body.menu-list button { justify-content: flex-start; text-align: left; color: var(--text); }
.tool { display: grid; gap: var(--s3); }
.tool p { margin: 0; }
.tool > h2, .tool .actions { margin: 0; }

@media (min-width: 720px) {
  .engine-state .long { display: inline; }
  .engine-state .short { display: none; }
  .view-head { grid-template-columns: 1fr auto; align-items: end; }
}
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; padding-bottom: 0; }
  /* Every part has a fixed place: the job line can be hidden, and hidden
     views must not change where the open view and the footer go. */
  .topbar { grid-column: 1 / -1; grid-row: 1; }
  .jobbar { grid-column: 1 / -1; grid-row: 2; }
  .view { grid-column: 2; grid-row: 3; width: 100%; max-width: 1440px; justify-self: center; }
  .rail { position: sticky; z-index: 18; top: var(--topbar); grid-row: 3 / 5; height: calc(100vh - var(--topbar)); grid-template-columns: none; grid-auto-rows: 72px; align-content: start; border-top: 0; border-right: 1px solid var(--line); background: var(--bg); padding-top: var(--s2); }
  .rail .more-item { display: flex; }
  .rail .more-btn { display: none; }
  .rail a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
  .view { padding: var(--s5) var(--s6); }
  footer { grid-column: 2; grid-row: 4; width: 100%; max-width: 1440px; justify-self: center; padding: 0 var(--s6) var(--s5); }
}

/* ---- components (kept from the earlier page, on the new tokens) ---- */
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
/* Field labels above a control use the micro-label role. */
.grid > label, .inv-form label, .lo-namefield, #lo-lineup-f { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.wide { grid-column: 1 / -1; }
.result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.result div { border-top: 2px solid var(--line); padding-top: 8px; }
.result .avg { border-top-color: var(--accent); }
.result b { display: block; font: 600 1.35rem var(--mono); letter-spacing: -0.02em; }
.result small { color: var(--muted); font-size: 0.8rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 0.8rem; }
td.r, th.r { text-align: right; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 48px; }
.bar i { display: block; height: 100%; background: var(--bar); }
.note { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }
.art { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 8px; margin-bottom: 8px; }
.row span { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); margin-bottom: -4px; }
.arts { display: grid; gap: 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
.verdict { margin-top: 16px; padding: 16px; border-left: 4px solid var(--line); background: var(--input); }
.el-pyro { --el: var(--pyro); } .el-hydro { --el: var(--hydro); } .el-electro { --el: var(--electro); } .el-cryo { --el: var(--cryo); }
.el-anemo { --el: var(--anemo); } .el-geo { --el: var(--geo); } .el-dendro { --el: var(--dendro); } .el-physical { --el: var(--physical); }
.mhead { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.portrait { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--el, var(--line)); background: var(--input); object-fit: cover; flex: none; }
.portrait.sm { width: 32px; height: 32px; border-width: 2px; vertical-align: middle; margin-right: 8px; }
.mhead b { font-size: 1.15rem; display: block; line-height: 1.2; }
.mhead small { color: var(--muted); font: 0.8rem var(--mono); }
.wep { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.wep img { width: 28px; height: 28px; }
.slotlabel { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s2); }
.strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.strip .pc { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input); }
.strip .pc img { width: 100%; height: 100%; }
.strip .pc i { position: absolute; right: 1px; bottom: 0; font: 600 0.65rem var(--mono); font-style: normal; background: var(--surface); padding: 0 var(--s0); border-radius: var(--r-sm); }
.teambar[hidden] { display: none; }
.teambar { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.teambar figure { margin: 0; text-align: center; font-size: 0.75rem; color: var(--muted); width: 72px; }
.teambar figure img { width: 60px; height: 60px; }
.loadouts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
.lo-group { min-width: 0; }
.lo-group .lo { max-width: 100%; flex-shrink: 1; }
.lo-group .lo-faces { flex-wrap: wrap; }
.lo-group { border: var(--bw) solid var(--line); border-radius: var(--r-md); padding: var(--s3); }
/* Lineup modes are told apart by their icon, not by colour. */
.lo-group header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); border: 0; padding: 0; margin-bottom: var(--s2); }
.lo-group header b { display: inline-flex; align-items: center; gap: var(--s2); color: var(--text); font-size: var(--fs-md); }
.lo-group header b .ico { color: var(--muted); }
.lo-group header small { flex-basis: 100%; color: var(--muted); font-size: var(--fs-xs); }
.lo-drop { margin-left: auto; min-height: var(--ctl-h-sm); padding: 0 var(--s3); font-size: var(--fs-sm); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.lo-count { font: var(--w-medium) var(--fs-2xs) var(--num); padding: var(--s0) var(--s2); border-radius: var(--r-sm); border: var(--bw) solid var(--line-input); color: var(--muted); }
.lo-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.lo.slot { justify-content: center; align-items: center; text-align: center; color: var(--muted); border-style: dashed; }
.lo.slot small { font-size: 0.72rem; }
.mode { color: var(--accent); font-size: 0.75rem; }
.gains { overflow-x: auto; margin-top: 12px; }
.gains td b { font-weight: 600; }
.lo-card { position: relative; flex: none; display: flex; }
.lo-rename { position: absolute; top: 4px; right: 4px; min-height: 28px; width: 28px; padding: 0; font-size: 0.85rem; color: var(--muted); background: transparent; border-color: transparent; }
.lo-rename:hover, .lo-rename:focus-visible { border-color: var(--line); color: var(--text); }
.lo-name-edit { min-height: var(--ctl-h-sm); font: var(--w-semi) var(--fs-md) var(--sans); padding: 0 var(--s2); }
.lo-card .lo { padding-right: 34px; }
.lo-new { display: flex; flex-wrap: wrap; gap: 8px; }
.lo-new button { border-style: dashed; color: var(--muted); }
.lo-overview:empty { display: none; }
.lo-overview { padding-top: var(--s3); border-top: var(--bw) solid var(--line); }
.ov-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ov { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s2) var(--s3); border: var(--bw) solid var(--line); border-radius: var(--r-md); font-size: var(--fs-sm); min-width: 120px; }
.ov { align-items: flex-start; text-align: left; height: auto; background: var(--raised); }
.ov:hover { border-color: var(--muted); }
.ov.on { border-color: var(--accent); }
.ov small { color: var(--muted); }
/* Team cards are level 2 inside their group: --line, not a control border. */
.lo { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); min-width: 150px; padding: var(--s2) var(--s3); text-align: left; flex: none; border-color: var(--line); }
.lo.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lo.add { justify-content: center; align-items: center; color: var(--muted); border-style: dashed; }
.lo b { font-weight: 600; }
.lo-faces { display: flex; gap: 2px; min-height: 30px; align-items: center; }
.lo-faces i { color: var(--muted); font-size: 0.8rem; }
.face { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--el, var(--line)); background: var(--input); object-fit: cover; }
.badge { display: inline-flex; align-items: center; gap: var(--s1); font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); letter-spacing: var(--tracking-label); text-transform: uppercase; padding: var(--s0) var(--s2); border: var(--bw) solid var(--line-input); border-radius: var(--r-sm); color: var(--muted); }
.lo-edit { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .lo-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); } .lo-edit .actions, .lo-edit .lo-mode { grid-column: 1 / -1; } }
.lo-mode { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
@media (min-width: 560px) { .lo-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .lo-mode { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lo-mode legend { font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; padding: 0; }
.lo-mode .opt { flex-direction: row; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; cursor: pointer; color: var(--text); }
.lo-mode .opt input { width: auto; min-height: 0; margin-top: 3px; }
.lo-mode .opt small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.lo-mode .opt:has(input:checked) { border-color: var(--accent); }
.lo-mode .mode:has(input:checked) { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; font-size: 0.78rem; color: var(--muted); }
.pick .face { width: 52px; height: 52px; border-width: 3px; opacity: 0.55; filter: grayscale(0.6); }
.pick.on { border-color: var(--el); color: var(--text); background: color-mix(in srgb, var(--el) 12%, var(--surface)); }
.pick.on .face { opacity: 1; filter: none; }
.pick small { font-size: 0.68rem; color: var(--muted); }
/* Not owned: a quieter name, not a dashed border (dashed means empty or add). */
.pick.notmine > span { font-style: italic; }
.face.initial { display: inline-grid; place-items: center; font: 600 1.1rem var(--sans); color: var(--el, var(--muted)); }
.opt-inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 10px; }
.opt-inline input { width: auto; min-height: 0; }
.pick:disabled { cursor: not-allowed; opacity: 0.5; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--input); font-size: 0.8rem; min-width: 0; }
.pcard header { display: flex; gap: 6px; align-items: center; border: 0; padding: 0; margin-bottom: 4px; }
.pcard header img { width: 40px; height: 40px; flex: none; }
.pcard header b { font: 600 0.85rem var(--sans); display: block; }
.pcard header small { color: var(--muted); }
.pcard ul { margin: 0; padding: 0; list-style: none; font-family: var(--mono); color: var(--muted); }
.result .avg b { color: var(--accent); }
.verdict b { font: 600 1.6rem var(--mono); display: block; }
.verdict.up { border-left-color: var(--good); } .verdict.up b { color: var(--good); }
.verdict.down { border-left-color: var(--bad); } .verdict.down b { color: var(--bad); }
.enc { margin-top: 10px; display: grid; gap: 6px; }
.enc > button { justify-self: start; }
.enc-t { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.enc-t th, .enc-t td { padding: 4px 6px; border-bottom: 1px solid var(--line, #8883); text-align: left; }
.enc-t td.pick { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 600; }
.ct-pick { display: flex; flex-wrap: wrap; gap: 12px; }
.ct-pick input { min-width: 16em; }
.ct-pick[hidden] { display: none; }
.ct-mode { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.ct-target { display: grid; grid-template-columns: repeat(auto-fill, minmax(17em, 1fr)); gap: 4px 18px; padding-left: 0; list-style-position: inside; max-height: 14em; overflow-y: auto; }
.ct-target li.done { color: var(--muted); }
.ct-target li.next { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.ct-keys summary { cursor: pointer; }
.ct-keygrid { display: grid; grid-template-columns: max-content minmax(8em, max-content); gap: 4px 12px; align-items: center; margin-top: 8px; }
tr.ct-worst td { font-weight: 600; }
.ct-pad { width: 100%; min-height: 96px; font-size: 1.05rem; }
.ct-pad:focus { outline: 3px solid var(--accent); }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .arts { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
  .sticky { position: sticky; top: 16px; }
}
@media (prefers-reduced-motion: no-preference) { .bar i { transition: width 200ms ease; } }
.members { display: grid; gap: 12px; }
.member { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.member h3 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.member h3 small { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.member .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.member details { margin-top: 8px; }
.member summary { cursor: pointer; color: var(--muted); font-size: var(--fs-md); min-height: 32px; display: flex; align-items: center; }
textarea { font: var(--fs-sm)/var(--lh-body) var(--mono); padding: var(--s2) var(--s3); min-height: 9em; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.actions select { width: auto; max-width: 100%; }
.actions label { min-width: 0; max-width: 100%; }
.actions label select { flex: 1 1 auto; min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
.grid > label, .member { min-width: 0; }
.status.error { color: var(--bad); }
.result.four { grid-template-columns: repeat(2, 1fr); }
.scroll { overflow-x: auto; max-width: 100%; }
.scroll table { min-width: 480px; }
.warn { color: var(--muted); font-size: 0.875rem; }
.cands li { margin: 4px 0; font-size: 0.875rem; }
.cands button { min-height: var(--ctl-h-sm); padding: 0 var(--s2); font-size: var(--fs-sm); }
.compare { display: grid; gap: 12px; }
.chip { display: inline-block; font: var(--fs-xs) var(--mono); padding: 1px var(--s2); border: var(--bw) solid var(--line); border-radius: var(--r-sm); color: var(--muted); }
@media (min-width: 720px) {
  .members { grid-template-columns: 1fr 1fr; }
  .result.four { grid-template-columns: repeat(4, 1fr); }
  .compare { grid-template-columns: 1fr 1fr; }
}

/* ---- new look for older components ---- */
.result div { border-top-width: 1px; }
.result .avg b { color: var(--accent); }
.member { background: var(--raised); }
.status { color: var(--muted); font-size: 0.875rem; min-height: 0; margin: 0; }

/* ---- teams workspace ---- */
.teams-layout { display: grid; gap: var(--s4); }
.workspace { display: grid; gap: var(--s4); align-content: start; min-width: 0; }
.workspace .view-head .actions { flex-wrap: wrap; }
.workspace .view-head .actions .primary { min-width: 140px; }
.team-list { display: grid; gap: var(--s2); align-content: start; }
.team-list h2 { margin: 0; }
.team-list .loadouts { margin: 0; }
.result.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--bw); margin: 0; background: var(--line); border: var(--bw) solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpis > div { background: var(--surface); border-top: 0 !important; padding: var(--s3) var(--s4); }
.kpis > .avg { grid-column: 1 / -1; }
.kpis > .avg b { font-size: 2.2rem; font-weight: 500; }
.kpis b { font-weight: 500; }
.kpis small { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); }
#r-warn:empty { display: none; }
/* Panel head: title, the hint on its own line under it, actions on the right. */
.panel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s1) var(--s3); margin-bottom: var(--s4); }
.panel-head > * { grid-column: 2; grid-row: 1 / span 2; }
.panel-head > h2, .panel-head > .hint { grid-column: 1; grid-row: auto; }
.panel-head h2 { margin: 0; }
.panel-head .hint { display: block; color: var(--faint); font-size: var(--fs-sm); font-weight: var(--w-regular); max-width: 70ch; }
.panel-head h2 .hint { margin-top: var(--s0); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: var(--ctl-h); background: transparent; color: var(--muted); font-size: var(--fs-md); }
.seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.pick-box > summary, .team-settings > summary, .member details.edit > summary { cursor: pointer; color: var(--muted); min-height: 40px; display: flex; align-items: center; font-size: var(--fs-md); }
.pick-box[open] > summary, .team-settings[open] > summary { color: var(--text); }
.pick-box { margin-bottom: var(--s3); }
.team-settings { border-top: var(--bw) solid var(--line); }
.team-settings[open] { padding-bottom: var(--s4); }
@media (min-width: 720px) {
  .result.kpis { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .kpis > .avg { grid-column: auto; }
}
@media (min-width: 1024px) {
  .teams-layout { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
  .team-list { position: sticky; top: calc(var(--topbar) + var(--s5)); max-height: calc(100vh - var(--topbar) - 48px); overflow-y: auto; padding-right: 4px; }
  .team-list .loadouts { grid-template-columns: minmax(0, 1fr); }
  .team-list .lo-row { flex-direction: column; overflow: visible; }
  .team-list .lo-card, .team-list .lo { width: 100%; min-width: 0; }
  .team-list .lo-new { flex-direction: column; }
  .team-list .lo-new button { width: 100%; }
}
@media (min-width: 1280px) {
  .members { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .team-list .lo-group header small { display: none; }
  .team-list .lo-new { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .team-list .lo-new button { min-height: var(--ctl-h-sm); font-size: var(--fs-sm); white-space: nowrap; flex: none; }
}
.members > .member { min-width: 0; overflow: hidden; }

/* ---- find ---- */
.ranked { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.ranked li { display: grid; grid-template-columns: 24px auto 1fr; grid-template-areas: "rank faces dps" "rank name name" ". btn btn"; gap: var(--s2) var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.ranked .rank { grid-area: rank; color: var(--faint); align-self: start; padding-top: 4px; }
.ranked .faces { grid-area: faces; display: flex; gap: 2px; }
.ranked .rname { grid-area: name; display: grid; }
.ranked .rname small { color: var(--muted); font-size: 0.8rem; }
.ranked .rdps { grid-area: dps; justify-self: end; font-size: 1.15rem; }
.ranked button { grid-area: btn; justify-self: start; }
.ranked li:first-child .rdps { color: var(--accent); }
@media (min-width: 720px) {
  .ranked li { grid-template-columns: 24px auto 1fr auto auto; grid-template-areas: "rank faces name dps btn"; }
  .ranked .rank { align-self: center; padding: 0; }
}

/* ---- roster ---- */
.ro { display: grid; gap: var(--s4); min-width: 0; }
.ro-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
.ro-top h2 { margin: 0; }
.ro-top h2 .num { color: var(--text); margin-left: 6px; letter-spacing: 0; }
.ro-add { display: flex; gap: var(--s2); flex: 1 1 260px; max-width: 420px; }
.ro-add select { flex: 1; min-width: 0; }
.ro-add button { flex: none; }
.ro > section > .status { margin-bottom: var(--s3); }
.ro-sub { margin: 0 0 var(--s3); }
.ro-list { display: grid; gap: var(--s2); grid-template-columns: minmax(0, 1fr); align-items: start; }
.ro-card { border: 1px solid var(--line); border-left: 3px solid var(--el, var(--line-strong)); border-radius: var(--radius); background: var(--raised); min-width: 0; }
.ro-card[open] { border-color: var(--line-strong); border-left-color: var(--el, var(--line-strong)); }
.ro-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s3); min-height: 64px; padding: var(--s2) var(--s3); }
.ro-card > summary::-webkit-details-marker { display: none; }
.ro-card > summary:hover { background: color-mix(in srgb, var(--el, var(--line)) 6%, transparent); }
.ro-card .portrait { width: 48px; height: 48px; border-width: 2px; }
.ro-initial { display: grid; place-items: center; font: 600 1.2rem var(--sans); color: var(--el); }
.ro-who { display: grid; gap: 2px; min-width: 0; flex: 1; }
.ro-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ro-who small { color: var(--faint); font-size: 0.75rem; }
.ro-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.85rem; color: var(--text); }
.ro-wep { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); min-width: 0; }
.ro-wep { flex-wrap: wrap; }
/* Phones: the weapon name wraps instead of being cut off; refinement and level follow it. */
.ro-wep > span:first-of-type { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 720px) { .ro-wep { flex-wrap: nowrap; } .ro-wep > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
.ro-wep .num { white-space: nowrap; }
.ro-wep img { width: 22px; height: 22px; flex: none; }
.ro-chev { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 6px 4px; transition: transform 120ms; }
.ro-card[open] .ro-chev { transform: rotate(-135deg); margin-bottom: -4px; }
.ro-edit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); padding: var(--s3); border-top: 1px solid var(--line); }
.ro-edit label { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.ro-edit .wide { grid-column: 1 / -1; }
.ro-hint { margin: -4px 0 0; font-size: 0.8rem; color: var(--muted); }
.ro-foot { display: flex; justify-content: flex-end; }
.ro-wname { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.ro-wname img { width: 32px; height: 32px; flex: none; }
.ro-wname > span { display: grid; min-width: 0; }
.ro-wname b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ro-wname small { color: var(--muted); font-size: 0.75rem; text-transform: capitalize; }
.ro-x { width: var(--ctl-h); padding: 0; }
.ro-acct-cur { margin: 0 0 var(--s2); }
.ro-acct .note { margin: var(--s2) 0 0; }
.ro-acct .actions { margin-bottom: 0; }
.acct-conflict { margin: var(--s3) 0; padding: var(--s3); border: 1px solid var(--warn); border-radius: var(--radius); }
.acct-conflict p { margin: 0 0 var(--s2); }
@media (min-width: 720px) {
  .ro-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ro-edit { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ro-wname { grid-column: auto; align-self: center; }
}
@media (min-width: 1200px) {
  .ro-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ro-spares { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- artifacts ---- */
.inv-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
.inv-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
.inv-filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; min-width: 0; }
.inv-filters label { flex: 1 1 140px; min-width: 0; }
.inv-filters .inv-search { flex: 2 1 200px; }
.inv-chips { flex: 1 1 100%; display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 2px; }
.inv-chip { flex: none; min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-full); white-space: nowrap; font-size: 0.85rem; color: var(--muted); background: transparent; }
.inv-chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.inv-shown:empty { display: none; }
.inv-shown { margin: 0; }
.inv-who { color: var(--text); font-weight: var(--w-medium); }
.inv-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); }
.inv-drawer { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow: auto; overscroll-behavior: contain; display: grid; gap: var(--s4); padding: var(--s4); background: var(--overlay); border-top: var(--bw) solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-pop); }
.inv-dhead { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.inv-dhead h2 { margin: 0; }
.inv-x { width: var(--ctl-h); padding: 0; }
.piece-hero { display: grid; gap: var(--s1); }
.inv-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); margin: 0; }
.inv-form .wide { grid-column: 1 / -1; }
.inv-subs-edit { display: grid; gap: var(--s2); margin: 0; min-width: 0; }
.inv-subs-edit legend { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.inv-sub { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: var(--s2); }
.inv-err { margin: 0; color: var(--down); font-size: 0.875rem; }
.inv-err.ok { color: var(--up); }
.inv-err:empty { display: none; }
.inv-drawer .note { margin: 0; }
.inv-dactions { position: sticky; bottom: calc(-1 * var(--s4)); display: flex; justify-content: space-between; gap: var(--s2); margin: 0 calc(-1 * var(--s4)) calc(-1 * var(--s4)); padding: var(--s3) var(--s4); background: var(--overlay); border-top: var(--bw) solid var(--line); }
@media (min-width: 1024px) {
  .inv-split.open { grid-template-columns: minmax(0, 1fr) 360px; }
  .inv-scrim { display: none; }
  .inv-drawer { position: sticky; z-index: 1; top: calc(var(--topbar) + var(--s4)); max-height: calc(100vh - var(--topbar) - var(--s6)); border: var(--bw) solid var(--line); border-radius: var(--r-lg); }
}

/* ---- piece cards (after Akasha's build cards) ---- */
.inv-key { margin: 0; }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); gap: var(--s3); }
.inv-split.open .pc-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.pc-card { --q: var(--line); position: relative; display: grid; gap: var(--s2); align-content: start; min-width: 0; padding: var(--s3); color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--q); border-radius: var(--radius); }
/* A full inventory is thousands of cards: skip layout and paint for those off screen. */
#inv-rows > .pc-wrap { content-visibility: auto; contain-intrinsic-size: auto 226px; }
a.pc-card:hover { background: var(--raised); }
a.pc-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pc-card.on { background: var(--accent-soft); border-color: var(--accent); }
.pc-card.q-top { --q: var(--accent); }
/* Quality is one accent ramp, more or less cyan: top, good, ok, below. */
.pc-card.q-good { --q: color-mix(in oklab, var(--accent) 55%, var(--muted)); }
.pc-card.q-ok { --q: var(--muted); }
.pc-top { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s1) var(--s2); align-items: center; }
.pc-img { width: 48px; height: 48px; border-radius: var(--radius); background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--q) 30%, transparent), var(--raised) 70%); object-fit: contain; }
.pc-card.four .pc-img { filter: saturate(0.8); }
.pc-img.glyph, .pc-card.empty .glyph { display: grid; place-items: center; color: var(--muted); font-size: 1.5rem; }
.pc-main { display: grid; min-width: 0; line-height: 1.15; }
.pc-mk { font: 600 0.72rem var(--cond); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pc-main b { font-size: 1.25rem; font-weight: 600; }
.pc-badges { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s2); font-size: 0.75rem; }
.pc-lv { margin-left: auto; }
.pc-rolls { color: var(--muted); }
.pc-subs .rc { margin-left: 4px; color: var(--muted); font-size: 0.72rem; }
.pc-subs li.dim .rc { color: var(--faint); }
.sc-extra { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; border: 0; font-size: 0.8rem; min-width: 0; }
.sc-extra legend { padding: 0; margin-bottom: 4px; color: var(--muted); }
.sc-extra label { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--s3); border: var(--bw) solid var(--line-input); border-radius: var(--r-full); color: var(--muted); cursor: pointer; }
.sc-extra input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sc-extra label:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.sc-extra label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pc-rv { padding: 1px var(--s2); border-radius: var(--r-sm); color: var(--accent-ink); background: var(--q); font-weight: 600; }
.pc-card:not([class*="q-"]) .pc-rv { color: var(--text); background: var(--raised); }
.pc-cv { color: var(--muted); }
.pc-cv.hi { color: var(--accent); }
.pc-lv { color: var(--warn); }
.pc-set { margin: 0; font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-set small { color: var(--muted); font-weight: 400; }
.pc-subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 0.875rem; }
.pc-subs li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr) auto; gap: var(--s2); align-items: baseline; }
.pc-subs .dots { display: flex; justify-content: flex-end; align-self: center; gap: 3px; color: var(--q); }
.pc-subs .dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pc-subs .v { text-align: right; }
.pc-subs li.good .k, .pc-subs li.good .v { color: var(--text); }
.pc-subs li.good.crit .v { color: var(--accent); }
.pc-subs li.dim { color: var(--faint); }
.pc-subs li.dim .dots { color: var(--faint); }
.pc-subs li.off { font-style: italic; }
.pc-foot { display: flex; flex-wrap: wrap; gap: 4px var(--s2); align-items: baseline; padding-top: var(--s2); border-top: 1px solid var(--line); font-size: 0.8rem; }
.pc-foot small { color: var(--muted); }
.pc-low { margin-left: auto; color: var(--warn); font-size: 0.75rem; }
.pc-card.empty { place-items: center; min-height: 140px; color: var(--muted); border-style: dashed; }
.inv-empty { grid-column: 1 / -1; }

/* ---- build showcase (Teams) ---- */
.sc-tabs { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 2px; }
.sc-tab { display: inline-flex; align-items: center; gap: var(--s2); flex: none; min-height: 44px; padding: var(--s0) var(--s3) var(--s0) var(--s0); border-radius: var(--r-full); color: var(--muted); background: transparent; }
.sc-tab img { width: 38px; height: 38px; border-radius: 50%; background: var(--raised); }
.sc-tab[aria-selected="true"] { color: var(--text); border-color: var(--el, var(--accent)); background: color-mix(in srgb, var(--el, var(--accent)) 12%, transparent); }
/* The showcase is a tinted area of its panel, not a box inside it. */
.sc { display: grid; gap: var(--s4); padding: var(--s4); margin-top: var(--s3); border-radius: var(--r-md); background: linear-gradient(135deg, color-mix(in srgb, var(--el, var(--accent)) 14%, var(--surface)), var(--surface) 55%); }
.sc-who { display: flex; gap: var(--s3); align-items: center; }
.sc-portrait { width: 96px; height: 96px; flex: none; border-radius: 50%; border: 2px solid var(--el, var(--accent)); background: radial-gradient(circle, color-mix(in srgb, var(--el, var(--accent)) 35%, transparent), var(--raised) 70%); }
.sc-who h3 { margin: 0; font-size: 1.5rem; }
.sc-who p { margin: 2px 0 0; color: var(--muted); }
.sc-tal { display: flex; gap: 6px; }
.sc-tal > span { min-width: 30px; padding: 1px 6px; text-align: center; border: var(--bw) solid var(--line-input); border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-sm); }
.sc-tal small { color: var(--muted); font-size: 0.7rem; }
.sc-mid { display: grid; gap: var(--s3); min-width: 0; }
.sc-wep { display: flex; gap: var(--s3); align-items: center; }
.sc-wimg { width: 52px; height: 52px; border-radius: var(--radius); background: var(--raised); }
.sc-wep b { display: block; }
.sc-wep small { color: var(--muted); }
.sc-stats { list-style: none; margin: 0; padding: 0; display: grid; }
.sc-stats li { display: flex; justify-content: space-between; gap: var(--s3); padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); color: var(--muted); }
.sc-stats li b { color: var(--text); font-weight: 500; }
.sc-stats li.good span { color: var(--text); }
.sc-stats li.set span { color: var(--up); }
.sc-side { display: grid; gap: var(--s3); align-content: start; }
.sc-dps { margin: 0; display: grid; }
.sc-dps small { color: var(--muted); }
.sc-dps b { font-size: 1.75rem; font-weight: 600; color: var(--accent); }
.sc-useful { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sc-useful small { flex: 1 1 100%; color: var(--muted); }
.sc-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: var(--s2); }
.sc-pieces .pc-card { padding: var(--s2); }
.sc-pieces .pc-top { grid-template-columns: 36px minmax(0, 1fr); }
.sc-pieces .pc-img { width: 36px; height: 36px; }
.sc-pieces .pc-main b { font-size: 1rem; }
.sc-pieces .pc-mk { font-size: 0.65rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-pieces .pc-subs { font-size: 0.8rem; }
.sc-pieces .pc-subs li { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.sc-pieces .pc-subs .dots { display: none; }
.sc-nopieces { margin: 0; }
.roll-bar { display: flex; flex-wrap: wrap; gap: var(--s2); font-size: 0.8rem; }
.rb { padding: var(--s0) var(--s2); border: var(--bw) solid var(--line); border-radius: var(--r-sm); color: var(--faint); }
.rb b { font-weight: 500; }
.rb.good { border-color: var(--line-input); color: var(--text); }
.rb.good i { color: var(--accent-text); font-style: normal; }
.rb i { font-style: normal; }
.rb.sum { border-color: var(--accent); color: var(--text); }
@media (min-width: 900px) {
  .sc { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 0.8fr); align-items: start; }
  .sc-who { flex-direction: column; text-align: center; }
  .sc-portrait { width: 140px; height: 140px; }
  .sc-pieces, .sc .roll-bar, .sc-nopieces { grid-column: 1 / -1; }
  .sc-pieces { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---- review pass ---- */
/* Small icon buttons get a full touch target on phones. */
@media (max-width: 1023px), (pointer: coarse) {
  .lo-rename { min-height: 40px; width: 40px; top: 2px; right: 2px; }
  .lo-card .lo { padding-right: 44px; }
}

/* ---- large screens ---- */
/* On big monitors at 1x pixel density everything would be drawn at laptop
   size in the middle of a huge window, so the whole page scales up in steps.
   --z keeps the sticky rail exactly one window tall at any scale. */
:root { --z: 1; }
@media (min-width: 1800px) { :root { --z: 1.2; } }
@media (min-width: 2200px) { :root { --z: 1.4; } }
@media (min-width: 2900px) { :root { --z: 1.7; } }
html { zoom: var(--z); }
@media (min-width: 1024px) {
  .rail { height: calc(100vh / var(--z) - var(--topbar)); }
}

/* ---------- in-page dialog (dialog.js) ---------- */
dialog.ask { background: var(--overlay); color: var(--text); border: var(--bw) solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--s5); width: min(440px, calc(100vw - 2 * var(--s4))); }
dialog.ask::backdrop { background: var(--scrim); }
/* The title is a heading, not an eyebrow: sentence case, full colour. */
dialog.ask h2 { margin: 0 0 var(--s3); font: var(--w-semi) var(--fs-lg)/var(--lh-snug) var(--sans); text-transform: none; letter-spacing: 0; color: var(--text); }
dialog.ask p { margin: 0 0 var(--s4); line-height: var(--lh-body); }
dialog.ask label { display: grid; gap: var(--s1); margin-bottom: var(--s4); color: var(--muted); font-size: var(--fs-sm); }
dialog.ask .ask-err { color: var(--down); min-height: 1em; }
dialog.ask .ask-err:empty { min-height: 0; }
.ask-btns { display: flex; justify-content: flex-end; gap: var(--gap-inline); margin-top: var(--s1); }
dialog.ask button.danger { background: var(--down); border-color: var(--down); color: var(--down-ink); font-weight: var(--w-semi); }

/* ---- kept simulation result (#80) ---- */
.r-when { margin: 8px 0 0; }
#kpis.stale .r-when, .stale-note { color: var(--warn); }
#kpis.stale .result b, #dmg.stale td.num, #dmg.stale .bar, #sc-sec.stale .sc-stats b, #sc-sec.stale .sc-dps b, #score.stale .rs-score, #score.stale .rs-steps, #score.stale .cmp-big { opacity: 0.55; }
.stale-note { margin: 0 0 8px; }

/* ---- Practice: live feedback while playing (#103, #107) ----
   Practice-only. Uses the shared tokens only (--accent, --up, --down, --warn,
   --muted, --line), so the visual refresh can restyle around it. */
button.ct-pad[data-state="ready"] { border-color: var(--accent); }
button.ct-pad[data-state="playing"] { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
button.ct-pad[data-state="done"] { border-color: var(--up); box-shadow: inset 4px 0 0 var(--up); }
.ct-target li[data-tone="ok"] { color: var(--up); }
.ct-target li[data-tone="near"] { color: var(--warn); }
.ct-target li[data-tone="off"], .ct-target li[data-tone="wrong"], .ct-target li[data-tone="missed"] { color: var(--down); }
.ct-live { margin: 10px 0; }
.ct-bar:empty { display: none; }
.ct-track { position: relative; height: 34px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.ct-tick { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: var(--muted); opacity: 0.6; }
.ct-tick.next { background: var(--accent); opacity: 1; width: 3px; }
.ct-hit { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--muted); }
.ct-hit.ok { background: var(--up); }
.ct-hit.near { background: var(--warn); }
.ct-hit.off, .ct-hit.wrong { background: var(--down); }
.ct-hit.extra { background: transparent; border: 2px solid var(--muted); }
.ct-hit.new { animation: ct-pop 0.25s ease-out; }
@keyframes ct-pop { from { transform: scale(2); } to { transform: scale(1); } }
.ct-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent); }
.ct-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; }
.ct-last { min-height: 1.4em; margin: 4px 0 0; font-weight: 600; }
.ct-last[data-tone="ok"] { color: var(--up); }
.ct-last[data-tone="near"] { color: var(--warn); }
.ct-last[data-tone="off"], .ct-last[data-tone="wrong"] { color: var(--down); }
.ct-last[data-tone="extra"] { color: var(--muted); }
/* Held inputs (#107): the target hold as a faint span, the player's hold over it. */
.ct-span { position: absolute; height: 6px; border-radius: 3px; background: var(--muted); }
.ct-span.target { top: 6px; background: var(--line); }
.ct-span.ok, .ct-span.near, .ct-span.off, .ct-span.extra, .ct-span.growing { bottom: 6px; }
.ct-span.ok { background: var(--up); }
.ct-span.near { background: var(--warn); }
.ct-span.off { background: var(--down); }
.ct-span.growing { background: var(--accent); }
.ct-holdtag { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .ct-hit.new { animation: none; } }
/* ---- end Practice ---- */

/* ---- teams workspace, refreshed (visual-refresh.md section 4) ---- */
/* Rarity tiles behind portraits and icons; the element shows once, as the
   portrait's ring. */
.tile { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: var(--r-md); background: linear-gradient(160deg, color-mix(in oklab, var(--rar, var(--line)) 38%, var(--raised)), var(--raised) 75%); }
.rar-5 { --rar: var(--r5); } .rar-4 { --rar: var(--r4); } .rar-3 { --rar: var(--r3); }
.tile .cbadge { display: block; position: absolute; right: calc(-1 * var(--s1)); bottom: calc(-1 * var(--s1)); padding: 0 var(--s1); font: var(--w-medium) var(--fs-2xs)/1.5 var(--num); color: var(--text); background: var(--overlay); border: var(--bw) solid var(--line); border-radius: var(--r-sm); }
.portrait.initial, .sc-face.initial { display: grid; place-items: center; font: var(--w-semi) var(--fs-lg) var(--sans); color: var(--muted); }

/* KPI strip: neutral values; DPS waits for a run, then shows the change. */
.kpis > .avg { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--s3); }
.kpis small { display: block; flex-basis: 100%; white-space: nowrap; }
.kpis > div b { font: var(--w-medium) 1.35rem/var(--lh-tight) var(--num); color: var(--text); }
.kpis > .avg b { font-size: var(--fs-num-xl); color: var(--text); }
.kpis > div b.empty { font: var(--w-regular) var(--fs-md)/var(--lh-body) var(--num); color: var(--faint); }
.kpis > .avg b.empty { font: var(--w-regular) var(--fs-sm)/var(--lh-body) var(--sans); padding-top: var(--s2); }
.delta { font-size: var(--fs-sm); }
.delta.up { color: var(--up); } .delta.down { color: var(--down); }
.delta:empty { display: none; }

/* Saved teams: a plain list. Group name as a micro-label with its mode
   icon, teams as rows, the open one with an accent key line. */
.lo-group { border: 0; border-radius: 0; padding: 0; }
.lo-group header b { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); }
.lo-group header b .ico { width: 14px; height: 14px; }
.lo-group header small { color: var(--faint); }
.lo-row { gap: var(--s1); }
.lo { background: transparent; border-color: transparent; }
.lo:hover:not(:disabled) { background: var(--raised); border-color: transparent; }
.lo.on, .lo.on:hover:not(:disabled) { background: var(--accent-soft); border-color: transparent; box-shadow: inset var(--key) 0 0 var(--accent); }
.lo.slot, .lo.add { border-color: var(--line-input); border-style: dashed; }
.loadouts { gap: var(--s5); }

/* Slot cards: level 2 tiles, no element stripe. */
.members { gap: var(--gap-grid); }
.member { display: grid; gap: var(--s2); align-content: start; padding: var(--pad-card); background: var(--raised); border: var(--bw) solid var(--line); border-radius: var(--r-md); }
.member.empty { background: transparent; border-style: dashed; border-color: var(--line-input); }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: var(--ctl-h-sm); }
.member .lock { background: transparent; border-color: transparent; color: var(--muted); }
.member .lock:hover:not(:disabled) { background: var(--overlay); border-color: transparent; color: var(--text); }
.member .lock.on { color: var(--accent-text); }
.member .lock .ico { width: 18px; height: 18px; }
.member .mhead { display: flex; gap: var(--s3); align-items: center; margin: 0; min-width: 0; }
.ptile { width: 56px; height: 56px; }
.ptile .portrait { width: 48px; height: 48px; border-width: 2px; }
.member .who { display: grid; gap: var(--s0); min-width: 0; }
.member .who b { font-size: var(--fs-lg); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.member .who small { color: var(--muted); font-size: var(--fs-xs); }
.member .wep { display: flex; align-items: center; gap: var(--s2); margin: 0; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
.member .wep > span:not(.tile) { min-width: 0; overflow-wrap: anywhere; }
.member .wep small { margin-left: auto; color: var(--faint); }
.wtile { width: 32px; height: 32px; }
.wtile img { width: 28px; height: 28px; }
.member .strip { margin: 0; }
.strip-none { margin: 0; font-size: var(--fs-xs); color: var(--faint); }
.slot-edit { justify-self: start; margin-left: calc(-1 * var(--s3)); }
.member > .label { margin: 0; }

/* Builds: avatar tabs, the showcase (the one loud surface), then the editor. */
#sc-sec { scroll-margin-top: calc(var(--topbar) + var(--s4)); }
.sc-tab { min-height: var(--ctl-h); border-color: var(--line); background: transparent; color: var(--muted); }
.sc-tab .tile { width: 32px; height: 32px; border-radius: var(--r-full); }
.sc-tab .sc-face, .sc-tab img { width: 30px; height: 30px; border-radius: 50%; background: none; }
.sc-tab[aria-selected="true"] { color: var(--text); background: var(--raised); border-color: var(--line); }
.sc-tab[aria-selected="true"] .tile { box-shadow: 0 0 0 2px var(--el, var(--accent)); }
.sc { background: linear-gradient(120deg, color-mix(in oklab, var(--el, var(--accent)) 22%, var(--surface)) 0%, var(--surface) 60%); border: var(--bw) solid var(--line); }
.sc-portrait { border: 0; border-radius: var(--r-md); background: none; -webkit-mask-image: linear-gradient(to right, #000 60%, transparent); mask-image: linear-gradient(to right, #000 60%, transparent); }
.sc-wep .tile { width: 56px; height: 56px; }
.sc-wimg { width: 48px; height: 48px; background: none; }
.sc-stats li { padding: var(--s1) 0; border-bottom: var(--bw) solid var(--line); }
.sc-stats li b { color: var(--text); }
.sc-stats li.good span { color: var(--text); }
.sc-stats li.good span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 var(--s2) 0 0; vertical-align: middle; border-radius: 50%; background: var(--accent-text); }
.sc-stats li.set span { color: var(--text); }
.sc-dps b { font-size: var(--fs-num-lg); font-weight: var(--w-medium); color: var(--text); }
.sc-useful { gap: var(--s1); }
.sc-useful small { font-size: var(--fs-xs); }
.sc-side > button { justify-self: start; }
@media (min-width: 900px) {
  .sc-pieces { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sc-pieces .pc-subs { grid-template-columns: 1fr 1fr; column-gap: var(--s2); }
  .sc-pieces .pc-subs li { grid-template-columns: auto; gap: 0; }
  .sc-pieces .pc-subs .v { text-align: left; }
}
.build-box { margin-top: var(--s4); }
.build-box > summary { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: 0 var(--s4); font: var(--w-medium) var(--fs-md)/var(--lh-tight) var(--sans); background: var(--raised); border: var(--bw) solid var(--line-input); border-radius: var(--r-md); cursor: pointer; list-style: none; }
.build-box > summary::-webkit-details-marker { display: none; }
.build-box > summary:hover { border-color: var(--muted); }
.build-box[open] > summary { border-color: var(--accent); color: var(--accent-text); }
.build-form { display: grid; gap: var(--s4); margin-top: var(--s4); max-width: 820px; min-width: 0; }
.build-form > .grid, .ed-sec > .grid { margin: 0; }
.ed-split { margin: 0; color: var(--muted); }
.ed-own { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.ed-sec { display: grid; gap: var(--s2); min-width: 0; margin: 0; padding: var(--s3) 0 0; border: 0; border-top: var(--bw) solid var(--line); }
.ed-sec > legend { padding: 0 var(--s2) 0 0; }
.ed-sec .note, .build-form > .note { margin: 0; }
.ed-sec > select { max-width: 420px; }
.role-targets { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); font-size: var(--fs-sm); }
.role-adjust > summary, .ed-totals > summary { display: flex; align-items: center; min-height: var(--ctl-h-sm); color: var(--muted); font-size: var(--fs-sm); cursor: pointer; }
.role-adjust[open] > summary, .ed-totals[open] > summary { color: var(--text); }
.role-adjust .sc-extra { margin-top: var(--s2); }
.ed-totals > .grid { margin-top: var(--s2); }

/* ---- artifacts and roster, refreshed (visual-refresh.md section 4) ---- */
/* Filter chips carry their count; the card legend is a ? popover. */
.inv-n { color: var(--faint); font-size: var(--fs-xs); }
.inv-chip.on .inv-n { color: inherit; }
.inv-filters .inv-key { flex: none; }
.inv-key > summary { width: var(--ctl-h); padding: 0; justify-content: center; border-radius: var(--r-full); }
.inv-key .more-body { width: min(360px, 86vw); }
.inv-key .more-body p { margin: 0; }
/* Piece cards: no quality stripe (quality is the RV pill on the accent
   ramp), the set icon on its rarity tile, main stat big, rolls neutral. */
.pc-card { border-left-width: var(--bw); border-left-color: var(--line); }
.pc-card.on { border-left-color: var(--accent); }
.pc-img { background: linear-gradient(160deg, color-mix(in oklab, var(--rar, var(--line)) 38%, var(--raised)), var(--raised) 75%); border-radius: var(--r-md); }
.pc-main b { font: var(--w-semi) var(--fs-lg)/var(--lh-tight) var(--num); }
.pc-subs { gap: var(--s0); }
.pc-subs .dots { color: var(--muted); }
.pc-subs li.good .dots { color: var(--text); }
.pc-subs li.dim .dots { color: var(--line-input); }
/* Equip on… sits beside the card's link, in the foot's right corner. */
.pc-wrap { position: relative; display: grid; min-width: 0; }
.pc-wrap > .pc-card { height: 100%; }
.pc-wrap > .pc-card .pc-foot { padding-right: 96px; }
.pc-equip { position: absolute; right: var(--s2); bottom: var(--s2); }
.inv-worn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.inv-worn .note { margin: 0; flex: 1 1 200px; }
.ed-pieces label { text-transform: none; }

/* Roster: element once (the ring), rarity tiles, neutral badges. */
.ro-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }
.ro-tools .inv-chips { flex: 1 1 auto; }
.ro-group { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.inv-chip .ico { color: var(--muted); }
.ro-el { display: flex; align-items: center; gap: var(--s2); margin: var(--s4) 0 var(--s2); }
.ro-el .ico { width: 14px; height: 14px; }
.ro-card, .ro-card[open] { border: var(--bw) solid var(--line); border-radius: var(--r-md); }
.ro-card[open] { border-color: var(--line-input); }
.ro-card > summary:hover { background: var(--overlay); }
.ro-card .ptile { width: 52px; height: 52px; }
.ro-card .ptile .portrait { width: 44px; height: 44px; }
.ro-stats { gap: var(--s1) var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.ro-wep .wtile { width: 26px; height: 26px; }
.ro-wep .wtile img { width: 22px; height: 22px; }
.ro-who .badge { justify-self: start; }
.ro-spares { min-width: 520px; }
.ro-spares th, .ro-spares td { padding: var(--s2) var(--s3) var(--s2) 0; vertical-align: middle; }
.ro-spares thead th { font: var(--w-semi) var(--fs-2xs)/var(--lh-snug) var(--cond); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--muted); border-bottom-color: var(--line-input); }
.ro-spares tbody th { font-weight: var(--w-regular); }
.ro-spares td:last-child { width: var(--ctl-h); padding-right: 0; }
.ro-spares select, .ro-spares input { min-width: 4.5rem; }

/* ---- rotation score (score-ui.js; design round 5, Akademiya 02 and 03) ----
   Lanes come from the engine's log. Element colour marks whose lane and
   action it is, always with the character's name and portrait beside it;
   --down never appears here (it would read as Pyro), and counting-down
   cooldowns are neutral, not --warn. */
.score .rs-empty { margin: 0; }
.rs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }
.rs-bar:empty { display: none; }
.rs-runs button[aria-pressed="true"], .settings-pop .seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.rs-delta { font-size: var(--fs-sm); color: var(--muted); }
.rs-delta.up, .cmp-big.up { color: var(--up); }
.rs-delta.down, .cmp-big.down { color: var(--down); }
.rs-score { --who: 168px; }
.rs-ruler, .rs-rows { display: grid; grid-template-columns: var(--who) minmax(0, 1fr); }
.rs-ruler .label { align-self: end; padding-bottom: 4px; }
.rs-ticks { position: relative; height: 22px; border-bottom: 1px solid var(--line); }
.rs-ticks span { position: absolute; bottom: 3px; transform: translateX(-50%); font: var(--fs-2xs) var(--mono); color: var(--muted); }
.rs-who, .rs-lane { height: 60px; border-bottom: 1px solid var(--line); }
.rs-who { display: flex; align-items: center; gap: var(--s2); padding-right: var(--s2); min-width: 0; }
.rs-who > span { display: grid; min-width: 0; }
.rs-who b { font-weight: var(--w-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-who small { font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; }
.rs-scrub { position: relative; }
.rs-lane { position: relative; }
.rs-act { position: absolute; top: 8px; height: 24px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--el) 20%, var(--surface)); border: 1px solid var(--el); font: var(--fs-2xs)/22px var(--mono); color: var(--text); padding: 0 3px; overflow: hidden; white-space: nowrap; }
.rs-act.big { background: var(--el); color: var(--surface); font-weight: var(--w-semi); }
.rs-cd { position: absolute; height: 6px; border-radius: 1px; }
.rs-cd.e { top: 38px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--el) 55%, transparent) 0 3px, transparent 3px 6px); }
.rs-cd.q { top: 47px; background: color-mix(in srgb, var(--el) 40%, transparent); }
.rs-swap { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line-input); pointer-events: none; }
.rs-ph { position: absolute; top: -2px; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; z-index: 2; }
.rs-ph::before { content: attr(data-t); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font: var(--w-semi) var(--fs-2xs)/1.4 var(--mono); color: var(--accent-ink); background: var(--accent); padding: 0 5px; border-radius: var(--r-sm); white-space: nowrap; }
.rs-hit { position: absolute; inset: 0; cursor: ew-resize; z-index: 3; touch-action: none; }
.rs-below { display: grid; gap: var(--s5); margin-top: var(--s4); }
@media (min-width: 1024px) { .rs-below { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.rs-below h3 { margin: 0 0 var(--s2); }
.rs-now { font: var(--w-semi) 1.375rem/1.2 var(--mono); }
.rs-field { margin: var(--s1) 0 0; }
.rs-cds { width: 100%; border-collapse: collapse; margin-top: var(--s3); font-size: var(--fs-sm); }
.rs-cds th { font: var(--w-semi) var(--fs-2xs) var(--cond); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px 8px 4px 0; }
.rs-cds td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line); }
.rs-cds .r { text-align: right; }
.rs-ready { color: var(--text); font-weight: var(--w-medium); }
.rs-wait { color: var(--muted); }
.rs-text pre { margin: 0; font: var(--fs-sm)/1.7 var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s2) var(--s3); white-space: pre-wrap; overflow-wrap: anywhere; }
.rs-text .ln { display: block; padding: 0 6px; border-radius: 3px; }
.rs-text .ln.on { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.rs-steps, .rs-dock { display: none; }

/* compare with the run before (round 5's 03) */
.cmp-sum { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3) var(--s6); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.cmp-big { display: block; font: var(--w-semi) 2.5rem/1.1 var(--mono); letter-spacing: -0.02em; margin-top: var(--s1); }
.cmp-pair { color: var(--muted); margin-top: var(--s1); }
.cmp-facts { display: flex; gap: var(--s5); }
.cmp-facts b { display: block; font: var(--w-semi) 1.125rem var(--mono); }
.cmp-diff { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; font: var(--fs-sm)/1.6 var(--mono); }
.cmp-diff .row { display: contents; }
.cmp-diff .h { padding: 6px var(--s3); background: var(--surface); border-bottom: 1px solid var(--line); font: var(--w-semi) var(--fs-2xs) var(--cond); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.cmp-diff .c { position: relative; padding: 3px var(--s3) 3px 34px; min-height: 28px; white-space: pre-wrap; word-break: break-word; }
.cmp-diff .h + .h, .cmp-diff .c + .c { border-left: 1px solid var(--line); }
.cmp-diff .c::before { content: attr(data-n); position: absolute; left: 8px; color: var(--muted); font-size: var(--fs-2xs); top: 5px; }
.cmp-diff .c.del, .cmp-diff .c.add { font-weight: var(--w-medium); }
.cmp-diff .c.del { color: var(--muted); }
.cmp-diff .c.add { background: color-mix(in srgb, var(--up) 9%, transparent); }
.cmp-diff .c.del::after, .cmp-diff .c.add::after { position: absolute; left: 22px; top: 3px; font-weight: var(--w-semi); }
.cmp-diff .c.del::after { content: "−"; color: var(--muted); }
.cmp-diff .c.add::after { content: "+"; color: var(--up); }
.cmp-diff mark { color: inherit; border-radius: 2px; padding: 0 2px; }
.cmp-diff .del mark { background: color-mix(in srgb, var(--muted) 20%, transparent); text-decoration: line-through; }
.cmp-diff .add mark { background: color-mix(in srgb, var(--up) 24%, transparent); color: var(--text); }
.cmp-env { display: grid; grid-template-columns: minmax(120px, auto) 1fr 1fr; margin-top: var(--s4); font-size: var(--fs-sm); }
.cmp-env > div { padding: 6px var(--s2) 6px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.cmp-env .k { color: var(--muted); }
.cmp-env .chg { color: var(--warn); font-weight: var(--w-semi); }
.cmp-foot { margin-top: var(--s4); }

/* Phone: 02's own view. The lanes give way to a timed step list, and a
   docked bar holds a 44 px slider (and Use, when viewing the run before).
   No text under 16 px. */
@media (max-width: 719.98px) {
  .score, .score .label, .score .hint, .score .note, .score small, .score button, .rs-delta { font-size: var(--fs-base); }
  .score .panel-head .seg { grid-column: 1; grid-row: auto; }
  .rs-score, .rs-text { display: none; }
  .rs-steps { display: block; list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; border-top: 1px solid var(--line); }
  .rs-steps li { border-bottom: 1px solid var(--line); }
  .rs-step button { display: grid; grid-template-columns: 64px 30px minmax(0, 1fr) auto; align-items: center; gap: var(--s2); width: 100%; min-height: 48px; padding: 0 var(--s2); border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; font-size: var(--fs-base); }
  .rs-step .num { color: var(--muted); }
  .rs-step .rs-a { color: var(--text); }
  .rs-step.on button { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  .rs-swapl { padding: 2px var(--s2) 2px 72px; color: var(--muted); }
  .rs-below { margin-top: var(--s3); }
  .rs-cds, .rs-cds th, .rs-now { font-size: var(--fs-base); }
  .rs-dock { display: block; position: sticky; bottom: 64px; z-index: 5; margin: var(--s3) calc(-1 * var(--pad-panel)) 0; padding: var(--s2) var(--s4) var(--s3); background: var(--surface); border-top: 1px solid var(--line); }
  .rs-dock-row { display: flex; justify-content: space-between; }
  .rs-dock input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; padding: 0; border: 0; box-shadow: none; background: transparent; touch-action: none; }
  .rs-dock input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line-input); }
  .rs-dock input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-input); }
  .rs-dock input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
  .rs-dock input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
  .rs-dock button { width: 100%; min-height: 48px; }
  .rs-bar .rs-use { display: none; }
  .rs-runs { width: 100%; } .rs-runs button { flex: 1; }
  .cmp-big { font-size: 2.25rem; }
  .cmp-diff { grid-template-columns: minmax(0, 1fr); font-size: var(--fs-base); }
  .cmp-diff .h { display: none; }
  .cmp-diff .c + .c { border-left: 0; }
  .cmp-diff .row.same .c + .c, .cmp-diff .c.none { display: none; }
  .cmp-diff .c::before { font-size: var(--fs-base); top: 3px; }
  .cmp-env { grid-template-columns: minmax(0, 1.1fr) 1fr 1fr; font-size: var(--fs-base); }
  .cmp-foot button { width: 100%; }
}

/* ---- settings: palette and theme ---- */
.settings > summary { display: inline-grid; place-items: center; width: var(--ctl-h); min-height: var(--ctl-h); border-radius: var(--r-md); color: var(--text); }
.settings > summary:hover { background: var(--raised); }
.settings > summary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.settings-pop { width: min(340px, calc(100vw - 24px)); gap: var(--s3); padding: var(--s3); }
.settings-pop fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.settings-pop legend { margin-bottom: var(--s1); }
.settings-pop .note { margin: 0; }
.palette-list { display: grid; gap: 2px; }
.pal-opt { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: var(--s2); padding: 6px var(--s1); border-radius: var(--r-md); cursor: pointer; }
.pal-opt:hover { background: var(--raised); }
.pal-opt:has(input:checked) { box-shadow: inset 3px 0 0 var(--accent); }
.pal-opt b { display: block; font-weight: var(--w-medium); }
.pal-opt small { color: var(--muted); font-size: var(--fs-xs); }
.pal-sw { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line-strong); }
.pal-sw i { width: 10px; height: 18px; border-radius: 2px; }
.settings-pop .seg { width: 100%; }
.settings-pop .seg button { flex: 1; }
@media (max-width: 719.98px) { .pal-opt small, .settings-pop .note { font-size: var(--fs-sm); } }

/* ---- job dock (jobdock.js; design round 5, Akademiya 04) ----
   While a rotation search runs, the job line opens into the job. Stop is
   its one primary; the plain Stop on the job line hides meanwhile. */
.jobbar:has(.jobdock:not([hidden])) #stop { display: none; }
.jobdock { flex-basis: 100%; padding: var(--s2) 0 var(--s3); }
.jd-head { display: flex; align-items: flex-end; gap: var(--s3); }
.jd-head > div { flex: 1; min-width: 0; }
.jd-head h2 { margin: 0; font-size: var(--fs-lg); }
.jd-head .eyebrow { margin: 0; }
.jd-body { display: grid; gap: var(--s3); margin-top: var(--s3); }
.jobdock.collapsed .jd-body { display: none; }
.jobdock.collapsed { padding: var(--s1) 0; }
.jobdock.collapsed .jd-head h2 { font-size: var(--fs-base); }
.jd-meters { display: grid; grid-template-columns: 1.4fr 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.jd-meters > div { display: grid; padding: var(--s2) var(--s3) var(--s2) 0; min-width: 0; }
.jd-meters > div + div { padding-left: var(--s3); border-left: 1px solid var(--line); }
.jd-meters b { font: var(--w-semi) 1.5rem/1.2 var(--mono); }
.jd-best b { font-size: var(--fs-num-xl); }
.jd-meters small { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.jd-track { position: relative; height: 24px; margin-top: var(--s1); background: var(--bg); border: 1px solid var(--line-input); border-radius: var(--r-md); overflow: hidden; }
.jd-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); border-right: 2px solid var(--accent); }
.jd-ticks i { position: absolute; top: 3px; bottom: 3px; width: 2px; background: var(--text); }
.jd-kept { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-sm); }
.jd-kept li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: var(--s3); align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); }
.jd-kept li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jd-ring { display: none; }
@media (min-width: 1024px) { .jd-body { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } .jd-bar { grid-column: 1; } .jd-kept { grid-column: 2; grid-row: 1 / span 2; align-self: start; } }
/* Phone: the dock scrolls with the page, a ring shows the time left, and
   Stop sits docked above the bottom bar. */
@media (max-width: 719.98px) {
  .jobbar:has(.jobdock:not([hidden])) { position: static; }
  .jobdock, .jobdock .label, .jd-meters small, .jd-kept, .jobdock .eyebrow, .jobdock button { font-size: var(--fs-base); }
  .jd-head { flex-wrap: wrap; }
  .jd-stop { position: fixed; left: var(--s4); right: var(--s4); bottom: 76px; z-index: 25; min-height: 48px; }
  .jd-ring { display: grid; place-items: center; position: relative; width: 200px; height: 200px; margin: 0 auto; }
  .jd-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
  .jd-ring circle { fill: none; stroke-width: 9; }
  .jd-ring .jd-bg { stroke: var(--line); }
  .jd-ring .jd-arc { stroke: var(--accent); stroke-linecap: round; }
  .jd-ring div { text-align: center; display: grid; }
  .jd-ring b { font: var(--w-semi) 2.25rem/1 var(--mono); }
  .jd-ring span { color: var(--muted); }
  .jd-meters { grid-template-columns: 1fr 1fr; }
  .jd-meters .jd-best { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .jd-meters .jd-fights { border-left: 0; padding-left: 0; }
  .jd-bar { display: none; }
  .jobdock:not([hidden]) { padding-bottom: 72px; }
  .jobdock.collapsed { padding-bottom: var(--s1); }
}
