:root {
  --ink: #17324d;
  --paper: #f7f3e8;
  --white: #fffdf8;
  --red: #d5533f;
  --teal: #2b7a78;
  --gold: #d7a62a;
  --line: #d9d4c8;
  --muted: #66717b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.shell {
  max-width: 1440px;
  margin: auto;
  padding: 22px;
}
.top {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 24px;
  align-items: end;
  border-bottom: 3px solid var(--ink);
  padding: 16px 0 22px;
}
.kicker {
  letter-spacing: 0.18em;
  color: var(--red);
  font-weight: 700;
}
.top h1 {
  font-family: "Noto Serif SC", "STSong", serif;
  font-size: clamp(30px, 4vw, 54px);
  margin: 8px 0;
}
.top p {
  color: var(--muted);
  margin: 0;
  line-height: 1.7;
}
.compact-top {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 22px;
  padding: 10px 0 16px;
}
.compact-top h1 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 46px);
}
.picker-heading {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: end;
  margin: 42px 0 22px;
}
.picker-heading h2 {
  margin: 0 0 6px;
  font-family: "Noto Serif SC", "STSong", serif;
  font-size: clamp(28px, 4vw, 48px);
}
.picker-index {
  color: var(--red);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.group-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.group-picker-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  min-height: 150px;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}
