:root {
  --bg: #070711;
  --bg-2: #0d0c18;
  --panel: rgba(24, 23, 36, 0.88);
  --panel-2: rgba(31, 30, 47, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(153, 122, 255, 0.45);
  --text: #eef0ff;
  --muted: #8f94ad;
  --soft: #b9bdd2;
  --purple: #8b5cf6;
  --purple-2: #6d5dfc;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family:
    "Avenir Next", "Helvetica Neue", Arial, "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  line-height: 1.58;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 22% 8%, rgba(139, 92, 246, 0.2), transparent 28%),
    radial-gradient(circle at 80% 28%, rgba(76, 97, 255, 0.13), transparent 30%),
    linear-gradient(135deg, #070711 0%, #0b0b16 48%, #080813 100%);
}

.bg-blob {
  position: fixed;
  inset: -30% auto auto 38%;
  width: 520px;
  height: 520px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.16), transparent 68%);
  filter: blur(8px);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin-top: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: rgba(9, 8, 20, 0.94);
  backdrop-filter: blur(18px);
}

.sidebar-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 24px 22px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  box-shadow: 0 14px 30px rgba(139, 92, 246, 0.28);
}

.sidebar-header strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.sidebar-header small,
.sidebar-progress span,
.sidebar-progress strong,
.section-header p,
.panel-head p,
.row-meta,
.answer-section p,
.risk-note p,
.match-item p,
.story-card p,
.story-card dd,
.knowledge-card span,
.mock-row em {
  color: var(--muted);
}

.nav-group {
  display: grid;
  gap: 8px;
  padding: 18px 10px;
}

.nav-button {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--soft);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

.nav-button.active {
  border-color: rgba(139, 92, 246, 0.28);
  background: rgba(139, 92, 246, 0.15);
  color: var(--text);
}

.nav-button.active::before {
  position: absolute;
  left: -11px;
  width: 3px;
  height: 26px;
  border-radius: 99px;
  background: var(--purple);
  content: "";
}

.nav-button strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button em {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}

.sidebar-progress {
  margin-top: auto;
  padding: 18px 22px 24px;
  border-top: 1px solid var(--line);
}

.progress-track {
  height: 7px;
  margin: 10px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), #22c55e);
}

.mobile-nav {
  display: none;
}

.workspace {
  position: relative;
  z-index: 1;
  width: min(100%, 1180px);
  min-width: 0;
  padding: 52px 34px 80px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.section-header {
  margin-bottom: 28px;
}

.section-header.with-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.section-header h1 {
  margin-bottom: 8px;
  color: var(--purple);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.section-header p {
  margin-bottom: 0;
  font-size: 17px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stats-grid article,
.card,
.question-list-panel,
.answer-card,
.story-card,
.knowledge-card,
.mock-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats-grid article {
  display: grid;
  min-height: 126px;
  place-items: center;
  padding: 22px;
  text-align: center;
}

.stats-grid span {
  font-size: 22px;
}

.stats-grid strong {
  color: var(--purple);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 26px;
}

.stats-grid small {
  color: var(--muted);
}

.card {
  margin-bottom: 24px;
  padding: 24px;
}

.card-head,
.panel-head,
.answer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.card-head h2,
.panel-head h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.match-chip,
.status-ok,
.status-warn {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.match-chip.warning,
.status-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--amber);
}

.match-board {
  display: grid;
  gap: 0;
}

.match-item {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.match-item:last-child {
  border-bottom: 0;
}

.match-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-content: start;
}

.match-title h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.match-title strong {
  color: var(--soft);
  font-size: 18px;
}

.match-title span {
  width: fit-content;
}

.match-item p {
  margin-bottom: 0;
}

.match-item b {
  color: var(--soft);
}

.weak-grid,
.story-grid,
.knowledge-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 18px;
}

.weak-card {
  display: grid;
  gap: 14px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.weak-card h3,
.story-card h2,
.knowledge-card h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.weak-card ul {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 18px;
  color: var(--soft);
}

.weak-card button,
.primary-button,
.secondary-button,
.toggle-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 850;
  transition:
    transform 170ms ease,
    border-color 170ms ease,
    background 170ms ease;
}

.weak-card button:hover,
.primary-button:hover,
.secondary-button:hover,
.toggle-button:hover,
.category-button:hover,
.question-card:hover,
.mock-row:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(139, 92, 246, 0.15);
}

.primary-button {
  border-color: rgba(139, 92, 246, 0.6);
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  box-shadow: 0 18px 42px rgba(139, 92, 246, 0.25);
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 180px;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.toolbar label {
  display: grid;
  gap: 7px;
}

.toolbar span,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

.toolbar option {
  background: #151422;
  color: var(--text);
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--line-strong);
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.category-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
}

.category-button.active {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.16);
  color: var(--text);
}

.category-button strong {
  margin-left: 6px;
  color: var(--purple);
}

