:root {
  color-scheme: dark;
  font: 15px/1.5 system-ui, sans-serif;
  --ink: #edf3f9;
  --muted: #aebbd0;
  --bg: #10151e;
  --panel: #18212d;
  --line: #354459;
  --link: #9fd9ff;
  --accent: #ffe969;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: min(1450px, 100% - 2rem); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; align-items: baseline; gap: 1rem; padding-block: .8rem; flex-wrap: wrap; }
.brand { margin-right: auto; color: var(--ink); font-weight: 650; }
.intro { padding: 2rem 0 1.35rem; }
h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); }
h2 { font-size: 1.25rem; margin-bottom: .95rem; }
.intro p { margin-bottom: 0; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 3fr) minmax(min(100%, 320px), 2fr); gap: 1rem; align-items: start; padding-bottom: 2rem; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 1rem; }
.composition { position: sticky; top: 1rem; max-height: calc(100dvh - 2rem); overflow: auto; }
.controls, .paging, .composition-actions, .dialog-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
button, input, select { min-height: 2rem; padding: .25rem .5rem; background: #101a28; color: var(--ink); border: 1px solid var(--line); font: inherit; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--link); }
button:not(.tile-preview, .selection-preview) { padding-inline: .75rem; clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 7px 100%, 0 50%); }
button:not(.tile-preview, .selection-preview):focus-visible { outline-offset: -4px; }
button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button:disabled, select:disabled, input:disabled { opacity: .55; cursor: default; }
input[type="number"] { width: 5.2rem; }
.check { display: flex; align-items: center; min-height: 2rem; }
.check input { min-height: 0; accent-color: var(--accent); }
.paging > span { padding-bottom: .34rem; }
.note { color: var(--muted); margin: .65rem 0; }
.note:empty { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: .55rem; }
.tile { margin: 0; padding: .55rem; border: 1px solid var(--line); background: #131c29; }
.tile-preview { display: grid; place-items: center; width: 100%; height: 104px; padding: .3rem; background: #10131a; }
.tile-preview canvas, .surface canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.tile-preview canvas { max-height: 92px; object-fit: contain; }
.tile figcaption { margin-block: .35rem; color: var(--muted); font-size: .85rem; }
.surface { display: grid; min-height: 72px; place-items: center; background: #10131a; border: 1px solid var(--line); padding: .5rem; }
.selection { display: grid; gap: .5rem; margin: .65rem 0; padding-left: 1.6rem; }
.selection li { padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.selection-preview { padding: 0; border: 0; background: transparent; color: var(--link); text-align: left; }
.placement { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; align-items: end; }
.placement input { width: 4.7rem; }
summary { cursor: pointer; color: var(--link); }
details p { margin: .4rem 0 0; color: var(--muted); }
dialog { width: min(760px, 100% - 1.5rem); max-height: 92dvh; padding: 1rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line); }
dialog::backdrop { background: #04070bb0; }
dialog canvas { max-height: 65dvh; object-fit: contain; }
.dialog-actions { margin-top: .65rem; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .composition { position: static; max-height: none; }
}
