:root {
  color-scheme: dark;
  --bg: #06142d;
  --bg-deep: #031027;
  --panel: rgba(7, 25, 55, 0.76);
  --panel-strong: rgba(10, 38, 80, 0.88);
  --line: rgba(100, 220, 255, 0.28);
  --text: #eff8ff;
  --muted: #9bc3df;
  --cyan: #58f3ff;
  --blue: #207cff;
  --amber: #ffc766;
  --ok: #67ffbd;
  --danger: #ff8f8f;
  --shadow: 0 24px 80px rgba(0, 9, 30, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 26% 22%, rgba(31, 145, 255, 0.32), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.world-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    linear-gradient(rgba(87, 219, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 219, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
}

.world-bg::before,
.world-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.world-bg::before {
  background:
    linear-gradient(90deg, transparent, rgba(57, 224, 255, 0.22), transparent),
    radial-gradient(circle at 76% 20%, rgba(92, 242, 255, 0.28), transparent 24%);
  opacity: 0.8;
}

.world-bg::after {
  background-image:
    linear-gradient(90deg, transparent 0 18%, rgba(87, 236, 255, 0.2) 18% 18.4%, transparent 18.4%),
    linear-gradient(180deg, transparent 0 36%, rgba(87, 236, 255, 0.17) 36% 36.4%, transparent 36.4%);
  background-size: 260px 180px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 18%, black 82%, transparent 100%);
}

.world-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .92;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 clamp(18px, 4vw, 64px);
  border-bottom: 1px solid rgba(115, 221, 255, 0.18);
  background: rgba(4, 18, 43, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(104, 241, 255, .72);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(89, 244, 255, 0.9), rgba(25, 95, 255, 0.7));
  box-shadow: 0 0 28px rgba(75, 228, 255, 0.72);
}

nav {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

nav a:hover {
  color: var(--cyan);
}

.shell {
  width: min(1200px, calc(100% - 36px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

.hero {
  position: relative;
  min-height: 260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: center;
  padding: clamp(26px, 5vw, 54px) 0;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(34px, 5.2vw, 68px);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 0 26px rgba(74, 214, 255, .32);
}

.hero p {
  max-width: 720px;
  margin: 22px 0 0;
  color: #c5def1;
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.7;
}

.hero-robot {
  position: relative;
  min-height: 260px;
  filter: drop-shadow(0 0 34px rgba(95, 223, 255, .36));
}

.robot-head,
.robot-body,
.robot-arm,
.spark {
  position: absolute;
}

.robot-head {
  top: 4px;
  right: 38px;
  width: 150px;
  height: 126px;
  border: 2px solid rgba(197, 236, 255, .72);
  border-radius: 55% 45% 48% 52%;
  background:
    radial-gradient(circle at 78% 42%, #ff9c9c 0 7px, #172b5b 8px 16px, #91eaff 17px 21px, transparent 22px),
    linear-gradient(145deg, rgba(218, 241, 255, .96), rgba(118, 162, 217, .88));
}

.robot-head::before {
  content: "";
  position: absolute;
  top: 52px;
  left: 24px;
  width: 84px;
  height: 14px;
  border-radius: 999px;
  background: #0a234d;
  box-shadow: inset 36px 0 0 #58e9ff;
}

.robot-body {
  top: 122px;
  right: 46px;
  width: 142px;
  height: 120px;
  border: 2px solid rgba(197, 236, 255, .54);
  border-radius: 8px 48px 8px 8px;
  background: linear-gradient(135deg, rgba(207, 232, 255, .9), rgba(77, 108, 164, .72));
}

.robot-arm {
  top: 115px;
  right: 174px;
  width: 170px;
  height: 34px;
  transform: rotate(-28deg);
  border: 2px solid rgba(197, 236, 255, .64);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(232, 246, 255, .9), rgba(111, 158, 218, .76));
}

.spark {
  top: 84px;
  right: 344px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 16px 7px rgba(88, 243, 255, .82), 0 0 100px 44px rgba(35, 132, 255, .46);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel), rgba(4, 20, 48, .72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.survey-panel,
.report-preview,
.report-grid .panel,
.dashboard .panel,
.teacher-shell > .panel {
  padding: clamp(20px, 3vw, 30px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.overline {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 15px;
}

.progress {
  width: 104px;
  height: 8px;
  border-radius: 999px;
  background: rgba(118, 216, 255, .16);
  overflow: hidden;
}

.progress span {
  display: block;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

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

label,
fieldset {
  display: block;
  margin: 0 0 22px;
}

fieldset {
  padding: 0;
  border: 0;
}

label span,
legend {
  display: block;
  margin-bottom: 12px;
  color: #d8efff;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(117, 220, 255, .28);
  border-radius: 8px;
  background: rgba(3, 16, 40, .64);
  color: var(--text);
  outline: none;
  padding: 14px 15px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(88, 243, 255, .78);
  box-shadow: 0 0 0 3px rgba(88, 243, 255, .12);
}

::placeholder {
  color: #6f98b8;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips button,
.material-grid button {
  border: 1px solid rgba(113, 223, 255, .25);
  border-radius: 8px;
  background: rgba(9, 31, 69, .72);
  color: #cfeeff;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.chips button {
  min-height: 42px;
  padding: 0 15px;
}

.chips button:hover,
.material-grid button:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 243, 255, .72);
}

.chips button.selected,
.material-grid button.selected {
  color: #03172e;
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--cyan), #6bb7ff);
  box-shadow: 0 0 22px rgba(88, 243, 255, .32);
}

.section-title {
  margin-top: 4px;
}

.section-note {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

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

.material-grid button {
  min-height: 112px;
  padding: 16px;
  text-align: left;
}

.material-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 16px;
  border: 1px solid currentColor;
  border-radius: 7px;
  font-size: 12px;
}

.material-grid strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
}

.upload-box {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed rgba(88, 243, 255, .56);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(88, 243, 255, .12), rgba(48, 139, 255, .08)),
    rgba(3, 16, 40, .54);
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-box strong {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(88, 243, 255, .32);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(3, 16, 40, .72);
  word-break: break-all;
}

.upload-box em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

#formStatus {
  min-height: 22px;
  margin: 0;
  color: var(--ok);
  line-height: 1.5;
}

.primary-btn,
.secondary-btn,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn {
  min-height: 48px;
  padding: 0 22px;
  background: linear-gradient(135deg, var(--cyan), #308bff);
  color: #03172e;
  font-weight: 800;
  box-shadow: 0 15px 36px rgba(60, 185, 255, .32);
}

.secondary-btn {
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(88, 243, 255, .48);
  background: rgba(88, 243, 255, .1);
  color: var(--cyan);
  font-weight: 700;
}

.danger-btn {
  border-color: rgba(255, 143, 143, .5);
  color: #ffd2d2;
  background: rgba(255, 143, 143, .1);
}

svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-link {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(88, 243, 255, .35);
  color: var(--cyan);
  background: rgba(88, 243, 255, .08);
}

.report-preview {
  position: sticky;
  top: 92px;
}

.metric {
  margin: 4px 0 22px;
  padding: 18px;
  border: 1px solid rgba(88, 243, 255, .24);
  border-radius: 8px;
  background: rgba(3, 19, 44, .56);
}

.metric span,
.metric em {
  color: var(--muted);
  font-style: normal;
}

.metric strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 56px;
  line-height: 1;
  color: var(--cyan);
}

.mini-chart {
  margin-bottom: 22px;
}

.mini-row,
.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(120px, 2fr) 34px;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: #cdeaff;
  font-size: 13px;
}

.mini-row i,
.bar-row i {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  box-shadow: 0 0 16px rgba(88, 243, 255, .34);
}

.empty {
  color: #7ca8c8;
  line-height: 1.7;
}

.teacher-shell {
  padding-top: 24px;
}

.teacher-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 190px;
}

.auth-panel {
  width: min(720px, 100%);
  margin: 46px auto 0;
  padding: clamp(24px, 4vw, 38px);
}

.auth-panel h1 {
  margin: 0 0 22px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

.auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

#teacherAuthStatus {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--danger);
}

.locked-content[hidden] {
  display: none;
}

.teacher-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.teacher-actions .secondary-btn {
  width: auto;
}

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

.stat-panel strong {
  display: block;
  min-height: 44px;
  color: var(--cyan);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.1;
}

.stat-panel span {
  color: var(--muted);
}

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

.bars {
  margin-top: 18px;
}

.report-text-panel {
  grid-row: span 2;
}

pre {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  margin: 18px 0 0;
  padding: 18px;
  border: 1px solid rgba(88, 243, 255, .22);
  border-radius: 8px;
  background: rgba(2, 12, 31, .64);
  color: #d9f2ff;
  white-space: pre-wrap;
  line-height: 1.75;
  font-family: inherit;
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.topic-item {
  padding: 16px;
  border: 1px solid rgba(88, 243, 255, .22);
  border-radius: 8px;
  background: rgba(4, 20, 48, .6);
  color: #d9f2ff;
  line-height: 1.65;
}

.roster-panel {
  margin-top: 18px;
}

.submission-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.submission-card {
  padding: 18px;
  border: 1px solid rgba(88, 243, 255, .22);
  border-radius: 8px;
  background: rgba(3, 18, 42, .62);
}

.submission-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(88, 243, 255, .16);
}

.submission-top strong {
  color: var(--cyan);
  font-size: 18px;
}

.submission-top span,
.no-file {
  color: var(--muted);
  font-size: 13px;
}

.submission-card dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.submission-card dt {
  color: #78b7d8;
}

.submission-card dd {
  margin: 0;
  color: #d9f2ff;
  line-height: 1.65;
  word-break: break-word;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--cyan);
  font-weight: 700;
  word-break: break-all;
}

.file-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 980px) {
  .topbar {
    height: auto;
    min-height: 68px;
    gap: 14px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  nav {
    flex-wrap: wrap;
    gap: 14px;
  }

  .hero,
  .app-grid,
  .teacher-hero,
  .dashboard,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .hero-robot {
    min-height: 160px;
    opacity: .75;
  }

  .report-preview {
    position: static;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1200px);
    padding-bottom: 42px;
  }

  .hero {
    padding-top: 24px;
  }

  .field-row,
  .material-grid,
  .topic-list {
    grid-template-columns: 1fr;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-row,
  .teacher-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .primary-btn {
    width: 100%;
  }

  .mini-row,
  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .submission-top,
  .submission-card dl {
    grid-template-columns: 1fr;
  }

  .submission-top {
    align-items: flex-start;
    flex-direction: column;
  }
}
