:root {
  --bg: #f6f8f7;
  --panel: #ffffff;
  --panel-soft: #f0f5f3;
  --line: #d9e2df;
  --text: #18201e;
  --muted: #63706c;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --accent-soft: #d9f0ec;
  --ok: #198754;
  --ok-soft: #dff3e8;
  --warn: #b7791f;
  --warn-soft: #fff0cf;
  --bad: #b42318;
  --bad-soft: #fbe3df;
  --blue: #22577a;
  --blue-soft: #e4eef4;
  --shadow: 0 14px 34px rgba(28, 41, 37, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: 64px calc(100vh - 64px);
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar,
.answer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar {
  min-width: 0;
}

.cultivation-card {
  width: min(340px, 32vw);
  min-width: 250px;
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.cultivation-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.46) 42%, transparent 62%);
  transform: translateX(-120%);
  pointer-events: none;
}

.cultivation-card.active::after {
  animation: none;
}

.cultivation-orb {
  display: none;
}

@keyframes cultivationSweep {
  0%,
  48% {
    transform: translateX(-120%);
  }

  78%,
  100% {
    transform: translateX(120%);
  }
}

.cultivation-main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1px;
}

.cultivation-main span,
.cultivation-row em,
.cultivation-row small {
  font-style: normal;
  font-size: 11px;
}

.cultivation-main span,
.cultivation-row small {
  color: var(--muted);
}

