:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #f0f5f1;
  --ink: #19211f;
  --muted: #66716d;
  --line: #dce4de;
  --line-strong: #c7d3cc;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --green: #4d7c0f;
  --amber: #b45309;
  --rose: #be123c;
  --charcoal: #26312e;
  --shadow: 0 18px 48px rgba(25, 33, 31, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(180, 83, 9, 0.06), transparent 38%),
    var(--bg);
}

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

button {
  cursor: pointer;
}

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

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), var(--amber));
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.35;
}

.login-copy,
.login-hint,
.muted {
  color: var(--muted);
}

.login-form,
.dialog-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-size: 13px;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 4px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
}

.topbar-actions,
.action-row,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.review-badge,
.status-pill,
.counter {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  color: var(--teal-dark);
  background: rgba(15, 118, 110, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(180, 83, 9, 0.2);
  border-radius: var(--radius);
  color: #53310d;
  background: #fff8ea;
}

.notice-banner span {
  color: #6e5638;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  grid-template-areas:
    "input result"
    "answer result";
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(25, 33, 31, 0.06);
}

.input-panel,
.answer-panel,
.result-panel {
  padding: 18px;
}

.input-panel {
  grid-area: input;
}

.answer-panel {
  grid-area: answer;
}

.result-panel {
  grid-area: result;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 12px;
  margin-bottom: 14px;
}

.meta-card {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.meta-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.meta-card strong {
  color: var(--charcoal);
  font-size: 16px;
}

.field-block {
  margin-top: 14px;
}

.textarea.compact {
  min-height: 96px;
}

.textarea.material {
  min-height: 260px;
}

.textarea.points {
  min-height: 178px;
}

.textarea.student {
  min-height: 210px;
}

.rubric-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.rubric-details summary {
  padding: 13px 14px;
  color: var(--charcoal);
  font-weight: 800;
  cursor: pointer;
}

.rubric-content {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.rubric-item {
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: var(--radius);
  background: #fff;
}

.rubric-item strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rubric-item ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.primary-button {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}

.secondary-button {
  color: var(--teal-dark);
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.08);
}

.ghost-button {
  color: var(--charcoal);
  border-color: var(--line-strong);
  background: #fff;
}

.danger-button {
  color: #fff;
  background: var(--rose);
}

.text-button {
  min-height: 34px;
  color: var(--teal-dark);
  background: transparent;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--charcoal);
  border-color: var(--line);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.text-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.empty-state,
.loading-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
}

.loading-state {
  gap: 14px;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(15, 118, 110, 0.16);
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: spin 780ms linear infinite;
}

.result-content {
  animation: resultIn 360ms ease both;
}

.score-summary {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #173f3b, #31523e 55%, #6f4b13);
}

.score-ring {
  width: 112px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(#f3c15c calc(var(--score-pct) * 1%), rgba(255, 255, 255, 0.22) 0);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #183f3b;
}

.score-number {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.score-number span {
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.score-number small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}

.score-summary h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.score-summary .muted {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
}

.result-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

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

.dimension-name {
  font-weight: 800;
}

.dimension-reason {
  grid-column: 2 / 4;
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  animation: barGrow 520ms ease forwards;
}

.dimension-score {
  color: var(--charcoal);
  font-weight: 900;
  text-align: right;
}

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

.coverage-column {
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.coverage-column h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.coverage-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.coverage-item:first-of-type {
  border-top: 0;
}

.coverage-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.coverage-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.clean-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clean-list li,
.suggestion-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  line-height: 1.65;
}

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

.suggestion-item span {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: rgba(15, 118, 110, 0.09);
  font-size: 12px;
  font-weight: 900;
}

.suggestion-item p {
  margin-bottom: 0;
}

.emphasized-block,
.teacher-block {
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius);
  background: rgba(15, 118, 110, 0.06);
}

.teacher-block {
  border-color: rgba(180, 83, 9, 0.2);
  background: #fff8ea;
}

.optimized-answer {
  margin-bottom: 0;
  line-height: 1.85;
}

.pulse-target {
  animation: pulseTarget 900ms ease;
}

.account-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.account-dialog::backdrop {
  background: rgba(25, 33, 31, 0.42);
}

.dialog-form {
  padding: 22px;
}

.dialog-tip {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes barGrow {
  to {
    width: var(--bar-width);
  }
}

@keyframes pulseTarget {
  0%,
  100% {
    box-shadow: none;
  }
  35% {
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "input"
      "answer"
      "result";
  }

  .result-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .notice-banner,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .meta-grid,
  .coverage-grid,
  .score-summary {
    grid-template-columns: 1fr;
  }

  .score-ring {
    margin: 0 auto;
  }

  .dimension-row {
    grid-template-columns: 1fr 56px;
  }

  .dimension-row .bar {
    grid-column: 1 / 3;
    order: 3;
  }

  .dimension-reason {
    grid-column: 1 / 3;
  }

  .action-row > button,
  .topbar-actions > button,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .review-badge,
  .status-pill,
  .counter {
    justify-content: center;
  }

  .login-panel {
    padding: 24px;
  }
}
