:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #102033;
  --muted: #66778f;
  --line: #dfe7f2;
  --soft: #f7f9fc;
  --blue: #2f7df6;
  --blue-soft: #eaf2ff;
  --green: #14885f;
  --green-soft: #eaf8f1;
  --red: #c23a3a;
  --red-soft: #fff0f0;
  --yellow: #fff2bb;
  --purple: #efe8ff;
  --shadow: 0 10px 28px rgba(35, 52, 78, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

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

button.ghost {
  color: var(--blue);
  background: var(--blue-soft);
}

button.danger {
  color: var(--red);
  background: var(--red-soft);
}

button.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 96px;
  padding: 10px;
  line-height: 1.55;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f6f9ff 0%, #eef6f1 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  margin-bottom: 22px;
}

.brand .eyebrow {
  margin-bottom: 6px;
}

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

.tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.logo {
  padding: 8px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.logo h2 {
  margin: 0;
  font-size: 19px;
}

.logo p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nav button {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.nav button.active {
  font-weight: 700;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
}

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

.content {
  padding: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.stat {
  display: grid;
  gap: 8px;
}

.stat strong {
  font-size: 28px;
}

.muted {
  color: var(--muted);
}

.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #cfe0ff;
  border-radius: 7px;
  color: #23559f;
  background: var(--blue-soft);
  line-height: 1.6;
}

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

.actions.compact {
  gap: 8px;
}

.actions.compact button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

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

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

.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.question-editor {
  display: grid;
  gap: 12px;
}

.question-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

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

.training-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
  height: calc(100vh - 76px);
  padding: 18px;
}

.passage-panel,
.question-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.passage-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.toolbox {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 64px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.toolbox span {
  color: var(--muted);
}

.passage {
  overflow: auto;
  padding: 28px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.68;
  white-space: pre-wrap;
}

.passage mark {
  padding: 2px 4px;
  border-radius: 4px;
}

.mark-word {
  background: var(--yellow);
}

.mark-component {
  background: var(--purple);
  border-bottom: 2px solid #8a5cf6;
}

.mark-evidence {
  background: #dff7eb;
  border-bottom: 2px solid var(--green);
}

.blank {
  color: var(--blue);
  text-decoration: underline;
}

.audio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.question-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.score {
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.questions {
  overflow: auto;
  padding: 12px;
}

.question-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.question-title strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.35;
}

.question-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.question-actions button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.option {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 10px 14px;
  text-align: left;
  border-radius: 7px;
  background: #fff;
}

.option.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.option.correct {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.option.wrong {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.analysis {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: 7px;
  color: #3d4d63;
  background: #f7f9fc;
  line-height: 1.6;
}

.analysis.show {
  display: block;
}

.evidence {
  margin-top: 10px;
  color: var(--green);
  font-size: 13px;
}

.training-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 32, 51, 0.35);
}

.modal-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16, 32, 51, 0.22);
}

.paper-modal {
  width: min(920px, 100%);
}

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

.paper-preview-image {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.paper-preview-frame {
  width: 100%;
  height: 62vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  line-height: 1.7;
}

.result-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.result-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .training-layout,
  .grid.two,
  .grid.three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .training-layout {
    height: auto;
  }

  .passage-panel,
  .question-panel {
    min-height: 520px;
  }
}

@media (max-width: 620px) {
  .topbar,
  .audio-bar,
  .training-footer {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .passage {
    padding: 20px;
    font-size: 19px;
  }
}
