/* 提取自 LearnView.vue */
.learn-page {
  padding-top: 90px;
  min-height: 100vh;
}

.learn-shell {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 90px);
}

/* ============ 左侧 ============ */
.learn-side {
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 90px);
  position: sticky;
  top: 90px;
}

.side-head {
  padding: 30px 24px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-title { font-size: 30px; }

.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--bg);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.side-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon { color: var(--ink-faint); font-size: 16px; }

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
}

.side-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-select {
  padding: 9px 24px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 10px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

.side-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-label {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  padding: 14px 10px 6px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.side-item:hover { background: var(--accent-soft); }
.side-item.active { background: var(--accent); color: var(--accent-ink); }

.si-index {
  font-size: 10.5px;
  color: var(--ink-faint);
  width: 20px;
  flex-shrink: 0;
}

.side-item.active .si-index { color: var(--accent-ink); opacity: 0.7; }

.si-name {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.si-level { font-size: 9px; flex-shrink: 0; }

.lvl-beginner { color: #22c55e; }
.lvl-basic { color: var(--accent); }
.lvl-intermediate { color: var(--accent2); }
.lvl-advanced { color: #d32f2f; }

.side-item.active .si-level { color: var(--accent-ink); opacity: 0.8; }

.side-empty {
  padding: 30px 10px;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
}

/* ============ 右侧（撑满剩余屏幕宽度） ============ */
.learn-detail {
  padding: 40px clamp(28px, 4vw, 64px) 120px;
  width: 100%;
  min-width: 0;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 30px;
}

.detail-head .eyebrow { margin-bottom: 8px; }

.detail-title {
  font-size: clamp(28px, 3.6vw, 46px);
}

.detail-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dc-cat {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 14px;
}

/* ============ 模块区块 ============ */
.module-block {
  margin-bottom: 52px;
}

.mb-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 22px;
  margin-bottom: 18px;
}

.mb-num {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.14em;
}

.mb-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.enter-quiz-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.25s;
}

.enter-quiz-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 16px;
  max-width: 940px;
  box-shadow: 0 10px 30px rgba(6, 20, 27, 0.05);
}

/* 双子图并列时放宽：左右两张图需要更大宽度 */
.chart-card:has(.geo-wrap.has-sub) {
  max-width: 1240px;
}

.chart-soon {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-faint);
}

.chart-note {
  margin: 0 0 16px;
  padding: 12px 18px;
  border: 1px solid rgba(211, 47, 47, 0.4);
  border-radius: 12px;
  background: var(--fill-loss);
  color: #d32f2f;
  font-size: 13.5px;
  line-height: 1.7;
}

/* 关键数据 */
.key-data {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kd-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bg);
  transition: border-color 0.25s;
}

.kd-item:hover { border-color: var(--accent); }

.kd-value {
  font-size: 23px;
  color: var(--accent);
  line-height: 1.4;
}

.kd-unit {
  font-size: 12px;
  margin-left: 4px;
  color: var(--ink-faint);
}

.kd-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.7;
}


.kd-cls {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent2);
}

/* 参数与开关面板 */
.params-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  background: var(--bg-soft);
  margin-bottom: 18px;
}

.params-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.params-title {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
}

.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.param-label {
  font-size: 10.5px;
  color: var(--ink-soft);
}

.param-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.25s;
  font-family: inherit;
}

.param-input:focus { border-color: var(--accent); }
.param-input.invalid { border-color: #d32f2f; }

.param-error {
  font-size: 9.5px;
  color: #d32f2f;
}

.switch-hint {
  font-size: 10px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.reset-btn {
  padding: 7px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s;
}

.reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 情景开关网格 */
.switches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.switch-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}

.switch-label {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
  /* 优先一行完整显示；必须换行时用 balance 让两行均衡（第二行不短于第一行一半） */
  white-space: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.switch-select {
  padding: 8px 26px 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 8px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

.switch-field .param-input {
  grid-column: 1 / -1;
}

.switch-field .param-error,
.switch-field .switch-hint {
  grid-column: 1 / -1;
}

/* 开关 toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* 内容卡片 */
.content-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 28px;
  background: var(--bg);
}

.cb-body {
  font-size: 14.5px;
  line-height: 2;
  color: var(--ink);
}

/* 知识点：两列网格，利用宽屏 */
.know-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.know-item {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color 0.25s;
}

.know-item:hover { border-color: var(--accent); }

.know-num {
  color: var(--accent);
  font-size: 13px;
  flex-shrink: 0;
  padding-top: 3px;
}

.know-body { min-width: 0; }

.know-title {
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--ink);
}

/* 例题（信息收缩） */
.q-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.q-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 24px;
  background: var(--bg);
}

