:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --ink: #172033;
  --muted: #607089;
  --line: #d7e1ea;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b7791f;
  --rose: #b42318;
  --shadow: 0 18px 42px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    "Segoe UI",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aab8c8;
}

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

button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

button.ghost {
  background: transparent;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

button:focus-visible,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.55;
}

h4 {
  margin-bottom: 8px;
  color: #334155;
  font-size: 14px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 251, 0.94);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-stats span,
.badge,
.keyword-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #38506b;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.top-stats button {
  min-height: 32px;
  padding: 0 10px;
}

.auth-shell {
  display: grid;
  place-items: start center;
  width: min(560px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.auth-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tabs button.active {
  border-color: var(--teal);
  background: rgba(15, 118, 110, 0.1);
  color: var(--teal);
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label span {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 56px;
  align-items: start;
}

.control-panel {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 14px;
}

.panel,
.empty-state,
.question-card,
.result-summary,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.compact-panel {
  box-shadow: none;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field > span {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.segmented,
.type-grid {
  display: grid;
  gap: 8px;
}

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

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

.segmented button,
.type-grid button {
  padding: 0 8px;
}

.segmented button.active,
.type-grid button.active {
  border-color: var(--teal);
  background: rgba(15, 118, 110, 0.1);
  color: var(--teal);
  font-weight: 700;
}

.full {
  width: 100%;
  margin-top: 10px;
}

.progress-line,
.paper-head,
.submit-row,
.result-summary,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-line strong {
  color: var(--teal);
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.2s ease;
}

.workspace {
  min-width: 0;
}

.empty-state {
  min-height: 320px;
  padding: 42px;
}

.paper,
.result-view {
  display: grid;
  gap: 14px;
}

.paper-head,
.submit-row,
.result-summary {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.paper-head h2,
.result-summary h2 {
  margin-bottom: 0;
}

.question-card,
.result-card {
  padding: 20px;
}

.question-card header,
.result-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  font-weight: 800;
}

.badge {
  margin-bottom: 8px;
}

.badge-choice {
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
}

.badge-judge {
  background: rgba(82, 82, 91, 0.12);
  color: #52525b;
}

.badge-fill {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.badge-short {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
}

.choice-list,
.judge-block,
.fill-block,
.short-block {
  display: grid;
  gap: 12px;
}

.choice-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

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

.choice-option span {
  line-height: 1.55;
}

.judge-statement {
  margin-bottom: 0;
  border-left: 4px solid var(--blue);
  background: #f3f7ff;
  padding: 14px;
  color: #23324a;
}

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

.fill-passage {
  margin-bottom: 2px;
  border-left: 4px solid var(--amber);
  background: #fffaf0;
  padding: 14px;
  color: #433d33;
}

.fill-input span {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-summary p {
  margin-bottom: 0;
}

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

.result-card.wrong {
  border-color: #f1b5ad;
}

.result-card header strong {
  color: var(--teal);
  font-size: 22px;
}

.result-card.wrong header strong {
  color: var(--rose);
}

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

.answer-grid section,
.reference,
.gpt-analysis {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.answer-grid p,
.reference p,
.gpt-analysis p {
  margin-bottom: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.reference,
.gpt-analysis {
  margin-top: 12px;
}

.gpt-analysis {
  border-color: rgba(15, 118, 110, 0.24);
  background: #f2fbf9;
}

.gpt-analysis.analysis-local {
  border-color: rgba(183, 121, 31, 0.28);
  background: #fffaf0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #172033;
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 18px 45px rgba(23, 32, 51, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

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

@media (max-width: 860px) {
  .topbar,
  .result-summary,
  .paper-head,
  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

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

  .control-panel {
    position: static;
  }

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

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

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1240px);
    margin-top: 14px;
  }

  .question-card,
  .result-card,
  .paper-head,
  .result-summary,
  .empty-state {
    padding: 16px;
  }

  .question-card header,
  .result-card header {
    grid-template-columns: 1fr;
  }
}
