﻿* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1f2937;
  background: #f5f7fb;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid #dde3ec;
  padding: 14px 22px;
}

.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.page-subtitle {
  margin: 6px 0 0;
  color: #4b5563;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 52% 48%;
  min-height: calc(100vh - 92px);
}

.panel {
  background: #ffffff;
  border-right: 1px solid #e3e8f0;
  padding: 18px 20px;
  overflow: auto;
}

.panel:last-child {
  border-right: 0;
}

.section-title {
  margin: 4px 0 10px;
  font-size: 16px;
}

.passage p {
  line-height: 1.65;
  margin: 0 0 12px;
}

.passage .p-label {
  margin-top: 16px;
  font-weight: 700;
}

.question-block {
  margin: 0 0 24px;
  border: 1px solid #dce3ed;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.question-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.question-block p.note {
  margin: 0 0 10px;
  color: #4b5563;
  font-size: 13px;
}

.question-item {
  border: 1px solid #d7dde7;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  margin: 0 0 10px;
}

.question-item .q-number {
  font-weight: 700;
  margin: 0 0 6px;
}

.question-item .q-text {
  margin: 0 0 8px;
  line-height: 1.5;
}

.question-item .q-control {
  max-width: 360px;
}

.note-template {
  border: 1px solid #d7dde7;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.note-heading {
  margin: 10px 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.note-line {
  margin: 4px 0;
  line-height: 1.6;
  font-size: 16px;
}

.q-inline-number {
  font-weight: 800;
  color: #0f172a;
}

.inline-blank {
  display: inline-block;
  min-width: 130px;
  width: 180px;
  height: 30px;
  border: 1px solid #c4cfdd;
  border-radius: 6px;
  background: #f8fbff;
  padding: 2px 8px;
  vertical-align: middle;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c9d4e4;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fbff;
  font-size: 13px;
  cursor: pointer;
}

.decision-guide {
  margin: 8px 0 12px;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.decision-guide .row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: baseline;
  line-height: 1.6;
}

.decision-guide .label {
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

table.question-table td,
table.question-table th {
  border: 1px solid #d7dde7;
  padding: 8px;
  vertical-align: top;
  font-size: 14px;
}

table.question-table th {
  background: #f2f5fa;
  text-align: left;
}

/* Index pages: render table data as card grid */
body[data-page$="_index"] {
  background:
    radial-gradient(800px 360px at -10% -10%, #dff7f2 0%, transparent 55%),
    radial-gradient(760px 340px at 110% 0%, #e5f1ff 0%, transparent 52%),
    #f5f7fb;
}

body[data-page$="_index"] .page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

body[data-page$="_index"] main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
}

body[data-page$="_index"] table.question-table {
  border-collapse: separate;
  width: 100%;
}

body[data-page$="_index"] table.question-table thead {
  display: none;
}

body[data-page$="_index"] table.question-table tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

body[data-page$="_index"] table.question-table tr {
  display: block;
  background: #ffffff;
  border: 1px solid #d7e0ee;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  padding: 14px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

body[data-page$="_index"] table.question-table tr:hover {
  transform: translateY(-3px);
  border-color: #bfd3ff;
  box-shadow: 0 14px 30px rgba(30, 64, 175, 0.14);
}

body[data-page$="_index"] table.question-table td,
body[data-page$="_index"] table.question-table th {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
}

body[data-page$="_index"] table.question-table td:nth-child(1) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 10px;
}

body[data-page$="_index"] table.question-table td:nth-child(2) {
  font-size: 21px;
  line-height: 1.3;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
}

body[data-page$="_index"] table.question-table td:nth-child(4) {
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 12px;
  min-height: 35px;
}

body[data-page$="_index"] table.question-table td:nth-child(3) a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  font-size: 0;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

body[data-page$="_index"] table.question-table td:nth-child(3) a::before {
  content: "进入练习";
  font-size: 13px;
  line-height: 1;
}

body[data-page$="_index"] table.question-table td:nth-child(3) a:hover {
  filter: brightness(1.06);
}

select.answer-select,
input.answer-input,
input.answer-slot {
  width: 100%;
  height: 32px;
  border: 1px solid #c4cfdd;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 8px;
  font-size: 14px;
}

input.answer-slot {
  background: #f8fbff;
  font-weight: 700;
}

.inline-q {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.options-list {
  margin: 0;
  padding-left: 18px;
}

.options-list li {
  margin: 4px 0;
  line-height: 1.5;
}

.multi-pair {
  border: 1px dashed #c8d3e3;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.multi-pair .check-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  margin: 0 0 6px;
}

.multi-pair .result-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.diagram-wrap {
  border: 1px solid #d7dde7;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  margin: 0 0 12px;
}

.diagram-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
}

.page-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px 20px;
  border-top: 1px solid #e3e8f0;
  background: #ffffff;
}

/* Keep action buttons always visible on passage pages */
body:not([data-page$="_index"]) .page-nav {
  position: sticky;
  bottom: 0;
  z-index: 30;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.26);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  color: #1e3a8a;
  background: #eef4ff;
  border-color: #bfd3ff;
}

.btn-secondary:hover {
  background: #e4eeff;
}

.btn-submit {
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.28);
  border: 0;
  cursor: pointer;
}

.btn-submit:hover {
  filter: brightness(1.06);
}

.submit-result {
  margin: 0 0 12px;
  border: 1px solid #d7dde7;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #334155;
}

.submit-result.good {
  border-color: #86efac;
  background: #f0fdf4;
  color: #14532d;
}

.submit-result.warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.submit-result.bad {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.question-item.is-correct {
  border-color: #86efac;
  background: #f8fff9;
}

.question-item.is-wrong {
  border-color: #fca5a5;
  background: #fff9f9;
}

select.answer-correct,
input.answer-correct {
  border-color: #22c55e;
  background: #f0fdf4;
}

select.answer-wrong,
input.answer-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.radio-group label.choice-correct {
  border-color: #22c55e;
  background: #f0fdf4;
}

.radio-group label.choice-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.answer-feedback {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #16a34a;
}

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

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .panel {
    border-right: 0;
    border-bottom: 1px solid #e3e8f0;
    max-height: none;
  }
}