.q-head {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  margin-bottom: 10px;
}

.q-index {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.q-source {
  flex: 1;
  font-size: 11px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  font-size: 16px;
  transition: all 0.25s;
}

.q-toggle.open {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.q-text {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--ink);
}

.q-detail {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: qfade 0.35s ease;
}

@keyframes qfade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.q-sol-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.q-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.q-step {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink);
}

.q-step-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  margin-top: 3px;
}

.q-solution,
.q-answer {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.q-pitfalls {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--fill-loss);
}

.q-pitfalls .q-sol-label { color: #d32f2f; }

.q-sol-text {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink);
  margin: 0;
}

.detail-empty {
  text-align: center;
  padding: 120px 20px;
  color: var(--ink-faint);
}

@media (max-width: 900px) {
  .learn-shell {
    grid-template-columns: 1fr;
  }

  .learn-side {
    position: static;
    height: auto;
    max-height: 45vh;
    min-width: 0;
  }

  .learn-detail {
    padding: 28px 22px 90px;
  }

  .switches-grid {
    grid-template-columns: 1fr;
  }

  .key-data {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .know-grid {
    grid-template-columns: 1fr;
  }

  .q-source {
    max-width: 46vw;
  }
}

/* ModelChart */
/* ============ 语义颜色（word 文档规定：深蓝/深红/绿/橙/紫/灰） ============ */



.geo-wrap {
  display: flex;
  gap: 18px;
  align-items: stretch;
}

.geo-wrap:not(.has-sub) {
  flex-direction: row;
}

.geo-wrap:not(.has-sub) .model-chart {
  flex: 1;
  min-width: 0;
}

.geo-wrap.has-sub {
  flex-direction: column;
}

.model-chart {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg);
  border-radius: 14px;
}

/* 阴影图例 */
.chart-legend {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
  flex-shrink: 0;
  width: 190px;
}

.chart-legend.horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%;
  gap: 10px 26px;
  padding: 0 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
}

.legend-name {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
}

@media (max-width: 900px) {
  .geo-wrap:not(.has-sub) {
    flex-direction: column;
  }

  .chart-legend {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    gap: 8px 22px;
  }
}

/* ============ 博弈矩阵 ============ */
.matrix-wrap {
  background: var(--bg);
  border-radius: 14px;
  padding: 20px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  grid-template-rows: auto 1fr 1fr;
  gap: 8px;
  max-width: 620px;
  margin: 0 auto;
}

.mg-corner {
  border: none;
}

.mg-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 12.5px;
  color: var(--ink);
  text-align: center;
}

.mg-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 18px 10px;
  background: var(--bg);
  min-height: 78px;
  transition: all 0.25s;
}

.mg-cell.nash {
  background: var(--fill-trap);
  outline: 2px solid var(--c-gray);
  outline-offset: -2px;
}

.mg-cell.pareto {
  background: var(--fill-profit);
  outline: 2px solid var(--c-green);
  outline-offset: -2px;
}

.mg-cell.nash.pareto {
  outline: 2px dashed var(--c-gray);
}

.payoff {
  font-size: 17px;
  color: var(--ink);
  font-weight: 700;
}

