/* 创面-水凝胶数字孪生仿真 · 样式 */

:root {
  --bg: #06090e;
  --panel: #0b1119;
  --panel-2: #101823;
  --line: rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .05);
  --txt: #e6eef7;
  --muted: #8598ad;
  --cyan: #3fd6c4;
  --cyan-dim: rgba(63, 214, 196, .14);
  --amber: #e8a33d;
  --amber-dim: rgba(232, 163, 61, .14);
  --bad: #ff6b6b;
  --bad-dim: rgba(255, 107, 107, .14);
  --skin: #c98d76;
  --radius: 10px;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(63, 214, 196, .07), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(232, 163, 61, .05), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 650; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 30px clamp(16px, 4vw, 44px) 22px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: clamp(21px, 3vw, 29px); letter-spacing: .01em; }
.topbar__sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar__tags { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .02em;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}
.tag--warn { color: var(--amber); border-color: rgba(232, 163, 61, .4); background: var(--amber-dim); }
.tag--ghost:hover { color: var(--txt); border-color: rgba(255, 255, 255, .25); }

/* ---------- 面板 ---------- */
main { padding: 0 clamp(16px, 4vw, 44px); }

.panel { padding: 34px 0; border-bottom: 1px solid var(--line-soft); }
.panel:last-of-type { border-bottom: 0; }

.panel__head { margin-bottom: 20px; max-width: 78ch; }
.panel__head h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.panel__head h2::before {
  content: "";
  width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), rgba(63, 214, 196, .25));
}
.panel__head p { margin: 7px 0 0 13px; color: var(--muted); font-size: 13.5px; }

/* ---------- 仿真台 ---------- */
.sim {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.stage__frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, #0a0f16, #070b11);
}
#wound { display: block; width: 100%; height: auto; }

.stage__badge {
  position: absolute; top: 12px; left: 14px;
  font-family: var(--mono); font-size: 12.5px;
  padding: 3px 10px; border-radius: 6px;
  background: rgba(6, 9, 14, .72);
  border: 1px solid var(--line);
  color: var(--cyan);
}
.stage__hud {
  position: absolute; right: 14px; top: 12px;
  display: flex; flex-direction: column; gap: 5px;
  align-items: flex-end;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--muted);
  pointer-events: none;
}
.stage__hud b { color: var(--txt); font-weight: 600; }

.timeline {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(63, 214, 196, .55), rgba(63, 214, 196, .12));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; margin-top: -5.5px;
  border-radius: 50%; background: var(--cyan);
  border: 2px solid #06090e;
  box-shadow: 0 0 0 1px rgba(63, 214, 196, .5);
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px; background: rgba(63, 214, 196, .3);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--cyan); border: 2px solid #06090e;
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(63, 214, 196, .35); }

.timeline__clock { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 74px; text-align: right; }
.timeline__clock b { color: var(--txt); font-size: 15px; }

.btn {
  font: inherit; cursor: pointer;
  background: var(--panel-2); color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: rgba(63, 214, 196, .45); background: #16212e; }
.btn--icon { width: 38px; height: 34px; padding: 0; font-size: 13px; line-height: 1; }
.btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }

.hint { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); min-height: 1.4em; }

/* ---------- 控制台 ---------- */
.sim__console { display: flex; flex-direction: column; gap: 14px; }

