:root {
  color-scheme: light;
  --bg: #f4f8fc;
  --panel: #ffffff;
  --ink: #10213b;
  --muted: #64758c;
  --line: #d9e5f0;
  --soft: #f3f7fb;
  --primary: #0878b7;
  --primary-dark: #064469;
  --cyan: #13bfb6;
  --accent: #f06432;
  --good: #16a36a;
  --bad: #d94a38;
  --warn: #d88718;
  --shadow: 0 18px 46px rgba(15, 43, 76, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fbff 0%, #eef6fb 48%, #f7fbfd 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(9, 37, 63, 0.96), rgba(12, 51, 80, 0.98)),
    #0b263f;
  color: #f8fafc;
  padding: 34px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 18px 0 42px rgba(7, 31, 55, 0.16);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-inline: 8px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff8b2d, #00a9c8);
  color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 169, 200, 0.28);
}

.flask-icon {
  position: relative;
  width: 25px;
  height: 30px;
  border: 3px solid #ffffff;
  border-top: 0;
  border-radius: 4px 4px 11px 11px;
}

.flask-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -12px;
  width: 8px;
  height: 12px;
  border: 3px solid #ffffff;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.flask-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 9px;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.72);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.brand p {
  color: #a9bdd0;
  margin-top: 4px;
}

.nav {
  display: grid;
  gap: 12px;
}

.nav-item {
  border: 0;
  color: #d8e4ef;
  background: transparent;
  text-align: left;
  min-height: 58px;
  padding: 0 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 17px;
  font-weight: 800;
}

.nav-icon {
  width: 28px;
  display: grid;
  place-items: center;
  color: #dceeff;
  font-size: 22px;
}

.nav-item.active,
.nav-item:hover {
  background: linear-gradient(90deg, #1c5c8b, #15466f);
  color: #ffffff;
  box-shadow: inset -4px 0 0 #18b8d8;
}

.bank-panel {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.profile-card,
.bank-card {
  border: 1px solid rgba(214, 232, 246, 0.12);
  background: rgba(26, 66, 101, 0.54);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 16px 34px rgba(5, 23, 42, 0.18);
}

.profile-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: start;
}

.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #f5fbff, #bfe9ff);
  color: var(--primary-dark);
  border: 3px solid #27bee2;
  font-weight: 900;
}

.profile-fields {
  min-width: 0;
}

.bank-panel label {
  color: #d5e3f0;
  font-size: 13px;
  font-weight: 700;
}

.bank-panel select,
.student-panel input {
  width: 100%;
  border: 1px solid rgba(191, 215, 235, 0.24);
  background: rgba(6, 28, 49, 0.64);
  color: #ffffff;
  border-radius: 8px;
  padding: 10px;
}

.student-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 7px;
}

.student-panel input {
  min-width: 0;
}

.compact-btn {
  min-height: 40px;
  padding-inline: 10px;
}

.bank-meta {
  color: #a8bad0;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 8px;
}

.sync-status {
  color: #cfe0ef;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
  padding-left: 14px;
  position: relative;
}

.sync-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 6px;
  background: #8fa8bd;
}

.sync-status.online {
  color: #b8f1cd;
}

.sync-status.online::before {
  background: #55df8a;
}

.sync-status.error {
  color: #ffd1cc;
}

.sync-status.error::before {
  background: var(--bad);
}

.main {
  position: relative;
  min-width: 0;
  padding: 34px 42px 48px;
  overflow: hidden;
}

.main::before {
  content: "⌬  ⌬  ⚗";
  position: absolute;
  top: 22px;
  right: 260px;
  color: rgba(8, 120, 183, 0.08);
  font-size: 74px;
  font-weight: 800;
  pointer-events: none;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  z-index: 1;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 8px;
}

.topbar h2 {
  font-size: 34px;
  line-height: 1.15;
}

.view-subtitle {
  color: #536b84;
  margin-top: 8px;
  line-height: 1.55;
}

.top-actions,
.answer-bar,
.section-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(8, 120, 183, 0.25);
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark), #0fa9a7);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 8px 18px rgba(15, 43, 76, 0.06);
}

.btn-icon {
  font-size: 17px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.compose-panel,
.question-panel,
.status-panel,
.import-panel,
.schema-panel,
.report-section,
.metric,
.list-item {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compose-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 28px;
  margin-bottom: 20px;
}

.compose-copy {
  display: flex;
  gap: 18px;
  align-items: center;
  min-width: 0;
}

.compose-icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #e9f9ff, #dff4f2);
  color: var(--primary);
  font-size: 38px;
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.68);
}

.compose-panel h3,
.compose-panel p {
  margin: 0;
}

.compose-panel h3 {
  font-size: 23px;
}

.compose-panel p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.6;
}

.compose-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: flex-end;
}

.compose-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compose-controls input {
  width: 78px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

.question-panel {
  padding: 28px;
}

.question-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 5px 14px;
  background: #e4f2ff;
  color: #0b63b9;
  font-size: 14px;
  font-weight: 900;
}

.pill.muted {
  background: #eaf9f1;
  color: #158151;
}

.question-content h3 {
  position: relative;
  font-size: 22px;
  line-height: 1.7;
  margin: 0 0 22px;
  padding-left: 20px;
}

.question-content h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 6px;
  height: 1.4em;
  border-radius: 8px;
  background: linear-gradient(180deg, #0e7de8, #15c1ba);
}

.options {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.option,
.blank-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: 0 8px 18px rgba(15, 43, 76, 0.04);
}

.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
}

