:root {
  color: #1f2937;
  background: #f5f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: #f5f7fb; }
button, input { font: inherit; }
button { cursor: pointer; }
button:active { transform: scale(0.99); }

.screen { min-height: 100vh; background: #f5f7fb; }
.top-header {
  position: sticky; top: 0; z-index: 20; min-height: 57px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border-bottom: 1px solid #e5e7eb;
  background: rgba(255,255,255,.94); box-shadow: 0 1px 7px rgba(15,23,42,.05);
  backdrop-filter: blur(12px);
}
.header-left, .header-right { min-width: 0; display: flex; align-items: center; gap: 8px; }
.header-left strong { font-size: 18px; line-height: 1; }
.back-button {
  width: 36px; height: 36px; border: 0; border-radius: 999px;
  background: #f3f4f6; color: #4b5563; font-size: 30px; line-height: 30px;
}
.header-button {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
  background: #f3f4f6; color: #4b5563; font-size: 14px; font-weight: 800;
}
.header-button.danger { background: #fef2f2; color: #dc2626; }

.content { width: min(100%, 920px); margin: 0 auto; padding: 14px; }
.content.narrow { max-width: 720px; }
.content.wide { max-width: 940px; }

.hero-panel {
  min-height: 156px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 20px; border-radius: 14px; background: #2563eb; color: #fff;
  box-shadow: 0 10px 26px rgba(37,99,235,.22);
}
.eyebrow { display: block; margin-bottom: 8px; color: #dbeafe; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.hero-panel h1 { margin: 0; font-size: clamp(30px, 8vw, 46px); line-height: 1; }
.hero-panel p { margin: 10px 0 0; color: #e0ecff; font-size: 14px; font-weight: 700; }
.hero-button, .primary, .secondary { min-height: 44px; border-radius: 10px; font-weight: 900; }
.hero-button { flex: 0 0 auto; padding: 0 16px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.16); color: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stats-grid div, .nav-card, .subject-card, .mode-panel, .chapter-card, .question-card, .empty-card {
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; box-shadow: 0 3px 12px rgba(15,23,42,.05);
}
.stats-grid div { padding: 13px 12px; }
.stats-grid strong { display: block; font-size: 22px; line-height: 1; }
.stats-grid span { display: block; margin-top: 7px; color: #6b7280; font-size: 12px; font-weight: 800; }

.card-list { display: grid; gap: 10px; }
.nav-card, .subject-card { width: 100%; padding: 16px; border: 1px solid #e5e7eb; color: inherit; text-align: left; }
.nav-card { min-height: 82px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.nav-card strong, .subject-card strong, .mode-panel strong { display: block; color: #111827; font-size: 16px; }
.nav-card small, .subject-card small, .mode-panel small { display: block; margin-top: 5px; color: #6b7280; font-size: 13px; }
.nav-card em { color: #c4c9d2; font-size: 26px; font-style: normal; }
.card-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; font-weight: 900; }
.card-icon.blue { background: #eff6ff; color: #2563eb; }
.card-icon.green { background: #ecfdf5; color: #059669; }

.subject-main { display: flex; align-items: center; gap: 12px; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: #6b7280; font-size: 12px; font-weight: 800; }
.progress { height: 8px; overflow: hidden; margin-top: 7px; border-radius: 999px; background: #eef2f7; }
.progress.slim { height: 6px; margin: 0 14px 12px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: #2563eb; }

.mode-panel { padding: 14px; margin-bottom: 12px; }
.chapter-list { display: grid; gap: 10px; }
.chapter-card { overflow: hidden; }
.chapter-open {
  width: 100%; min-height: 92px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  padding: 14px; border: 0; background: #fff; color: inherit; text-align: left;
}
.chapter-title span {
  display: inline-flex; margin-bottom: 6px; padding: 3px 8px; border-radius: 999px;
  background: #eff6ff; color: #2563eb; font-size: 11px; font-weight: 900;
}
.chapter-title strong { display: block; color: #111827; font-size: 17px; line-height: 1.25; }
.chapter-title small { display: block; margin-top: 5px; color: #6b7280; font-size: 12px; line-height: 1.35; }
.chapter-meta { text-align: right; color: #6b7280; font-size: 12px; font-weight: 800; }
.chapter-meta span, .chapter-meta b { display: block; }
.chapter-meta b { margin-top: 6px; color: #2563eb; }
.mode-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 14px 14px; }
.mode-tabs button {
  min-height: 36px; border: 1px solid #e5e7eb; border-radius: 8px;
  background: #fff; color: #4b5563; font-size: 13px; font-weight: 900;
}
.mode-tabs button:hover { border-color: #bfdbfe; background: #eff6ff; color: #2563eb; }

.practice-content { max-width: 720px; }
.practice-topline { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: #6b7280; font-size: 13px; font-weight: 900; }
.question-card { padding: 18px; }
.question-meta { display: flex; justify-content: space-between; gap: 12px; color: #6b7280; font-size: 12px; font-weight: 900; }
.pill { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 999px; }
.pill.gray { background: #f3f4f6; color: #6b7280; }
.pill.green { background: #dcfce7; color: #15803d; }
.pill.red { background: #fee2e2; color: #b91c1c; }
.question-card h1 {
  min-height: 108px; margin: 24px 0; color: #111827;
  font-size: clamp(34px, 10vw, 56px); line-height: 1.08; overflow-wrap: anywhere;
}
.answer-box { display: block; }
.answer-box span { display: block; margin-bottom: 8px; color: #6b7280; font-size: 13px; font-weight: 900; }
.answer-box input {
  width: 100%; height: 56px; padding: 0 14px; border: 2px solid #d1d5db; border-radius: 10px;
  outline: none; background: #fff; color: #111827; font-size: 18px; font-weight: 800;
}
.answer-box input:focus { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.answer-box input.correct { border-color: #16a34a; }
.answer-box input.wrong { border-color: #dc2626; }
.answer-result {
  min-height: 44px; margin-top: 12px; display: flex; align-items: center; padding: 10px 12px;
  border-radius: 10px; background: #f9fafb; color: #4b5563; font-weight: 900; overflow-wrap: anywhere;
}
.answer-result.correct { background: #f0fdf4; color: #15803d; }
.answer-result.wrong { background: #fef2f2; color: #b91c1c; }

.bottom-actions {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px;
  padding: 12px 0 0; background: linear-gradient(180deg, rgba(245,247,251,0), #f5f7fb 28%);
}
.primary { border: 0; background: #2563eb; color: #fff; }
.secondary { border: 1px solid #d1d5db; background: #fff; color: #374151; }
.full { width: 100%; margin-top: 14px; }
.empty-card { padding: 22px; text-align: center; }

@media (max-width: 560px) {
  .content { padding: 10px; }
  .hero-panel { min-height: 150px; display: grid; align-items: end; }
  .hero-button { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-tabs, .bottom-actions { grid-template-columns: 1fr 1fr; }
  .primary { grid-column: 1 / -1; grid-row: 1; }
  .question-card h1 { min-height: 92px; }
}
