:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #d6dee8;
  --panel: #ffffff;
  --paper: #f6f8fb;
  --blue: #2563eb;
  --yellow: #facc15;
  --red: #dc2626;
  --green: #16a34a;
  --teal: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
a {
  font: inherit;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 56px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(12, 74, 110, 0.94), rgba(15, 118, 110, 0.9)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.admin-link {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.65);
  padding: 10px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 22px;
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 18px 36px;
}

.side-panel,
.question-card,
.hint-panel,
.result-panel,
.admin-layout section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.side-panel {
  padding: 18px;
  align-self: start;
}

.side-panel h2,
.admin-layout h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.side-panel section + section {
  margin-top: 24px;
}

.module-list,
.mastery-list,
.data-grid {
  display: grid;
  gap: 10px;
}

.map-group + .map-group {
  margin-top: 16px;
}

.map-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0 8px;
}

.module-item,
.mastery-item,
.weak-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}

.scope-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.scope-item + .scope-item {
  margin-top: 8px;
}

.scope-item strong,
.scope-item span {
  display: block;
}

.scope-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.scope-item:hover,
.scope-item.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.module-item strong,
.mastery-item strong {
  display: block;
  margin-bottom: 4px;
}

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

.question-shell {
  min-width: 0;
}

.progress-line {
  margin-bottom: 10px;
  color: var(--muted);
}

.question-card {
  padding: clamp(18px, 4vw, 34px);
}

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

.question-meta span {
  color: #fff;
  background: var(--teal);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

#questionText {
  margin: 28px 0 14px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.25;
  letter-spacing: 0;
}

.keyword {
  display: inline-block;
  background: rgba(250, 204, 21, 0.45);
  border: 1px solid rgba(202, 138, 4, 0.35);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 18px;
}

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

.option {
  min-height: 58px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
  cursor: pointer;
}

.option:hover,
.option.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.primary,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}

.primary {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.ghost:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #f8fbff;
}

.ghost:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

button.ghost.hint-active,
button.ghost.hint-active:hover,
button.ghost.hint-active:focus-visible {
  color: #0f3ea8;
  background: #dbeafe;
  border-color: #2563eb;
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  outline: none;
  transform: translateY(-1px);
}

.hint-panel,
.result-panel {
  padding: 18px;
  margin-top: 14px;
}

.hint-panel h3 {
  margin: 0 0 10px;
}

.hint-panel ul,
.learning-block ul,
.learning-block ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.hint-panel li,
.learning-block li {
  margin: 8px 0;
  line-height: 1.65;
}

.hidden {
  display: none;
}

.result-badge {
  display: inline-block;
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  margin-bottom: 8px;
}

.result-badge.ok {
  background: var(--green);
}

.result-badge.bad {
  background: var(--red);
}

.result-panel h3 {
  margin: 14px 0 6px;
  font-size: 16px;
}

.learning-grid {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.learning-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px 16px;
}

.learning-block h3 {
  margin-top: 0;
}

.teacher-note {
  border-left: 4px solid var(--yellow);
  margin: 12px 0 0;
  padding: 8px 0 8px 12px;
  color: var(--muted);
  background: rgba(250, 204, 21, 0.12);
}

.mark-blue,
.mark-yellow,
.mark-red,
.mark-green,
.mark-teal {
  border-radius: 5px;
  padding: 1px 5px;
  font-weight: 700;
}

.mark-blue {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
}

.mark-yellow {
  color: #854d0e;
  background: rgba(250, 204, 21, 0.28);
}

.mark-red {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
}

.mark-green {
  color: #15803d;
  background: rgba(22, 163, 74, 0.12);
}

.mark-teal {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.12);
}

.admin-layout {
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 18px 36px;
  display: grid;
  gap: 18px;
}

.admin-layout section {
  padding: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef4fb;
}

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

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

.recommend-item {
  border-left: 4px solid var(--blue);
  background: #f8fbff;
  padding: 10px 12px;
  border-radius: 6px;
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr 48px;
  gap: 12px;
  align-items: center;
}

.bar-meta strong,
.bar-meta span {
  display: block;
}

.bar-meta span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

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

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .options {
    grid-template-columns: 1fr;
  }

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

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