/* 玻璃化转变 · 全屏沉浸式
   模拟即背景；文字浮在分子宇宙上；温度轴就是页面底边 */

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/space-grotesk-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/space-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #ecEEf6;
  --mid: #a9aec0;
  --dim: #7d8296;
  --faint: #565b6e;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.22);
  --chipbg: rgba(10, 13, 20, 0.55);
  --accent: #e8a33d;
  --red: #ff6b5e;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --disp: 'Space Grotesk', 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 13px/1.6 var(--mono), 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  background: #07090f;
}

/* ---- 全屏模拟 ---- */
#viewport { position: fixed; inset: 0; }
#viewport canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#viewport canvas:active { cursor: grabbing; }
#viewport::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(130% 105% at 50% 40%, rgba(0,0,0,0) 52%, rgba(0,0,0,0.52) 100%);
}
/* 胶片颗粒：压住数码平板感 */
#veil {
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
  background-size: 140px 140px;
  opacity: 0.05;
  mix-blend-mode: overlay;
  z-index: 2;
}

/* ---- 顶栏 ---- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 26px 0;
  z-index: 6;
}
#mark {
  font-family: var(--disp); font-weight: 700; font-size: 14px;
  color: var(--accent);
  border: 1px solid rgba(232, 163, 61, 0.4);
  border-radius: 9px; padding: 5px 7px 6px;
  text-shadow: 0 0 16px rgba(232, 163, 61, 0.5);
}
#brand { font-family: var(--disp); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; }
#topnav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.ghostbtn {
  background: transparent; border: none; cursor: pointer;
  color: var(--dim); font: 12px var(--mono), 'Microsoft YaHei UI', sans-serif;
  letter-spacing: 0.1em; text-decoration: none;
  padding: 5px 10px; border-radius: 999px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.ghostbtn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }

/* ---- 标题卡 ---- */
#hero {
  position: fixed; left: 44px; top: 108px;
  z-index: 5;
  pointer-events: none;
}
#hero h1 {
  margin: 0;
  font-family: var(--disp), 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
  font-size: clamp(42px, 5vw, 62px);
  font-weight: 700; line-height: 1.14;
  letter-spacing: 0.05em;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.85);
}
/* ---- 右上 HUD 读数 ---- */
#readout {
  position: fixed; top: 96px; right: 26px;
  text-align: right;
  z-index: 5;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
}
#heroT { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-bottom: 14px; }
#heroT .unit { display: block; }
#heroT b {
  font-family: var(--disp); font-weight: 700; font-size: 42px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
#heroT .unit { font-size: 10px; color: var(--dim); letter-spacing: 0.08em; margin-left: 7px; }
#heroT .unit em { font-style: normal; color: var(--faint); margin-left: 5px; }
#readout .r {
  display: grid;
  grid-template-columns: 30px 1fr 46px;
  gap: 12px;
  align-items: baseline;
  padding: 5px 0;
}
#readout .r + .r { border-top: 1px solid rgba(255, 255, 255, 0.07); }
#readout i {
  font-style: normal; font-size: 10px; letter-spacing: 0.2em;
  color: var(--faint); text-transform: uppercase;
  width: 34px; text-align: left; flex: none;
}
#readout .r b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
#readout .r > span { font-size: 10px; color: var(--faint); text-align: left; }
#readout .dim b, #readout .dim span { color: var(--faint); font-size: 11.5px; }

/* ---- 左下控制簇 ---- */
#controls {
  position: fixed; left: 26px; bottom: 84px;
  display: flex; align-items: center; gap: 7px;
  z-index: 6;
  flex-wrap: wrap;
}
.pill {
  background: var(--chipbg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mid);
  font: 500 12.5px var(--disp), 'Microsoft YaHei UI', sans-serif;
  letter-spacing: 0.04em;
  padding: 6px 14px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.15s ease;
}
.pill:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(20, 25, 38, 0.7); }
.pill:active { transform: translateY(1px); }
.pill.hot { color: var(--accent); border-color: rgba(232, 163, 61, 0.4); }
.pill.hot:hover { background: rgba(232, 163, 61, 0.12); }
.vsep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