.ctl, .dose, .readout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
}
.ctl label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.ctl label b { color: var(--txt); font-family: var(--mono); font-weight: 600; }
.ctl__row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ctl input[type="number"] {
  width: 100%; padding: 7px 10px;
  background: #070c12; color: var(--txt);
  border: 1px solid var(--line); border-radius: 7px;
  font-family: var(--mono); font-size: 14px;
}
.ctl input[type="number"]:focus { outline: none; border-color: rgba(63, 214, 196, .5); }
.ctl__x { color: var(--muted); }
.ctl__note { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.ctl input[type="range"] { margin-top: 4px; }

h3 { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: none; }

.dose__list { margin: 9px 0 0; display: flex; flex-direction: column; gap: 2px; }
.dose__list > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.dose__list dt { color: var(--muted); font-size: 12.5px; }
.dose__list dd { margin: 0; font-family: var(--mono); font-size: 13px; }
.dose__list > div:last-child dd { color: var(--cyan); }

.warn {
  margin: 9px 0 0; font-size: 12px;
  color: var(--amber); background: var(--amber-dim);
  border: 1px solid rgba(232, 163, 61, .3);
  border-radius: 7px; padding: 7px 10px;
  line-height: 1.5;
}

.readout__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.stat {
  background: #070c12; border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 8px 10px;
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: 16px; font-weight: 600; }
.stat[data-tone="ok"] b { color: var(--cyan); }
.stat[data-tone="warn"] b { color: var(--amber); }
.stat[data-tone="bad"] b { color: var(--bad); }

.meter { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .07); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #7de7d6); transition: width .18s linear; }

/* ---------- 情景卡 ---------- */
.scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 20px; }

.scenario {
  text-align: left; cursor: pointer;
  background: var(--panel); color: var(--txt);
  border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 9px; padding: 11px 13px;
  font: inherit;
  transition: border-color .15s, background .15s;
}
.scenario:hover { background: var(--panel-2); }
.scenario[aria-pressed="true"] { border-color: rgba(63, 214, 196, .45); background: var(--panel-2); }
.scenario[data-tone="ok"] { border-left-color: var(--cyan); }
.scenario[data-tone="warn"] { border-left-color: var(--amber); }
.scenario[data-tone="bad"] { border-left-color: var(--bad); }
.scenario strong { display: block; font-size: 13.5px; font-weight: 600; }
.scenario em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.scenario .scenario__out { display: block; margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.scenario .scenario__out b { color: var(--txt); }

.scenario__val {
  display: block; margin-top: 7px; line-height: 1.1;
  font-family: var(--mono); font-size: 23px; font-weight: 600; color: var(--txt);
}
.scenario__val i { font-size: 12px; font-style: normal; color: var(--muted); margin-left: 2px; }
.scenario[data-tone="ok"] .scenario__val { color: var(--cyan); }
.scenario[data-tone="warn"] .scenario__val { color: var(--amber); }
.scenario[data-tone="bad"] .scenario__val { color: var(--bad); }
.scenario em { margin-top: 6px; }
.scenario [data-tone="ok"] { color: var(--cyan); }
.scenario [data-tone="warn"] { color: var(--amber); }
.scenario [data-tone="bad"] { color: var(--bad); }

/* ---------- 对比 ---------- */
.compare { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.compare h3 { margin-bottom: 10px; }
#curve { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #070b11; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 460px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #080d13; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td:not(:first-child) { font-family: var(--mono); }
td.tone-ok { color: var(--cyan); }
td.tone-warn { color: var(--amber); }
td.tone-bad { color: var(--bad); }
td[data-tone="ok"] { color: var(--cyan); }
td[data-tone="warn"] { color: var(--amber); }
td[data-tone="bad"] { color: var(--bad); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr.is-on { background: rgba(63, 214, 196, .06); }
tbody tr.is-on th { color: var(--txt); }
.tag--tone { margin-left: 7px; padding: 1px 7px; font-size: 10.5px; border-color: currentColor; opacity: .85; vertical-align: 1px; }

.verdict {
  margin-top: 12px; font-size: 13px;
  border-left: 3px solid var(--cyan);
  background: var(--cyan-dim);
  padding: 11px 14px; border-radius: 0 8px 8px 0;
}
.verdict b { color: var(--cyan); }

/* ---------- 微观三维 ---------- */
.micro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.micro__view {
  position: relative; aspect-ratio: 16 / 10;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: radial-gradient(circle at 50% 42%, #101a25, #060a0f 70%);
  overflow: hidden;
}
#gl { display: block; width: 100%; height: 100%; }
.micro__loading, .micro__fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted);
  background: rgba(6, 9, 14, .82);
}
.micro__fallback { padding: 24px; text-align: center; line-height: 1.7; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.micro__note { margin: 12px 0 0; color: var(--muted); font-size: 13px; min-height: 3.4em; }
.micro__map { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); }
.micro__map li { display: flex; gap: 9px; align-items: baseline; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.dot--gel { background: var(--cyan); }
.dot--pro { background: #a48ef0; }
.dot--esc { background: var(--amber); }

/* ---------- 说明 ---------- */
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.notes__block h3 { color: var(--txt); font-size: 13.5px; margin-bottom: 9px; }
.notes__text { margin: 9px 0 0; font-size: 13px; color: var(--muted); }
.notes__text b { color: var(--txt); }
.notes__list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 7px; }
.notes__list b { color: var(--txt); }
.notes table { min-width: 300px; }
.notes td:not(:first-child) { font-family: var(--sans); }

/* ---------- 页脚 ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px clamp(16px, 4vw, 44px) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}

/* ---------- 设置与参数抽屉 ---------- */
.btn--settings {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px; white-space: nowrap;
}
.btn--settings svg { width: 16px; height: 16px; opacity: .8; flex: none; }

html.no-scroll, html.no-scroll body { overflow: hidden; }

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(3, 5, 8, .68);
  opacity: 0; transition: opacity .26s ease;
}
.drawer.is-open .drawer__scrim { opacity: 1; }

.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(580px, 94vw);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0b1119, #080d14);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 64px rgba(0, 0, 0, .5);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.3, .7, .2, 1);
}
.drawer.is-open .drawer__panel { transform: none; }

.drawer__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--line); flex: none;
}
.drawer__head h2 { font-size: 15px; }
.drawer__body { overflow-y: auto; padding: 0 20px 34px; }

