:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #637083;
  --line: #d9e0ea;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --blue: #1d5fd1;
  --green: #16856c;
  --red: #bc3a4b;
  --gold: #b37a16;
  --shadow: 0 18px 55px rgba(29, 39, 60, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(29, 95, 209, 0.08), transparent 34%),
    linear-gradient(215deg, rgba(22, 133, 108, 0.1), transparent 36%),
    #eef3f8;
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

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

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar,
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.session-meta span {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 10px 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

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

.review-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 430px;
  gap: 20px;
  align-items: start;
}

.interview-panel,
.control-panel,
.results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.interview-panel {
  overflow: hidden;
}

.teacher-stage {
  position: relative;
  min-height: 430px;
  background: #111827;
}

#teacherCanvas {
  display: block;
  width: 100%;
  height: min(54vw, 520px);
  min-height: 420px;
}

.human-examiner,
.picture-prompt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.human-examiner {
  z-index: 1;
}

.picture-prompt {
  z-index: 2;
  background: #111827;
  object-fit: contain;
}

#teacherCanvas {
  position: relative;
  z-index: 0;
}

.teacher-caption {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 18px;
  bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  padding: 14px 16px;
  color: #f8fafc;
  backdrop-filter: blur(8px);
}

.caption-label {
  display: inline-block;
  margin-bottom: 6px;
  color: #9ee7d4;
  font-size: 12px;
  font-weight: 800;
}

.teacher-caption p {
  margin: 0;
  line-height: 1.55;
}

.question-card {
  padding: 22px;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.question-card h2 {
  margin-bottom: 10px;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0;
}

.question-card p {
  margin-bottom: 0;
  color: #344055;
  font-size: 18px;
  line-height: 1.65;
}

.control-panel {
  padding: 18px;
}

.camera-box {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(23, 32, 51, 0.9), rgba(51, 65, 85, 0.82)),
    #1f2937;
}

#studentVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-overlay {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.timer-wrap {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
}

.timer-ring {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    conic-gradient(var(--blue) var(--progress, 0%), #e6edf6 0),
    #e6edf6;
}

.timer-ring span {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  font-size: 28px;
  font-weight: 850;
}

.timer-label {
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 850;
}

.timer-copy {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.step-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
}

.step-item.active {
  border-color: rgba(29, 95, 209, 0.4);
  background: rgba(29, 95, 209, 0.08);
}

.step-item.done .step-number {
  background: var(--green);
  color: #fff;
}

.step-title {
  min-width: 0;
  font-weight: 800;
}

.step-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions button,
.results-head button,
.link-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.link-button {
  display: inline-grid;
  place-items: center;
  min-width: 118px;
  padding: 0 14px;
  text-decoration: none;
}

.actions .primary {
  grid-column: 1 / -1;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.actions .danger {
  border-color: rgba(188, 58, 75, 0.35);
  background: rgba(188, 58, 75, 0.1);
  color: var(--red);
}

button.danger {
  min-height: 46px;
  border: 1px solid rgba(188, 58, 75, 0.35);
  border-radius: 8px;
  background: rgba(188, 58, 75, 0.1);
  color: var(--red);
  cursor: pointer;
  font-weight: 850;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.upload-config label {
  display: block;
  margin-bottom: 8px;
  font-weight: 850;
}

.upload-config input,
.upload-config select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fff;
  color: var(--ink);
}

.upload-config p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.results {
  margin-top: 20px;
  padding: 22px;
}

.review-layout .results {
  margin-top: 0;
}

.review-panel {
  position: sticky;
  top: 16px;
}

.session-manager {
  position: sticky;
  top: 16px;
}

.compact-head {
  margin-bottom: 12px;
}

.session-list {
  display: grid;
  gap: 10px;
}

.session-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.session-item.active {
  border-color: rgba(29, 95, 209, 0.45);
  background: rgba(29, 95, 209, 0.08);
}

.session-item strong {
  font-size: 15px;
}

.session-item span,
.session-item small,
.empty-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.review-actions {
  margin-top: 16px;
}

.review-actions .primary {
  grid-column: 1 / -1;
}

.editor-block {
  margin-top: 18px;
}

.editor-block label {
  display: block;
  margin-bottom: 8px;
  font-weight: 850;
}

.editor-block textarea {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

#transcriptBlock textarea {
  min-height: 240px;
}

.editor-block p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 16px;
}

.score-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.score-card span {
  font-size: 30px;
  font-weight: 900;
}

.recordings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.recording-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.recording-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #101827;
}

.recording-card div {
  padding: 12px;
}

.recording-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.recording-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.schema-box {
  overflow: auto;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  padding: 14px;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.5;
}

.complete-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.complete-screen h1 {
  font-size: clamp(34px, 7vw, 72px);
}

@media (max-width: 980px) {
  .workspace,
  .review-layout,
  .score-grid,
  .recordings {
    grid-template-columns: 1fr;
  }

  .control-panel {
    order: -1;
  }

  .review-panel {
    position: static;
  }

  .session-manager {
    position: static;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .results-head,
  .question-head {
    align-items: stretch;
    flex-direction: column;
  }

  .session-meta {
    justify-content: stretch;
  }

  .session-meta span {
    flex: 1;
  }

  #teacherCanvas {
    min-height: 330px;
  }

  .teacher-stage {
    min-height: 340px;
  }

  .teacher-caption {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}
