/* 데이터 분석 예제 — docs/data_analysis/gwas/gwas_simulator.html 의 스타일을 사이트 레이아웃에 맞춰 이식.
   모든 규칙을 .da- 접두사로 스코프해서 base.html 전역 스타일과 충돌하지 않게 한다. */

/* 구조 모달은 JS가 body 직속으로 옮기므로 .da-wrap 의 자손이 아니다.
   변수를 양쪽에 다 걸어야 모달 안 표 스타일(테두리/헤더 배경)이 살아난다. */
.da-wrap,
.da-modal {
  --da-ink: #1a2233;
  --da-paper: #f7f6f2;
  --da-panel: #ffffff;
  --da-line: #d9dae0;
  --da-accent: #c6402f;   /* 신호 강조색 */
  --da-band-a: #8aa0c8;   /* 염색체 밴드 밝은 */
  --da-band-b: #3e5c89;   /* 염색체 밴드 어두운 */
  --da-muted: #6b7280;
}

.da-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  color: var(--da-ink);
  line-height: 1.5;
}

.da-wrap *,
.da-wrap *::before,
.da-wrap *::after { box-sizing: border-box; }

.da-head {
  border-bottom: 2px solid var(--da-ink);
  padding-bottom: 14px;
  margin-bottom: 22px;
}
.da-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; font-weight: 700; }
.da-head .da-sub {
  color: var(--da-muted);
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.da-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .da-layout { grid-template-columns: 1fr; } }

/* ── 좌측 패널 ── */
.da-panel {
  background: var(--da-panel);
  border: 1px solid var(--da-line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.da-panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--da-muted);
  margin: 0 0 12px;
  font-family: ui-monospace, monospace;
  font-weight: 600;
}
.da-side { position: sticky; top: 16px; }
@media (max-width: 900px) { .da-side { position: static; } }

/* ── 버튼 ── */
.da-btn {
  width: 100%; padding: 9px 12px; margin-top: 6px;
  border: none; border-radius: 8px;
  background: var(--da-ink); color: #fff;
  font-size: 13.5px; cursor: pointer; font-family: inherit; letter-spacing: 0.02em;
  transition: background .12s;
}
.da-btn:hover:not(:disabled) { background: var(--da-band-b); }
.da-btn:disabled { opacity: .5; cursor: not-allowed; }
.da-btn--ghost {
  background: transparent; color: var(--da-ink); border: 1px solid var(--da-line);
}
.da-btn--ghost:hover:not(:disabled) { background: var(--da-paper); }
.da-btn--accent { background: var(--da-accent); }
.da-btn--accent:hover:not(:disabled) { background: #a5331f; }

/* ── 폼 컨트롤 ── */
.da-ctrl { margin-bottom: 12px; }
.da-ctrl label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; font-family: ui-monospace, monospace; margin-bottom: 5px;
}
.da-ctrl label .da-val { color: var(--da-accent); font-weight: 600; }
.da-ctrl input[type=range] { width: 100%; accent-color: var(--da-band-b); }
.da-ctrl select {
  width: 100%; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--da-line); border-radius: 6px; background: #fff; color: var(--da-ink);
}
.da-hint { font-size: 11.5px; color: var(--da-muted); margin: 6px 0 0; line-height: 1.45; }

/* ── 통계 타일 ── */
.da-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 640px) { .da-stats { grid-template-columns: repeat(2, 1fr); } }
.da-stat {
  background: var(--da-panel); border: 1px solid var(--da-line);
  border-radius: 8px; padding: 11px 12px;
}
.da-stat .da-num { font-size: 21px; font-weight: 700; line-height: 1.2; }
.da-stat .da-lbl {
  font-size: 10.5px; color: var(--da-muted); font-family: ui-monospace, monospace;
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px;
}
.da-stat.is-hit .da-num { color: var(--da-accent); }

/* ── 플롯 카드 ── */
.da-plot {
  background: var(--da-panel); border: 1px solid var(--da-line);
  border-radius: 10px; padding: 14px 14px 8px; margin-bottom: 16px;
}
.da-plot h3 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.da-plot .da-badge {
  font-size: 12px; color: var(--da-muted);
  font-family: ui-monospace, monospace; font-weight: 400; margin-left: 6px;
}
.da-plot .da-note { font-size: 12px; color: var(--da-muted); margin: 0 0 10px; }
.da-plot canvas { width: 100%; display: block; }

