:root[data-theme="dark"]{color-scheme:dark;--rlm-ink:#fff;--rlm-olive:#4e785e;--rlm-leaf:#a7cea9;--rlm-pale:#264536;--rlm-line:#3d5a48;--rlm-paper:#141d18}
html[data-theme="dark"],html[data-theme="dark"] body{background:#090d0b;color:#f4f7f4}
[data-theme="dark"] :is(header,.rail,aside,dialog,#fsrc,#finish-card-hover,#finish-card-dialog,.radialFan,.poseWheel,.cuttingBoard){background:#141d18!important;color:#f4f7f4!important;border-color:#3d5a48!important}
[data-theme="dark"] :is(button,select,input[type="number"],input[type="text"],fieldset){background:#19271f;color:#fff;border-color:#4d6856}
[data-theme="dark"] :is(button:hover:not(:disabled),button[aria-selected="true"],button[aria-pressed="true"],.radialFan button.candidate){background:#2d513b;color:#fff;border-color:#93c6a0}
[data-theme="dark"] :is(h1,h2,h3,h4,legend,summary,label,#modeName,#meshStatus,.hint,.studyNote,.radialHint,.compactHeading,.coordinateReadout,output,.studyTools summary){color:#f4f7f4}
[data-theme="dark"] a{color:#b8dbbe}
[data-theme="dark"] input[type="range"]{accent-color:#a7cea9}
[data-theme="dark"] :focus-visible{outline-color:#bbdfbd}
[data-theme="dark"] :is(.workspacePan,#workspacePanH,#workspacePanV){background:#141d18;border-color:#3d5a48}
[data-theme="dark"] header strong svg{filter:brightness(0) invert(1)}
html[data-theme="dark"][data-leaf-page="surface"] #view{background:radial-gradient(ellipse at 50% 44%,#1d2822 0%,#101713 42%,#070a08 80%);border-radius:2px}
.leaf-frame-light{display:none;position:absolute;pointer-events:none;inset:0;overflow:hidden;border-radius:2px;z-index:2}
[data-theme="dark"] .leaf-frame-light{display:block;box-shadow:inset 0 0 1px 1px #a1c3a64f,inset 0 0 min(9vw,72px) 1px #a4c1a229}
.leaf-frame-light::before{content:"";position:absolute;inset:0;background:radial-gradient(ellipse 110px 74px at var(--lamp-x,50%) var(--lamp-y,0%),#ebcb7338,transparent 100%)}
.leaf-frame-light span{position:absolute;left:var(--lamp-x,50%);top:var(--lamp-y,0%);width:40px;height:2px;border-radius:80%;background:#ffe2a0;box-shadow:0 0 9px 2px #f6c77780;transform:translate(-50%,-50%) rotate(var(--lamp-angle,0deg))}
#leaf-preferences{display:flex;align-items:center;gap:4px;margin-left:auto;flex:none}
#leaf-preferences button{width:auto;min-width:31px;min-height:29px;padding:2px 6px;font-size:12px}
#leaf-preferences button[data-theme-choice]{font-size:18px;line-height:1}
#leaf-preferences button[aria-pressed="true"]{border-color:#9ab99f}
header #meshStatus{margin-left:auto}
header #leaf-preferences{margin-left:0}
@media(max-width:620px){header #meshStatus{display:none}header #leaf-preferences{margin-left:auto}header #modeName{display:none}}

#osmosisShades input[type="color"]{appearance:none;-webkit-appearance:none;padding:0!important;border:1px solid #fff!important;border-radius:3px;overflow:hidden;background:none}
#osmosisShades input[type="color"]::-webkit-color-swatch-wrapper{padding:0}
#osmosisShades input[type="color"]::-webkit-color-swatch{border:0;border-radius:2px}
#osmosisShades input[type="color"]::-moz-color-swatch{border:0;border-radius:2px}
#osmosisShades .black-chip{border:1px solid #fff;border-radius:3px}
[data-theme="light"] #osmosisShades input[type="color"],[data-theme="light"] #osmosisShades .black-chip{outline:1px solid #aab7a8}
[data-theme="dark"]{scrollbar-color:#466453 #101813}
.leaf-frame-light .leaf-depth{position:absolute;inset:0;width:100%;height:100%}
.leaf-tool{margin:.5rem 0;padding:.55rem;border:1px solid var(--rlm-line,#aab69f);border-radius:7px}
.leaf-tool summary{cursor:pointer;font-weight:600}
.leaf-tool[open] summary{margin-bottom:.45rem}
#finish-card-hover[hidden]{display:none}

#catalogFields, #catalogVeins {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 3px;
  overflow: hidden;
  background: none;
}
:is(#catalogFields, #catalogVeins)::-webkit-color-swatch-wrapper { padding: 0; }
:is(#catalogFields, #catalogVeins)::-webkit-color-swatch { border: 0; }
:is(#catalogFields, #catalogVeins)::-moz-color-swatch { border: 0; }

#catalogPaintControls, #catalogOriginTools, .catalog-region {
  display:flex;
  align-items:center;
  gap:.3rem;
}
#catalogPaintControls { display:grid; grid-template-columns:1fr 1fr; margin:.45rem 0; }
.catalog-region { border:1px solid var(--rlm-line,#aab69f); border-radius:6px; padding:2px; }
.catalog-region button { flex:1; min-width:0; }
#catalogPaintControls button, #catalogOriginTools button {
  margin:0;
  padding:.32rem .38rem;
  font-size:.83rem;
}
#catalogPaintControls button[aria-pressed="true"] { outline:1px solid #7da887; }
#catalogPaintControls input[type="color"] { flex:none; width:23px; height:23px; }
#catalogOriginTools { flex-wrap:wrap; }
#catalogOriginTools .historyTools { position:static; display:flex; gap:.3rem; }

#catalogMetalTrials {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;margin-top:.4rem}
#catalogMetalTrials button {margin:0;padding:3px 1px;font-size:.73rem;white-space:nowrap}

#rectangleInspection:not([hidden]) {display:inline-flex;align-items:center;justify-content:center;padding:5px}
#rectangleInspectionRing {
  position:fixed;width:120px;height:120px;box-sizing:border-box;z-index:8;
  transform:translate(-50%,-50%);border-radius:50%;pointer-events:none;
  border:1px solid #e9f5ed;box-shadow:0 0 0 1px #12251b,0 3px 15px #0009;
}