/* 参数浮层 */
#paramsPop {
  position: fixed; left: 26px; bottom: 130px;
  width: 292px;
  background: rgba(10, 13, 20, 0.82);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 8;
}
#paramsPop.hidden { display: none; }
.panel.open { transform: translateX(0); }
#paramsPop .kv, #figs .kv { display: flex; align-items: center; gap: 8px; margin: 9px 0; }
#paramsPop .k, #figs .k { color: var(--dim); font-size: 11px; letter-spacing: 0.14em; }
.mini { font-size: 11px; color: var(--mid); }
.mono { font-variant-numeric: tabular-nums; }
#paramsPop .kv.tight { gap: 6px; }
#paramsPop .btns, #figs .btns { display: flex; gap: 6px; margin: 4px 0 0; }
input[type="text"] {
  flex: 1; min-width: 0;
  background: #161b26; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 4px 8px; font-size: 12px; font-family: inherit;
}
input[type="text"]:focus { outline: none; border-color: var(--accent); }

label.chk { color: var(--dim); cursor: pointer; gap: 4px; display: inline-flex; align-items: center; font-size: 12px; }
.spacer { flex: 1; }
#exportRow { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
label.chk input { accent-color: var(--accent); }
select {
  width: 132px;
  background: #161b26; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 4px 8px; font-size: 12px; font-family: inherit;
}
select:focus { outline: none; border-color: var(--accent); }
select option { background: #10141d; color: var(--ink); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent;
  cursor: pointer; margin: 2px 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; margin-top: -4px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
}
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border: none; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
}

/* ---- 温度轨：页面底边 ---- */
#rail {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 8px 40px 14px;
  z-index: 6;
  background: linear-gradient(rgba(7, 9, 15, 0), rgba(7, 9, 15, 0.82) 46%);
}
#railScale { position: relative; height: 16px; font-size: 9.5px; color: var(--faint); }
#railScale i { position: absolute; transform: translateX(-50%); font-style: normal; letter-spacing: 0.06em; }
#railScale i.tg { color: var(--accent); font-weight: 600; text-shadow: 0 0 14px rgba(232, 163, 61, 0.5); }
#railWrap { position: relative; }
#tempSlider { height: 30px; margin: 0; }
#tempSlider::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #16324f, #ccddee 50%, #ff8a3d);
}
#tempSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 9px; height: 28px; margin-top: -10.5px;
  border-radius: 3px;
  background: var(--ink);
  border: none;
  box-shadow: 0 0 18px rgba(233, 235, 242, 0.5);
}
#tempSlider::-moz-range-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #16324f, #ccddee 50%, #ff8a3d);
}
#tempSlider::-moz-range-thumb {
  width: 9px; height: 28px; border-radius: 3px; border: none;
  background: var(--ink); box-shadow: 0 0 18px rgba(233, 235, 242, 0.5);
}
#railBand {
  position: absolute; left: 17.2%; width: 13.8%; top: 50%; height: 8px;
  transform: translateY(-50%);
  background: rgba(232, 163, 61, 0.18);
  pointer-events: none;
}
#railBand::after, #railBand::before {
  content: ''; position: absolute; top: -3px; bottom: -3px; width: 1px;
  background: rgba(232, 163, 61, 0.6);
}
#railBand::after { left: 0; }
#railBand::before { right: 0; }
#railBubble {
  position: absolute; top: -12px; transform: translateX(-50%);
  background: var(--ink); color: #0a0d14;
  font-weight: 600; font-size: 11.5px; padding: 2px 8px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 3;
}
#railWrap:hover #railBubble, #railWrap:active #railBubble { opacity: 1; }
#railEnds { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--faint); margin-top: 2px; }

