:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #65716f;
  --line: #dce5e2;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #d9f3ef;
  --accent: #b45309;
  --good: #16803c;
  --good-soft: #ddf7e7;
  --bad: #be123c;
  --bad-soft: #ffe4e6;
  --shadow: 0 18px 45px rgba(20, 38, 35, 0.08);
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #102522;
  color: #eef8f5;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f7c948;
  color: #102522;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #a9c8c2;
  font-size: 13px;
}

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

.nav-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: inherit;
  background: transparent;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  width: min(1180px, 100%);
  padding: 28px;
  min-width: 0;
}

.top-bar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.back-button,
.back-nav {
  color: var(--primary-dark);
}

.bank-select-page {
  min-height: 100vh;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 34px 22px;
  display: grid;
  align-content: center;
  gap: 22px;
}

.bank-select-hero {
  padding: 34px;
  border-radius: 8px;
  color: #f8fffd;
  background: linear-gradient(120deg, #102522, #0f766e);
  box-shadow: var(--shadow);
}

.bank-select-hero h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.08;
}

.bank-select-hero p:last-child {
  max-width: 680px;
  margin: 16px 0 0;
  color: #d6ebe7;
  line-height: 1.8;
}

.bank-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.bank-card {
  min-height: 190px;
  display: grid;
  gap: 10px;
  align-content: start;
  text-align: left;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.bank-card:hover {
  border-color: #9dd7cf;
  transform: translateY(-1px);
}

.bank-card-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.bank-card strong {
  font-size: 24px;
}

.bank-card em,
.bank-card i {
  font-style: normal;
  color: var(--muted);
  line-height: 1.6;
}

.hero {
  min-height: 230px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 34px;
  border-radius: 8px;
  color: #f8fffd;
  background:
    linear-gradient(120deg, rgba(16, 37, 34, 0.92), rgba(15, 118, 110, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='360' viewBox='0 0 900 360'%3E%3Crect width='900' height='360' fill='%230f766e'/%3E%3Cg fill='none' stroke='%23f7c948' stroke-opacity='.32' stroke-width='2'%3E%3Cpath d='M60 80h260M60 132h330M60 184h210M520 74h260M520 126h310M520 178h240M126 260h650'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.14'%3E%3Crect x='70' y='222' width='150' height='48' rx='6'/%3E%3Crect x='240' y='222' width='150' height='48' rx='6'/%3E%3Crect x='410' y='222' width='150' height='48' rx='6'/%3E%3Crect x='580' y='222' width='150' height='48' rx='6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: #f7c948;
  font-size: 14px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.05;
}

.hero-copy {
  max-width: 640px;
  margin: 16px 0 0;
  color: #d6ebe7;
  line-height: 1.8;
}

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

.primary,
.secondary,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

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

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #fff;
  color: var(--primary-dark);
  border-color: var(--line);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger {
  color: var(--bad);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric {
  padding: 18px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.metric span,
.compact-question span,
.source,
.question-footer,
.filter-count,
.chapter-card span,
.section-head p {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 26px 0 14px;
}

.section-head p {
  margin: 8px 0 0;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.chapter-card,
.compact-question {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  box-shadow: 0 8px 20px rgba(20, 38, 35, 0.04);
}

.chapter-card {
  min-height: 132px;
  padding: 16px;
}

.chapter-card strong,
.chapter-card span {
  display: block;
}

.chapter-card strong {
  min-height: 48px;
  margin: 10px 0;
  line-height: 1.45;
}

.chapter-card i,
.progress-line i,
.mini-bar i {
  display: block;
  height: 100%;
  background: var(--primary);
}

.chapter-card i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
}

.chapter-index {
  color: var(--accent);
  font-weight: 800;
}

.recent-list {
  margin-top: 26px;
}

.practice-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.filter-panel {
  position: sticky;
  top: 28px;
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}

.filter-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  min-width: 0;
}

select,
input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--text);
}

.question-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.question-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 6px 8px 0;
  padding: 0 10px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.tag.muted {
  background: #f2f5f4;
  color: var(--muted);
}

.star {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 42px;
  height: 38px;
  background: #fff;
  color: var(--accent);
  font-size: 22px;
}

.star.active {
  background: #fff7df;
  border-color: #f0cf7a;
}

.progress-line {
  height: 5px;
  margin: 10px 0 22px;
  border-radius: 999px;
  background: #edf2f0;
  overflow: hidden;
}

.question-stem {
  font-size: 18px;
  line-height: 1.85;
}

.question-stem p,
.answer-panel p {
  margin: 0 0 10px;
}

.choices {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

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

.choice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.choice span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  border-radius: 7px;
  background: #eef3f2;
  color: var(--primary-dark);
  font-weight: 900;
}

.choice b {
  line-height: 1.7;
  font-weight: 600;
}

.choice.picked {
  border-color: var(--primary);
  background: #f2fbf9;
}

.choice.correct {
  border-color: #78c998;
  background: var(--good-soft);
}

.choice.wrong {
  border-color: #f0a2b5;
  background: var(--bad-soft);
}

.actions {
  margin-top: 18px;
}

.question-actions {
  align-items: stretch;
}

.question-actions > button {
  min-width: 112px;
}

.hint,
.answer-panel,
.empty {
  margin-top: 18px;
  border-radius: 8px;
  padding: 16px;
}

.hint {
  background: #f6f1e8;
  color: #73510d;
}

.hint.warning {
  background: #fff4e6;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.answer-panel {
  background: #f7faf9;
  border: 1px solid var(--line);
}

.answer-panel.ok {
  border-color: #9bd8b2;
  background: var(--good-soft);
}

.answer-panel.bad {
  border-color: #f0a2b5;
  background: var(--bad-soft);
}

.answer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 800;
}

.explain,
.answer-text {
  line-height: 1.85;
}

.answer-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 12px 0 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.answer-table {
  min-width: min(680px, 100%);
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.answer-table.compact {
  min-width: min(460px, 100%);
}

.answer-table.wide {
  min-width: 760px;
}

.answer-table th,
.answer-table td {
  white-space: normal;
  vertical-align: top;
  line-height: 1.65;
  word-break: break-word;
}

.answer-table th {
  color: var(--text);
  font-weight: 800;
}

.question-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 7px;
  max-height: 156px;
  margin-top: 18px;
  padding: 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.question-number {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.question-number.done {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #9dd7cf;
}

.question-number.has-wrong {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: #f2a4b5;
}

.question-number.current {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}

.access-gate {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

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

.gate-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 8px;
  background: #fff4cf;
  color: #8a4b0f;
  font-size: 24px;
  font-weight: 900;
}

.gate-card h1 {
  font-size: 28px;
  line-height: 1.25;
}

.gate-card p {
  margin: 12px auto 18px;
  color: var(--muted);
  line-height: 1.7;
}

.buy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-bottom: 14px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff7df;
  color: #8a4b0f;
  border: 1px solid #f0cf7a;
  font-weight: 800;
  text-decoration: none;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.password-error {
  margin-top: 10px;
  color: var(--bad);
  font-weight: 700;
}

.purchase-done,
.purchase-required {
  margin: 0 auto 12px;
  font-size: 13px;
  font-weight: 700;
}

.purchase-done {
  color: var(--good);
}

.purchase-required {
  color: var(--accent);
}

.book-note {
  grid-column: 1 / -1;
  padding: 12px;
  border-radius: 8px;
  background: #f6f1e8;
  color: #73510d;
  line-height: 1.6;
  font-size: 13px;
}

.review-list {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.review-block {
  min-width: 0;
}

.question-area,
.answer-panel,
.answer-text,
.explain {
  min-width: 0;
}

.compact-question {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  padding: 14px;
}

.compact-question strong {
  line-height: 1.55;
}

.compact-question em {
  color: var(--accent);
  font-style: normal;
  font-size: 13px;
}

.empty {
  background: #fff;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.empty.large {
  min-height: 260px;
  display: grid;
  place-items: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f7faf9;
  font-size: 14px;
}

.mini-bar {
  width: 140px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

.calculator-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(15, 118, 110, 0.28);
}

.calculator-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: min(340px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(20, 38, 35, 0.2);
}

.calculator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.calculator-head strong {
  font-size: 14px;
}

.calculator-close {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.calculator-input {
  height: 34px;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.calculator-result {
  min-height: 22px;
  padding: 3px 2px 5px;
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 900;
  text-align: right;
  word-break: break-all;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  grid-auto-flow: row;
}

.calculator-grid button {
  aspect-ratio: auto;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf9;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.calculator-tool {
  background: #eef3f2;
  color: var(--primary-dark);
}

.calculator-operator,
.calculator-equals {
  background: var(--primary);
  color: #fff;
}

.calculator-zero {
  grid-column: span 2;
}

.bottom-nav {
  display: none;
}

@media (max-width: 880px) {
  .app-shell {
    display: block;
    padding-bottom: 70px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .top-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -2px 0 10px;
    padding: 6px 0;
    background: rgba(244, 247, 246, 0.96);
  }

  .back-button {
    width: 100%;
    min-height: 40px;
    background: #fff;
  }

  .hero {
    min-height: 250px;
    display: grid;
    align-items: end;
    padding: 22px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .hero-copy {
    line-height: 1.65;
  }

  .metric-grid,
  .practice-layout {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .filter-panel label {
    font-size: 12px;
  }

  .filter-panel label:last-of-type,
  .filter-count {
    grid-column: 1 / -1;
  }

  .section-head,
  .answer-head,
  .question-top {
    display: grid;
  }

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

  .question-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .question-actions > button {
    min-width: 0;
    padding: 0 8px;
    white-space: nowrap;
  }

  .question-actions .action-redo {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
  }

  .bottom-nav .nav-button {
    text-align: center;
    color: var(--muted);
  }

  .bottom-nav .nav-button.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
  }

  .calculator-fab {
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .calculator-panel {
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    max-width: 360px;
    padding: 8px;
  }

  .calculator-grid {
    gap: 5px;
  }

  .calculator-grid button {
    min-height: 30px;
    font-size: 13px;
  }

  .gate-card {
    padding: 22px;
  }

  .gate-card h1 {
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  .bank-select-page {
    padding: 18px 14px;
    align-content: start;
  }

  .bank-select-hero {
    padding: 24px 18px;
  }

  .bank-card-grid {
    grid-template-columns: 1fr;
  }

  .bank-card {
    min-height: 150px;
    padding: 20px;
  }

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

  .metric {
    padding: 14px;
  }

  .metric strong {
    font-size: 24px;
  }

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

  .chapter-card {
    min-height: 112px;
  }

  .question-card {
    padding: 14px;
    box-shadow: 0 10px 26px rgba(20, 38, 35, 0.07);
  }

  .question-nav-grid {
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 6px;
    max-height: 142px;
    padding: 10px;
  }

  .question-number {
    font-size: 11px;
    border-radius: 5px;
  }

  .question-stem {
    font-size: 16px;
    line-height: 1.75;
  }

  .choice {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
  }

  .choice span {
    width: 30px;
    height: 28px;
  }

  .actions > button {
    flex: 1 1 42%;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

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

  .answer-table {
    font-size: 13px;
  }

  .answer-table.wide {
    min-width: 720px;
  }

  th,
  td {
    padding: 10px;
  }
}
