:root {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", sans-serif;
  color: #16181d;
  background: #f7f7f8;
  --accent: #002fa7;
  --line: #d1d3db;
  --muted: #555b6a;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.app {
  display: grid;
  grid-template-rows: auto minmax(9rem, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  max-width: 68rem;
  margin-inline: auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(.75rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.top { padding: .625rem 0 .75rem; border-top: 4px solid var(--accent); }
.columns, #status, #model-status, #feedback { font-size: .875rem; }
#model-status { color: var(--muted); }
h1 {
  margin: .125rem 0 .875rem;
  font-size: clamp(1.85rem, 7vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.controls { display: flex; gap: .5rem; }
button, textarea, input { font: inherit; color: inherit; }
button {
  border: 1px solid currentColor;
  min-height: 44px;
  padding: .5rem .875rem;
  color: var(--accent);
  background: #fff;
  font-weight: 650;
}
button:disabled { color: var(--muted); opacity: .62; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#status, #model-status, #feedback { margin: .5rem 0 0; line-height: 1.4; }
.captions {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-top-color: var(--accent);
}
.columns, .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.columns {
  font-weight: 700;
  color: var(--accent);
  background: #f7f7f8;
  border-bottom: 1px solid var(--line);
}
.columns span, .row p { padding: .625rem .75rem; }
.columns span + span, .row p + p { border-left: 1px solid var(--line); }
.viewport { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-y: contain; }
.rows { padding: 0; margin: 0; list-style: none; }
.row { border-bottom: 1px solid var(--line); }
.row p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.row p[lang="zh-CN"] { font-weight: 540; }
.row p:empty { min-height: 2.5rem; }
.empty, .interim { color: var(--muted); margin: 0; padding: .85rem .75rem; line-height: 1.5; }
.interim { border-top: 1px solid var(--line); font-style: italic; font-size: .875rem; }
.latest { align-self: end; margin: .4rem .5rem; }
footer { min-width: 0; padding-top: .5rem; }
summary { min-height: 44px; padding: .625rem 0; color: var(--accent); font-weight: 650; cursor: pointer; }
form { display: flex; gap: .5rem; align-items: start; padding-bottom: .5rem; }
textarea { inline-size: 100%; min-inline-size: 0; margin: 0; resize: vertical; padding: .5rem; border: 1px solid var(--line); background: #fff; }
form button { flex: none; }
.topic, #course-url {
  inline-size: 100%;
  min-inline-size: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  padding: .5rem .625rem;
}
.topic { margin-bottom: .5rem; }
.course-inputs { margin-block: 0 .375rem; display: grid; gap: .375rem; }
#course input[type="file"] { max-inline-size: 100%; min-height: 36px; }
#course summary { padding-bottom: .3rem; }
#course-player { width: 100%; max-height: 24vh; background: #16181d; }
#course-player.audio-only { height: 54px; }
.review-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
dialog {
  width: min(42rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 2rem);
  color: #16181d;
  background: #fff;
  padding: 1rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  overflow: auto;
}
dialog::backdrop { background: rgb(22 24 29 / .46); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.dialog-head h2 { margin: 0; font-size: 1.25rem; }
.dialog-head form { padding: 0; }
#transcript-body {
  margin: 1rem 0 0;
  max-height: 68vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.55;
}
#summary-status { color: var(--muted); line-height: 1.5; }
#summary-rows { padding-left: 1.4rem; }
#summary-rows li { padding: .4rem 0; overflow-wrap: anywhere; }
#summary-rows small { color: var(--muted); display: block; margin-top: .25rem; }
.hint { margin: 0 0 .5rem; font-size: .875rem; color: var(--muted); line-height: 1.5; }
