/* Subtwine styles — the sentence list beside the player: its head (the
   display switch while watching, the three compare states while learning),
   the count and its tools, the search field, the subtitle-job state, the
   sentence rows and the two empty states.
   Loaded from index.html in the order web_manifest.py declares. */
.sentence-panel {
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  position:sticky;
  top:calc(var(--appbar-h) + 12px);
  height:calc(100vh - var(--appbar-h) - 96px);
  min-height:420px;
  overflow:hidden;
}
.panel-head {
  flex:none;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-bottom:1px solid var(--line-soft);
}
.panel-head .seg {
  flex:1 1 auto;
}
.panel-sub {
  flex:none;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:6px 12px 6px 14px;
  border-bottom:1px solid var(--line-soft);
  min-width:0;
}
.panel-count {
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  font-size:12px;
  color:var(--faint);
  font-variant-numeric:tabular-nums;
}
.panel-actions {
  margin-inline-start:auto;
  flex:none;
  display:flex;
  align-items:center;
  gap:4px;
}
.star-filter {
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-height:26px;
  padding:0 8px;
  border-radius:7px;
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
}
.star-filter:hover {
  background:var(--hover);
  color:var(--ink);
}
.star-filter[aria-pressed=true] {
  background:color-mix(in srgb,var(--star) 16%,transparent);
  color:var(--ink);
}
.star-filter[aria-pressed=true] svg {
  color:var(--star);
}
/* The three compare states of the learn step. They are drawn as one segmented
   control and take the whole line, so the head fits the panel at any width
   in any language. */
.compare-state {
  flex:1 0 100%;
  display:flex;
  gap:2px;
  padding:2px;
  border-radius:7px;
  background:var(--surface-2);
}
.compare-state button {
  flex:1;
  min-width:0;
  height:26px;
  padding:0 9px;
  border-radius:5px;
  font-size:12px;
  font-weight:500;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.compare-state button:hover {
  color:var(--ink);
}
.compare-state button[aria-pressed=true] {
  background:var(--seg-on);
  color:var(--ink);
  box-shadow:var(--seg-shadow);
}

.search-field {
  flex:none;
  display:flex;
  align-items:center;
  gap:8px;
  margin:8px 12px 4px;
  height:32px;
  padding:0 10px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--faint);
}
/* The field draws the one border; the input inside has none of its own (the
   base rule for inputs is more specific than a class, hence the id). */
#search-field input,
#search-field input:focus {
  flex:1;
  min-width:0;
  height:100%;
  border:0;
  border-radius:0;
  padding:0;
  background:none;
  box-shadow:none;
  font-size:12.5px;
}
.search-field:focus-within {
  border-color:var(--accent);
}

/* The line that stands where a row's star would be, for a material recognised
   before learning sentences existed. It is an aside, not an error, so it is as
   quiet as the count in the head, and it wraps rather than pushing the panel
   sideways at its narrowest. */
.panel-note {
  flex:none;
  margin:8px 12px 2px;
  padding:6px 10px;
  border-radius:8px;
  background:var(--line-soft);
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
  overflow-wrap:anywhere;
}

/* ---- the subtitle job ---- */
.pipeline {
  flex:none;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background:var(--accent-soft);
  color:var(--accent-ink);
  font-size:11px;
}
.pipeline .btn {
  white-space:nowrap;
}
.pipeline.error {
  background:var(--diff-bg);
  color:var(--fail);
}
.pipeline.busy #job-message:before {
  content:'◌';
  display:inline-block;
  margin-right:7px;
  animation:spin 2s linear infinite;
}
/* T003: the state column is never narrower than a configuration name such as
   ECHO_ALLOW_PAID_CALLS=1 (a nowrap .config-token), so the buttons wrap onto
   the next row instead; every other word may still break anywhere, so a long
   path or address cannot widen the bar. */
