:root {
  --bg: #101318;
  --panel: #171c24;
  --card: #1d232e;
  --line: #2a3240;
  --text: #dde3ec;
  --dim: #8a93a6;
  --accent: #4dabf7;
  --amber: #f0b429;
  --green: #2fbf71;
  --red: #e5484d;
  --violet: #b39ddb;   /* marked-coat chip: distinct from status colours */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  display: flex; flex-direction: column;
}

header {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 17px; margin: 0; font-weight: 600; }
#status-line { color: var(--dim); font-size: 13px; margin-inline-start: auto; }

.tab {
  background: none; border: 1px solid var(--line); color: var(--dim);
  padding: 5px 16px; border-radius: 8px; cursor: pointer; font: inherit;
}
.tab.active { color: var(--text); border-color: var(--accent); background: #1a2432; }

/* ---- who is signed in (header) ---- */
#whoami { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#who-name { color: var(--text); }
/* A person may hold several roles at once, so the header carries a set, not
   a single chip. Wraps rather than pushing the tab bar sideways. */
.role-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.role-chip {
  font-size: 11px; padding: 1px 8px; border-radius: 8px; white-space: nowrap;
  color: var(--accent); background: rgba(77, 171, 247, .12);
  border: 1px solid rgba(77, 171, 247, .45);
}
.role-chip.admin {
  color: var(--amber); background: rgba(240, 180, 41, .12);
  border-color: rgba(240, 180, 41, .5);
}
.who-out {
  font: inherit; font-size: 12px; cursor: pointer; color: var(--dim);
  background: none; border: 1px solid var(--line); border-radius: 7px;
  padding: 2px 10px;
}
.who-out:hover { color: var(--text); border-color: var(--red); }

/* ---- login gate ----
   Full-screen and opaque: while it is up boot() has not run, so there is
   nothing behind it to leak. */
#login-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
#login-form {
  width: 320px; max-width: 100%;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px 20px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
}
#login-form h2 { margin: 0; font-size: 17px; font-weight: 600; }
#login-form .login-sub { margin: 0 0 10px; font-size: 12px; color: var(--dim); }
#login-form label { font-size: 12px; color: var(--dim); margin-top: 6px; }
#login-form input {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px;
}
#login-form input:focus { outline: none; border-color: var(--accent); }
#login-form button {
  font: inherit; font-size: 14px; cursor: pointer; margin-top: 14px;
  color: var(--text); background: #1d2c40;
  border: 1px solid var(--accent); border-radius: 9px; padding: 8px 12px;
}
#login-form button[disabled] { opacity: .55; cursor: default; }
.login-error { margin: 10px 0 0; font-size: 12px; color: var(--red); }

main { flex: 1; min-height: 0; display: flex; }
main > section { flex: 1; min-width: 0; }

/* ---- words view: rail (phys. left) | main | avatar (phys. right) ---- */
#view-words { display: grid; grid-template-columns: 270px 1fr 360px; direction: ltr; }
#view-words > * { direction: rtl; min-height: 0; overflow-y: auto; }

#rail { grid-column: 1; background: var(--panel); border-inline: 1px solid var(--line); padding: 8px 0 24px; }
#word-main { grid-column: 2; padding: 16px; }
#avatar-panel { grid-column: 3; background: var(--panel); border-inline: 1px solid var(--line); padding: 12px; }

/* sticky so the search stays reachable after scrolling into list BP —
   #rail is the scroll container (#view-words > * is overflow-y:auto) */
