:root {
  --bg: #f7faff;
  --surface: #ffffff;
  --surface2: #eef4ff;
  --text: #1f2d3d;
  --muted: #627189;
  --accent: #4a8dff;
  --accent2: #39c48d;
  --danger: #e45858;
  --radius: 12px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shadow: 0 10px 24px rgba(92, 128, 188, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(165deg, #f4f8ff 0%, #edf7ff 48%, #f7fbff 100%);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface2);
  color: #3367c7;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

@media (min-width: 900px) {
  .shell-wide {
    max-width: 960px;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid #e3ecfb;
}

.card + .card {
  margin-top: 1rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: #3e5a82;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type='text'],
input[type='password'],
input[type='tel'] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #d8e6ff;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 139, 253, 0.25);
}

.field {
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  border: 1px solid #d6e5ff;
  background: #f2f7ff;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.primary {
  background: linear-gradient(135deg, #5c97ff, #72b0ff);
  border-color: transparent;
  color: #fff;
}

.btn.success {
  background: linear-gradient(135deg, #38b97f, #58d3a0);
  border-color: transparent;
  color: #fff;
}

.btn.danger {
  background: #ffeef0;
  border-color: #f4b9c0;
  color: #c43f4f;
}

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

.err {
  background: #fff1f3;
  border: 1px solid #f5c3ca;
  color: #b64652;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.notice {
  background: #eef5ff;
  border: 1px solid #cfe0ff;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.timer-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin: 0 -1rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #dfebff;
}

.timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #5686cc;
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--surface2);
}

.case-block {
  background: #f6f9ff;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e3ecfb;
}

.case-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.case-bg {
  font-size: 0.95rem;
  color: #4d6485;
}

.q-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid #e3ecfb;
}

.q-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--surface2);
  font-size: 0.75rem;
}

.tag-practice {
  background: #e9fbf2;
  color: #259665;
}

.q-stem {
  margin-bottom: 0.85rem;
  word-break: break-word;
}

.q-stem img {
  max-width: 100%;
  height: auto;
}

.opts label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
}

.opts input {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.practice-actions {
  margin-top: 0.75rem;
}

.practice-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.practice-loading {
  background: #edf4ff;
}

.practice-correct {
  background: #ecfbf4;
  border: 1px solid #bceecf;
}

.practice-wrong {
  background: #fff3f4;
  border: 1px solid #f7c9ce;
}

.score-big {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.score-table th,
.score-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--surface2);
  text-align: left;
}

.review-wrong {
  margin-bottom: 1.25rem;
}

.review-correct-line {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
}

.review-correct-highlight {
  color: #4ade80;
  font-weight: 700;
  word-break: break-word;
}

.review-user-line {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.95rem;
}

.review-user-wrong {
  color: #f87171;
  font-weight: 600;
  word-break: break-word;
}

.review-options-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.review-options-list li.review-opt-correct {
  color: #4ade80;
  font-weight: 600;
}

.review-options-list li:not(.review-opt-correct) {
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.rules {
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.mt-20 {
  margin-top: 1.25rem;
}

.small-text {
  font-size: 0.8rem;
}

.text-right {
  text-align: right;
}

.mb-8 {
  margin-bottom: 0.5rem;
}

.sms-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.sms-row input[type='tel'] {
  flex: 1;
}

.sms-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface2);
}

.oauth-divider span {
  flex-shrink: 0;
}

.btn-wechat {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid #98e0be;
  background: linear-gradient(135deg, #39ba81 0%, #57d6a2 100%);
  color: #f0fdf4 !important;
  font-weight: 600;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.btn-wechat:hover {
  filter: brightness(1.06);
  text-decoration: none;
}

.stats-card {
  margin-bottom: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

@media (min-width: 520px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-block {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  border: 1px solid #e3ecfb;
}

.stat-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #93c5fd;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.88rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row .label {
  color: var(--muted);
}

.stat-row .val {
  font-weight: 600;
  text-align: right;
}

.stat-note {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.exam-score-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e3ecfb;
}

.exam-score-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4b77bd;
}

.exam-score-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.exam-score-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.5rem 0.35rem;
  border-bottom: 1px solid #edf3ff;
  font-size: 0.88rem;
}

.exam-score-item:last-child {
  border-bottom: none;
}

.exam-score-link {
  color: var(--accent);
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.exam-score-link:hover {
  text-decoration: underline;
}

.exam-score-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.exam-score-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.exam-score-num.score-pass,
.exam-score-tag.score-pass {
  color: #28a86f;
}

.exam-score-num.score-fail,
.exam-score-tag.score-fail {
  color: #d95a67;
}

.exam-score-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #f0f5ff;
}

.exam-score-tag.score-pass {
  background: #e8fbf2;
}

.exam-score-tag.score-fail {
  background: #fff1f3;
}