.pipeline-state {
  flex:1 1 130px;
  min-width:auto;
  max-width:100%;
}
.pipeline-line {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:8px;
}
#job-message {
  line-height:1.6;
  min-width:0;
  overflow-wrap:anywhere;
}
#job-message .config-token {
  white-space:nowrap;
}
#job-step {
  flex:none;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.pipeline-progress {
  height:5px;
  margin-top:6px;
  border-radius:5px;
  overflow:hidden;
  background:var(--line-strong);
}
.pipeline-progress i {
  display:block;
  height:100%;
  width:0;
  background:currentColor;
  transition:width .2s ease;
}

/* ---- the sentence rows ---- */
.sentence-list {
  flex:1;
  min-height:0;
  overflow:auto;
  position:relative;
}
/* With no rows the list gives its room to whichever empty state is showing. */
.sentence-list:empty {
  flex:none;
}
.sentence-row {
  display:grid;
  grid-template-columns:40px minmax(0,1fr) auto;
  gap:10px;
  padding:11px 12px 11px 18px;
  border-bottom:1px solid var(--line-soft);
  cursor:pointer;
  position:relative;
}
.sentence-row:hover {
  background:var(--hover);
}
.sentence-row.current {
  background:var(--row-active);
}
.sentence-row.current:before {
  content:"";
  position:absolute;
  left:0;
  top:9px;
  bottom:9px;
  width:2.5px;
  border-radius:2px;
  background:var(--accent);
}
.sentence-time {
  font-size:11.5px;
  color:var(--faint);
  font-variant-numeric:tabular-nums;
  padding-top:2px;
}
.sentence-row.current .sentence-time {
  color:var(--accent-ink);
  font-weight:600;
}
.sentence-source {
  font-size:13.5px;
  line-height:1.5;
  color:var(--ink);
}
.sentence-translation,
.sentence-written {
  font-size:12px;
  line-height:1.5;
  color:var(--muted);
  margin-top:2px;
}
.sentence-body mark {
  background:color-mix(in srgb,var(--star) 30%,transparent);
  color:inherit;
  border-radius:3px;
  padding:0 1px;
}
/* Dictation rows stand in for a sentence the reader has not written yet, so
   they carry its shape and never its words. */
.sentence-bars {
  display:flex;
  flex-wrap:wrap;
  gap:4px 5px;
  align-items:center;
  padding:5px 0;
}
.sentence-bars i {
  display:block;
  width:16px;
  height:7px;
  border-radius:4px;
  background:var(--line);
}
.sentence-actions {
  display:flex;
  align-items:flex-start;
  gap:0;
}
.row-action {
  width:24px;
  height:24px;
  border-radius:6px;
  display:grid;
  place-items:center;
  color:var(--faint);
  opacity:0;
}
.row-action.starred {
  color:var(--star);
}
.row-action:hover {
  background:var(--surface-2);
  color:var(--ink);
}
.sentence-row:hover .row-action,
.sentence-row.current .row-action,
.sentence-row:focus-within .row-action,
.row-action.starred,
.row-action:focus-visible {
  opacity:1;
}
@media (hover:none) {
  .row-action {
    opacity:1;
  }
}
.edited {
  font-style:normal;
  font-size:10.5px;
  padding:0 5px;
  border-radius:4px;
  background:var(--surface-2);
  color:var(--muted);
  vertical-align:1px;
}

/* ---- the two empty states and the way back ---- */
.panel-empty {
  flex:1;
  /* Only the rows are centred: an auto-sized column would take its
     max-content width and push the narrow layout sideways. */
  display:grid;
  align-content:center;
  padding:44px 28px;
  text-align:center;
  color:var(--muted);
  font-size:13px;
  line-height:1.7;
  overflow-wrap:anywhere;
}
.panel-empty b {
  display:block;
  color:var(--ink);
  font-size:14px;
  margin-bottom:4px;
}
.panel-empty span {
  white-space:pre-line;
}
.jump-to-current {
  position:absolute;
  left:50%;
  bottom:16px;
  transform:translateX(-50%);
  height:32px;
  padding:0 14px 0 11px;
  border-radius:999px;
  background:var(--accent);
  color:var(--on-accent);
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12.5px;
  font-weight:500;
  white-space:nowrap;
  box-shadow:var(--shadow-menu);
  z-index:4;
}
.jump-to-current:hover {
  background:var(--accent-hover);
  color:var(--on-accent);
}
