/* 数据分析视图专用样式。
   公共部分（:root 变量、主题、头部 .app-header / .top-tabs / .brand / button 等）
   统一由 eq-simulator.css 提供，这里只保留数据分析视图独有的样式，并对
   与 EQ 仿真冲突的选择器（.chart-panel / canvas）加作用域，避免互相覆盖。 */

/* 合并页面：视图与操作组的显示切换 */
[hidden] {
  display: none !important;
}

body.readme-page {
  overflow: auto;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.lang-button:hover,
.lang-button.active {
  border-color: var(--blue);
  color: var(--blue);
}

/* 数据分析：导入文件按钮 */
.file-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.file-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

#fileInput {
  display: none;
}

/* 数据分析：工作区与图表 */
.workspace {
  display: block;
  min-height: calc(100vh - 46px);
  padding: 0;
}

.workspace .chart-panel {
  min-height: calc(100vh - 46px);
  border: 0;
  overflow: hidden;
  background: var(--surface);
}

#curveCanvas {
  display: block;
  width: 100%;
  height: calc(100vh - 46px);
  min-height: 520px;
  background: #ffffff;
  cursor: crosshair;
}

.dark-theme #curveCanvas {
  background: var(--chart-bg);
}

@media (max-width: 900px) {
  .app-header,
  .workspace {
    padding: 0;
  }
}

@media (max-width: 520px) {
  .header-actions {
    width: 100%;
  }

  .header-actions button,
  .file-button {
    flex: 1;
  }
}

/* README 网页版 */
.readme-shell {
  min-height: calc(100vh - 46px);
  background: #ffffff;
  padding: 22px 18px 48px;
}

.readme-content {
  width: min(1060px, 100%);
  margin: 0 auto;
  color: var(--text);
}

.readme-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  gap: 22px;
  align-items: center;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--line);
}

.readme-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
}

.readme-hero h1 {
  margin: 0 0 14px;
  font-size: 34px;
  line-height: 1.14;
  letter-spacing: 0;
}

.readme-hero p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.readme-hero img,
.readme-section img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.readme-section {
  padding: 26px 0;
  border-bottom: 1px solid var(--line-soft);
}

.readme-section h2 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.readme-section h3 {
  margin: 18px 0 8px;
  font-size: 17px;
  line-height: 1.45;
}

.readme-section p,
.readme-section li,
.readme-definition dd,
.readme-gallery figcaption {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.readme-section p {
  margin: 0 0 12px;
}

.readme-section ul,
.readme-section ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.readme-section code {
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--control-bg-muted);
  color: var(--text);
  padding: 1px 5px;
  font-size: 0.92em;
}

.readme-section figure {
  width: min(88%, 880px);
  margin: 18px auto 0;
}

.readme-equations,
.readme-code {
  width: min(88%, 880px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.readme-equations {
  padding: 14px;
  margin: 14px auto;
}

.readme-equations p {
  margin: 0 0 7px;
  font-size: 14px;
}

.readme-equations pre,
.readme-code {
  overflow-x: auto;
  margin: 0 0 12px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.readme-equations pre {
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--panel);
}

.readme-code {
  margin: 12px auto 16px;
}

.math-block {
  overflow-x: auto;
  margin: 0 0 12px;
  padding: 8px 0;
}

.readme-definition {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.readme-definition div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 12px;
}

.readme-definition dt {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.readme-definition dd {
  margin: 0;
}

.readme-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 18px;
}

.readme-gallery figure {
  width: min(88%, 880px);
  margin: 0 auto;
}

.readme-content img {
  cursor: zoom-in;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  padding: 28px;
}

.image-lightbox[hidden] {
  display: none !important;
}

.image-lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  cursor: zoom-out;
}

.image-lightbox-close {
  position: fixed;
  top: 12px;
  right: 14px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.readme-gallery figcaption {
  margin-top: 8px;
}

.readme-contact {
  margin-top: 18px !important;
}

.readme-contact a {
  color: var(--blue);
}

@media (max-width: 900px) {
  body.readme-page .app-header {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  body.readme-page .top-tabs,
  body.readme-page .header-actions {
    justify-self: stretch;
  }

  body.readme-page .top-tabs {
    justify-content: center;
  }

  .readme-hero {
    grid-template-columns: 1fr;
  }

  .readme-definition,
  .readme-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .readme-shell {
    padding: 14px 12px 38px;
  }

  .readme-hero h1 {
    font-size: 27px;
  }

  .readme-section h2 {
    font-size: 21px;
  }

  .readme-section figure,
  .readme-equations,
  .readme-code {
    width: 100%;
  }

  body.readme-page .tab-link {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
  }
}
