/* ==========================================================================
   Transcribe Monkey — a quiet, warm dark interface.
   One accent colour, one type family, flat surfaces, generous spacing.
   ========================================================================== */

:root {
  --bg:            #131211;
  --surface:       #1b1a18;
  --surface-2:     #22201e;
  --surface-3:     #2b2926;
  --border:        #2a2825;
  --border-strong: #3c3935;

  --text:   #f1ebe1;
  --text-2: #aca397;
  --text-3: #756e64;

  --accent:        #f6a531;
  --accent-strong: #ffb84d;
  --accent-ink:    #1e1404;
  --accent-soft:   rgba(246, 165, 49, .13);
  --accent-ring:   rgba(246, 165, 49, .35);

  --green:      #6fcf85;
  --green-soft: rgba(111, 207, 133, .14);
  --red:        #ef6b62;
  --red-soft:   rgba(239, 107, 98, .14);
  --blue:       #74b7e0;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 16px 40px -20px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px var(--accent-ring);
}

* { box-sizing: border-box; }

/* Several components below set `display`, which would otherwise beat the
   user-agent rule for [hidden] and leave them stuck on screen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -140px, rgba(246, 165, 49, .07), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding: 0 20px 56px;
}

main, .masthead, footer { max-width: 920px; margin: 0 auto; }

/* --------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: 22px 0 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.logo { width: 38px; height: 38px; flex: none; }
.logo .face   { fill: var(--accent); }
.logo .ear    { fill: #c9700a; }
.logo .ear-in { fill: #7a4406; }
.logo .muzzle { fill: #ffd9a0; }
.logo .eye    { fill: #17120d; }
.logo .mouth  { fill: none; stroke: #17120d; stroke-width: 2.4; stroke-linecap: round; }

.wordmark {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.wordmark span { color: var(--accent); }

/* older pages still ship an <h1> wordmark and a tagline in the masthead */
.wordmark h1 { font: inherit; margin: 0; display: inline; }
.wordmark h1 span { margin-left: .25em; }  /* that markup has no literal space */
.masthead .tagline { display: none; }