.rail-head {
  position: sticky; top: 0; z-index: 2; background: var(--panel);
  padding: 6px 12px 8px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.rail-search {
  width: 100%; box-sizing: border-box; padding: 6px 10px; font: inherit;
  font-size: 13px; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px;
}
.rail-search:focus { outline: none; border-color: var(--accent); }
.rail-count { font-size: 11px; color: var(--dim); }

#rail h2 {
  font-size: 13px; color: var(--accent); margin: 14px 12px 4px;
  text-transform: none; letter-spacing: 0;
}
#rail h3 { font-size: 12px; color: var(--dim); margin: 10px 14px 2px; font-weight: 600; }
.word-item {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 14px; cursor: pointer; border-inline-start: 3px solid transparent;
}
.word-item:hover { background: #202836; }
.word-item.sel { background: #1d2c40; border-inline-start-color: var(--accent); }
.word-item .num { color: var(--dim); font-size: 12px; min-width: 20px; }
.word-item .count {
  margin-inline-start: auto; font-size: 12px; color: var(--dim);
  background: var(--card); border-radius: 10px; padding: 0 8px; min-width: 22px; text-align: center;
}
.word-item .count.some { color: var(--amber); }
.word-item .count.done { color: var(--green); }

.empty { color: var(--dim); padding: 40px; text-align: center; }

#word-main h2 { margin: 0 0 12px; font-size: 22px; }
#word-main h2 small { color: var(--dim); font-size: 13px; font-weight: 400; }

.players { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }

/* ---- player card ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; width: 340px; max-width: 100%;
}
.card.status-suggested { border-color: var(--amber); }
.card.status-verified { border-color: var(--green); }
.card.status-discard { border-color: var(--red); opacity: .65; }

.vidbox { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.vidbox video { display: block; width: 100%; height: auto; }
.vidbox canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.vidbox .badge-soft { position: absolute; top: 6px; inset-inline-start: 6px; }
.badge-soft {
  background: rgba(20, 24, 32, .8); color: var(--dim); font-size: 11px;
  padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line);
}

.card .meta-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 2px;
  font-size: 12px; color: var(--dim);
}
.card .meta-row .cid { font-family: monospace; color: var(--text); }
.card .meta-row button { margin-inline-start: auto; }

.status-pill { font-size: 11px; padding: 0 8px; border-radius: 8px; }
.status-pill.suggested { color: #000; background: var(--amber); }
.status-pill.verified { color: #000; background: var(--green); }
.status-pill.discard { color: #fff; background: var(--red); }
.status-pill.unassigned { color: var(--dim); background: var(--panel); border: 1px solid var(--line); }

/* ---- repetition timeline ---- */
.tl { margin-top: 6px; }
.tl-canvas {
  display: block; width: 100%; height: 56px; direction: ltr;
  background: #12161d; border: 1px solid var(--line); border-radius: 8px;
  cursor: crosshair;
}
.tl-controls { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 5px; }
.tl-controls button {
  font: inherit; font-size: 12px; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px;
}
.tl-controls .rep { min-width: 26px; padding: 2px 4px; text-align: center; }
.tl-controls .rep.on { border-color: var(--accent); background: #1d2c40; }
.tl-controls .tl-save.dirty { border-color: var(--amber); color: var(--amber); }
.tl-gap { width: 4px; }

/* ---- audio lane ---- */
.tl-canvas.has-audio { height: 78px; }
/* finger-curl lane adds a third strip under the audio lane */
.tl-canvas.has-curl { height: 74px; }
.tl-canvas.has-audio.has-curl { height: 96px; }
.tl-legend {
  display: flex; flex-wrap: wrap; gap: 12px; font-size: 10px; color: var(--dim);
  margin: 2px 4px 0; line-height: 1.3;
}
.tl-legend .lg-grp { display: inline-flex; gap: 10px; }
.tl-legend .lg-hit { color: #22d3ee; }
.tl-legend .lg-voice { color: #a78bfa; }
.tl-legend .lg-cr { color: #ffb74d; }
.tl-legend .lg-cl { color: #4dd0e1; }
.tl-controls .snap { color: var(--dim); border-style: dashed; }
.tl-controls .snap.on {
  color: #22d3ee; border-style: solid;
  border-color: rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .08);
}

/* ---- toasts ---- */
#toast-holder {
  position: fixed; bottom: 16px; inset-inline-start: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 6px;
}
.toast {
  background: var(--card); border: 1px solid var(--amber); border-radius: 9px;
  padding: 8px 14px; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
.toast.ok { border-color: var(--green); }
.toast.warn { border-color: var(--red); }

/* ---- confirm processing badge (motion extraction jobs in flight) ---- */
.proc-badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; padding: 0 8px; border-radius: 8px;
  color: var(--accent); background: rgba(77, 171, 247, .12);
  border: 1px solid rgba(77, 171, 247, .5);
}
.proc-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent); animation: proc-pulse 1s ease-in-out infinite;
}
.proc-badge.done {
  color: var(--green); background: rgba(47, 191, 113, .12);
  border-color: rgba(47, 191, 113, .5);
}
.proc-badge.done::before { background: var(--green); animation: none; }
@keyframes proc-pulse {
  0%, 100% { opacity: .25; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1); }
}

/* auto-expanded boundaries: the sign was cut from a wider rest→rest span */
.exp-wrap:empty { display: none; }
.exp-chip {
  display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; padding: 0 8px; border-radius: 8px; cursor: help;
  color: var(--amber); background: rgba(240, 180, 41, .12);
  border: 1px solid rgba(240, 180, 41, .5);
}

/* boundary nudge: confirm without segments highlights the timeline */
.tl-canvas.flash { animation: tl-flash .8s ease-in-out 3; }
@keyframes tl-flash {
  0%, 100% { border-color: var(--line); box-shadow: none; }
  50% { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(240, 180, 41, .35); }
}

/* ---- editor ---- */
.editor { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.editor .row { display: flex; gap: 6px; align-items: center; }
.editor label { font-size: 12px; color: var(--dim); min-width: 42px; }
.editor input, .editor select, .editor button {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 8px;
}
.editor input { flex: 1; min-width: 0; }
.editor select { flex: 1; min-width: 0; }
.editor button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.editor .btn-verify { color: var(--green); border-color: #23503a; }
.editor .btn-verify:hover, .editor .btn-verify.on { background: #143526; border-color: var(--green); }
.editor .btn-discard { color: var(--red); border-color: #57272b; }
.editor .btn-discard:hover, .editor .btn-discard.on { background: #3a1a1d; border-color: var(--red); }

/* ---- avatar panel ---- */
#avatar-panel h2 { font-size: 15px; margin: 4px 4px 10px; }
#avatar-mount { min-height: 260px; border-radius: 10px; background: var(--card); }
#avatar-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
#avatar-buttons button {
  font: inherit; font-size: 14px; text-align: start; cursor: pointer;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px;
}
#avatar-buttons button small { color: var(--dim); }
#avatar-buttons .hint { color: var(--dim); font-size: 12px; }
#skel-slot:empty { display: none; }
#skel-slot { display: flex; flex-direction: column; gap: 8px; }
/* skeleton-direct = the primary captured playback (i14) */
#avatar-buttons button.btn-skel {
  border-color: var(--accent); background: #1a2836;
}
.skel-chip {
  display: block; margin-top: 3px; font-size: 11px; color: var(--dim);
}

/* ---- measured yaw badge ---- */
.yaw-badge {
  font-size: 11px; padding: 0 7px; border-radius: 8px; white-space: nowrap;
  color: var(--amber); background: rgba(240, 180, 41, .12);
  border: 1px solid rgba(240, 180, 41, .45);
}
.yaw-badge.front {
  color: var(--green); background: rgba(47, 191, 113, .12);
  border-color: rgba(47, 191, 113, .45);
}
.clip-cell .yaw-badge { font-size: 10px; }

/* ---- garment: is this footage the marked capture coat? ----
   Only the MARKED case is chipped — un-coated is the corpus default, and a
   chip on every session-1/2 clip would be noise. Tooltip = the marker layout
   (colour -> limb), served from isigncapture/garment.py. */
.garment-chip {
  font-size: 11px; padding: 0 7px; border-radius: 8px; white-space: nowrap;
  cursor: help; color: var(--violet); background: rgba(179, 157, 219, .14);
  border: 1px solid rgba(179, 157, 219, .5);
}
.clip-cell .garment-chip { font-size: 10px; }

/* session x garment filter bar (built by app.js, not index.html) */
.clip-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.clip-filters button {
  font: inherit; font-size: 12px; padding: 2px 10px; cursor: pointer;
  color: var(--dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; white-space: nowrap;
}
.clip-filters button.marked {
  color: var(--violet); border-color: rgba(179, 157, 219, .45);
}
.clip-filters button.on { color: var(--text); border-color: var(--accent); background: #1d2c40; }

/* ---- versions: running app (header) + age of a word's avatar data ----
   Discreet by design: this is a working tool. Amber only when the data on
   screen was generated by an older pipeline than the one now running. */
.ver-chip {
  font-size: 11px; color: var(--dim); cursor: help; white-space: nowrap;
  direction: ltr; unicode-bidi: isolate;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px;
}
.ver-chip:hover { color: var(--text); border-color: var(--accent); }

.ver-slot:empty { display: none; }
.data-ver {
  display: inline-block; font-size: 11px; font-weight: 400; padding: 0 8px;
  border-radius: 8px; white-space: nowrap; cursor: help; vertical-align: 2px;
  color: var(--dim); background: var(--card); border: 1px solid var(--line);
}
.data-ver.stale {
  color: var(--amber); background: rgba(240, 180, 41, .12);
  border-color: rgba(240, 180, 41, .55);
}
.data-ver.current {
  color: var(--green); background: rgba(47, 191, 113, .10);
  border-color: rgba(47, 191, 113, .35);
}
.data-ver.ahead {
  color: var(--accent); background: rgba(77, 171, 247, .12);
  border-color: rgba(77, 171, 247, .45);
}
/* a skeleton built from a preview-grade fusion: shown, but never mistaken
   for reviewed work — deliberately quieter than .stale, which is a fault */
.data-ver.preview {
  color: var(--dim); background: var(--card);
  border-style: dashed; border-color: var(--line);
}

/* ---- 3D fusion panel ---- */
.grade-chip {
  font-size: 11px; font-weight: 400; padding: 0 8px; border-radius: 8px;
  white-space: nowrap; vertical-align: 2px;
  color: var(--dim); background: var(--card); border: 1px solid var(--line);
}
.grade-chip.confirmed {
  color: var(--green); background: rgba(47, 191, 113, .12);
  border-color: rgba(47, 191, 113, .5);
}
#fusion-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
#fusion-panel h2 { font-size: 15px; margin: 0 4px 8px; }
#fusion-panel h2 small { color: var(--dim); font-weight: 400; }
#fusion-panel .dim { color: var(--dim); }
#fusion-panel .hint { color: var(--dim); font-size: 12px; }
.fusion-takes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.take-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 2px 8px;
}
.take-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.take-chip .cid { font-family: monospace; }
.skel-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  font-size: 11px; margin: 6px 0;
}
.skel-line .skel-bad { color: var(--amber); }
.fusion-reps { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-bottom: 6px; }
.fusion-reps button {
  font: inherit; font-size: 12px; min-width: 26px; padding: 2px 4px; text-align: center;
  color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.fusion-reps button.on { border-color: var(--accent); background: #1d2c40; }
.fusion-agree { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; margin-bottom: 6px; }
.fusion-agree .agv b { color: var(--text); font-weight: 600; }
.fusion-agree .agv.worst b { color: var(--amber); }
.fusion-canvas {
  display: block; width: 100%; height: 190px; direction: ltr;
  background: #12161d; border: 1px solid var(--line); border-radius: 8px;
}
.fusion-legend { color: var(--dim); font-size: 11px; margin-top: 4px; text-align: center; }

/* ---- clips tab ---- */
#view-clips { padding: 14px 18px; overflow-y: auto; }
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.toolbar button {
  font: inherit; cursor: pointer; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 14px;
}
#clips-summary { color: var(--dim); font-size: 13px; }

#clips-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.clip-cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; cursor: pointer; border-top: 3px solid var(--line);
}
.clip-cell.status-suggested { border-top-color: var(--amber); }
.clip-cell.status-verified { border-top-color: var(--green); }
.clip-cell.status-discard { border-top-color: var(--red); opacity: .6; }
.clip-cell:hover { border-color: var(--accent); }
.clip-cell img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; }
.clip-cell .info { padding: 5px 8px; font-size: 12px; }
.clip-cell .info .cid { font-family: monospace; }
.clip-cell .info .sub { display: flex; justify-content: space-between; color: var(--dim); }
.clip-cell .word-tag { color: var(--amber); }
.clip-cell.status-verified .word-tag { color: var(--green); }

#clip-detail { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }

/* ---- context variants (one word, several signs) ---- */
#word-main .ctx-head {
  font-size: 14px; font-weight: 600; color: var(--accent);
  margin: 18px 2px 8px; padding-inline-start: 8px;
  border-inline-start: 3px solid var(--accent);
}
#word-main .ctx-head:first-of-type { margin-top: 4px; }
.clip-cell .ctx-sub { color: var(--dim); font-size: 11px; }
.fusion-variants { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.fusion-variants button {
  font: inherit; font-size: 12px; padding: 2px 10px; cursor: pointer;
  color: var(--dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px;
}
.fusion-variants button.on { color: var(--text); border-color: var(--accent); background: #1d2c40; }


/* ---------------------------------------------------------------- branding
   Product footer. Deliberately quiet: this is a working tool people stare at
   for hours, and ownership does not need to compete with the review panel. */
.app-foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 28px; padding: 10px 16px 18px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--dim);
}
.app-foot strong { color: var(--dim); font-weight: 600; }

/* fast labeling — add a word that is not in any list, from the clip */
.btn-newword { white-space: nowrap; background: #1a7f5a; color: #fff;
  border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.btn-newword:hover { filter: brightness(1.1); }

/* الإنبوكس — minimal inbox uploader */
.inbox-drop { border: 2px dashed var(--line, #8884); border-radius: 10px;
  padding: 36px; text-align: center; margin: 18px auto; max-width: 640px; }
.inbox-drop.hot { border-color: #1a7f5a; background: rgba(26,127,90,.06); }
.inbox-pick { display: inline-block; background: #1a7f5a; color: #fff;
  border-radius: 6px; padding: 6px 16px; cursor: pointer; }
.inbox-note { text-align: center; color: var(--dim); }
.inbox-row { display: grid; grid-template-columns: 1fr auto 160px auto;
  gap: 10px; align-items: center; max-width: 760px; margin: 4px auto;
  padding: 6px 10px; border-bottom: 1px solid #8882; font-size: 14px; }
.inbox-row.done { opacity: .65; }
.inbox-row.err .inbox-state { color: #b3382e; }
.inbox-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-size { color: var(--dim); }

/* ---- mapping evidence: how did this clip get its word? ---- */
.evidence {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
}
.ev-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--dim);
}
.ev-tag {
  font-size: 11px; padding: 1px 8px; border-radius: 8px;
  border: 1px solid var(--line); white-space: nowrap;
}
.ev-tag.screen { color: var(--accent); border-color: rgba(77, 171, 247, .5); }
.ev-tag.voice  { color: var(--green);  border-color: rgba(47, 191, 113, .45); }
.ev-read { color: var(--text); }
.ev-conf { font-variant-numeric: tabular-nums; }
/* the crop a reviewer checks the OCR against — small enough to sit in a card,
   large enough that the two lines of text are readable without opening it */
.ev-shot {
  max-width: 260px; width: 100%; border-radius: 6px;
  border: 1px solid var(--line); align-self: flex-start;
}

/* ---- rail: sort toggle ---- */
.rail-headrow { display: flex; align-items: center; gap: 8px; }
.rail-sort {
  margin-inline-start: auto; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--dim); background: var(--card);
  border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px;
  white-space: nowrap;
}
.rail-sort:hover { color: var(--text); border-color: var(--accent); }

/* ---- collapsible side panels ----
   The middle column does the work; these two asides cost it 630px on a
   laptop. Collapsing is a grid-template change so the CSS keeps ownership of
   layout, and the handles stay reachable while collapsed. */
.panel-edge {
  position: absolute; z-index: 3; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: 12px; line-height: 1; cursor: pointer;
  color: var(--dim); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 3px;
}
.panel-edge:hover { color: var(--text); border-color: var(--accent); }
#view-words { position: relative; }
#rail-toggle { inset-inline-start: 0; }
#avatar-toggle { inset-inline-end: 0; }
#view-words.rail-collapsed { grid-template-columns: 0 1fr 360px; }
#view-words.avatar-collapsed { grid-template-columns: 270px 1fr 0; }
#view-words.rail-collapsed.avatar-collapsed { grid-template-columns: 0 1fr 0; }
#view-words.rail-collapsed #rail,
#view-words.avatar-collapsed #avatar-panel {
  padding: 0; border: 0; overflow: hidden;
}

/* ---- fullscreen ---- */
.panel-btn {
  font: inherit; font-size: 12px; cursor: pointer; margin-inline-start: 6px;
  color: var(--dim); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 7px;
}
.panel-btn:hover { color: var(--text); border-color: var(--accent); }
/* the browser paints its own black behind a fullscreen element; without an
   explicit background the panel's own colour is lost and the UI reads broken */
#avatar-panel:fullscreen, #view-skel3d:fullscreen {
  background: var(--bg); padding: 16px; overflow: auto;
}
#avatar-panel:fullscreen #avatar-mount { min-height: 70vh; }

/* ---- clip filters: review state, then session ------------------------------
   Two rows because they answer different questions — "what is left to do"
   and "which day" — and a single wrapping row of twenty buttons reads as one
   undifferentiated list. */
.clip-filters { display: flex; flex-direction: column; gap: 6px; }
.clip-filters .filter-row { display: flex; flex-wrap: wrap; gap: 6px; }

.clip-filters button.state {
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 600;
}
/* بلا كلمة is the only queue a machine cannot clear, so it is the one button
   that looks different. 676 clips sat in it unnoticed while every filter on
   this bar looked identical. */
.clip-filters button.state.need {
  border-color: var(--amber);
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 16%, var(--panel));
}
.clip-filters button.state.need.on {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--panel);
}

/* ---- the naming queue ------------------------------------------------------ */
.queue-row { align-items: center; }
.queue-row .queue-left {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  margin-inline-end: 8px;
}
.queue-row .btn-next { font-weight: 600; }
.queue-row .btn-next:disabled { opacity: .5; cursor: default; }

/* both filter rows behave the same way — that consistency was the complaint */
/* every session is visible; the strip scrolls instead of shoving the grid
   down the page. Small badges, not few badges. */
.clip-filters .filter-row.sessions {
  max-height: 5.6em;
  overflow-y: auto;
  padding-bottom: 2px;
}
.clip-filters .filter-row.sessions button {
  padding: 2px 8px;
  font-size: .85em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.clip-cell .tag-sess {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  background: var(--panel);
  border-radius: 3px;
  padding: 0 4px;
}

/* ---- what the typed word resolves to, before anything is saved -------------
   The server already folds spellings and finds the existing entry; the
   reviewer simply could not see it happen and had to press the button and
   read the message afterwards. */
.word-echo { margin: 4px 0 0 0; font-size: .9em; min-height: 1.2em; }
.word-echo.hit { color: var(--green); }
.word-echo.new { color: var(--amber); }
.word-echo .chk { font-weight: 700; margin-inline-end: 6px; }
.word-echo b { margin-inline-end: 6px; }
.word-echo .key {
  background: color-mix(in srgb, var(--green) 20%, var(--panel)); color: var(--green); border-radius: 3px;
  padding: 0 5px; font-variant-numeric: tabular-nums; margin-inline-end: 8px;
}
.word-echo .why { color: var(--dim); }
.word-echo .more { color: var(--dim); margin-inline-start: 8px; }
