:root {
  --bg: #f4f5f6;
  --panel: #ffffff;
  --panel2: #eceef0;
  --ink: #1d2329;
  --muted: #5e6872;
  --line: #d3d8dd;
  --accent: #3e3a8c;
  --accent-soft: #e8e7f5;
  --mark: #e2a01b;
  --steel: #8a9894;
  --steel-light: #dfe5e3;
  --shaft: #b9c3c0;
  --housing: #eef0ee;
  --sleeve: #e3e8d8;
  --tool: #f2d79b;
  --coil: #c9a76b;
  --heat: #e8742a;
  --oil: #2f7fbf;
  --good: #1f7a3a; --good-bg: #e2f2e6;
  --warn: #9a6200; --warn-bg: #fbf0d9;
  --bad: #b3261e; --bad-bg: #fbe6e4;
  --font-display: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
}
:root[data-theme="dark"] {
  --bg: #15181c; --panel: #1d2127; --panel2: #262b32; --ink: #e6e9ec; --muted: #9ba4ad; --line: #353c45; --mark: #e8b23e;
  --accent: #aba7f2; --accent-soft: #2a2950; --steel: #7b8a86; --steel-light: #2a3431; --shaft: #46534f;
  --housing: #222a28; --sleeve: #2d3527; --tool: #6b5a32; --coil: #7c6740; --heat: #ff8a3d; --oil: #6cb3ec;
  --good: #6fd38c; --good-bg: #183223; --warn: #e8b45a; --warn-bg: #36290f; --bad: #f08a80; --bad-bg: #3a1a17;
  color-scheme: dark;
}
:root[data-theme="fag"] {
  --bg: #f3f4f4; --panel: #ffffff; --panel2: #eceeed; --ink: #1d2621; --muted: #5d6762; --line: #d3d8d5;
  --accent: #00893d; --accent-soft: #e2f2e8; --brandbar: #00893d;
}
:root[data-theme="skf"] {
  --bg: #f2f4f8; --panel: #ffffff; --panel2: #e8ecf3; --ink: #15203a; --muted: #56607a; --line: #d2d8e4;
  --accent: #0f58d6; --accent-soft: #e2ebfb; --brandbar: #0f58d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
.top { background: var(--panel); border-bottom: 1px solid var(--line); border-top: 4px solid var(--brandbar, transparent); }
.top .in { max-width: 1320px; margin: 0 auto; padding: 14px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.brand h1 { font-family: var(--font-display); font-size: 22px; margin: 0; font-weight: 600; letter-spacing: .01em; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.searchbox { position: relative; flex: 1 1 420px; max-width: 620px; }
.searchbox label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
#q { width: 100%; font: 500 17px var(--font-mono); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
#q:focus { outline: none; border-color: var(--accent); }
#results { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; max-height: 420px; overflow-y: auto; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.res { display: grid; grid-template-columns: minmax(150px, 1.1fr) 1.4fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 8px 12px; cursor: pointer; color: var(--ink); font: inherit; }
.res:hover, .res.on { background: var(--accent-soft); }
.res .rc { font-family: var(--font-mono); font-weight: 500; }
.res .rt { font-size: 13px; color: var(--muted); }
.res .rd { font-size: 12px; font-family: var(--font-mono); color: var(--muted); white-space: nowrap; }
.res em { color: var(--warn); font-style: normal; }
.empty { padding: 12px; color: var(--muted); font-size: 14px; }
.examples { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.examples button { font: 12px var(--font-mono); padding: 2px 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 4px; cursor: pointer; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .wrap { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.side { display: grid; gap: 16px; }
.main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
h2 { font-family: var(--font-display); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.code { font-family: var(--font-mono); font-size: 22px; font-weight: 500; word-break: break-all; }
.type { color: var(--muted); margin-bottom: 8px; }
dl.spec { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 8px; font-size: 14px; }
dl.spec dt { color: var(--muted); font-family: var(--font-mono); }
dl.spec dd { margin: 0; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ext { font-size: 13.5px; display: inline-block; margin: 4px 0; }
.chip.warn { background: var(--warn-bg); color: var(--warn); padding: 5px 8px; border-radius: 4px; font-size: 13px; margin: 6px 0; }
.meth { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px 8px 34px; position: relative; cursor: pointer; margin-bottom: 6px; }
.meth input { position: absolute; left: 10px; top: 11px; accent-color: var(--accent); }
.meth.on { border-color: var(--accent); background: var(--accent-soft); }
.meth .mn { font-weight: 600; font-size: 14.5px; }
.meth .ms { font-size: 12.5px; color: var(--muted); }
.badge { font: 600 10.5px var(--font-body); text-transform: uppercase; letter-spacing: .04em; background: var(--accent); color: var(--panel); border-radius: 3px; padding: 1px 5px; vertical-align: 2px; }
label.f { display: grid; gap: 3px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
select, input[type=number] { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%; }
ul.tools { margin: 0; padding-left: 18px; font-size: 14px; }
.simhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.simhead h2 { margin: 0; }
#methTitle { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.stagebox { overflow-x: auto; margin-top: 8px; }
#stage { width: 100%; min-width: 520px; height: auto; display: block; background: var(--bg); border-radius: 4px; }
.stepbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; margin-top: 12px; }
#stepNo { font-family: var(--font-mono); color: var(--accent); font-size: 14px; padding-top: 2px; white-space: nowrap; }
#stepTitle { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0; text-wrap: balance; }
#stepText { margin: 4px 0 0; max-width: 78ch; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
button { font: inherit; font-size: 14px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--panel); border-color: var(--accent); font-weight: 600; }
button:focus-visible, select:focus-visible, input:focus-visible, .meth:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#live { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.sl-row { display: grid; grid-template-columns: minmax(150px, auto) 1fr auto; gap: 10px; align-items: center; }
.sl-row label { font-size: 13px; color: var(--muted); }
.sl-row input { width: 100%; accent-color: var(--accent); }
.sl-row output { font-family: var(--font-mono); font-size: 17px; min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .sl-row { grid-template-columns: 1fr auto; } .sl-row label { grid-column: 1 / -1; } .stepbar { grid-template-columns: 1fr; } .nav { justify-content: flex-start; } }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.kv > div { border: 1px solid var(--line); border-radius: 4px; padding: 6px 9px; }
.kv .k { display: block; font-size: 12px; color: var(--muted); }
.kv .v { font-family: var(--font-mono); font-size: 17px; font-variant-numeric: tabular-nums; }
.status { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: 4px; border-left: 4px solid; margin-top: 10px; flex-wrap: wrap; }
.status b { font-family: var(--font-display); white-space: nowrap; }
.status span { color: var(--ink); }
.status.good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.status.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.status.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.status.info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }
table.vals { width: 100%; border-collapse: collapse; font-size: 14px; }
table.vals th { text-align: left; font-weight: 400; color: var(--muted); padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: top; width: 48%; }
table.vals td { font-family: var(--font-mono); padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.vals .nt { display: block; font-family: var(--font-body); font-size: 12px; color: var(--muted); }
#warnBox ul { margin: 0; padding-left: 18px; }
#warnBox li { margin-bottom: 6px; font-size: 14px; }
#warnBox { border-left: 4px solid var(--warn); }
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sl { width: 100%; text-align: left; display: flex; gap: 10px; align-items: baseline; border: 1px solid transparent; background: none; padding: 6px 8px; }
.sl .sn { font-family: var(--font-mono); color: var(--muted); min-width: 18px; }
.sl.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sl.done .sn { color: var(--accent); }
.site-foot { background: var(--panel); border-top: 1px solid var(--line); margin-top: 24px; }
.site-foot .in { max-width: 1320px; margin: 0 auto; padding: 22px 16px 10px; display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; font-size: 14px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; align-items: center; }
.site-foot nav a { color: var(--muted); text-decoration: none; }
.site-foot nav a:hover { color: var(--accent); text-decoration: underline; }
.site-foot nav a + a::before { content: "|"; color: var(--line); margin: 0 10px; display: inline-block; text-decoration: none; }
.site-foot .fine { max-width: 1320px; margin: 0 auto; padding: 0 16px 20px; font-size: 12px; color: var(--muted); }
/* SVG */
#stage .part { stroke: var(--ink); stroke-width: 1.1; }
#stage .hl { stroke: var(--accent); stroke-width: 2.6; }
#stage .tool { stroke: var(--ink); stroke-width: 1; }
#stage .thin { stroke: var(--ink); stroke-width: 0.8; }
#stage .dash { stroke-dasharray: 4 3; stroke: var(--muted); }
#stage .acc { stroke: var(--accent); }
#stage .axis { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 16 3 2 3; }
#stage .arrow { stroke: var(--accent); stroke-width: 2.2; }
#stage .hose { stroke: var(--ink); stroke-width: 2.5; }
#stage .needle { stroke: var(--bad); stroke-width: 2; }
#stage .mark { stroke: var(--accent); stroke-width: 2.5; }
#stage .oilline { stroke: var(--oil); stroke-width: 2; stroke-dasharray: 5 3; }
#stage .oilfilm { stroke: var(--oil); stroke-width: 3; stroke-linecap: round; }
#stage .heatov { stroke: none; }
#stage text { font-family: var(--font-mono); font-size: 11px; }
#stage .lbl { fill: var(--muted); }
#stage .lbl-ink { fill: var(--ink); }
#stage .lbl-acc { fill: var(--accent); }
#stage .lbl-bad { fill: var(--bad); }
#stage .lbl-warn { fill: var(--warn); }
#stage .lbl-heat { fill: var(--heat); font-weight: 600; }
@media (max-width: 600px) {
  .res { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .res .rt { grid-column: 1 / -1; grid-row: 2; }
  .simhead #methTitle { display: none; }
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
optgroup { font-style: normal; font-weight: 600; }
table.vals td.srccell { font-family: var(--font-body); font-size: 13px; }

.theme { display: inline-flex; margin-top: 8px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.theme button { font: 500 12px var(--font-body); color: var(--muted); background: var(--panel); border: 0; border-right: 1px solid var(--line); padding: 4px 10px; cursor: pointer; }
.theme button:last-child { border-right: 0; }
.theme button:hover { color: var(--ink); }
.theme button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.theme button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.simhead .viewsw { display: inline-flex; margin: 0 auto 0 12px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.viewsw button { font: 600 12px var(--font-mono); color: var(--muted); background: var(--panel); border: 0; border-right: 1px solid var(--line); padding: 3px 10px; cursor: pointer; }
.viewsw button:last-child { border-right: 0; }
.viewsw button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.viewsw button:disabled { opacity: 0.45; cursor: not-allowed; }
#stage3d { width: 100%; min-width: 520px; aspect-ratio: 2 / 1; background: linear-gradient(#f4f6f7, #cfd5d8); border-radius: 4px; overflow: hidden; cursor: grab; }
#stage3d:active { cursor: grabbing; }
#stage3d canvas { display: block; }
#hint3d { margin: 6px 0 0; }
#stage[hidden], #stage3d[hidden] { display: none; }

:root[data-theme="dark"] #stage3d { background: linear-gradient(#2b3238, #14181b); }

.brandsw { display: inline-flex; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.brandsw button { font: 600 13px var(--font-body); color: var(--muted); background: var(--panel); border: 0; border-right: 1px solid var(--line); padding: 5px 16px; cursor: pointer; }
.brandsw button:last-child { border-right: 0; }
.brandsw button:hover { color: var(--ink); }
.brandsw button[aria-checked="true"] { background: var(--accent); color: #fff; }
.brandsw button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
:root[data-brand="fag"] [data-show="skf"], :root[data-brand="skf"] [data-show="fag"], :root:not([data-brand]) [data-show="skf"] { display: none; }
.theme.lang { margin-left: 8px; }
.valhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.valhead h2 { margin: 0; }
.valhead .theme { margin-top: 0; }
.site-head { padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); padding-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px)); padding-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px)); }
.site-foot { padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)); padding-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px)); padding-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px)); }
.hint-touch { display: none; }
@media (pointer: coarse) { .hint-touch { display: inline; } .hint-mouse { display: none; } }
@media (max-width: 600px) { #stage3d { min-width: 0; aspect-ratio: 4 / 3; } }
.infolink { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--accent); }
