:root {
  color-scheme:dark;
  --bg:#090d16; --surface:#111725; --surface-up:#171f30; --stroke:#263044;
  --text:#eff2fb; --muted:#a4aec3; --dim:#818da8; --mint:#81f3c4;
  --iris:#b4a5ff; --warning:#f6cc82;
  --body: "Inter","Yu Gothic UI","Hiragino Sans",Meiryo,system-ui,sans-serif;
  --mono: "IBM Plex Mono",Consolas,"Yu Gothic UI",monospace;
  font:16px/1.55 var(--body); color:var(--text); background:var(--bg);
}
*,*::before,*::after {box-sizing:border-box}
body {margin:0; min-width:300px; background:radial-gradient(ellipse at 60% 0%,#13162b 0%,transparent 52rem),var(--bg)}
a {color:inherit; text-decoration:none}
button,input,select {font:inherit}
button,select {cursor:pointer}
button:disabled {opacity:.42; cursor:not-allowed}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible,canvas:focus-visible {outline:2px solid var(--mint); outline-offset:3px}
button {color:inherit}
h1,h2,h3,p {margin:0}
.site-header {border-bottom:1px solid #222b3d; background:#0c101bd9}
.header-inner {max-width:1460px; min-height:72px; margin:auto; padding:0 38px; display:flex; align-items:center; justify-content:space-between; gap:24px}
.brand {display:flex; align-items:center; gap:12px; flex:none}
.brand strong {display:block; font-size:18px; letter-spacing:-.04em; line-height:1.1}
.brand small {display:block; font:10px/1.4 var(--mono); letter-spacing:.21em; color:#a7b0ce; margin-top:4px}
.brand-icon {width:39px; height:39px; border:1px solid #7668bd; border-radius:12px; background:linear-gradient(145deg,#30274f,#151e2a); display:flex; align-items:center; justify-content:center; gap:3px; transform:rotate(-6deg)}
.brand-icon i {display:block; width:2px; height:10px; border-radius:3px; background:#b7a7ff; box-shadow:0 0 7px #b7a7ff8c}
.brand-icon i:nth-child(2) {height:20px}
.brand-icon i:nth-child(3) {height:15px; background:#8ef7dc}
.brand-icon i:nth-child(4) {height:8px; background:#8ef7dc}
nav {display:flex; align-self:stretch; gap:22px}
nav a {position:relative; display:grid; place-items:center; white-space:nowrap; min-height:46px; font-weight:650; font-size:.88rem; color:var(--muted); padding:0 5px}
nav a:hover,nav a[aria-current=page] {color:#e7e2ff}
nav a[aria-current=page]::after {content:''; position:absolute; bottom:-1px; left:0; right:0; height:2px; border-radius:4px 4px 0 0; background:#a998ff; box-shadow:0 0 14px #9f87ff7a}
.indicator,.status {display:inline-flex; align-items:center; gap:7px; color:#b9c4dc; font-size:.8rem; white-space:nowrap}
.indicator {border:1px solid #303953; border-radius:999px; padding:6px 11px}
.indicator i,.status i {width:7px; height:7px; border-radius:50%; background:#a797fc; box-shadow:0 0 11px #a797fc95}
.status.good, .positive {color:var(--mint)}
.status.good i {background:var(--mint); box-shadow:0 0 11px #81f3c495}
.status.warn, .caution {color:var(--warning)}
.status.warn i {background:var(--warning); box-shadow:none}
.shell {max-width:1460px; padding:24px 38px 0; margin:auto}
.hero {position:relative; isolation:isolate; min-height:196px; border:1px solid #30304b; border-radius:18px; overflow:hidden; display:flex; align-items:center; margin-bottom:22px; background:linear-gradient(105deg,#191b34,#101328 52%,#191329)}
.hero::after {content:''; z-index:-1; position:absolute; inset:0 0 0 31%; background:linear-gradient(90deg,#171a30 2%,#14172a3d 48%,#120e209c),url('assets/optical-bench.webp') 63% 53%/cover; opacity:.9}
.hero-copy {padding:26px 32px; max-width:680px}
.kicker {display:flex; align-items:center; gap:10px; font:12px/1.4 var(--mono); font-weight:bold; letter-spacing:.20em; color:#c6b8ff}
.kicker span {width:18px; height:1px; background:#ae9bff; box-shadow:0 0 11px #ae9bff}
.hero h1 {margin:6px 0 7px; font-size:clamp(2rem,4.4vw,3.2rem); line-height:1.18; letter-spacing:-.05em; font-weight:750}
.hero p {color:#c2cadf; line-height:1.7; font-size:.94rem; max-width:510px}
.hero-tag {position:absolute; right:19px; bottom:15px; color:#e4dafa; font:11px var(--mono); letter-spacing:.18em; background:#0b0c18bd; padding:6px 9px; border:1px solid #51466b; border-radius:5px}
.grid {display:grid; grid-template-columns:minmax(0,1fr) minmax(295px,345px); gap:18px; align-items:start}
.grid.equal {grid-template-columns:repeat(2,minmax(0,1fr))}
.span-all {grid-column:1/-1}
.stack {display:grid; gap:18px}
.panel {min-width:0; background:linear-gradient(165deg,#141b2c,var(--surface) 65%); border:1px solid var(--stroke); border-radius:14px; padding:19px 20px}
.section-head {display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:13px}
.section-head h2 {font-size:1.12rem; font-weight:750; letter-spacing:-.02em}
.section-head p,.hint {font-size:.82rem; color:var(--muted); margin-top:4px}
.button,.pill,.view-tab,.text-button {border:1px solid #35415a; background:#182236; color:#d8e0f7; border-radius:8px; padding:7px 11px; white-space:nowrap; font-size:.82rem; font-weight:650; display:inline-flex; justify-content:center; align-items:center; gap:7px}
.button:hover,.pill:hover,.view-tab:hover {background:#242e47; border-color:#627090}
.button.primary {background:#b8a8ff; color:#171127; border-color:#cbbfff; box-shadow:0 4px 20px #a596ff35; font-weight:780}
.button.primary:hover {background:#d2c8ff}
.button.wide {width:100%; min-height:41px}
.button svg {width:16px; height:16px}
.text-button {border:none; background:transparent; color:#c4b7fd; padding:0}
.text-button:hover {text-decoration:underline}
.pill {font:600 .83rem var(--mono); background:#161f30; min-height:35px}
.pill.selected {color:var(--text); border-color:var(--color,#9e8afa); background:color-mix(in srgb,var(--color,#9e8afa) 16%,#151b2c)}
.pill i,.dot {width:8px; height:8px; background:var(--color,#c2b2ff); border-radius:50%; display:inline-block; flex:none}
.button-row,.tabs,.source-row {display:flex; flex-wrap:wrap; align-items:center; gap:7px}
.view-tab {border-color:transparent; background:transparent; color:var(--muted); padding:6px 10px}
.view-tab[aria-pressed=true] {background:#262442; color:#ded7ff; border-color:#413968}
.toolbar {display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; margin:8px 0 12px}
.toolbar .source-row {gap:5px}
.toolbar .pill {min-height:30px; padding:5px 8px; font-size:.78rem}
label.field {display:grid; gap:5px; font-size:.81rem; color:#c9d2e6}
select {border:1px solid #34405a; appearance:none; background:#151d2d; background-image:linear-gradient(45deg,transparent 50%,#b3bed6 50%),linear-gradient(135deg,#b3bed6 50%,transparent 50%); background-position:calc(100% - 13px) 50%,calc(100% - 8px) 50%; background-size:5px 5px; background-repeat:no-repeat; color:var(--text); border-radius:7px; padding:6px 23px 6px 8px; min-height:33px; font-size:.81rem; max-width:100%}
.chart-host {position:relative; width:100%; border-radius:9px; background:#0b111e; border:1px solid #232d42; overflow:hidden}
canvas.plot {display:block; width:100%; height:330px}
canvas.plot.compact {height:242px}
canvas.plot.heatmap {height:260px}
.tooltip {position:absolute; pointer-events:none; z-index:2; padding:7px 10px; background:#171d2df5; border:1px solid #53607b; border-radius:7px; font:12px/1.55 var(--mono); white-space:pre-line; color:#e9edfb; box-shadow:0 8px 20px #0008}
.legend {display:flex; flex-wrap:wrap; gap:6px 17px; min-height:20px; margin:10px 0 0; color:#adb8d1; font-size:.76rem}
.legend span {display:inline-flex; align-items:center; gap:7px}
.legend i {width:14px; height:2px; background:var(--color); border-radius:5px}
.legend i.dash {background:repeating-linear-gradient(90deg,var(--color) 0 4px,transparent 4px 7px)}
.control-label {font-size:.86rem; color:#d5dcf0; font-weight:690; margin-bottom:7px}
.control-block {margin-top:14px}
.control-block:first-of-type {margin-top:0}
.control-block.split {display:grid; grid-template-columns:1fr 1fr; gap:10px}
.control-block .source-row {display:grid; grid-template-columns:repeat(3,minmax(0,1fr))}
.range-head {display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:3px; font-size:.84rem}
output,.numeric,.code {font-family:var(--mono); font-variant-numeric:tabular-nums; color:#e0e6fa}
input[type=range] {width:100%; margin:0; accent-color:#af9afd; height:18px}
.control-end {display:flex; justify-content:space-between; align-items:center; gap:6px; margin:9px 0 0}
.compact-hint {font-size:.76rem; color:var(--dim); margin-top:7px; line-height:1.55}
.metrics {display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; border:1px solid var(--stroke); border-radius:12px; overflow:hidden; background:var(--stroke)}
.metric {background:#111826; padding:12px 15px; min-width:0}
.metric span {display:block; color:var(--muted); font-size:.78rem}
.metric strong {display:block; font:600 1.16rem/1.35 var(--mono); color:#f1efff; margin:3px 0 1px; overflow-wrap:anywhere}
.metric small {display:block; font-size:.73rem; color:var(--dim)}
.material-list {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px}
.material-picker {width:100%; text-align:left; min-width:0; border:1px solid #2c364e; background:#121a2b; border-radius:9px; padding:10px 11px; display:grid; gap:2px}
.material-picker:hover,.material-picker[aria-pressed=true] {border-color:var(--color); background:color-mix(in srgb,var(--color) 12%,#141a28)}
.material-picker strong {display:flex; align-items:center; gap:6px; font-size:.84rem; overflow-wrap:anywhere}
.material-picker small {display:block; color:var(--muted); font:.77rem var(--mono)}
.comparison {width:100%; border-collapse:collapse; font-size:.82rem}
.comparison th,.comparison td {text-align:left; border-bottom:1px solid #263148; padding:8px 9px; white-space:nowrap}
.comparison th {font-weight:650; color:#b6c1da; background:#131c2d}
.comparison tbody tr:hover {background:#1a2235}
.comparison tr:last-child td {border-bottom:0}
.comparison th:last-child,.comparison td:last-child {text-align:right}
.comparison .highlight td {color:#dfd5ff; background:#201e36}
.table-scroll {overflow:auto; max-height:350px; scrollbar-color:#505a76 #111827}
.table-scroll th {position:sticky; top:0; z-index:1}
.spectral-matrix .table-scroll {max-height:none}
.spectral-matrix td {padding:10px 12px}
.spectral-matrix small {display:block; color:var(--muted); font-size:.73rem; margin-top:2px}
.spectral-matrix strong.positive {color:var(--mint)}
.spectral-inspection {align-items:stretch}
.spectral-inputs {display:flex; flex-wrap:wrap; gap:8px 14px; margin-bottom:9px}
.spectral-validation #spectral-detail .table-scroll {margin-top:8px}
.spectral-sources {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:11px 0}
.spectral-sources > div {background:#101626; border:1px solid var(--stroke); border-radius:8px; padding:8px 9px}
.spectral-sources strong,.spectral-sources span {display:block; font-size:.78rem}
.spectral-sources span {color:var(--muted); margin-top:4px}
.spectral-sources .refs {margin-top:5px; column-gap:9px}
.spectral-plots {gap:9px}
.spectral-plots h3 {font-size:.82rem; color:#c9d2e6; margin-bottom:4px}
.spectral-plots .plot.compact {height:194px}
.spectral-method {margin-top:12px; border-top:1px solid var(--stroke); padding-top:10px; color:#c9d2e6; font-size:.82rem}
.spectral-method summary {cursor:pointer; font-weight:650; width:fit-content}
.spectral-method .table-scroll,.spectral-method p {margin-top:8px}
.material-intro {display:flex; align-items:center; gap:13px; margin-bottom:14px}
.spectrum-orb {width:42px; height:42px; display:grid; place-items:center; border-radius:50%; border:1px solid var(--color); flex:none; background:radial-gradient(circle at 36% 30%,var(--color),transparent 60%),#14203a; box-shadow:0 0 18px color-mix(in srgb,var(--color),transparent 60%)}
.material-intro h2 {font-size:1.45rem}
.material-intro small {color:var(--muted); font-size:.82rem}
.refs {display:flex; flex-wrap:wrap; gap:5px 18px; margin-top:12px}
.refs a, .dialog-inner a {color:#bfb1fc; text-decoration:underline; text-underline-offset:3px; font-size:.79rem}
.recipe {display:grid; gap:7px}
.recipe-heading {font-size:.84rem; color:#cbd4ec; margin:13px 0 6px}
.sample-actions {display:grid; gap:7px; margin-top:13px}
.composition-scroll {overflow-x:auto; border-radius:9px}
.composition-scroll .chart-host {min-width:680px}
.composition-codes {display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-bottom:12px}
.composition-codes > div,.composition-bits > div {min-width:0; padding:8px 9px; background:#101827; border:1px solid var(--stroke); border-radius:7px}
.composition-codes small,.composition-bits small {display:block; color:var(--muted); font-size:.73rem}
.composition-codes .code {font-size:1.08rem; margin-top:3px}
.composition-bits {display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:5px}
.composition-bits strong {font:600 .9rem var(--mono)}
.composition-bits strong span {font-weight:400; color:var(--muted)}
.composition-bits .on {background:#13302c; border-color:#316955; color:var(--mint)}
.composition-bits .different {background:#32291d; border-color:#866642; color:#ffda9b}
.ingredient {display:grid; grid-template-columns:minmax(155px,1.2fr) minmax(80px,1fr) 55px; align-items:center; gap:14px; padding:7px 10px; border:1px solid #27334a; border-radius:8px; background:#101827}
.ingredient label:first-child {display:flex; align-items:center; gap:8px; font-size:.87rem; font-weight:650}
input[type=checkbox] {accent-color:#ad9afd; width:17px; height:17px; margin:0; flex:none}
.ingredient input[type=range] {accent-color:var(--color)}
.ingredient output {text-align:right; font-size:.86rem}
.sample-visual {height:160px; border:1px solid #293651; border-radius:10px; background:repeating-linear-gradient(0deg,transparent 0 23px,#545e7f20 23px 24px),repeating-linear-gradient(90deg,#101626 0 23px,#2a3347 23px 24px); display:grid; align-items:center; justify-items:center}
.sample-disc {width:178px; height:95px; border-radius:50%; border:2px solid #bdccfa9a; box-shadow:0 11px 0 -3px #434969,0 15px 24px #000a,inset 0 0 15px #ffffff75; transform:rotate(-15deg); background:var(--mix,#7668b3); position:relative}
.sample-disc::after {content:''; position:absolute; inset:8px; border:1px solid #fff7; border-radius:50%; background:radial-gradient(ellipse at 30% 20%,#fff5,transparent 55%)}
.ratio-bar {display:flex; height:12px; overflow:hidden; border-radius:3px; background:#1b2335; margin:14px 0 10px}
.ratio-bar i {height:100%; background:var(--color)}
.mode-choice {display:grid; gap:4px; width:100%; text-align:left; padding:8px 12px; border:1px solid #34405a; border-radius:8px; background:#141c2d; font-size:.83rem}
.mode-choice[aria-pressed=true] {background:#282344; border-color:#9a86ef}
.mode-choice small {font-size:.76rem; color:var(--muted)}
.analysis-modes {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px}
.analysis-modes .mode-choice {grid-template-rows:auto 1fr auto; gap:7px; padding:10px 12px}
.analysis-wavelengths {display:flex; flex-wrap:wrap; align-content:start; gap:5px 10px; font:600 .78rem/1.45 var(--mono)}
.analysis-wavelengths span {white-space:nowrap}
.analysis-wavelengths .dot {width:6px; height:6px}
.analysis-mode-settings {display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; margin-top:11px}
.analysis-mode-settings .field {display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px}
.analysis-mode-settings .hint {margin:0}
.binary {display:flex; gap:4px; flex-wrap:wrap}
.binary span {display:grid; place-items:center; background:#111827; color:#8994ac; border:1px solid #34415a; min-width:25px; height:30px; border-radius:5px; font:600 .88rem var(--mono)}
.binary span.on {background:#14332d; color:#a2f6d7; border-color:#316955}
.code {color:var(--mint); font-size:1.45rem; letter-spacing:.08em}
.note {border-left:2px solid #8877ca; padding:8px 10px; background:#191b30; border-radius:0 6px 6px 0; font-size:.8rem; color:#c1c8df; margin-top:12px}
.tag {display:inline-block; padding:2px 7px; border:1px solid #3d4866; border-radius:5px; color:#c5cbe5; font-size:.76rem; white-space:nowrap}
.tag.known {color:#a3e6d3; border-color:#397260}
.tag.estimate {color:#e2c7ff; border-color:#684e85}
.empty {padding:40px 18px; text-align:center; color:var(--muted)}
.study-form {display:grid; grid-template-columns:1.15fr 1.55fr repeat(3,minmax(91px,.65fr)) auto; gap:10px; align-items:end}
.study-form input {color:var(--text); background:#111827; border:1px solid #35415a; border-radius:7px; padding:6px 9px; min-height:35px; width:100%; font-family:var(--mono)}
.study-form [aria-invalid=true] {border-color:var(--warning)}
.study-form label,.study-form select,.study-run {min-height:35px}
.study-form input:disabled,.study-form select:disabled {opacity:.75}
.study-error {font-size:.85rem; margin-top:7px}
.study-progress:not([hidden]) {display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin-top:8px; font:.79rem var(--mono); color:var(--iris)}
.study-progress progress {width:min(320px,100%); height:10px; accent-color:#ad9afd}
.study-map-toolbar {display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-bottom:13px}
.study-map-toolbar .pill {font-family:var(--body)}
.study-map-key {display:flex; align-items:center; gap:8px; font-size:.76rem; color:var(--muted)}
.study-map-key i {display:block; width:60px; height:7px; border-radius:3px; background:linear-gradient(90deg,#422e66,#23584b)}
.study-maps {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px}
.study-map-card {min-width:0; border:1px solid #2c354b; background:#101726; border-radius:9px; padding:10px 9px}
.study-map-card h3 {padding:0 4px; font-size:.94rem}
.study-map-card p {padding:0 4px; margin-top:1px}
.study-axis {margin-top:9px; padding-left:43px; font-size:.74rem; color:var(--dim); text-align:center}
.study-map {border-collapse:separate; border-spacing:3px; width:100%; font:.77rem var(--mono); text-align:center; font-variant-numeric:tabular-nums}
.study-map th {font-weight:550; color:var(--muted); white-space:nowrap}
.study-map th[scope=row] {text-align:right; padding:0 4px 0 0}
.study-map th,.study-map td {padding:0}
.study-cell {width:100%; min-width:34px; min-height:34px; border:1px solid transparent; border-radius:4px; padding:4px 2px; color:#f0f2fa; background:var(--tone); font:inherit; white-space:nowrap}
.study-cell:hover {border-color:var(--muted)}
.study-cell[aria-pressed=true] {border-color:#e0d7ff; box-shadow:inset 0 0 0 1px #e0d7ff70}
.study-detail th[scope=row] {background:transparent; position:static; color:var(--text)}
.study-detail tbody td {font-family:var(--mono); font-variant-numeric:tabular-nums}
.study-detail small {display:block; color:var(--muted); font: .75rem var(--body)}
.study-detail .muted {color:var(--dim)}
.study-breakdown {margin-top:13px; border-top:1px solid var(--stroke); padding-top:11px}
.study-breakdown summary {cursor:pointer; color:#dcd4fb; font-size:.86rem; font-weight:680}
.study-breakdown .table-scroll {margin-top:6px}
.code-summary {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:10px 0}
.code-mode {padding:10px 12px}
.code-mode strong {font-size:1.3rem}
.code-filter {display:inline-flex; align-items:center; gap:7px; font-size:.82rem; color:var(--muted)}
.code-diagnostic {margin-bottom:8px}
.code-scroll {max-height:370px}
footer {display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:9px 15px; color:var(--dim); border-top:1px solid #222c3e; margin-top:23px; padding:15px 0 19px; font-size:.78rem}
footer b {color:#cbd3ec}
dialog {max-width:min(700px,calc(100vw - 24px)); max-height:90vh; border:1px solid #4c5374; border-radius:14px; background:#141a2a; color:var(--text); padding:0}
dialog::backdrop {background:#060914bd; backdrop-filter:blur(3px)}
.dialog-inner {padding:21px 24px}
.dialog-inner h3 {margin:12px 0 4px; font-size:.94rem}
.dialog-inner p {font-size:.87rem; margin-bottom:10px; color:#c0c9e0}
@media(max-width:960px){
  .header-inner,.shell {padding-left:22px; padding-right:22px}
  .hero-copy {max-width:62%}
  nav {gap:10px}
  .grid {grid-template-columns:minmax(0,1fr) minmax(265px,295px); gap:12px}
  .stack {gap:12px}
  .panel {padding:14px}
  .metric {padding:10px}
  .study-form {grid-template-columns:repeat(6,minmax(0,1fr))}
  .study-form .study-levels {grid-column:span 3}
  .study-form label:not(.study-levels) {grid-column:span 2}
  .study-run {grid-column:span 3}
}
@media(max-width:740px){
  .header-inner {min-height:0; flex-wrap:wrap; gap:0 12px; padding-top:12px}
  .brand {margin-bottom:8px}
  .indicator {order:0; margin-bottom:8px; font-size:.72rem}
  nav {order:1; width:100%; display:flex; gap:10px; overflow-x:auto}
  nav a {font-size:.75rem; padding:0 1px}
  .shell {padding:14px 14px 0}
  .hero {min-height:164px; margin-bottom:15px}
  .hero-copy {max-width:85%; padding:18px}
  .hero p {font-size:.82rem}
  .hero::after {opacity:.55; inset:0 0 0 24%}
  .hero-tag {display:none}
  .grid,.grid.equal {grid-template-columns:minmax(0,1fr)}
  .analysis-modes {grid-template-columns:minmax(0,1fr)}
  .measure-side {grid-row:1}
  .metrics {grid-template-columns:repeat(2,minmax(0,1fr))}
  canvas.plot {height:285px}
  canvas.plot.compact {height:226px}
  .ingredient {grid-template-columns:minmax(118px,1.4fr) minmax(55px,1fr) 39px; gap:7px; padding:7px}
  .ingredient label:first-child {font-size:.77rem; gap:5px}
  .ingredient output {font-size:.74rem}
  .study-maps {grid-template-columns:minmax(0,1fr)}
  .code-summary {grid-template-columns:minmax(0,1fr)}
  .code-scan .section-head {flex-wrap:wrap}
  .composition-bits {grid-template-columns:repeat(4,minmax(0,1fr))}
}
