:root {
  --ink: #162033;
  --muted: #617086;
  --line: #dbe4ee;
  --surface: #ffffff;
  --soft: #f5f9fb;
  --mint: #dff8ee;
  --blue: #dceeff;
  --yellow: #fff3c4;
  --coral: #ffe4dd;
  --green: #17a36b;
  --orange: #f28c28;
  --red: #d94b48;
  --accent: #2478d4;
  --accent-2: #0fa37f;
  --shadow: 0 12px 30px rgba(30, 56, 88, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9f6 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 86px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1,
.student-header h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.18;
}

.eyebrow {
  margin: 0;
  color: #547089;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions,
.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: #196fc3;
  color: white;
}

.button.ghost {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.button.danger {
  background: #fff1ef;
  color: #a63535;
  border-color: #ffc6bf;
}

.button.full {
  width: 100%;
}

.console-layout {
  min-height: calc(100vh - 86px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.assessment-switch,
.view-tabs,
.status-block {
  display: grid;
  gap: 8px;
}

.assessment-choice,
.tab {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 700;
}

.assessment-choice span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.assessment-choice.active,
.tab.active {
  border-color: #8bc7ff;
  background: linear-gradient(180deg, #eef7ff, #ffffff);
}

.status-block {
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border-radius: 8px;
  background: var(--mint);
}

.status-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.workspace {
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.teaching-main,
.qr-panel,
.entry-copy,
.analysis-surface,
.student-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.teaching-main {
  min-height: calc(100vh - 136px);
  padding: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-heading.tight {
  align-items: center;
  margin-bottom: 8px;
}

.section-heading h2,
.section-heading h3,
.entry-copy h2 {
  margin: 4px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--yellow);
  color: #7a5d05;
  font-weight: 800;
  white-space: nowrap;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.timeline-item {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 8px;
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.timeline-item span {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8f3ff;
  color: var(--accent);
}

.timeline-item.active {
  color: var(--ink);
  background: #eef8ff;
  border-color: #9bd0ff;
}

.teaching-panel h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.teaching-panel p {
  color: var(--muted);
  line-height: 1.75;
}

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

.question-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 150px;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #edf2f7;
  align-items: start;
}

.question-row:last-child {
  border-bottom: 0;
}

.question-index {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.question-row strong {
  display: block;
  line-height: 1.45;
}

.question-row p {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.6;
}

.score-chip {
  min-height: 34px;
  border-radius: 8px;
  background: #f5f8fb;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #40546d;
}

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

.rule-line {
  padding: 13px 0;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  gap: 12px;
  align-items: center;
}

.rule-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  flex: 0 0 auto;
}

.qr-panel {
  padding: 18px;
  position: sticky;
  top: 110px;
}

.qr-panel h3 {
  margin: 4px 0 14px;
}

.qr-panel img,
.qr-card img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.link-line {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progress-strip {
  margin: 14px 0;
  display: grid;
  gap: 8px;
}

.progress-strip span,
.survey-progress span {
  font-weight: 900;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e9eef4;
  overflow: hidden;
}

.progress-track div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
}

.entry-copy {
  padding: 26px;
}

.entry-copy p {
  color: var(--muted);
  line-height: 1.75;
}

.link-pair {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.link-tile {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.link-tile strong {
  display: block;
  margin-bottom: 4px;
}

.link-tile span {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 14px;
}

.dual-qr {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.qr-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.qr-card h3 {
  margin: 0 0 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  min-height: 112px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.analysis-surface {
  padding: 18px;
}

.analysis-surface h3 {
  margin: 0 0 14px;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr) minmax(86px, auto);
  gap: 10px;
  align-items: center;
}

.bar-label {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #ecf1f5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #55a8f2, #37c79a);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  min-height: 36px;
  padding: 7px 10px;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--blue);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid #edf2f7;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 900;
}

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

.student-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fcff 0%, #f7fbf4 100%);
}

.student-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 22px 16px 42px;
}

.student-header {
  padding: 12px 2px 18px;
}

.student-header h1 {
  font-size: 26px;
}

.student-header p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.student-surface {
  padding: 18px;
  border-radius: 8px;
}

.chooser-list {
  display: grid;
  gap: 12px;
}

.chooser-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.chooser-button strong {
  display: block;
  font-size: 18px;
}

.chooser-button span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.form-section {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.form-section h2 {
  margin: 0;
  font-size: 20px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
  color: var(--ink);
}

.survey-progress {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.student-question {
  padding: 15px 0;
  border-bottom: 1px solid #edf2f7;
}

.student-question:last-child {
  border-bottom: 0;
}

.student-question strong {
  display: block;
  line-height: 1.5;
}

.answer-row {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.answer-row label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
  font-weight: 900;
}

.answer-row input {
  position: absolute;
  opacity: 0;
}

.answer-row label:has(input:checked) {
  border-color: #75b8ef;
  background: #eaf6ff;
  color: #145fa8;
}

.score-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.submit-button {
  margin-top: 8px;
}

.form-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
  font-weight: 700;
}

.result-view {
  text-align: center;
}

.result-band {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #145fa8;
  font-size: 18px;
  font-weight: 900;
}

.result-band[data-tone="green"] {
  background: var(--mint);
  color: #0b7d52;
}

.result-band[data-tone="yellow"] {
  background: var(--yellow);
  color: #7a5d05;
}

.result-band[data-tone="orange"] {
  background: #ffe7ce;
  color: #a35a11;
}

.result-band[data-tone="red"] {
  background: #ffe4dd;
  color: #b93636;
}

.result-description {
  margin: 0 auto 16px;
  max-width: 32rem;
  color: var(--muted);
  line-height: 1.65;
}

.score-number {
  margin: 16px auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #ffffff 0%, #eef8ff 72%, #dff3ec 100%);
  border: 1px solid #cfe1ef;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.score-number span {
  font-size: 64px;
  line-height: 1;
  font-weight: 900;
  color: #145fa8;
}

.score-number small {
  margin-left: 4px;
  align-self: center;
  font-weight: 900;
}

@media (max-width: 980px) {
  .topbar,
  .console-layout,
  .teaching-grid,
  .entry-grid,
  .analytics-grid {
    display: block;
  }

  .topbar {
    position: static;
  }

  .topbar-actions {
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 16px;
  }

  .qr-panel {
    position: static;
    margin-top: 16px;
  }

  .timeline,
  .dual-qr,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .question-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .question-row .score-chip {
    grid-column: 2;
    justify-content: flex-start;
    padding-left: 12px;
  }
}

@media (max-width: 520px) {
  .student-shell {
    padding: 18px 12px 34px;
  }

  .student-surface {
    padding: 15px;
  }

  .answer-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
