:root {
  color-scheme: light;
  --ink: #13223a;
  --muted: #53627a;
  --navy: #102039;
  --teal: #086f66;
  --teal-dark: #005c54;
  --line: #d7e0ea;
  --surface: #fff;
  --ground: #f1f5f9;
  --radius: 16px;
  --shadow: 0 8px 30px #17324b0d;
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang TC","Microsoft JhengHei",sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none!important;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  line-height: 1.55;
}

button,input,select,textarea {
  font: inherit;
}

a {
  color: var(--teal-dark);
}

:focus-visible {
  outline: 3px solid #147d91;
  outline-offset: 3px;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px max(20px,calc((100vw - 1160px)/2));
  background: var(--navy);
  color: #d8e7f1;
}

.brand {
  color: white;
  font-weight: 800;
  text-decoration: none;
  font-size: 1.17rem;
  letter-spacing: -.03em;
}

.topbar-label {
  font-size: .8rem;
  color: #aebfd1;
}

.topbar #logout {
  margin-left: auto;
  color: #e8f4ff;
  border-color: #465a73;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 44px 20px 60px;
  min-height: 80vh;
}

.hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: clamp(26px,7vw,110px);
  align-items: center;
  padding: clamp(22px,6vw,84px) 0;
}

.hero h1 {
  font-size: clamp(2.3rem,6vw,4.25rem);
  line-height: 1.17;
  letter-spacing: -.035em;
  margin: 10px 0 18px;
}

.intro {
  max-width: 34rem;
  font-size: 1.07rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: .79rem;
  font-weight: 750;
  letter-spacing: .105em;
}

.journey {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 7px;
  padding: 0;
  margin: 25px 0 0;
}

.journey li {
  background: #dfefed;
  border: 1px solid #c8e5df;
  border-radius: 99px;
  padding: 4px 9px;
  color: #0a4c46;
  font-size: .78rem;
  font-weight: 700;
}

.workspace-heading,.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-heading,.between {
  justify-content: space-between;
}

.workspace-heading {
  margin-bottom: 22px;
}

.workspace-heading h1 {
  font-size: clamp(1.7rem,4vw,2.35rem);
  line-height: 1.2;
  margin: 4px 0;
}

.capabilities,.status {
  font-size: .82rem;
  color: #254461;
  background: #e9f0f8;
  border-radius: 10px;
  padding: 6px 10px;
  margin: 0;
  width: max-content;
  max-width: 100%;
  font-weight: 650;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 240px minmax(0,1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  min-width: 0;
}

.sidebar h2 {
  margin: 0;
  font-size: 1rem;
}

.sidebar > .row > .button {
  flex-shrink: 0;
  white-space: nowrap;
}

.work-column,#project-view {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.project-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-tabs button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.project-tabs button[aria-selected="true"] {
  background: var(--navy);
  color: white;
}

.project-tabs button:disabled {
  opacity: .45;
  cursor: default;
}

.project-tabs button:focus-visible {
  outline-offset: -2px;
}

.project-panel {
  min-width: 0;
  scroll-margin-top: 62px;
}

.project-panel [id] {
  scroll-margin-top: 62px;
}

.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(16px,3.2vw,27px);
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.34rem;
  line-height: 1.3;
  margin: 0 0 9px;
}

.card h3 {
  font-size: 1.03rem;
  margin: 0;
}

.login,.form-stack {
  display: grid;
  gap: 10px;
}

.login h2,.login p {
  margin: 0;
}

.login .primary {
  width: 100%;
  margin-top: 5px;
}

.form-stack {
  align-items: start;
}

.form-stack>.button {
  justify-self: start;
}

.project-heading {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 12px;
}

.project-heading h2 {
  overflow-wrap: anywhere;
}

.project-heading-meta {
  gap: 8px;
  margin-bottom: 6px;
}

.project-heading-meta .eyebrow {
  margin: 0;
}

.scenario-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #e3f2ee;
  color: var(--teal-dark);
  font-size: .76rem;
  font-weight: 700;
}

.scenario-picker .muted {
  margin: 6px 0 0;
}

.project-heading .muted {
  margin: 0;
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 6px;
}