.group-picker-item:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
}
.group-picker-item > span {
  grid-row: 1 / 3;
  color: var(--gold);
  font-family: "Noto Serif SC", "STSong", serif;
  font-size: 34px;
  line-height: 1;
}
.group-picker-item strong {
  align-self: end;
  font-family: "Noto Serif SC", "STSong", serif;
  font-size: 25px;
}
.group-picker-item small {
  color: var(--muted);
}
.student-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.student-heading h2 {
  margin-bottom: 3px;
}
.group-badge {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}
.status {
  text-align: right;
}
.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.pill {
  display: inline-block;
  padding: 8px 13px;
  border: 1px solid var(--ink);
  border-radius: 99px;
  background: var(--white);
  font-weight: 700;
}
.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.nav button,
.button {
  border: 1px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.nav button.active,
.button.primary {
  background: var(--ink);
  color: #fff;
}
.button.teal {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 22px;
}
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.panel h2 {
  font-family: "Noto Serif SC", "STSong", serif;
  margin: 0 0 14px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}
th {
  background: var(--ink);
  color: #fff;
  padding: 13px 10px;
  font-size: 14px;
}
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: center;
}
tbody tr:hover {
  background: #f3ecdc;
}
.level {
  text-align: left;
  font-weight: 700;
  border-left: 5px solid var(--c);
}
input,
select {
  width: 100%;
  min-width: 90px;
  padding: 10px;
  border: 1px solid #bbb4a8;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.number-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.035em;
}
input:focus {
  outline: 2px solid var(--gold);
  border-color: var(--gold);
}
input.is-invalid {
  border-color: var(--red);
  background: #fff4f1;
}
input.is-invalid:focus {
  outline-color: var(--red);
}
.input-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}
.input-hint.is-valid {
  color: var(--teal);
}
.input-hint.is-invalid {
  color: var(--red);
  font-weight: 700;
}
.computed {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
}
.metric {
  padding: 13px;
  border-top: 3px solid var(--c, var(--gold));
  background: #f6f1e6;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metric strong {
  display: block;
  font-size: 20px;
  margin-top: 4px;
}
.metric small {
  display: block;
  min-height: 17px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.metric.is-valid {
  border-top-color: var(--teal);
  background: #eef7f3;
}
.metric.is-valid small {
  color: var(--teal);
}
.metric.is-invalid {
  border-top-color: var(--red);
  background: #fff3ef;
}
.metric.is-invalid small {
  color: var(--red);
  font-weight: 700;
}
.validation-error-list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.8;
}
.charts {
  display: grid;
  gap: 18px;
}
.chart {
  min-height: 300px;
}
.chart canvas {
  width: 100%;
  height: 250px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.message {
  min-height: 24px;
  margin-top: 10px;
  color: var(--teal);
  font-weight: 700;
}
.teacher-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  align-items: end;
}
.teacher-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.progress {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.group-state {
  padding: 12px;
  background: #eee8db;
  border-top: 4px solid #aaa;
  text-align: center;
}
.group-state.done {
  border-color: var(--teal);
  background: #e6f2ed;
}
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.six-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.mini {
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.mini h3 {
  margin: 0 0 8px;
}
.mini canvas {
  width: 100%;
  height: 150px;
}
.empty {
  color: var(--muted);
  padding: 30px;
  text-align: center;
}
.login {
  max-width: 520px;
  margin: 50px auto;
}
.note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.compare-bar-canvas {
  height: 390px !important;
}
.contribution-rows {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.contribution-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 10px;
  row-gap: 7px;
  padding: 2px 0 10px;
  border-bottom: 1px solid #e7e1d5;
}
.contribution-row:last-child {
  border-bottom: 0;
}
.contribution-row > strong {
  grid-row: 1/3;
  align-self: start;
  padding-top: 6px;
  font-size: 13px;
}
.stack-track {
  display: flex;
  align-items: center;
  height: 28px;
  overflow: hidden;
  border-radius: 5px;
  background: #e8e3d9;
  box-shadow: inset 0 0 0 1px rgba(23, 50, 77, 0.08);
}
.stack-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 0;
  transition: filter 0.15s ease;
}
.stack-segment:hover {
  filter: brightness(0.9);
}
.stack-segment b {
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.stack-segment:nth-child(3) b {
  color: var(--ink);
  text-shadow: none;
}
.row-percentages {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 18px;
}
.row-percentages span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.row-percentages i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.row-percentages b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.contribution-row.is-empty .stack-track {
  justify-content: center;
  color: #827d74;
  font-size: 12px;
}
.teacher-tabs {
  display: flex;
  gap: 0;
  margin: 20px 0 14px;
  border-bottom: 2px solid var(--ink);
}
.teacher-tabs button {
  padding: 11px 18px;
  border: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.teacher-tabs button.active {
  background: var(--ink);
  color: #fff;
}
.teacher-tab-panel > .compare {
  margin-top: 0;
}
.teacher-summary {
  border-left: 5px solid var(--teal);
}
.explore1-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
  gap: 20px;
  margin-top: 20px;
}
.raw-tables {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.raw-table {
  min-width: 0;
  font-size: 12px;
}
.raw-table th,
.raw-table td {
  padding: 7px 5px;
}
.worksheet {
  border-top: 5px solid var(--teal);
}
.explore2-table {
  min-width: 1120px;
}
.explore2-table th:first-child {
  width: 60px;
}
.sentence-fields {
  min-width: 430px;
  text-align: left;
  line-height: 3.5;
}
.sentence-fields input {
  display: inline-block;
  width: 76px;
  min-width: 0;
  font-family: "JetBrains Mono", monospace;
}
.explore2-table td:nth-child(3) {
  min-width: 235px;
}
.explore2-table td:nth-child(3) select,
.explore2-table td:nth-child(3) input {
  display: inline-block;
  width: 46%;
}
.suffix-field {
  display: flex;
  align-items: center;
  gap: 7px;
}
.explore2-summary {
  min-width: 1280px;
  font-size: 12px;
}
.source-note {
  padding: 10px 14px;
  border-left: 4px solid var(--gold);
  background: #fff8df;
}
.stack-segment {
  border: 0;
  padding: 0;
  cursor: pointer;
}
.stack-segment::after {
  content: attr(data-tooltip);
  position: fixed;
  z-index: 20;
  display: none;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  pointer-events: none;
}
.stack-segment:hover::after,
.stack-segment:focus::after {
  display: block;
  transform: translate(8px, 24px);
}
.rule-effects,
.teacher-results {
  margin-top: 20px;
}
.teacher-tab-panel > .rule-effects {
  margin-top: 0;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}
.section-heading h2 {
  margin: 5px 0 0;
}
.rule-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}
.rule-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rule-legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}
.rule-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.rule-chart-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.rule-chart-card h3 {
  margin: 0 0 4px;
  font-family: "Noto Serif SC", "STSong", serif;
}
.rule-chart-card .note {
  margin: 0 0 10px;
}
.rule-chart-wide {
  grid-column: 1 / -1;
}
.rule-canvas-wrap {
  position: relative;
}
.rule-canvas-wrap canvas {
  width: 100%;
  height: 280px;
}
.rule-chart-wide canvas {
  height: 320px;
}
.rule-tooltip {
  position: absolute;
  z-index: 6;
  display: grid;
  gap: 3px;
  min-width: 164px;
  padding: 9px 11px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 8px 22px rgba(23, 50, 77, 0.16);
  color: var(--ink);
  font-size: 12px;
  pointer-events: none;
}
.rule-tooltip strong {
  font-size: 13px;
}
.hidden {
  display: none !important;
}
@media (max-width: 980px) {
  .grid,
  .compare,
  .rule-chart-grid,
  .group-picker-grid,
  .explore1-detail-grid {
    grid-template-columns: 1fr;
  }
  .rule-chart-wide {
    grid-column: auto;
  }
  .six-grid,
  .raw-tables {
    grid-template-columns: repeat(2, 1fr);
  }
  .top {
    grid-template-columns: 1fr;
  }
  .status {
    text-align: left;
  }
}
@media (max-width: 620px) {
  .shell {
    padding: 12px;
  }
  .metrics,
  .progress,
  .six-grid {
    grid-template-columns: 1fr 1fr;
  }
  .teacher-head {
    grid-template-columns: 1fr;
  }
  .section-heading {
    display: block;
  }
  .picker-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .picker-index {
    font-size: 18px;
  }
  .rule-legend {
    justify-content: flex-start;
    margin-top: 10px;
  }
  .rule-canvas-wrap canvas,
  .rule-chart-wide canvas {
    height: 250px;
  }
  .top h1 {
    font-size: 32px;
  }
}