.masthead-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-2);
  max-width: 100%;
}
.status-text { color: var(--text); font-weight: 500; white-space: nowrap; }
.status-detail {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-detail:empty { display: none; }
.status-detail::before { content: "·"; margin-right: 8px; }

.led {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.led.ok   { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.led.busy { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
            animation: pulse 1.2s ease-in-out infinite; }
.led.bad  { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes pulse { 50% { opacity: .35; } }

/* legacy LCD readout (admin page) — rendered as a plain list now */
.readout { font-size: 13px; color: var(--text-2); }
.readout-row { display: flex; align-items: center; gap: 8px; }
.readout-label { color: var(--text-3); width: 56px; }
.readout-value { color: var(--text); }

/* ------------------------------------------------------- account chip */

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}
.account-email {
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-out {
  appearance: none;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.account-out:hover { color: var(--text); border-color: var(--border-strong); }
.account-out:focus-visible { outline: none; box-shadow: var(--ring); }

/* ------------------------------------------------------------------- cards */

.rack {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  animation: rise .4s cubic-bezier(.2, .8, .3, 1) both;
}
#queueRack  { animation-delay: .05s; }
#viewerRack { animation-delay: .08s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

.rack-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 24px 0;
}
.rack-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.rack-sub {
  margin-left: auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rack-head .screw { display: none; }

.rack-body { padding: 22px 24px 24px; }

/* ---------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  grid-template-areas:
    "pet drop"
    "pet status";
  column-gap: 24px;
  align-items: center;
}

.monkey-companion {
  grid-area: pet;
  display: flex;
  justify-content: center;
  align-self: center;
}
.monkey-status { grid-area: status; min-width: 0; }

/* --------------------------------------------------------------- dropzone */

.dropzone {
  grid-area: drop;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 30px 24px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover,
.dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-3);
}
.dropzone:focus-visible { box-shadow: var(--ring); }
.dropzone.dragging {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--ring);
}

.dz-icon {
  width: 40px; height: 40px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}
.dropzone.dragging .dz-icon,
.dropzone:hover .dz-icon { animation: bars 1.1s ease-in-out infinite; }
@keyframes bars { 50% { transform: scaleY(.8); } }

.dz-title {
  margin: 10px 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.dz-sub { margin: 0; color: var(--text-2); font-size: 13.5px; }
.dz-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dz-limits { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------- options */

.options, .controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 28px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.option, .ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.option-wide { grid-column: 1 / -1; }

.label, .ctl-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.hint, .control-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}
.hint:empty { display: none; }

.fineprint, .workflow-note {
  margin: 22px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
}
.fineprint:empty { display: none; }

.row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 38px;
}

/* segmented control */
.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.seg:empty { display: none; }
.seg-item { flex: 1; min-width: 0; position: relative; }
.seg-item input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg-item span {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.seg-item:hover span { color: var(--text); }
.seg-item input:checked + span {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.seg-item input:focus-visible + span { box-shadow: var(--ring); }
.seg-item input:disabled { cursor: not-allowed; }
.seg-item input:disabled + span { opacity: .4; }

/* selects and text inputs */
select, input[type="password"] {
  appearance: none;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 34px 9px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aca397' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .15s, box-shadow .15s;
}
select:hover { border-color: var(--border-strong); }
select:focus-visible, input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input[type="password"] { background-image: none; padding-right: 12px; cursor: text; }

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.inline-field select {
  width: auto;
  padding: 6px 30px 6px 10px;
  font-size: 13px;
  background-position: right 10px center;
}

/* toggle switch */
.ctl-toggle { justify-content: flex-start; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.switch-track {
  width: 40px; height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  position: relative;
  flex: none;
  transition: background .2s, border-color .2s;
}
.switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #cfc6b8;
  transition: transform .2s cubic-bezier(.3, 1.3, .5, 1), background .2s;
}
.switch[aria-checked="true"] .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}
.switch[aria-checked="true"] .switch-knob {
  transform: translateX(18px);
  background: #fff;
}
.switch:focus-visible { outline: none; }
.switch:focus-visible .switch-track { box-shadow: var(--ring); }
.switch[disabled] { opacity: .5; cursor: not-allowed; }

/* notices */
.diarize-note, .notice {
  margin: 16px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.notice.err { border-color: rgba(239, 107, 98, .4); background: var(--red-soft); color: #f8bab5; }
.notice.ok  { border-color: rgba(111, 207, 133, .4); background: var(--green-soft); color: #c4ecce; }

/* ---------------------------------------------------------------- buttons */

.btn, .chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.btn:hover, .chip:hover {
  color: var(--text);
  border-color: var(--text-3);
  background: var(--surface-3);
}
.btn:active, .chip:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip { border-radius: 999px; padding: 6px 12px; }
.chip.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- jobs */

.jobs { list-style: none; margin: -6px 0 0; padding: 0; }

.job {
  padding: 16px 0;
  border-top: 1px solid var(--border);
  animation: rise .3s ease both;
}
.job:first-child { border-top: 0; padding-top: 4px; }
.job:last-child { padding-bottom: 2px; }

.job-top { display: flex; align-items: center; gap: 12px; }
.job-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-stage {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.job.running .job-stage { background: var(--accent-soft); color: var(--accent); }
.job.done    .job-stage { background: var(--green-soft);  color: var(--green); }
.job.failed  .job-stage { background: var(--red-soft);    color: var(--red); }

.job-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-3);
  overflow-wrap: anywhere;
}
.job-meta:empty { display: none; }

.job-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.meter {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width .3s ease;
}
.job.queued .meter i { background: var(--text-3); }
.job-pct {
  flex: none;
  width: 3.2em;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.job-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.job-error {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #f8bab5;
}
.job-error.warn { color: #e6c890; }

/* -------------------------------------------------------------- transcript */

.exportbar {
  display: flex;
  align-items: flex-end;
  gap: 20px 24px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.export-group { display: flex; flex-direction: column; gap: 8px; }
.export-group select { width: auto; min-width: 130px; }
.export-end {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.transcript {
  max-height: 64vh;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.transcript::-webkit-scrollbar { width: 8px; }
.transcript::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.turn {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 10px 0;
}
.turn-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.turn-body p { margin: 0; line-height: 1.65; }

.turn-speaker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 600;
}
.turn-speaker::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
/* speaker palette — assigned round-robin by index */
.sp0 { color: var(--accent); }
.sp1 { color: var(--blue); }
.sp2 { color: var(--green); }
.sp3 { color: #d99ae0; }
.sp4 { color: #e6c890; }
.sp5 { color: #8fd8d0; }

.empty {
  text-align: center;
  padding: 34px 12px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* --------------------------------------------------------------- admin */

.admin-masthead { align-items: center; }
.admin-actions { display: flex; align-items: center; gap: 10px; }
.admin-actions .btn { text-decoration: none; }

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.admin-stat {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px;
}
.admin-stat strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.admin-stat span { color: var(--text-3); font-size: 12.5px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.admin-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.admin-table code { color: var(--text-2); font-size: 12px; font-family: var(--mono); }
.admin-nowrap { white-space: nowrap; }
.admin-detail { color: var(--text-2); min-width: 250px; }
.admin-empty { color: var(--text-3); text-align: center; padding: 30px; }

@media (max-width: 720px) {
  .admin-summary { grid-template-columns: 1fr; }
  .admin-actions { width: 100%; }
}

/* ------------------------------------------------------------- sign-in */

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(400px, 100%);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 36px 32px 30px;
}
.login-logo { width: 56px; height: 56px; margin-bottom: 14px; }
.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
  margin: 0 0 8px;
}
.login-card h1 span { color: var(--accent); margin-left: .25em; }
.login-sub {
  color: var(--text-2);
  font-size: 14px;
  margin: 0 0 24px;
}
.login-hint {
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 20px 0 0;
}
.login-error,
.login-bye {
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 18px;
}
.login-error {
  color: #f8bab5;
  border: 1px solid rgba(239, 107, 98, .4);
  background: var(--red-soft);
}
.login-bye {
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Google's button, dressed to match, with their mark kept intact. */
.gbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .05s;
}
.gbtn:hover { border-color: var(--accent); background: var(--surface-3); }
.gbtn:focus-visible { outline: none; box-shadow: var(--ring); }
.gbtn:active { transform: translateY(1px); }
.gbtn-mark {
  width: 18px;
  height: 18px;
  flex: none;
  background: #fff;
  border-radius: 3px;
  padding: 1px;
}

/* ---------------------------------------------------------------- footer */

footer {
  justify-content: center;
  text-align: center;
  margin-top: 36px;
  padding-top: 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}
footer p { margin: 0; }
footer .tagline { color: var(--text-3); }

.btn.danger-armed { border-color: var(--red); color: var(--red); }

/* ------------------------------------------------------------- the monkey */

.monkey-pet {
  width: 168px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.monkey-pet:focus-visible { outline: none; box-shadow: var(--ring); }
.monkey-pet svg { display: block; width: 100%; overflow: visible; }

/* Blinking is the only CSS-timed motion; everything else is blended
   frame by frame in app.js so a state change never restarts a loop. */
.monkey-eyes { transform-origin: 120px 79px; animation: monkey-blink 5.3s infinite; }
.monkey-head, .monkey-body, .monkey-arm, .monkey-sparkles { animation: none; }
.monkey-head { transform-origin: 120px 115px; }
.monkey-body { transform-origin: 120px 190px; }
.monkey-arm  { transform-box: fill-box; transform-origin: 50% 0; }
.monkey-sparkles { opacity: 0; transform-origin: center; }
[data-mood="error"] .monkey-smile { transform: translateY(222px) scaleY(-1); }
@keyframes monkey-blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }

/* live progress for the file the monkey is working on */
.monkey-progress {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.monkey-progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
}
.monkey-filename {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.monkey-percent {
  flex: none;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.monkey-track {
  height: 6px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.monkey-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .15s linear;
}
.monkey-stage { margin-top: 7px; font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.monkey-progress-note { display: none; }
.monkey-progress[data-failed="true"] .monkey-track > span { background: var(--red); }
.monkey-progress[data-failed="true"] .monkey-percent { color: var(--red); }

.monkey-test { margin-top: 10px; font-size: 12px; opacity: .7; }
.monkey-test:hover, .monkey-test:focus-visible { opacity: 1; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  body { padding: 0 14px 44px; }
  .masthead { padding: 16px 0 18px; }
  .rack-body { padding: 18px 16px 20px; }
  .rack-head { padding: 16px 16px 0; }

  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "pet" "drop" "status";
  }
  .monkey-pet { width: 124px; }
  .monkey-companion { margin-bottom: 12px; }
  .dropzone { padding: 24px 16px 20px; }

  .options { grid-template-columns: 1fr; gap: 20px; }
  #qualitySeg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-end { margin-left: 0; }
  #viewerRack .rack-head { flex-wrap: wrap; gap: 4px 14px; }
  #viewerSub { flex-basis: 100%; margin-left: 0; white-space: normal; }
  .turn { grid-template-columns: 46px 1fr; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .001ms !important;
  }
}