.project-list button {
  display: block;
  text-align: left;
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.project-list-scenario {
  display: block;
  margin-top: 1px;
  font-size: .72rem;
  font-weight: 600;
}

.upload-progress-heading {
  font-variant-numeric: tabular-nums;
}

.source-file-list {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 10px 0;
  list-style: none;
}

.source-file-row {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.source-file-heading {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: start;
}

.source-file-name {
  margin: 0;
  font-size: .92rem;
  overflow-wrap: anywhere;
}

.source-file-row .muted {
  margin: 4px 0 6px;
}

.source-file-controls {
  flex-shrink: 0;
  gap: 4px;
}

.source-file-controls .button {
  min-height: 32px;
  padding: 3px 7px;
  font-size: .8rem;
}

#source-library-current {
  overflow-wrap: anywhere;
}

.project-list button[aria-current="true"] {
  border-color: var(--teal);
  background: #e3f2ee;
  color: var(--teal-dark);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fc;
  color: var(--ink);
  padding: 7px 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button:hover:not(:disabled) {
  background: #e9eff6;
}

.button.primary {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: white;
}

.button.primary:hover:not(:disabled) {
  background: var(--teal-dark);
}

.button.quiet {
  background: transparent;
}

.button.quiet:hover:not(:disabled) {
  background: #147d9115;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.wrap {
  flex-wrap: wrap;
}

.wizard-buttons {
  margin-top: 4px;
}

label,.label,legend {
  font-size: .9rem;
  font-weight: 680;
}

.label {
  margin: 0 0 5px;
}

legend {
  padding: 0 0 5px;
}

fieldset {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

input:not([type=checkbox]):not([type=radio]),select,textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 4px 0 0;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  border: 1px solid #acbacb;
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

input[type=checkbox],input[type=radio] {
  accent-color: var(--teal);
  margin: 3px 0 0;
  min-width: 16px;
  height: 16px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}

.check-grid,.field-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 9px 16px;
}

.check-grid label {
  font-weight: 520;
}

.check-grid {
  grid-template-columns: repeat(auto-fit,minmax(105px,1fr));
}

.muted,small {
  color: var(--muted);
}

.muted {
  font-size: .88rem;
  margin: .45em 0 .8em;
}

small {
  font-size: .82rem;
}

.notice,.error,.warning {
  border: 1px solid #bddbd5;
  border-radius: 10px;
  padding: 10px 13px;
  margin: 0;
  background: #e6f3ee;
  color: #184e42;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.error {
  color: #8c2532;
  background: #fff0f1;
  border-color: #edc4ca;
}

.warning {
  background: #fff6dd;
  color: #6b4a10;
  border-color: #efdca8;
}

.nested {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 16px;
}

.analysis-result {
  margin-top: 16px;
}

.analysis-options {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr));
  gap: 12px;
  margin: 12px 0;
}

.analysis-option {
  grid-template-rows: auto 1fr auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.analysis-option p,.chapter-summary {
  margin: 0;
}

.chapter-summary {
  color: var(--muted);
  font-size: .88rem;
}

.outline-role {
  display: inline-block;
  margin-left: 6px;
  color: var(--teal-dark);
}

.semantic-segments {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 10px 0;
  padding: 0;
}

.semantic-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.semantic-card h4 {
  margin: 0;
  font-size: 1rem;
}

.semantic-evidence {
  display: grid;
  gap: 5px;
  margin: 9px 0 0;
}

.semantic-evidence > div {
  display: grid;
  grid-template-columns: minmax(72px,7.5rem) minmax(0,1fr);
  gap: 8px;
}

.semantic-evidence dt {
  color: var(--teal-dark);
  font-weight: 680;
}

.semantic-evidence dd {
  margin: 0;
  white-space: pre-wrap;
}

.semantic-citations {
  list-style: none;
  margin: 0;
  padding: 0;
}

.semantic-citations li + li {
  margin-top: 4px;
}

.evidence-context {
  display: block;
}

#preview-start-field {
  display: block;
  max-width: 20rem;
  margin: 12px 0;
}

.summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.metrics div {
  border-radius: 8px;
  background: #eef3f8;
  padding: 7px 10px;
}

.metrics dt {
  color: var(--muted);
  font-size: .74rem;
}

.metrics dd {
  margin: 0;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.clip-list {
  display: grid;
  gap: 9px;
  margin: 12px 0;
}

.clip-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) minmax(0,1fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 10px;
}