.cell-tag {
  position: absolute;
  top: 4px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.cell-tag:first-of-type { left: 6px; }
.cell-tag:last-of-type { right: 6px; }

/* 博弈矩阵单元格内的箭头（必须加 .mg-cell 作用域——
   否则全局 .arrow 会把首页等所有按钮上的 ↗ 箭头变成绝对定位，与文字重叠） */
.mg-cell .arrow {
  position: absolute;
  font-size: 18px;
  color: var(--c-red);
  line-height: 1;
}

.mg-cell .arrow.down { right: 8px; bottom: 2px; }
.mg-cell .arrow.right { bottom: 2px; left: 50%; transform: translateX(-50%); }

.nash-note {
  margin-top: 14px;
  text-align: center;
}

.nash-badge {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

.nash-badge.none {
  background: var(--accent2-soft);
  color: var(--accent2);
}

.viol-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viol-item {
  font-size: 12px;
  color: #d32f2f;
}

.repeated-box {
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 14px 18px;
  background: var(--bg-soft);
}

.rb-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 6px;
}

.rb-line {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink);
}

/* ============ 循环流动图 ============ */
.circular-wrap {
  background: var(--bg);
  border-radius: 14px;
  padding: 10px;
}

.circular-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ============ 数量论 ============ */
.qty-wrap {
  background: var(--bg);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qty-table {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow-x: auto;
}

.qty-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
}

.qty-head-row {
  background: var(--bg-soft);
}

.qty-cell {
  padding: 10px 6px;
  font-size: 12px;
  color: var(--ink);
  text-align: center;
  border-right: 1px solid var(--line);
}

.qty-cell:last-child { border-right: none; }

.qty-in {
  color: var(--accent);
  font-weight: 700;
}

.qty-out {
  color: var(--accent2);
  font-weight: 700;
}

.qty-eq {
  text-align: center;
  font-size: clamp(24px, 3.5vw, 38px);
  letter-spacing: 0.05em;
}

.qty-eq2 {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.qty-sub {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ============ 全屏模式 ============ */
body.fs-locked {
  overflow: hidden;
}

.learn-detail.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: var(--bg);
  overflow-y: auto;
  padding: 26px clamp(20px, 3vw, 48px) 100px;
}

/* 内容容器：图表保持原尺寸、向左对齐 */
.learn-detail.fullscreen > * {
  max-width: 1680px;
  width: 100%;
  margin-left: 0;
  margin-right: auto;
}

/* 模块 01：图表（左，保持大小）+ 情景开关（中）+ 可修改参数（右），三列并列 */
.learn-detail.fullscreen .module-block:first-of-type {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px) minmax(0, 300px);
  gap: 18px 22px;
  align-items: start;
}

.learn-detail.fullscreen .module-block:first-of-type .mb-title {
  grid-column: 1 / -1;
}

.learn-detail.fullscreen .module-block:first-of-type .chart-card {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  max-width: none;
}

.learn-detail.fullscreen .module-block:first-of-type .key-data {
  grid-column: 1;
  grid-row: 3;
  margin-top: 6px;
}

.learn-detail.fullscreen .module-block:first-of-type .params-card {
  margin: 0;
  grid-row: 2;
}

.learn-detail.fullscreen .module-block:first-of-type .params-card.switch-card {
  grid-column: 2;
}

.learn-detail.fullscreen .module-block:first-of-type .params-card.param-card {
  grid-column: 3;
}

/* 只有一个面板时（没有基础参数或没有情景开关）跨中右两列 */
.learn-detail.fullscreen .module-block:first-of-type .params-card.solo {
  grid-column: 2 / span 2;
}

.learn-detail.fullscreen .module-block:first-of-type .params-card .params-grid,
.learn-detail.fullscreen .module-block:first-of-type .params-card .switches-grid {
  grid-template-columns: 1fr;
}

/* 退出按钮 */
.fs-exit {
  position: fixed;
  top: 18px;
  right: 26px;
  z-index: 6100;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s;
}

.fs-exit:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.fs-btn {
  margin-left: 8px;
}

@media (max-width: 1200px) {
  .learn-detail.fullscreen .module-block:first-of-type {
    grid-template-columns: 1fr;
  }

  .learn-detail.fullscreen .module-block:first-of-type .chart-card,
  .learn-detail.fullscreen .module-block:first-of-type .key-data,
  .learn-detail.fullscreen .module-block:first-of-type .params-card {
    grid-column: 1;
    grid-row: auto;
  }
}