.dsec { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.dsec:last-child { border-bottom: 0; }
.dsec h3 { color: var(--txt); font-size: 13.5px; margin-bottom: 10px; letter-spacing: 0; }
.dsec table { min-width: 0; }
.dsec .notes__text { margin-top: 10px; }
.dsec .notes__list { padding-left: 18px; }

.dsec--alert {
  margin-top: 18px; padding: 14px 16px;
  background: var(--amber-dim);
  border: 1px solid rgba(232, 163, 61, .3);
  border-radius: 9px;
}
.dsec--alert h3 { color: var(--amber); }
.dsec--alert p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.dsec--alert b { color: var(--txt); }

.opts { display: flex; flex-direction: column; gap: 11px; }
.opts label { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.opts select {
  margin-left: auto; padding: 5px 9px;
  background: #070c12; color: var(--txt);
  border: 1px solid var(--line); border-radius: 7px;
  font: inherit; font-size: 13px;
}
.opts input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--cyan); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .sim { grid-template-columns: 1fr; }
  .compare, .micro { grid-template-columns: 1fr; }
  .sim__console { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .sim__console .dose, .sim__console .readout { grid-column: span 1; }
}
@media (max-width: 680px) {
  body { font-size: 14px; }
  .sim__console { grid-template-columns: 1fr; }
  .topbar { padding-top: 22px; }
  .panel { padding: 26px 0; }
  .readout__grid { grid-template-columns: 1fr 1fr; }
  .btn--settings { padding: 7px 10px; }
  .drawer__body { padding: 0 14px 28px; }
  #wound { min-height: 260px; object-fit: contain; }
}

/* ---------- 打印 ---------- */
@media print {
  :root { --bg: #fff; --panel: #fff; --txt: #111; --muted: #555; --line: #ccc; }
  body { background: #fff; color: #111; }
  #gl, .timeline, .stage__hud, .scenarios, .drawer { display: none !important; }
  .panel { break-inside: avoid; border-bottom: 1px solid #ddd; }
  .verdict { background: #f4f4f4; border-left-color: #666; }
  a { color: #111; }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