.cultivation-main strong {
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.cultivation-progress {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.cultivation-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cultivation-row em,
.cultivation-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cultivation-row em {
  color: var(--text);
  font-weight: 700;
}

.cultivation-meter {
  height: 4px;
  border-radius: 999px;
  background: #dfeae6;
  overflow: hidden;
  box-shadow: none;
}

.cultivation-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: none;
  transition: width 0.22s ease;
}

.icon-button,
.text-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  height: 34px;
  white-space: nowrap;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.sync-button {
  position: relative;
}

.sync-dot {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #aab6b2;
}

.sync-dot.ready {
  background: var(--blue);
}

.sync-dot.syncing {
  background: var(--warn);
}

.sync-dot.ok {
  background: var(--ok);
}

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

.text-button {
  padding: 0 12px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
}

.icon-button:hover,
.text-button:hover {
  border-color: #b7c7c1;
  background: #f9fbfa;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.icon-button svg,
.text-button svg,
.primary-button svg,
.search-box svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.sidebar,
.workspace,
.right-work,
.rubric-pane {
  overflow: hidden;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.filter-row {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.search-box {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-box input,
.filter-row select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.filter-row select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.question-list {
  overflow: auto;
  padding: 6px;
}

.question-group-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin: 5px 2px 3px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
}

.question-group-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.question-group-header span {
  flex: 0 0 auto;
  font-size: 11px;
}

.question-item {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--text);
}

.question-item:hover {
  background: var(--panel-soft);
}

.question-item.active {
  border-color: #a8d7cf;
  background: var(--accent-soft);
}

.question-item.wrong {
  box-shadow: inset 3px 0 0 var(--bad);
}

.question-item.mastered {
  box-shadow: inset 3px 0 0 var(--ok);
}

.question-item.answered {
  box-shadow: inset 3px 0 0 var(--blue);
}

.question-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef3f1;
  color: #40504b;
  font-size: 12px;
  font-weight: 800;
}

.question-brief {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.question-brief strong {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-brief em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-state {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.question-state small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef3f1;
  color: #4c5b57;
  font-size: 12px;
}

.progress-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef1f0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.progress-badge.wrong {
  background: var(--bad-soft);
  color: var(--bad);
}

.progress-badge.mastered {
  background: var(--ok-soft);
  color: var(--ok);
}

.progress-badge.answered {
  background: var(--blue-soft);
  color: var(--blue);
}

.workspace {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(540px, 3fr) minmax(360px, 2fr);
  grid-template-rows: 1fr;
  gap: 12px;
  padding: 14px;
  min-height: 0;
}

.question-pane,
.answer-pane,
.rubric-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.question-pane {
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.meta-line {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.question-pane h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.45;
}

.prompt {
  line-height: 1.75;
  white-space: pre-wrap;
}

.requirement-panel {
  margin-top: 10px;
  border: 1px solid #cfe1dc;
  border-radius: 8px;
  background: #f7faf9;
  padding: 9px 10px;
  display: grid;
  gap: 6px;
}

.requirement-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.requirement-head strong {
  font-size: 13px;
}

.requirement-tags {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.requirement-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  max-width: 150px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 1px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.requirement-panel p,
.requirement-panel ul {
  margin: 0;
  color: #3d4b47;
  line-height: 1.65;
}

.requirement-panel ul {
  padding-left: 18px;
}

.requirement-panel li {
  margin: 2px 0;
}

.material-pane {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 260px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #f4f8f6;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.material-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tool-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid #e1e9e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.tool-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.font-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.font-stepper .mini-icon-button {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
}

.font-stepper span {
  min-width: 34px;
  color: var(--text);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.pen-button,
.mini-icon-button {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.pen-button {
  position: relative;
  padding: 0;
}

.pen-button::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 4px;
}

.pen-button[data-pen="yellow"]::after {
  background: #ffe66d;
}

.pen-button[data-pen="green"]::after {
  background: #9be7b6;
}

.pen-button[data-pen="blue"]::after {
  background: #9fd3ff;
}

.pen-button[data-pen="pink"]::after {
  background: #ffb3cf;
}

.pen-button.active,
.mini-icon-button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.mini-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.mini-icon-button svg {
  width: 15px;
  height: 15px;
}

.material-content {
  margin: 0;
  flex: 1;
  max-height: none;
  overflow: auto;
  padding: 14px 15px;
  line-height: 1.88;
  font-family: inherit;
  font-size: var(--material-font-size, 15px);
  user-select: text;
}

.material-content.erase-mode {
  cursor: cell;
}

.material-paragraph {
  margin: 0 0 12px;
  text-indent: 2em;
  white-space: pre-wrap;
}

.material-paragraph:last-child {
  margin-bottom: 0;
}

.material-text {
  white-space: pre-wrap;
}

.material-mark {
  border-radius: 3px;
  padding: 1px 0;
}

.material-mark.yellow {
  background: rgba(255, 230, 109, 0.78);
}

.material-mark.green {
  background: rgba(155, 231, 182, 0.78);
}

.material-mark.blue {
  background: rgba(159, 211, 255, 0.82);
}

.material-mark.pink {
  background: rgba(255, 179, 207, 0.82);
}

.material-focus {
  border-radius: 4px;
  padding: 1px 0;
  outline: 2px solid var(--accent);
  background: rgba(217, 240, 236, 0.92);
  scroll-margin: 120px;
}

.material-focus.full {
  outline-color: var(--ok);
  background: rgba(223, 243, 232, 0.96);
}

.material-focus.partial {
  outline-color: var(--warn);
  background: rgba(255, 240, 207, 0.96);
}

.material-focus.miss {
  outline-color: var(--bad);
  background: rgba(251, 227, 223, 0.96);
}

.model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.model-grid div,
.reference-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.model-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.model-grid p {
  margin: 0;
  line-height: 1.6;
}

.reference-pane {
  margin-top: 12px;
}

.reference-pane h3,
.pane-head h3 {
  margin: 0;
  font-size: 15px;
}

.reference-pane pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: inherit;
  max-height: 260px;
  overflow: auto;
}

.hidden {
  display: none;
}

.answer-pane {
  padding: 12px;
  display: grid;
  grid-template-rows: 34px minmax(300px, 1fr) auto auto auto;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.right-work {
  display: grid;
  grid-template-rows: minmax(420px, 1.45fr) minmax(180px, 0.55fr);
  gap: 12px;
  min-height: 0;
}

.right-work.reviewing {
  grid-template-rows: minmax(360px, 1.25fr) minmax(300px, 0.75fr);
}

.right-work.reviewing .answer-pane {
  grid-template-rows: 34px minmax(240px, 1fr) auto auto auto;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.answer-editor {
  position: relative;
  min-height: 0;
}

textarea {
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 12px 42px;
  outline: 0;
  line-height: 1.75;
  color: var(--text);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.answer-counter {
  position: absolute;
  right: 10px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 20px);
  min-height: 28px;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(28, 41, 37, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.answer-counter span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.answer-counter em,
.answer-counter strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-weight: 400;
}

.answer-counter strong {
  color: var(--accent-strong);
}

.answer-counter.over-limit {
  border-color: #efb4ad;
  background: #fff7f6;
}

.answer-counter.over-limit span,
.answer-counter.over-limit em,
.answer-counter.over-limit strong {
  color: var(--bad);
}

.answer-counter.under-limit {
  border-color: #efd18c;
  background: #fffaf0;
}

.answer-counter.under-limit span,
.answer-counter.under-limit em,
.answer-counter.under-limit strong {
  color: var(--warn);
}

.answer-counter.no-limit strong {
  display: none;
}

.score-strip {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  min-height: 0;
}

.score-box {
  border-radius: 8px;
  border: 1px solid #c8dcd6;
  background: #f7faf9;
  color: var(--accent-strong);
  padding: 6px 9px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score-box span,
.score-box em {
  display: block;
  font-style: normal;
  opacity: 0.86;
  font-size: 12px;
}

.score-box strong {
  display: inline-block;
  font-size: 22px;
  line-height: 1.1;
  margin-right: 4px;
}

.score-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.score-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 7px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score-stats span {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.score-stats em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.score-stats div.over-limit {
  border-color: #efb4ad;
  background: #fff7f6;
}

.score-stats div.over-limit span,
.score-stats div.over-limit em {
  color: var(--bad);
}

.score-stats div.under-limit {
  border-color: #efd18c;
  background: #fffaf0;
}

.score-stats div.under-limit span,
.score-stats div.under-limit em {
  color: var(--warn);
}

.word-meter {
  width: 100%;
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: #e7eeee;
  overflow: hidden;
}

.word-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.16s ease;
}

.over-limit .word-meter span {
  background: var(--bad);
}

.under-limit .word-meter span {
  background: var(--warn);
}

#wordLimitDelta {
  display: block;
  min-height: 14px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-stats div.over-limit #wordLimitDelta {
  color: var(--bad);
}

.score-stats div.under-limit #wordLimitDelta {
  color: var(--warn);
}

.score-stats div.no-limit .word-meter,
.score-stats div.no-limit #wordLimitDelta {
  display: none;
}

.battle-result {
  position: relative;
  border: 1px solid #cfe1dc;
  border-radius: 8px;
  background: #fbfcfc;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 10px;
  overflow: hidden;
  box-shadow: inset 3px 0 0 var(--accent);
}

.battle-result.hidden {
  display: none;
}

.battle-result.mastered {
  border-color: #b9d9bf;
  box-shadow: inset 3px 0 0 var(--ok);
}

.battle-result.passed {
  border-color: #bfd4e2;
  box-shadow: inset 3px 0 0 var(--blue);
}

.battle-result.weak {
  border-color: #efd18c;
  box-shadow: inset 3px 0 0 var(--warn);
}

.battle-result.wrong {
  border-color: #efb4ad;
  box-shadow: inset 3px 0 0 var(--bad);
}

.battle-emblem {
  display: none;
}

.battle-emblem svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.3;
}

.battle-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.battle-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.battle-head span {
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fff8da;
  color: #8a5b08;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.star-row {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-right: 5px;
}

.star-row span {
  padding: 0;
  min-height: 0;
  background: transparent;
  color: #c9d1cf;
  font-size: 13px;
  line-height: 1;
}

.star-row span.filled {
  color: #d3a137;
  text-shadow: 0 0 8px rgba(211, 161, 55, 0.34);
}

.battle-head span em {
  font-style: normal;
}

.battle-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.battle-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  padding: 5px 7px;
}

.battle-grid span,
.battle-result p {
  color: var(--muted);
  font-size: 12px;
}

.battle-grid span {
  display: block;
}

.battle-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
}

.battle-rewards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.battle-rewards span {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eef3f1;
  color: #40504b;
  font-size: 12px;
  font-weight: 700;
}

.battle-result.mastered .battle-rewards span {
  background: var(--ok-soft);
  color: var(--ok);
}

.battle-result.wrong .battle-rewards span {
  background: var(--bad-soft);
  color: var(--bad);
}

.battle-result p {
  grid-column: 1 / -1;
  margin: 0;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attempt-history {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 7px;
  background: #fbfcfc;
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr);
  overflow: hidden;
  max-height: 150px;
}

.attempt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.attempt-title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.attempt-head h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attempt-title span {
  min-width: 36px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef3f1;
  color: #4c5b57;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.attempt-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 52px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 5px;
  font-size: 12px;
}

.attempt-toggle:hover:not(:disabled) {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.attempt-toggle:disabled {
  cursor: default;
  opacity: 0.45;
}

.attempt-toggle svg {
  width: 14px;
  height: 14px;
}

.attempt-history.collapsed {
  grid-template-rows: 24px;
  min-height: 38px;
}

.attempt-history.collapsed .attempt-list {
  display: none;
}

.attempt-list {
  min-height: 0;
  overflow: auto;
  padding: 2px 0 0;
  display: grid;
  gap: 3px;
  align-content: start;
}

.attempt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 5px 7px;
  border-left: 3px solid #c9d8d3;
  border-radius: 6px;
  background: #f7faf9;
}

.attempt-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.attempt-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.attempt-main strong {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.35;
}

.attempt-line span,
.attempt-main p,
.attempt-empty {
  color: var(--muted);
  font-size: 12px;
}

.attempt-line span,
.attempt-delta,
.attempt-main p {
  display: block;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attempt-delta {
  color: #4c5b57;
  font-size: 12px;
  font-weight: 700;
}

.attempt-delta.up {
  color: var(--ok);
}

.attempt-delta.down {
  color: var(--bad);
}

.attempt-delta.flat {
  color: var(--muted);
}

.attempt-main p {
  margin: 0;
}

.attempt-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.attempt-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.attempt-actions button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.attempt-actions svg {
  width: 14px;
  height: 14px;
}

.attempt-empty {
  padding: 7px 2px 0;
  text-align: left;
}

.rubric-pane {
  padding: 12px;
  display: grid;
  grid-template-rows: 34px auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-width: 54px;
  height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

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

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.rubric-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  padding: 8px 9px;
  display: grid;
  gap: 7px;
  box-shadow: inset 3px 0 0 var(--accent);
}

.rubric-summary.mastered {
  box-shadow: inset 3px 0 0 var(--ok);
}

.rubric-summary.passed {
  box-shadow: inset 3px 0 0 var(--blue);
}

.rubric-summary.weak {
  box-shadow: inset 3px 0 0 var(--warn);
}

.rubric-summary.wrong {
  box-shadow: inset 3px 0 0 var(--bad);
}

.rubric-summary.empty {
  color: var(--muted);
  box-shadow: inset 3px 0 0 #cbd7d3;
}

.rubric-summary-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.rubric-summary-main strong {
  color: var(--accent-strong);
  font-size: 16px;
  white-space: nowrap;
}

.rubric-summary-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.rubric-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.rubric-summary-stats span {
  min-width: 0;
  min-height: 24px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.rubric-summary-stats b {
  margin-right: 3px;
  color: var(--text);
}

.rubric-summary-compare {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rubric-summary-compare.up {
  color: var(--ok);
}

.rubric-summary-compare.down {
  color: var(--bad);
}

.rubric-summary-compare svg {
  width: 14px;
  height: 14px;
}

.review-panel {
  border: 1px solid #efd18c;
  border-radius: 8px;
  background: #fffaf0;
  padding: 6px 7px;
  display: grid;
  gap: 5px;
}

.review-panel.hidden {
  display: none;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.review-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.review-head strong {
  color: #70490a;
  font-size: 13px;
}

.review-head span {
  color: var(--warn);
  font-size: 12px;
}

.review-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  border: 1px solid #efd18c;
  border-radius: 6px;
  background: #fff;
  color: var(--warn);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.review-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.review-action svg {
  width: 13px;
  height: 13px;
}

.review-list {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
}

.review-item {
  flex: 0 0 190px;
  min-height: 30px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 2px 6px;
  align-items: center;
  border: 1px solid #efd18c;
  border-radius: 6px;
  background: #fff;
  padding: 4px 6px;
  text-align: left;
}

.review-item.miss {
  border-color: #efb4ad;
}

.review-item:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.review-item span,
.review-item em {
  font-size: 12px;
  font-style: normal;
}

.review-item span {
  color: var(--warn);
  font-weight: 800;
}

.review-item.miss span {
  color: var(--bad);
}

.review-item strong,
.review-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-item strong {
  color: var(--text);
  font-size: 12px;
}

.review-item em {
  display: none;
  grid-column: 2;
  color: var(--muted);
}

.rubric-list {
  overflow: auto;
  padding-right: 2px;
}

.point-card {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  padding: 8px 9px;
  margin-bottom: 7px;
}

.point-card.full {
  border-left-color: var(--ok);
}

.point-card.partial {
  border-left-color: var(--warn);
}

.point-card.miss {
  border-left-color: var(--bad);
}

.point-card.auto {
  border-left-color: var(--blue);
}

.point-card.focused {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.point-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.point-head h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.point-score {
  min-width: 64px;
  text-align: right;
  font-weight: 700;
}

.point-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
}

.status-pill.full {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.partial {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.miss {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-pill.auto {
  background: var(--blue-soft);
  color: var(--blue);
}

.revision-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: #eef3f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.revision-pill.up {
  background: var(--ok-soft);
  color: var(--ok);
}

.revision-pill.down {
  background: var(--bad-soft);
  color: var(--bad);
}

.locate-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 0 7px;
  font-size: 12px;
}

.locate-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

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

.locate-button svg {
  width: 13px;
  height: 13px;
}

.matched {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.point-compare {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.compare-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  border: 1px solid #e0e8e5;
  border-radius: 8px;
  background: #fbfcfc;
  padding: 5px 7px;
}

.compare-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.compare-row p {
  margin: 0;
  color: #2f3c38;
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.compare-row.mine {
  background: #f7faf9;
}

.compare-row.source {
  background: #fff;
}

.compare-row.gap.warn {
  border-color: #efd18c;
  background: #fffaf0;
}

.compare-row.gap.ok {
  border-color: #c9e5d4;
  background: #f1faf5;
}

.compare-row.gap.warn p {
  color: var(--warn);
}

.compare-row.gap.ok p {
  color: var(--ok);
}

.point-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 7px 0;
}

.point-actions button {
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.point-actions button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.details {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  display: grid;
  gap: 6px;
}

.details:not([open]) {
  border-top: 0;
  padding-top: 0;
}

.details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.details p {
  margin: 0;
  line-height: 1.55;
  color: #3d4845;
  font-size: 12px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 180px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1f2a27;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 28, 25, 0.38);
}

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

.sync-modal {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(18, 28, 25, 0.22);
  padding: 14px;
}

.sync-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sync-head h3 {
  margin: 0;
  font-size: 16px;
}

.sync-head p,
.sync-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sync-form {
  display: grid;
  gap: 9px;
}

.sync-form label {
  display: grid;
  gap: 5px;
}

.sync-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-form input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: 0;
  padding: 0 10px;
}

.sync-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.sync-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sync-meta {
  min-height: 20px;
  padding: 8px 9px;
  border-radius: 8px;
  background: #f7faf9;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: minmax(500px, 3fr) minmax(320px, 2fr);
  }

  .model-grid,
  .score-strip {
    grid-template-columns: 1fr;
  }

  .answer-pane {
    grid-template-rows: 34px minmax(270px, 1fr) auto auto auto;
  }

  .right-work {
    grid-template-rows: minmax(430px, 1.45fr) minmax(190px, 0.55fr);
  }

  .right-work.reviewing {
    grid-template-rows: minmax(350px, 1.2fr) minmax(290px, 0.8fr);
  }

  .right-work.reviewing .answer-pane {
    grid-template-rows: 34px minmax(230px, 1fr) auto auto auto;
  }

  .battle-result {
    grid-template-columns: 1fr;
  }

  .battle-rewards {
    justify-content: flex-start;
  }

}

@media (max-width: 960px) {
  body {
    min-width: 0;
  }

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

  .topbar {
    padding: 0 12px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .cultivation-card {
    min-width: 148px;
    width: 148px;
    grid-template-columns: 1fr;
    padding: 6px 9px;
  }

  .cultivation-orb {
    display: none;
  }

  .cultivation-progress {
    display: none;
  }

  .sidebar {
    grid-column: 1;
    grid-row: 2;
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 12px;
    overflow: visible;
  }

  .question-pane {
    min-height: 640px;
  }

  .right-work {
    grid-template-rows: auto minmax(480px, auto);
    overflow: visible;
  }

  .right-work.reviewing {
    grid-template-rows: auto minmax(480px, auto);
  }

  .answer-pane {
    grid-template-rows: auto 320px auto auto auto;
  }

  .right-work.reviewing .answer-pane {
    grid-template-rows: auto 320px auto auto auto;
  }

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

  .answer-actions {
    flex-wrap: wrap;
  }

  .rubric-pane {
    min-height: 520px;
  }

  .rubric-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .battle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .battle-result {
    padding-left: 9px;
  }

  .battle-rewards span {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .cultivation-card {
    display: none;
  }
}
