:root { color-scheme: dark; font: 14px/1.4 system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: #f3f5ed; background: radial-gradient(ellipse at 50% 48%,#264838,#0b1b17 82%); height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.viewer-toolbar { display: flex; align-items: center; gap: clamp(4px,2vw,12px); padding: 7px clamp(6px,2vw,14px); background: #10251e; border-bottom: 1px solid #8ca99555; }
#name { font-size: .95rem; flex: 1; min-width: 0; }
.viewer-modes { display: flex; flex: none; align-items: stretch; }
button, summary { font: inherit; cursor: pointer; }
button { color: inherit; background: #1a362b; border: 1px solid #809a84; border-radius: 5px; min-height: 38px; padding: 4px clamp(6px, 2vw, 12px); }
.viewer-modes button { border-radius: 0; }
.viewer-modes button:first-child { border-radius: 5px 0 0 5px; }
.viewer-modes button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
button[aria-pressed=true] { background: #d8e6c2; color: #10251e; }
.viewer-reset { display: grid; place-items: center; flex: none; min-width: 38px; padding: 4px; }
button:focus-visible, summary:focus-visible { outline: 2px solid #d8e6c2; outline-offset: 2px; }
button:disabled { cursor: default; opacity: .5; }
main { position: relative; flex: 1; min-height: 0; }
canvas { display: block; width: 100%; height: 100%; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas:focus-visible { outline: 2px solid #d8e6c2; outline-offset: -2px; }
#status { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; padding: 1rem; text-align: center; }
#legend { position: absolute; z-index: 1; bottom: 8px; left: 8px; max-width: calc(100% - 16px); border: 1px solid #8ca99572; border-radius: 5px; background: #10251ef5; color: #f3f5ed; font-size: 13px; box-shadow: 0 2px 12px #07161155; }
#legend summary { padding: 9px 11px; }
#legend ul { list-style: none; margin: 0; padding: 0 11px 10px; display: grid; grid-template-columns: repeat(2,auto); gap: 4px 12px; max-height: 38dvh; overflow: auto; }
#legend li { display: flex; align-items: center; gap: 6px; }
.swatch { flex: none; width: .65em; height: .65em; border-radius: 50%; background: var(--swatch); }
@media (pointer: coarse) { button, #legend summary { min-height: 44px; } .viewer-reset { min-width: 44px; } }
@media (max-width: 330px) { .viewer-toolbar { font-size: 12px; } }
