:root {
  --background: #eaf2f2;
  --foreground: #16333f;
  --primary: #e55548;
  --teal: #245b70;
  --blue: #3184ad;
  --green: #2f9775;
  --purple: #7654a8;
  --border: #c9dadd;
  --muted: #607984;
  --card: #ffffff;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--foreground);
  background: radial-gradient(circle at 12% 4%, rgba(255,255,255,.94), transparent 25rem), linear-gradient(155deg, #eff6f5 0%, #dbe8e9 100%);
}
button, input { font: inherit; }
button { touch-action: manipulation; }
.lab-page { width: min(1510px, 100%); margin: 0 auto; padding: 24px clamp(16px, 3vw, 44px) 28px; }
.lab-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.brand-mark { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; background: #173e4d; color: white; font-size: 1.65rem; font-weight: 900; box-shadow: 0 8px 20px rgba(20,57,71,.2); }
.eyebrow { margin: 0 0 2px; color: #e05247; font-size: .8rem; font-weight: 800; letter-spacing: .15em; }
h1 { margin: 0; font-size: clamp(1.45rem, 2.4vw, 2.35rem); line-height: 1.2; letter-spacing: -.035em; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.zoom-control { display: grid; grid-template-columns: 34px 54px 34px; align-items: center; padding: 3px; border: 1px solid #bfd0d3; border-radius: 999px; background: rgba(255,255,255,.78); box-shadow: 0 3px 10px rgba(28,63,74,.06); }
.zoom-control button { height: 30px; border: 0; border-radius: 999px; background: transparent; color: #315868; cursor: pointer; font-size: 1.1rem; font-weight: 850; line-height: 1; }
.zoom-control button:hover { background: #e4edef; }
.zoom-control button:disabled { cursor: not-allowed; opacity: .35; background: transparent; }
.zoom-control .zoom-value { font-size: .76rem; font-variant-numeric: tabular-nums; }
.status-pill { display: flex; align-items: center; gap: 9px; border: 1px solid #bfd0d3; background: rgba(255,255,255,.7); padding: 9px 14px; border-radius: 999px; color: #4f6974; font-size: .88rem; }
.status-pill span { width: 9px; height: 9px; border-radius: 50%; background: #78909a; }
.status-pill.running span { background: #e35449; animation: pulse 1s infinite; }
.status-pill.paused span { background: #d99b21; }
.status-pill.finished span { background: #2a9d78; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(227,84,73,.15); } }

.experiment-shell { display: grid; grid-template-columns: minmax(0, 1fr) 350px; border: 1px solid rgba(106,141,151,.5); border-radius: 26px; overflow: hidden; background: rgba(255,255,255,.78); box-shadow: 0 22px 60px rgba(28,63,74,.13); backdrop-filter: blur(12px); }
.canvas-wrap { position: relative; min-width: 0; background: #f8fbfa; display: grid; place-items: center; }
canvas { display: block; width: 100%; height: auto; }
.canvas-legend { position: absolute; left: 18px; bottom: 15px; display: flex; flex-wrap: wrap; gap: 11px; color: #58717b; background: rgba(255,255,255,.9); border: 1px solid #d2e1e2; border-radius: 999px; padding: 7px 11px; font-size: .76rem; font-weight: 750; pointer-events: none; }
.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--purple); }
.dot.current { background: #348ba9; }
.dot.vx { background: var(--blue); }
.dot.vy { background: var(--green); }

.control-panel { border-left: 1px solid #ccdddf; background: #f6faf9; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.control-heading { display: flex; justify-content: space-between; align-items: center; font-weight: 850; font-size: 1.08rem; }
.control-heading small { color: #6d838c; font-size: .75rem; font-weight: 650; background: #e7eff0; padding: 5px 8px; border-radius: 999px; }
.axis-card { border-radius: 16px; border: 1px solid #d3e1e2; background: #fff; padding: 12px; box-shadow: 0 6px 15px rgba(30,68,80,.05); }
.horizontal-card { border-top: 4px solid var(--blue); }
.vertical-card { border-top: 4px solid var(--green); }
.axis-title { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.axis-badge { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: #e4f0f4; color: #256c8c; font-weight: 900; font-style: italic; }
.vertical-card .axis-badge { background: #e2f1eb; color: #287b60; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #e9f0f1; padding: 3px; border-radius: 10px; gap: 3px; margin-bottom: 10px; }
.mode-button { border: 0; border-radius: 8px; background: transparent; color: #607984; min-height: 34px; cursor: pointer; font-size: .82rem; font-weight: 800; }
.mode-button.active { background: #fff; color: #173f4e; box-shadow: 0 2px 7px rgba(26,65,78,.12); }
.mode-button:disabled { cursor: not-allowed; opacity: .58; }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; color: #43616c; font-size: .8rem; font-weight: 700; margin-top: 8px; }
.slider-row output { color: #173f4e; font-variant-numeric: tabular-nums; }
.slider-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--teal); }
.slider-row.disabled { opacity: .42; }

.preset-group > span { display: block; margin-bottom: 7px; color: #617984; font-size: .76rem; font-weight: 750; }
.preset-group > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.preset-group button, #clearTrails { border: 1px solid #c7d8db; color: #315868; background: #fff; min-height: 37px; padding: 5px; border-radius: 9px; font-size: .71rem; font-weight: 750; cursor: pointer; transition: .18s ease; }
.preset-group button:hover, #clearTrails:hover { border-color: #e35449; color: #d94b41; transform: translateY(-1px); }
.preset-group button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.action-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.primary-button, .secondary-button { min-height: 46px; border-radius: 12px; font-size: .88rem; font-weight: 850; cursor: pointer; }
.primary-button { border: 0; background: var(--primary); color: white; box-shadow: 0 7px 17px rgba(223,78,68,.23); }
.primary-button:hover { background: #d94a3e; }
.secondary-button { border: 1px solid #c7d8db; background: #fff; color: #315868; padding: 0 16px; }
.switch-row { position: relative; display: flex; align-items: center; gap: 9px; cursor: pointer; color: #3c5b67; font-size: .82rem; font-weight: 750; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 38px; height: 22px; background: #b8c9cc; border-radius: 999px; position: relative; transition: .2s; flex: 0 0 auto; }
.switch-ui::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 2px 5px rgba(0,0,0,.18); }
.switch-row input:checked + .switch-ui { background: #2e6d82; }
.switch-row input:checked + .switch-ui::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch-ui { outline: 3px solid rgba(47,111,133,.25); }
.data-card { display: grid; grid-template-columns: repeat(3, 1fr); background: #173e4d; color: #fff; border-radius: 14px; padding: 11px 8px; }
.data-card div { text-align: center; padding: 0 4px; border-right: 1px solid rgba(255,255,255,.14); }
.data-card div:last-child { border: 0; }
.data-card span { display: block; color: #bad0d7; font-size: .66rem; margin-bottom: 4px; }
.data-card strong { font-size: .79rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.observe-card { background: #fff6e6; border: 1px solid #f0dcae; border-radius: 13px; padding: 10px 12px; color: #6f582b; }
.observe-card span { font-size: .72rem; font-weight: 850; letter-spacing: .08em; color: #b57a12; }
.observe-card p { margin: 4px 0 0; font-size: .8rem; line-height: 1.55; }
.conclusion-strip { margin-top: 15px; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; border: 1px solid rgba(116,148,156,.4); border-radius: 17px; background: rgba(250,253,252,.78); padding: 13px 16px; }
.formula { white-space: nowrap; color: #255368; background: #dfebed; border-radius: 10px; padding: 8px 11px; font-size: .83rem; font-weight: 800; font-family: Cambria, "Times New Roman", serif; }
.conclusion-strip p { margin: 0; font-size: .82rem; color: #536e79; line-height: 1.5; }
.conclusion-strip p strong { color: #183d4b; }
#clearTrails { min-width: 76px; }

@media (max-width: 1060px) {
  .experiment-shell { grid-template-columns: 1fr; }
  .control-panel { border-left: 0; border-top: 1px solid #ccdddf; display: grid; grid-template-columns: 1fr 1fr; }
  .control-heading, .preset-group, .action-row, .data-card, .observe-card { grid-column: 1 / -1; }
  .switch-row { justify-content: center; }
  .conclusion-strip { grid-template-columns: auto auto 1fr; }
  #clearTrails { grid-column: 3; justify-self: end; }
}
@media (max-width: 650px) {
  .lab-page { padding: 14px 10px 20px; }
  .lab-header { align-items: flex-start; gap: 10px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
  .eyebrow { font-size: .67rem; }
  .header-tools { position: absolute; top: 71px; right: 14px; z-index: 2; gap: 6px; }
  .zoom-control { grid-template-columns: 29px 46px 29px; }
  .zoom-control button { height: 27px; }
  .status-pill { padding: 6px 9px; font-size: .72rem; }
  .experiment-shell { border-radius: 18px; }
  .canvas-wrap { padding-top: 22px; }
  .canvas-legend { left: 8px; bottom: 7px; gap: 7px; font-size: .65rem; }
  .control-panel { grid-template-columns: 1fr; padding: 14px; }
  .control-heading, .preset-group, .action-row, .data-card, .observe-card { grid-column: auto; }
  .switch-row { justify-content: flex-start; }
  .conclusion-strip { grid-template-columns: 1fr; gap: 7px; padding: 11px; }
  #clearTrails { grid-column: auto; justify-self: stretch; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
