.ref-palette {
  margin-top:8px;
  min-width:0;
  border:1px solid var(--line,#3b3542);
  border-radius:6px;
  color:var(--ink,#e7e1eb);
  background:#201d25;
}
.ref-palette > summary {
  display:flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:8px 11px;
  cursor:pointer;
  list-style:none;
}
.ref-palette > summary::-webkit-details-marker { display:none; }
.ref-palette > summary strong { font:600 11px/1.25 var(--mono,monospace); letter-spacing:.045em; text-transform:uppercase; }
.ref-emblem { width:19px; height:19px; flex:none; color:var(--gold,#d6b58b); stroke-width:1.2; }
.ref-count {
  margin-left:auto;
  color:var(--muted,#b1a9bb);
  white-space:nowrap;
  font:10px/1.4 var(--mono,monospace);
}
.ref-chevron { width:6px; height:6px; flex:none; border:solid var(--lav,#c5acdf); border-width:0 1.5px 1.5px 0; transform:rotate(45deg); }
.ref-palette[open] .ref-chevron { transform:rotate(225deg); }
.ref-palette > summary:focus-visible,.ref-palette button:focus-visible { outline:2px solid var(--lav,#c5acdf); outline-offset:1px; border-radius:4px; }
.ref-palette summary:hover { color:#f6e7d1; }
.ref-body { border-top:1px solid var(--line,#3b3542); padding:9px 11px 8px; }
.ref-group { border:0; padding:0; margin:0 0 10px; min-width:0; }
.ref-group legend { float:none; width:100%; padding:0; margin:0 0 5px; color:var(--muted,#b1a9bb); font:10px/1.4 var(--mono,monospace); }
.ref-choices { display:grid; gap:4px; grid-template-columns:repeat(auto-fit,minmax(min(119px,100%),1fr)); }
.ref-pick,.ref-modes label { position:relative; cursor:pointer; }
.ref-pick {
  display:flex; align-items:center; gap:5px; min-width:0; min-height:30px; padding:4px 6px;
  border:1px solid #413a49; border-radius:4px; background:#19171e; color:#c7bece;
  font:11px/1.3 system-ui,sans-serif;
}
.ref-pick svg { width:15px; height:15px; flex:none; opacity:.8; stroke-width:1.2; }
.ref-pick:has(input:checked) { border-color:#a587b0; color:#f0dff7; background:#372b3d; }
.ref-pick:has(input:checked)::after { content:"✓"; margin-left:auto; font-size:10px; }
.ref-pick:has(input:disabled) { opacity:.45; cursor:default; }
.ref-pick:has(input:focus-visible),.ref-modes label:has(input:focus-visible) { outline:2px solid var(--lav,#c5acdf); outline-offset:1px; }
.ref-pick input,.ref-modes input { position:absolute; width:1px; height:1px; inset:0 auto auto 0; margin:0; opacity:0; }
.ref-modes { display:grid; grid-template-columns:.62fr 1fr 1.35fr; padding:2px; border:1px solid #433a47; border-radius:5px; background:#17151c; }
.ref-modes label { min-width:0; }
.ref-modes span { display:block; padding:5px 2px; border-radius:3px; color:var(--muted,#b1a9bb); font:11px/1.35 system-ui,sans-serif; text-align:center; }
.ref-modes input:checked + span { color:#f4e2c4; background:#3a3032; box-shadow:inset 0 0 0 1px #665250; }
.ref-body .ref-planet { margin:5px 0 0; font:10px/1.4 var(--mono,monospace); color:var(--gold,#d6b58b); }
.ref-sliders { display:grid; gap:3px; }
.ref-sliders label { display:grid; grid-template-columns:84px minmax(35px,1fr) 4ch; min-height:24px; align-items:center; gap:6px; font:11px/1.4 system-ui,sans-serif; }
.ref-sliders label[hidden],.ref-planet[hidden] { display:none; }
.ref-sliders input { width:100%; min-width:0; margin:0; accent-color:#b7a1c4; }
.ref-sliders output { text-align:right; font:10px/1.4 var(--mono,monospace); color:#d8c9dc; }
.ref-fit {display:flex;gap:5px;flex-wrap:wrap;margin:8px 0}
.ref-fit button,.oe .ref-fit button {min-height:36px;padding:5px 8px;border:1px solid #51415f;border-radius:5px;background:#28212f;color:#d8c9e2;font:11px/1.3 system-ui,sans-serif;cursor:pointer}
.ref-fit button[aria-pressed="true"],.oe .ref-fit button[aria-pressed="true"] {background:#44334e;border-color:#c4a3ed;color:#f3e8ff;box-shadow:inset 0 -2px #c4a3ed}
.ref-fit button[data-ref-original],.oe .ref-fit button[data-ref-original] {margin-left:auto;color:#bcd6ca;border-color:#49685b;background:#21332b}
.ref-scale-row {display:grid;grid-template-columns:84px minmax(35px,1fr) 84px;gap:6px;align-items:center;margin:7px 0 9px;font:11px/1.4 system-ui,sans-serif}
.ref-scale-row > input {width:100%;min-width:0;margin:0;accent-color:#b7a1c4}
.ref-exact-size {display:flex;align-items:center;gap:3px;min-width:0;color:#d8c9dc}
.ref-palette .ref-sizing-help {margin:-3px 0 9px;color:var(--muted,#b1a9bb);font:10px/1.4 system-ui,sans-serif}
.ref-palette .ref-exact-size input,.oe .ref-palette .ref-exact-size input {box-sizing:border-box;min-width:0;width:100%;height:34px;padding:4px 5px;border:1px solid #65516e;border-radius:4px;color:#eee4f4;background:#19151e;font:12px/1.2 var(--mono,monospace)}
@media(max-width:420px){.ref-scale-row{grid-template-columns:72px minmax(35px,1fr) 77px}.ref-fit button,.oe .ref-fit button{min-height:40px}.ref-fit button[data-ref-original],.oe .ref-fit button[data-ref-original]{margin-left:0}}
.ref-foot { display:flex; align-items:center; justify-content:space-between; gap:5px; margin-top:4px; }
.ref-foot span { color:var(--muted,#b1a9bb); font-size:10px; }
.ref-foot button,.oe .ref-foot button { background:none; border:0; padding:3px 0; color:var(--lav,#c5acdf); font:11px/1.4 system-ui,sans-serif; text-decoration:underline; text-underline-offset:2px; cursor:pointer; }
.ref-foot button:disabled { opacity:.38; cursor:default; }
[data-reference-overlay] { pointer-events:none; }
[data-reference-layer=ring] { color:#d5b58d; }
[data-reference-layer=geometry] { color:#b3a4de; }
[data-reference-layer=square] { color:#e2c9a2; }
[data-reference-layer=grid] { color:#9db3c6; }
[data-reference-layer=compass] { color:#9abab9; }
[data-reference-layer=smith] { color:#c0d8de; --smith-guide-color:#c0d8de; }
#edit-plate:has([data-reference-overlay]) > svg { width:min(100%,clamp(300px,48vh,460px)); max-width:100%; height:auto; }