.question-grid-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 20px 0 22px;
}

.question-grid-head span,
.question-grid-head strong {
  color: var(--muted);
  font-size: 15px;
}

.question-grid-head span {
  justify-self: end;
}

.question-grid-head strong {
  color: var(--soft);
}

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

.question-card,
.mock-row {
  display: grid;
  gap: 16px;
  align-content: start;
  width: 100%;
  min-height: 300px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.question-card.active {
  border-color: rgba(139, 92, 246, 0.66);
  background: rgba(139, 92, 246, 0.16);
}

.question-card.mastered {
  box-shadow: inset 0 -3px 0 rgba(34, 197, 94, 0.5);
}

.question-card.review {
  box-shadow: inset 0 -3px 0 rgba(245, 158, 11, 0.6);
}

.question-card strong,
.mock-row strong {
  font-size: 21px;
  line-height: 1.45;
}

.card-topline,
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-topline i,
.card-topline em {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
}

.card-topline i {
  background: rgba(139, 92, 246, 0.18);
  color: #b99cff;
}

.card-topline em {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.hint-title {
  margin-top: auto;
  color: var(--soft);
  font-weight: 850;
}

.question-card ul {
  display: grid;
  gap: 8px;
  min-height: 128px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.question-card li::marker {
  color: #a78bfa;
}

.card-foot {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.card-foot i {
  font-style: normal;
}

.card-foot b {
  color: #a78bfa;
}

.row-tags,
.memory-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-tags i,
.memory-strip span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
}

.answer-card {
  padding: 20px;
}

.answer-top h2 {
  margin: 6px 0 0;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.2;
}

.status-stack {
  display: grid;
  gap: 7px;
  justify-items: end;
}

.status-stack span,
.status-stack strong {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-stack strong {
  background: rgba(139, 92, 246, 0.16);
  color: var(--purple);
}

.formula-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(139, 92, 246, 0.32);
  border-radius: 13px;
  background: rgba(139, 92, 246, 0.12);
}

.formula-box span {
  color: var(--purple);
  font-size: 12px;
  font-weight: 900;
}

.formula-box p {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 850;
  line-height: 1.35;
}

.memory-strip {
  padding-top: 14px;
}

.answer-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.answer-section h3,
.risk-note strong {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 900;
}

.answer-section ol {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 22px;
  color: var(--soft);
}

.answer-section p {
  margin-bottom: 0;
}

.risk-note {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.08);
}

.risk-note strong {
  color: var(--amber);
}

.risk-note p {
  margin-bottom: 0;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.toggle-button.active {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.14);
  color: var(--green);
}

.story-grid {
  padding-top: 0;
}

.story-card,
.knowledge-card {
  padding: 22px;
}

.story-card dl {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 16px 0;
}

.story-card dt {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.18);
  color: var(--purple);
  font-weight: 900;
}

.punchline {
  margin: 0;
  padding: 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  font-weight: 750;
}

.knowledge-board {
  padding-top: 0;
}

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

.knowledge-card p {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.knowledge-card b {
  color: var(--text);
}

.mock-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.mock-row {
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 82px;
}

.mock-row span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  color: var(--purple);
  font-weight: 900;
}

.mock-row em {
  grid-column: 2;
  font-style: normal;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 26px;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(940px, 100%);
  max-height: min(88dvh, 980px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #171625;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.56);
}

.modal-close {
  position: sticky;
  top: 14px;
  right: 14px;
  z-index: 3;
  float: right;
  display: grid;
  width: 42px;
  height: 42px;
  margin: 14px 14px 0 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 26px;
}

body.modal-open {
  overflow: hidden;
}

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

  .sidebar {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(11, 10, 22, 0.92);
    backdrop-filter: blur(18px);
  }

  .mobile-nav .nav-button {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 52px;
    padding: 5px 4px;
    gap: 0;
  }

  .mobile-nav .nav-button::before,
  .mobile-nav .nav-button em {
    display: none;
  }

  .mobile-nav .nav-button strong {
    font-size: 11px;
  }

  .workspace {
    width: 100%;
    padding: 32px 16px 96px;
  }

  .match-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .section-header.with-actions,
  .card-head,
  .panel-head,
  .answer-top,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .weak-grid,
  .story-grid,
  .knowledge-board,
  .question-grid,
  .question-grid-head {
    grid-template-columns: 1fr;
  }

  .question-grid {
    gap: 16px;
  }

  .question-card {
    min-height: 280px;
    padding: 22px;
  }

  .question-grid-head span {
    justify-self: start;
  }

  .modal {
    padding: 10px;
    align-items: end;
  }

  .modal-card {
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }

  .section-header h1 {
    font-size: 32px;
  }

  .stats-grid article {
    min-height: 132px;
  }

  .formula-box p {
    font-size: 18px;
  }

  .status-stack {
    justify-items: start;
  }
}