/* ── 설명 박스 ── */
.da-explain {
  background: #eef1f6; border-left: 3px solid var(--da-band-b); border-radius: 4px;
  padding: 13px 15px; font-size: 13.5px; color: #333; margin-bottom: 16px;
}
.da-explain b { color: var(--da-band-b); }

/* ── 상위 히트 표 ── */
.da-table-wrap { overflow-x: auto; }
.da-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.da-table th, .da-table td {
  border-bottom: 1px solid var(--da-line); padding: 6px 10px;
  text-align: right; white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.da-table th {
  text-align: right; color: var(--da-muted); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--da-paper); position: sticky; top: 0;
}
.da-table td:first-child, .da-table th:first-child { text-align: left; }
.da-table tr.is-causal td { background: #fdf2f0; }
.da-table .da-tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600;
}
.da-tag--sig { background: var(--da-accent); color: #fff; }
.da-tag--causal { background: #fadbd5; color: #8c2c1f; }
.da-tag--none { color: var(--da-muted); }

/* ── 상태 표시 ── */
.da-status {
  font-size: 12.5px; color: var(--da-muted);
  font-family: ui-monospace, monospace; min-height: 18px; margin-top: 8px;
}
.da-status.is-error { color: var(--da-accent); }
.da-alert {
  background: #fdecea; border: 1px solid #f5c6c0; color: #8c2c1f;
  border-radius: 8px; padding: 11px 13px; font-size: 13px; margin-bottom: 16px;
}

/* ── 구조 모달 ── */
.da-modal .modal-dialog { max-width: 1000px; }
.da-modal .modal-body { max-height: 78vh; overflow: auto; }
/* 데이터 전체(수천 행)는 자체 스크롤 박스에 담아야 헤더 sticky 가 먹는다 */
.da-modal-data { max-height: 46vh; overflow: auto; }
.da-modal-data td:first-child { color: var(--da-muted); }
.da-modal-summary {
  font-size: 12.5px; color: var(--da-muted);
  font-family: ui-monospace, monospace; margin-bottom: 12px;
}
.da-modal h6 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #6b7280; font-family: ui-monospace, monospace; margin: 16px 0 8px; font-weight: 600;
}
.da-role {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: #eef1f6; color: #3e5c89; font-size: 10.5px; font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════
   내수용감각 시뮬레이터 (.io-*) — .da-* 위에 얹는다
   ══════════════════════════════════════════════════════════════════════════ */
.io-wrap { max-width: 1240px; position: relative; }

.io-lead {
  background: var(--da-panel); border: 1px solid var(--da-line); border-left: 3px solid var(--da-accent);
  border-radius: 8px; padding: 14px 17px; margin-bottom: 20px;
}
.io-lead p { font-size: 13.5px; margin: 0 0 8px; line-height: 1.62; }
.io-lead p:last-child { margin-bottom: 0; }

/* ── 패널 ── */
.io-panel { padding: 16px 16px 14px; position: relative; }
.io-panel__no {
  font-size: 10px; font-family: ui-monospace, monospace; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--da-band-b); margin-bottom: 3px;
}
.io-panel--key { border-color: var(--da-band-b); border-width: 2px; }
.io-panel--key .io-panel__no { color: var(--da-accent); }

/* ── 좌측 문헌값 표 ── */
.io-litbox .io-littable { width: 100%; border-collapse: collapse; font-size: 11px; }
.io-littable td {
  padding: 3px 0; border-bottom: 1px dotted var(--da-line);
  font-family: ui-monospace, monospace; vertical-align: top;
}
.io-littable td:first-child { color: var(--da-muted); padding-right: 8px; }
.io-littable td:last-child { text-align: right; white-space: nowrap; font-weight: 600; }

/* ── 패널 1 탭 ── */
.io-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.io-tab {
  border: 1px solid var(--da-line); background: #fff; color: var(--da-muted);
  border-radius: 7px; padding: 6px 11px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; transition: background .12s, color .12s, border-color .12s;
}
.io-tab:hover { background: var(--da-paper); }
.io-tab.is-on { background: var(--da-ink); border-color: var(--da-ink); color: #fff; font-weight: 600; }

.io-tabpane { display: none; }
.io-tabpane.is-on { display: block; }
.io-tabpane canvas { width: 100%; display: block; margin-top: 8px; }

.io-taskdesc {
  font-size: 13px; line-height: 1.6; margin: 0 0 12px;
  padding: 10px 13px; background: var(--da-paper); border-radius: 7px; color: #333;
}

.io-taskctrl {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  padding: 10px 12px; border: 1px solid var(--da-line); border-radius: 8px; background: #fcfcfd;
}
.io-taskctrl label {
  display: block; font-size: 11.5px; font-family: ui-monospace, monospace; color: var(--da-muted);
  min-width: 168px; flex: 1 1 168px;
}
.io-taskctrl label .da-val { color: var(--da-accent); font-weight: 600; margin-left: 4px; }
.io-taskctrl input[type=range] { width: 100%; margin-top: 4px; accent-color: var(--da-band-b); }
.io-taskctrl select {
  display: block; margin-top: 4px; padding: 4px 8px; font-size: 12.5px;
  border: 1px solid var(--da-line); border-radius: 6px; background: #fff; color: var(--da-ink);
}
.da-btn--inline { width: auto; flex: 0 0 auto; margin-top: 0; padding: 8px 16px; }

/* ── 점수 표시 박스 ── */
.io-scorebox {
  margin-top: 10px; padding: 11px 13px; border-radius: 8px;
  background: #eef1f6; border-left: 3px solid var(--da-band-b);
  font-size: 12.5px; font-family: ui-monospace, monospace; color: #26303f;
}
.io-formula { line-height: 1.7; }
.io-formula + .io-formula { margin-top: 5px; }
.io-big { font-size: 16px; color: var(--da-accent); }
.io-dim { color: var(--da-muted); font-weight: 400; }
.io-hit { color: var(--da-accent); font-weight: 600; }

.io-minitable { border-collapse: collapse; font-size: 11.5px; margin: 8px 0; }
.io-minitable th, .io-minitable td {
  padding: 3px 12px 3px 0; text-align: right; font-family: ui-monospace, monospace;
}
.io-minitable th { color: var(--da-muted); font-weight: 600; border-bottom: 1px solid var(--da-line); }
.io-minitable tr.is-cur td { color: var(--da-accent); font-weight: 700; }

/* ── 패널 2 분포 격자 ── */
.io-distgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .io-distgrid { grid-template-columns: 1fr; } }
.io-distgrid canvas { width: 100%; display: block; }
.io-distlabel {
  font-size: 11.5px; font-family: ui-monospace, monospace; font-weight: 600;
  color: var(--da-band-b); margin-bottom: 2px;
}

/* ── 요약 셀 격자 ── */
.io-summary { margin-top: 12px; }
.io-sumgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 9px; }
.io-sumcell {
  border: 1px solid var(--da-line); border-radius: 7px; padding: 9px 11px; background: #fcfcfd;
}
.io-sumk {
  font-size: 10.5px; font-family: ui-monospace, monospace; color: var(--da-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.io-sumv { font-size: 14.5px; font-weight: 700; margin-top: 2px; font-family: ui-monospace, monospace; }
.io-sumn { font-size: 10.5px; color: var(--da-muted); margin-top: 3px; line-height: 1.4; }

/* ── 패널 3 산점도 행렬 ── */
.io-stats { grid-template-columns: repeat(4, 1fr); }
.io-matrixwrap { overflow-x: auto; margin-top: 4px; }
.io-matrixwrap canvas { width: 100%; min-width: 520px; display: block; }

.io-tip {
  position: absolute; z-index: 30; pointer-events: none;
  background: #1a2233; color: #f2f4f8; border-radius: 8px; padding: 9px 11px;
  font-size: 11px; font-family: ui-monospace, monospace; line-height: 1.5;
  box-shadow: 0 6px 22px rgba(0,0,0,.28); max-width: 300px;
}
.io-tip__head {
  font-weight: 700; margin-bottom: 5px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.18); font-size: 11.5px;
}
.io-tip table { border-collapse: collapse; }
.io-tip td { padding: 1px 0; }
.io-tip td:first-child { color: #a9b4c6; padding-right: 10px; white-space: nowrap; }
.io-tip td:last-child { text-align: right; white-space: nowrap; }

.io-corrtable-wrap { margin-top: 14px; }
.io-corrtable tr.is-perf td { background: #f6f8fb; }

.io-perceiver {
  margin-top: 14px; padding: 13px 15px; border-radius: 8px;
  background: #fdf6f4; border: 1px solid #f0d5cf;
}
.io-perceiver__head {
  font-size: 11px; font-family: ui-monospace, monospace; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: #8c2c1f; margin-bottom: 7px;
}
.io-perceiver ul { margin: 0 0 8px; padding-left: 20px; font-size: 12.5px; }
.io-perceiver li { margin-bottom: 2px; }
.io-perceiver__big { font-size: 14px; margin-bottom: 7px; }
.io-perceiver__note { font-size: 12px; color: #5b4a46; line-height: 1.6; }

.io-litcard {
  margin-top: 14px; padding: 13px 15px; border-radius: 8px;
  background: #f4f7f5; border-left: 3px solid #2e7d5b;
}
.io-litcard__head {
  font-size: 11.5px; font-family: ui-monospace, monospace; font-weight: 700;
  color: #1f5b41; margin-bottom: 6px;
}
.io-litcard p { font-size: 12.5px; margin: 0 0 6px; }
.io-litcard ul { margin: 0 0 8px; padding-left: 20px; font-size: 12.5px; }
.io-litcard li { margin-bottom: 3px; }
.io-litcard__foot { font-size: 12px; color: #40564c; line-height: 1.6; }

/* ── 패널 4 ── */
.io-effctrl {
  padding: 11px 13px; border: 1px solid var(--da-line); border-radius: 8px;
  background: #fcfcfd; margin-bottom: 14px;
}
.io-effctrl label {
  display: block; font-size: 12px; font-family: ui-monospace, monospace; color: var(--da-muted);
}
.io-effctrl label .da-val { color: var(--da-accent); font-weight: 600; margin-left: 6px; }
.io-effctrl input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--da-band-b); }
.io-effctrl input[type=range]:disabled { opacity: .45; }

.io-scatter2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .io-scatter2 { grid-template-columns: 1fr; } }
.io-scatter2 canvas, .io-panel > canvas { width: 100%; display: block; }

.da-explain--warn { background: #fdf1ee; border-left-color: var(--da-accent); }
.da-explain--warn b { color: #8c2c1f; }

/* ── 패널 5 해설 ── */
.io-explain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 720px) { .io-explain-grid { grid-template-columns: 1fr; } }
.io-expl {
  border: 1px solid var(--da-line); border-radius: 8px; padding: 12px 14px; background: #fcfcfd;
}
.io-expl--wide { grid-column: 1 / -1; background: #eef1f6; border-color: #d6dded; }
.io-expl h4 { font-size: 13px; font-weight: 700; margin: 0 0 6px; color: var(--da-band-b); }
.io-expl p { font-size: 12.5px; line-height: 1.65; margin: 0; color: #333; }

.io-refhead {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--da-muted);
  font-family: ui-monospace, monospace; margin: 20px 0 8px; font-weight: 600;
}
.io-refs { margin: 0 0 12px; padding-left: 20px; }
.io-refs li { font-size: 11.5px; color: #444; line-height: 1.55; margin-bottom: 5px; }

/* ── 예제 목록 카드 (index) ── */
.da-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.da-card {
  display: block; background: var(--da-panel); border: 1px solid var(--da-line);
  border-radius: 10px; padding: 18px; text-decoration: none; color: inherit;
  transition: border-color .12s, transform .12s;
}
.da-card:hover { border-color: var(--da-band-b); transform: translateY(-2px); color: inherit; }
.da-card__tag {
  font-size: 10.5px; font-family: ui-monospace, monospace; color: var(--da-band-b);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.da-card__title { font-size: 17px; font-weight: 700; margin: 6px 0 6px; }
.da-card__desc { font-size: 13px; color: var(--da-muted); line-height: 1.5; margin: 0; }