.option:hover,
.blank-item:hover {
  border-color: #b8d6eb;
}

.option input {
  margin-top: 4px;
}

.option.correct,
.blank-item.correct {
  border-color: rgba(22, 163, 106, 0.45);
  background: #effaf4;
}

.option.wrong,
.blank-item.wrong {
  border-color: rgba(217, 74, 56, 0.45);
  background: #fff2ef;
}

.blank-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  line-height: 1.6;
}

.blank-input,
.free-answer,
#importText,
#cloudImportText {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #ffffff;
  color: var(--ink);
}

.blank-input {
  min-height: 42px;
}

.free-answer {
  min-height: 150px;
  resize: vertical;
  display: none;
}

.answer-bar {
  justify-content: space-between;
  margin-top: 22px;
}

.status-panel {
  padding: 24px 22px;
  position: sticky;
  top: 20px;
}

.status-title {
  margin: 0 0 20px;
  font-size: 18px;
}

.score-ring {
  width: 164px;
  height: 164px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    conic-gradient(var(--cyan) 24%, #e9eef5 0) border-box;
  border: 12px solid transparent;
  box-shadow: inset 0 0 0 1px #eef3f8;
}

.score-ring span {
  font-size: 38px;
  font-weight: 900;
  color: #0c6f8e;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 20px;
}

.stats div {
  background: linear-gradient(180deg, #f8fbff, #eef4fa);
  padding: 12px 8px;
  border-radius: 8px;
  text-align: center;
}

.stats dt {
  color: var(--muted);
  font-size: 13px;
}

.stats dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 900;
  color: var(--primary);
}

.analysis-box {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  line-height: 1.75;
}

.analysis-box h4 {
  margin: 0 0 8px;
}

.question-map {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.map-btn {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 7px 16px rgba(15, 43, 76, 0.08);
}

.map-btn.current {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.map-btn.correct {
  background: #e9f7ef;
  color: var(--good);
}

.map-btn.wrong {
  background: #fdecea;
  color: var(--bad);
}

.section-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.inline-head {
  margin-bottom: 8px;
}

.muted-text {
  color: var(--muted);
  line-height: 1.6;
}

.section-head h3,
.report-section h3,
.import-panel h3,
.schema-panel h3 {
  margin: 0;
}

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

.list-item {
  padding: 18px;
  line-height: 1.7;
}

.list-item h4 {
  margin: 0 0 8px;
}

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

.metric {
  padding: 22px;
}

.metric span {
  font-size: 36px;
  font-weight: 900;
  color: var(--primary);
}

.metric p {
  margin: 6px 0 0;
  color: var(--muted);
}

.report-section {
  padding: 22px;
  margin-bottom: 18px;
}

.knowledge-row,
.attempt-row,
.teacher-row,
.teacher-question-row,
.cloud-question-row {
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

.knowledge-row {
  display: grid;
  grid-template-columns: 160px 1fr 80px;
  padding: 12px 0;
}

.attempt-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px 110px;
  padding: 12px 0;
}

.data-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  background: #ffffff;
}

.table-head {
  background: #f0f6fb;
  color: #5c7188;
  font-size: 13px;
  font-weight: 900;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  padding: 12px 0 0;
  line-height: 1.5;
}

.pager {
  display: flex;
  gap: 8px;
}

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

.teacher-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 90px 90px 90px;
  padding: 12px 0;
}

.teacher-question-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 80px 80px 90px minmax(140px, 0.8fr);
  min-width: 760px;
  padding: 12px;
}

.cloud-question-row {
  display: grid;
  grid-template-columns: 76px minmax(260px, 1fr) 90px 70px 80px 70px minmax(130px, 0.7fr) 74px;
  min-width: 980px;
  padding: 12px;
}

.danger-btn {
  background: #fff1ef;
  color: var(--bad);
  border-color: rgba(217, 74, 56, 0.42);
  box-shadow: none;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 900;
  padding: 0;
  text-align: left;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 34, 0.44);
  padding: 20px;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: min(760px, 88vh);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 34, 0.28);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
}

.modal-body {
  padding: 18px;
  overflow: auto;
  line-height: 1.75;
}

.modal-body p {
  margin: 0 0 12px;
}

.modal-body ul {
  margin: 0;
  padding-left: 20px;
}

.bar {
  height: 10px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.import-panel,
.schema-panel,
.teacher-import {
  padding: 22px;
  margin-bottom: 18px;
}

.import-panel p {
  color: var(--muted);
}

#fileInput,
#cloudFileInput {
  display: block;
  margin-bottom: 12px;
}

#importText {
  min-height: 220px;
  resize: vertical;
}

.teacher-import {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: none;
}

#cloudImportText {
  min-height: 180px;
  resize: vertical;
}

pre {
  overflow: auto;
  background: #10243a;
  color: #f8fafc;
  padding: 16px;
  border-radius: 8px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .practice-layout,
  .report-grid,
  .compose-panel {
    grid-template-columns: 1fr;
  }

  .compose-controls {
    justify-content: flex-start;
  }

  .status-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 22px 16px;
  }

  .main::before {
    display: none;
  }

  .topbar,
  .top-actions,
  .answer-bar,
  .section-head,
  .compose-copy {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 30px;
  }

  .compose-panel,
  .question-panel,
  .status-panel,
  .report-section,
  .metric {
    padding: 18px;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .compose-icon {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }

  .knowledge-row,
  .attempt-row,
  .teacher-row,
  .teacher-question-row,
  .cloud-question-row,
  .blank-item {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}