.clip-reason {
  grid-column: 2/-1;
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.clip-number {
  align-self: center;
  font-variant-numeric: tabular-nums;
  color: var(--teal-dark);
  font-weight: 750;
}

.clip-row .button {
  min-height: 36px;
}

.clip-row input {
  font-variant-numeric: tabular-nums;
}

video {
  display: block;
  width: 100%;
  max-height: 65vh;
  background: #101723;
  border-radius: 11px;
  margin: 10px 0;
}

.player-captions {
  margin: 10px 0;
  gap: 6px;
}

.player-captions select {
  max-width: 16rem;
  margin: 0;
}

.player-caption-display {
  min-height: 3.2em;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.course-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(165px,27%);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.course-mode {
  margin-bottom: 8px;
}

.course-mode button[aria-pressed="true"] {
  border-color: var(--teal);
  background: #e3f2ee;
  color: var(--teal-dark);
}

.course-player-shell {
  overflow: hidden;
  border-radius: 11px;
  background: #101723;
  color: #fff;
}

.course-player-shell video {
  aspect-ratio: 16/9;
  object-fit: contain;
  margin: 0;
  border-radius: 0;
}

.course-player-shell:fullscreen {
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: #070b12;
}

.course-player-shell:fullscreen video {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

.course-caption-display {
  min-height: 2.7em;
  max-height: 24vh;
  overflow: auto;
  padding: 6px 14px;
  background: #0c1521;
  color: white;
  font-size: clamp(.93rem,1.3vw,1.23rem);
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.course-player-toolbar {
  min-height: 43px;
  padding: 5px 10px;
  background: #142337;
}

.course-caption-options select {
  width: auto;
  margin: 0;
  padding: 3px 6px;
  font-size: .82rem;
}

.course-player-toolbar button {
  min-height: 32px;
  margin-left: auto;
  padding: 3px 9px;
  font-size: .82rem;
}

.course-scrubber {
  margin: 10px 0 0;
  gap: 5px;
}

.course-scrubber input[type="range"] {
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--teal);
}

.course-scrubber output,.course-chapter-list time {
  color: var(--teal-dark);
  font-size: .81rem;
  font-variant-numeric: tabular-nums;
}

#course-seconds {
  width: 7rem;
  margin: 0;
}

.course-rail {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.course-chapter-list {
  max-height: min(57vh,420px);
  overflow-y: auto;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}

.course-chapter-list button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.course-chapter-list button[aria-current="true"],.course-chapter-list button:hover {
  background: #e3f2ee;
}

.course-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,230px),1fr));
  gap: 12px;
}

.course-notes h4 {
  margin: 9px 0 4px;
}

.course-cues {
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-cues li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

progress {
  width: 100%;
  height: 14px;
  accent-color: var(--teal);
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

.transcript-list {
  max-height: 17rem;
  overflow: auto;
  padding-left: 1.4rem;
}

.transcript-list li {
  margin: 4px 0;
  overflow-wrap: anywhere;
}

.transcript-list time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-right: .65em;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.downloads a {
  display: block;
  padding: 5px 9px;
  border-radius: 6px;
  background: #e6f2f0;
  font-weight: 700;
  font-size: .84rem;
  text-decoration: none;
}

.stills {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(105px,1fr));
  gap: 8px;
  margin: 10px 0;
}

.stills figure {
  margin: 0;
}

.stills img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.stills figcaption {
  color: var(--muted);
  font-size: .78rem;
}

.footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

@media(max-width:930px) {
  .course-layout {
    grid-template-columns: minmax(0,1fr);
  }
  .course-chapter-list {
    max-height: 215px;
  }
}

@media(max-width:760px) {
  .shell {
    padding-top: 24px;
  }
  .hero,.workspace-grid {
    grid-template-columns: minmax(0,1fr);
  }
  .sidebar {
    position: static;
  }
  .project-list {
    grid-template-columns: repeat(auto-fit,minmax(min(100%,135px),1fr));
    max-height: 145px;
    overflow-y: auto;
  }
  .workspace-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .hero {
    padding-top: 12px;
  }
  .topbar-label {
    display: none;
  }
}

@media(max-width:430px) {
  .source-file-heading {
    grid-template-columns: minmax(0,1fr);
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .clip-row {
    grid-template-columns: auto minmax(0,1fr) minmax(0,1fr);
  }
  .clip-row button {
    grid-column: 2/-1;
    justify-self: start;
  }
  .clip-reason {
    grid-column: 2/-1;
  }
}

.frame-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #e7eef5;
  cursor: pointer;
}

.frame-button:hover {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.contact-sheet {
  align-self: end;
  font-size: .82rem;
  font-weight: 700;
}

.time-button {
  border: 0;
  background: #eef3f8;
  color: var(--teal-dark);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 5px;
  margin-right: .6em;
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.clip-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.clip-controls .button {
  min-width: 34px;
  padding: 4px 8px;
}

.clip-controls .button:last-child {
  white-space: nowrap;
}

@media(max-width:650px) {
  .clip-row {
    grid-template-columns: auto minmax(0,1fr) minmax(0,1fr);
  }
  .clip-controls {
    grid-column: 2/-1;
  }
}

@media(prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto;
  }
}