/* ---- 曲线浮层 ---- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(360px, 94vw);
  background: rgba(9, 12, 19, 0.82);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
  overflow-y: auto;
  padding: 18px 18px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
  transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(.22,.8,.3,1);
}
.panel.open { transform: translateX(0); }
#figsClose {
  position: absolute; top: 12px; right: 12px;
  font-size: 14px; padding: 3px 10px;
}
/* 首图卡标题避让右上角悬浮的 × 按钮 */
#figs figure:first-of-type { margin-top: 34px; }
#figs figure { margin: 0 0 18px; }
#figs figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 12px; color: var(--ink); font-weight: 600;
  margin-bottom: 7px;
}
#figs figcaption .mini { color: var(--faint); font-weight: 400; font-size: 10px; }
#figs canvas {
  width: 100%; height: 190px;
  display: block;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
#figs p.mini { font-size: 11px; color: var(--dim); line-height: 1.6; margin: 7px 0 0; }
#figs details { margin: 4px 0 10px; }
#figs details summary { cursor: pointer; font-size: 11px; letter-spacing: 0.3em; color: var(--dim); }
#figs details p { font-size: 12px; color: var(--mid); line-height: 1.7; margin: 7px 0; }

#anneal {
  position: fixed; left: 50%; top: 44%;
  transform: translate(-50%, -50%);
  font-size: 12px; letter-spacing: 0.1em; color: var(--mid);
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
}
#anneal span { color: var(--accent); font-weight: 600; }

#fatal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 9, 15, 0.92);
  color: var(--red); font-size: 13px;
  z-index: 99;
}
#fatal[hidden] { display: none; }

/* 导览字幕条：底部居中，悬于控制行之上、避让右侧曲线面板 */
#tourBar {
  position: fixed; left: 50%; bottom: 132px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  max-width: min(600px, max(320px, calc(100vw - 780px)));
  background: rgba(10, 13, 20, 0.88);
  border: 1px solid rgba(232, 163, 61, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 12.5px; color: var(--ink); letter-spacing: 0.04em;
  backdrop-filter: blur(12px);
  z-index: 30;
  animation: riseC 0.4s cubic-bezier(.22,.8,.3,1) both;
}
#tourBar[hidden] { display: none; }
@keyframes riseC {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
#tourCaption em { color: var(--accent); font-style: normal; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
#topbar { animation: rise 0.5s cubic-bezier(.22,.8,.3,1) 0.02s both; }
#hero { animation: rise 0.6s cubic-bezier(.22,.8,.3,1) 0.08s both; }
#readout { animation: rise 0.55s cubic-bezier(.22,.8,.3,1) 0.14s both; }
#controls { animation: rise 0.55s cubic-bezier(.22,.8,.3,1) 0.2s both; }
#rail { animation: rise 0.6s cubic-bezier(.22,.8,.3,1) 0.12s both; }

@media (max-width: 760px) {
  #hero { left: 22px; top: 84px; }
  #hero h1 { font-size: 38px; }
  #readout { right: 22px; top: 84px; }
  #heroT b { font-size: 34px; }
  #controls { left: 14px; right: 14px; bottom: 96px; }
  #rail { padding: 8px 18px 12px; }
}

.pill.active { color: var(--accent); border-color: rgba(232, 163, 61, 0.45); background: rgba(232, 163, 61, 0.1); }

/* ---- 样品参数浮层：分组 ---- */
[hidden] { display: none !important; } /* .kv 等显式 display 会压过 UA 的 hidden 规则 */
#paramsPop {
  width: 300px;
  padding: 8px 18px 12px;
  background: rgba(13, 16, 24, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
#paramsPop::-webkit-scrollbar { width: 5px; }
#paramsPop::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
#paramsPop .pgroup { padding: 10px 0 8px; }
#paramsPop .pgroup + .pgroup { border-top: 1px solid var(--line); }
#paramsPop h3 {
  margin: 0 0 4px;
  font: 600 9.5px var(--mono), 'Microsoft YaHei UI', sans-serif;
  letter-spacing: 0.28em; color: var(--faint);
  text-transform: uppercase;
}
#paramsPop .kv { margin: 9px 0; }
#paramsPop input[type="range"] { height: 16px; }
.mini-pill { padding: 3px 10px; font-size: 11px; border-radius: 8px; }
#paramsToggle.active {
  color: var(--accent);
  border-color: rgba(232, 163, 61, 0.45);
  background: rgba(232, 163, 61, 0.1);
}
