:root {
	color-scheme: dark;
	--background: #101820;
	--panel: #18242f;
	--line: #2a4353;
	--accent: #7cc0e0;
	--text: #e8f1f6;
	--muted: #8ba3b4;
	font: 16px/1.4 system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { background: var(--background); color: var(--text); min-height: 100dvh; }

button, input, .button {
	font: inherit;
	color: inherit;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	min-height: 44px;
	padding: 0 14px;
}

button, .button { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; text-decoration: none; }
button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--background); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#catalog { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
#catalog header { display: grid; gap: 8px; margin-bottom: 24px; }
#summary, footer, #empty, #note { color: var(--muted); }
#search { max-width: 420px; width: 100%; }
footer { margin-top: 32px; font-size: 13px; }

#grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
#grid a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none; }
#grid a:hover { border-color: var(--accent); }
#grid img { display: block; width: 100%; aspect-ratio: 1; image-rendering: pixelated; }
#grid strong, #grid span { display: block; padding: 0 12px; }
#grid strong { padding-top: 8px; }
#grid span { padding-bottom: 10px; color: var(--muted); font-size: 13px; }

#viewer { height: 100dvh; display: flex; flex-direction: column; }
#viewer header { display: flex; align-items: center; gap: 8px; padding: 10px; }
#title { flex: 1; font-size: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

#stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #0b1015; user-select: none; }
#stage:active { cursor: grabbing; }
#canvas { position: absolute; left: 0; top: 0; width: 128px; height: 128px; transform-origin: 0 0; }
#canvas > * { position: absolute; inset: 0; width: 128px; height: 128px; image-rendering: pixelated; pointer-events: none; }
#ghost { opacity: .45; }

nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
#levels, .tools { display: flex; flex-wrap: wrap; gap: 6px; }
#note { width: 100%; font-size: 13px; }
