:root { --ink: #23262b; --dim: #6b717a; --card: rgba(255, 255, 255, 0.9); --line: #d6dadf; --acc: #3b6fc0; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1c2547; color: var(--ink); font: 14px/1.35 system-ui, sans-serif; }
#c { display: block; width: 100vw; height: 100vh; touch-action: none; }
#panel { position: fixed; top: 10px; left: 10px; width: 356px; max-width: calc(100vw - 20px); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); user-select: none; }
.row { display: flex; align-items: center; gap: 6px; margin: 5px 0; flex-wrap: wrap; }
.head b { font-size: 15px; }
#lvname { flex: 1; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: #eef0f2; color: var(--dim); }
.chip.ok { background: #e2f3e3; color: #2f7a39; } .chip.warn { background: #fcefd9; color: #9a6216; }
#swatches { gap: 4px; }
.sw { width: 27px; height: 27px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; position: relative; padding: 0; }
.sw span { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: rgba(0, 0, 0, 0.5); }
.sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 3px 9px; cursor: pointer; color: var(--ink); }
button:hover { border-color: var(--acc); }
.sz { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.sz button { padding: 0 6px; min-width: 22px; }
.sz output { min-width: 26px; text-align: center; font-weight: 500; }
select { font: inherit; flex: 1; min-width: 0; padding: 3px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.small { font-size: 12px; color: var(--dim); }
.small p { margin: 4px 0; }
#count { margin-left: auto; }
#selinfo { color: var(--acc); font-weight: 600; }
#legend { position: fixed; left: 10px; bottom: 10px; background: var(--card); border-radius: 9px; padding: 4px 10px; font-size: 12px; }
#legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 8px; vertical-align: -1px; }
#legend i.o { background: #e0812f; } #legend i.b { background: #3d72c4; }
#xrbtns { position: fixed; right: 14px; bottom: 14px; display: flex; gap: 10px; }
#xrbtns button { font-size: 16px; padding: 10px 18px; background: var(--acc); color: #fff; border: 0; border-radius: 10px; }
#xrbtns #ar { background: #5a6b80; }
select.mini { flex: none; padding: 1px 2px; font-size: 12px; max-width: 112px; }

#panel { max-height: calc(100dvh - 20px); overflow-y: auto; }
#pinmode[aria-pressed="true"], #refbtn[aria-pressed="true"] { color: white; background: var(--acc); }
#pinpicker, #refpicker { border-block: 1px solid var(--line); padding: 4px 0; }
#cancelpin, #uploadref { margin-left: auto; }
#pingroups, #refgroups { max-height: 40vh; overflow: auto; }
#pingroups summary, #refgroups summary { cursor: pointer; padding: 4px; font-weight: 600; }
#refgroups .reflevel { padding-left: 10px; }
#refgroups .reflevel summary { font-weight: 500; font-size: 13px; }
#pingroups button { display: inline-flex; align-items: center; gap: 4px; margin: 2px; }
#pingroups img { height: 24px; width: 24px; object-fit: contain; }
.refgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 2px; }
.refcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; text-align: center; font-size: 11px; }
.refcard img { width: 100%; height: 84px; object-fit: contain; background: #161d24; border-radius: 4px; }
.refcard span { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
