:root { color-scheme: dark; --radius: 6px;
  --bg: #1f1d26; --panel: #2a2733; --panel-2: #332f3e; --rail: #24212d; --field: #3a3645; --field-hover: #4a4558;
  --ink: #ece6dc; --dim: #9a92a6; --line: #3d3849; --accent: #d9b77e; --accent-ink: #d9b77e; --on-accent: #241f18;
  --danger: #e08a7a; --danger-bg: #2a1f22; --stage: #1a1820; --select: #78dcff; --tip: #111018; --shadow: rgba(0,0,0,0.4);
  --checker-a: #2c2a33; --checker-b: #24222b; --swatch-edge: rgba(255,255,255,0.15); }
:root[data-theme=light] { color-scheme: light;
  --bg: #e9eaee; --panel: #ffffff; --panel-2: #f2f3f6; --rail: #f6f6f8; --field: #f2f3f6; --field-hover: #e6e7ec;
  --ink: #1d1d22; --dim: #5f6070; --line: #e2e3e8; --accent: #f2d49b; --accent-ink: #85601f; --on-accent: #3b2a10;
  --danger: #b4412f; --danger-bg: #fdecea; --stage: #ececf0; --select: #1f8fd6; --tip: #1d1d22; --shadow: rgba(20,20,40,0.15);
  --checker-a: #ffffff; --checker-b: #ececf0; --swatch-edge: rgba(0,0,0,0.15); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the hidden attribute must win over display rules */
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, sans-serif; display: flex; flex-direction: column; }
button { background: var(--field); color: var(--ink); border: 0; border-radius: var(--radius); padding: 6px 10px; cursor: pointer; font: inherit; }
button:hover { background: var(--field-hover); }
button.primary { background: var(--accent); color: var(--on-accent); }
button.active { outline: 2px solid var(--accent); }
input, select { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; font: inherit; }

.spacer { flex: 1; }

#app { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px;
  grid-template: "left center right" 1fr "dock dock dock" auto / 260px 1fr 300px; }
#left { grid-area: left; } #center { grid-area: center; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; } #right { grid-area: right; } #dock { grid-area: dock; }
.panel { background: var(--panel); border-radius: 8px; padding: 12px; overflow: auto; }
.panel h2 { font-size: 13px; color: var(--accent-ink); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }

/* The character frame: the same fixed size on every page (128 x 152 at 3x plus padding); larger zooms scroll. */
#stage { flex: none; display: flex; flex-direction: column; background: var(--stage); border-radius: 8px; }
.toolbar { display: flex; gap: 6px; padding: 8px; flex-wrap: wrap; }
#canvas-wrap { height: 472px; display: flex; overflow: auto; padding: 8px; }
#canvas-wrap canvas { margin: auto; flex: none; }          /* auto margins centre it, yet a zoomed canvas still scrolls fully */
#canvas-wrap.pan, #canvas-wrap.pan canvas { cursor: grab; }
canvas { image-rendering: pixelated; display: block; }
#view { cursor: crosshair; }
#view.picking { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.9 7.9L7.4 14.4 6.6 17.4 9.6 16.6 16.1 10.1 M6.6 17.4L4 20 M12.6 6.6l4.8 4.8 M14.6 6.6l2.3-2.3a2.3 2.3 0 0 1 3.2 3.2l-2.3 2.3' stroke='white' stroke-width='4'/%3E%3Cpath d='M13.9 7.9L7.4 14.4 6.6 17.4 9.6 16.6 16.1 10.1 M6.6 17.4L4 20 M12.6 6.6l4.8 4.8 M14.6 6.6l2.3-2.3a2.3 2.3 0 0 1 3.2 3.2l-2.3 2.3' stroke='black' stroke-width='1.8'/%3E%3C/svg%3E") 4 20, crosshair; }
#status { color: var(--dim); font-size: 12px; padding: 6px 10px; min-height: 28px; }

.row { display: grid; grid-template-columns: 84px 28px 1fr 28px; align-items: center; gap: 6px; margin: 6px 0; }
.row .name { color: var(--dim); }
.row .value { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#dock { background: var(--panel); border-radius: 8px; padding: 8px 12px; }
.dock-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.dock-head button { padding: 4px 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.chip { flex: none; background: var(--panel-2); border-radius: var(--radius); padding: 6px; cursor: grab; user-select: none; min-width: 110px; }
.chip:active { cursor: grabbing; }
.chip .name { font-size: 11px; color: var(--dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.swatches { display: flex; }
.chip input[type=color] { width: 100%; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.swatches span { width: 14px; height: 18px; display: block; }
.swatches span.outline { margin-right: 3px; }

.switch { display: flex; background: var(--panel-2); border-radius: var(--radius); padding: 2px; margin: 8px 0; }
.switch button { flex: 1; background: transparent; padding: 4px; }
.switch button.on { background: var(--accent); color: var(--on-accent); }
.muted { color: var(--dim); font-size: 12px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--panel-2); border-radius: 8px; padding: 8px; text-align: center; }
.card canvas { margin: 0 auto 6px; background: var(--stage); border-radius: 4px; }
.card .actions { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.card .actions button { padding: 4px 6px; font-size: 12px; }

#error { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); color: var(--danger); background: var(--danger-bg); padding: 6px 12px; border-radius: var(--radius); }
#error:empty { display: none; }
#error.ok { color: var(--ink); background: var(--panel-2); outline: 1px solid var(--line); }



.panel h3 { font-size: 12px; color: var(--dim); margin: 14px 0 6px; font-weight: 600; }
.form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.form input:not([type=color]):not([type=checkbox]):not([type=radio]) { flex: 1 1 140px; min-width: 0; }
.form select { flex: 1 1 110px; min-width: 0; }
.form input[type=color] { width: 36px; height: 30px; padding: 0; border: 0; background: none; }
.swatch-edit { display: flex; gap: 2px; margin: 6px 0; }
.swatch-edit input { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.swatch-edit input:first-child { margin-right: 4px; }
.warn { color: var(--danger); font-size: 11px; margin: 4px 0; }
label.button { background: var(--field); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; }
.card .actions label { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 4px; }
input.hex { width: 100%; font: 11px ui-monospace, monospace; margin: 2px 0 4px; }
input.hex-one { width: 84px; flex: none !important; font: 12px ui-monospace, monospace; }
.badge { background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 0 5px; font-size: 11px; }
label.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; }

/* icons: line drawings in the text colour, in front of the label */
svg.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; flex: none; }
button:has(svg.ic) { display: inline-flex; align-items: center; gap: 6px; }
button:has(svg.ic):not(:has(span)):empty, #undo, #redo { padding: 6px 8px; }
.panel h2 { display: flex; align-items: center; gap: 6px; }
.layers { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.layer { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: var(--radius); }
.layer:hover { background: var(--panel-2); }
.layer.indent { padding-left: 26px; font-size: 12px; }
.layer.off span { color: var(--dim); text-decoration: line-through; }
.layer button { background: transparent; padding: 2px 4px; }
.history { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; margin-bottom: 6px; }
.history button { text-align: left; background: transparent; font-size: 12px; padding: 4px 6px; }
.history button.on { background: var(--accent); color: var(--on-accent); }

.shades { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px; margin-bottom: 6px; }
.shades button { display: flex; align-items: center; gap: 6px; justify-content: flex-start; font-size: 12px; padding: 4px 6px; }
.shades .sw { width: 18px; height: 18px; border-radius: 3px; flex: none; outline: 1px solid var(--swatch-edge); }

/* Edit page: a dockview workspace replaces the page frame; the stage moves into its Canvas panel */
#workspace { grid-area: 1 / 1 / -1 / -1; min-height: 0; }
#app.editing > #left, #app.editing > #center, #app.editing > #right, #app.editing > #dock { display: none; }
#workspace .dockview-theme-dark, #workspace { --dv-group-view-background-color: var(--panel); --dv-tabs-and-actions-container-background-color: var(--bg);
  --dv-activegroup-visiblepanel-tab-background-color: var(--panel); --dv-activegroup-visiblepanel-tab-color: var(--accent);
  --dv-inactivegroup-visiblepanel-tab-background-color: var(--panel); --dv-separator-border: var(--line); --dv-paneview-header-border-color: var(--line);
  --dv-activegroup-hiddenpanel-tab-background-color: var(--bg); --dv-activegroup-hiddenpanel-tab-color: var(--dim);
  --dv-inactivegroup-hiddenpanel-tab-background-color: var(--bg); --dv-inactivegroup-hiddenpanel-tab-color: var(--dim);
  --dv-inactivegroup-visiblepanel-tab-color: var(--ink); --dv-tab-divider-color: var(--line); --dv-sash-color: transparent;
  --dv-active-sash-color: var(--accent); --dv-icon-hover-background-color: var(--field); --dv-scrollbar-background-color: var(--line);
  --dv-drag-over-background-color: color-mix(in srgb, var(--accent) 25%, transparent); --dv-drag-over-border-color: var(--accent-ink);
  --dv-activegroup-visiblepanel-tab-color: var(--accent-ink); }
.ws-panel { height: 100%; border-radius: 0; }
.ws-canvas { height: 100%; display: flex; flex-direction: column; background: var(--panel); }
.ws-top { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ws-docs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.ws-docs .doc { display: inline-flex; background: var(--panel-2); border-radius: var(--radius); }
.ws-docs .doc.active { outline: 2px solid var(--accent); }
.ws-docs .doc button { background: transparent; padding: 4px 6px; font-size: 12px; }
.ws-body { flex: 1; min-height: 0; display: flex; }
.ws-tools { padding: 6px; border-right: 1px solid var(--line); overflow: auto; }
.toolbar-v { display: flex; flex-direction: column; gap: 4px; }
.toolbar-v .sep { height: 1px; background: var(--line); margin: 4px 0; }
button.icon { padding: 6px; }
.ws-stage { flex: 1; min-width: 0; display: flex; }
.ws-stage #stage { flex: 1; min-width: 0; border-radius: 0; }
.ws-stage #canvas-wrap { flex: 1; height: auto; min-height: 0; }
.viewbar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.viewbar .alpha { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); margin-left: 6px; }
.viewbar .alpha input { width: 110px; padding: 0; }
.maplist { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.maplist button { display: flex; align-items: center; gap: 8px; text-align: left; }
.maplist .sw, .shades .sw { width: 18px; height: 18px; border-radius: 3px; flex: none; outline: 1px solid var(--swatch-edge); }
.lib-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.lib-cats button { font-size: 12px; padding: 4px 8px; }
#lib-search { width: 100%; margin-bottom: 8px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.piece { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; font-size: 11px; background: var(--panel-2); }
.piece img, .piece svg.ic { width: 64px; height: 76px; object-fit: contain; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
.piece.on { outline: 2px solid var(--accent); }
.piece span { text-align: center; line-height: 1.2; }

/* Editor: the Editing chip and scope switch, the layer tree, the brush swatches, the save list, tooltips */
.ws-view { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.edit-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--select); border-radius: var(--radius); padding: 4px 8px; font-size: 12px; }
.edit-chip .sw { width: 14px; height: 14px; border-radius: 3px; outline: 1px solid var(--swatch-edge); }
.edit-chip .warn { margin: 0; }
.seg { display: inline-flex; border-radius: var(--radius); overflow: hidden; }
.seg button { border-radius: 0; font-size: 12px; padding: 4px 8px; }
.seg button.active { outline: none; background: var(--accent); color: var(--on-accent); }
.layer { gap: 2px; }
.layer .name { flex: 1; display: flex; align-items: center; gap: 6px; text-align: left; background: transparent; padding: 3px 6px; min-width: 0; }
.layer .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer.sel { background: color-mix(in srgb, var(--select) 14%, transparent); outline: 1px solid var(--select); }
.layer button.icon.on { color: var(--accent-ink); }
.layer.off .name span { color: var(--dim); text-decoration: line-through; }
.swatch-row { display: flex; align-items: center; gap: 4px; border-radius: var(--radius); }
.swatch-row button { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; justify-content: flex-start; }
.swatch-row button span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch-row.active button { outline: 2px solid var(--accent); }
.swatch-row input[type=color] { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }
#b-add { width: 36px; height: 30px; padding: 0; border: 0; background: none; }
details summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--field); border-radius: var(--radius); margin-bottom: 6px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: var(--panel); border-radius: 10px; padding: 18px; width: min(560px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; }
.modal-box h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; color: var(--accent-ink); }
.style-tiles { display: flex; gap: 12px; justify-content: center; margin: 8px 0 12px; }
.style-tile { margin: 0; text-align: center; cursor: pointer; }
.style-tile img { height: 152px; image-rendering: pixelated; background: var(--bg, #1e1d26); border-radius: 6px; display: block; }
.style-tile figcaption { margin-top: 4px; font-size: 13px; }
.save-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.save-row select { grid-column: 1 / -1; }
.form.end { justify-content: flex-end; margin-top: 12px; }
#tooltip { position: fixed; z-index: 200; pointer-events: none; background: var(--tip); color: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; font-size: 12px; max-width: 280px; }
/* panels never close by accident: no × on their tabs; groups fold to a strip with the arrow instead */
#workspace .dv-default-tab-action { display: none; }
.ws-fold { background: transparent; padding: 4px 6px; margin: 0 4px; }
.ws-folded .dv-content-container { display: none; }
.ws-folded .dv-tabs-and-actions-container { flex-direction: column; height: 100%; align-items: center; }
.ws-folded .dv-tabs-container { flex-direction: column; overflow: hidden; }
.ws-folded .dv-tab { writing-mode: vertical-rl; padding: 8px 0; cursor: pointer; }
.ws-folded .dv-right-actions-container { order: -1; }
.focus { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.focus .check { margin: 0; }
.focus input[type=range] { width: 80px; padding: 0; }
/* sliders and tick boxes in the app's colours, not the browser's blue */
input[type=range], input[type=checkbox] { accent-color: var(--accent); }
input[type=range] { background: transparent; border: 0; height: 18px; }
.focus input[type=range] { width: 90px; }
.fixed-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.fixed-row .sw { width: 20px; height: 20px; border-radius: 3px; outline: 1px solid var(--swatch-edge); }
.legend-fixed { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--dim); font-size: 12px; }
.sw.hatch { width: 18px; height: 18px; border-radius: 3px; background: repeating-linear-gradient(45deg, #969696 0 3px, #5f5f5f 3px 6px); }
button.choice { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; padding: 10px 12px; margin: 6px 0; }
button.choice span { line-height: 1.35; }
button.choice.primary b { color: var(--on-accent); }
/* the dock as the Edit page's Palettes panel: chips wrap in a grid instead of one scrolling row */
.ws-panel .chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); overflow: visible; }
.ws-panel .chip { min-width: 0; cursor: pointer; }
.ws-panel .dock-head input { flex: 1 1 100%; }
.layer .name em.viewonly { font-style: normal; font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: auto; flex: none; }
/* the Colours panel */
.col-current { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 8px; padding: 8px; }
.col-current input[type=color] { width: 48px; height: 48px; padding: 0; border: 0; background: none; cursor: pointer; }
.col-map { margin: 10px 0; }
.col-name { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.sw.small { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.col-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.col-sw { width: 26px; height: 26px; padding: 0; border-radius: 4px; outline: 1px solid var(--swatch-edge); }
.col-sw:hover { outline: 2px solid var(--ink); background-blend-mode: normal; }
.col-sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }
/* the File menu */
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px; min-width: 220px; display: flex; flex-direction: column; box-shadow: 0 6px 20px var(--shadow); }
.menu-list[hidden] { display: none !important; }
.menu-list button { background: transparent; text-align: left; display: flex; justify-content: space-between; gap: 12px; }
.menu-list button:hover { background: var(--panel-2); }
.menu-list kbd { font: 11px ui-monospace, monospace; color: var(--dim); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.save-row input[data-name] { grid-column: 1 / -1; }
.cr-previews { display: flex; gap: 8px; margin: 8px 0; }
.cr-previews canvas { width: 128px; height: 152px; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
#left label:not(.check):not(.button), #right label:not(.check):not(.button) { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); margin: 4px 0; }
.cr-previews canvas { width: 104px; height: 124px; }
#in-before { cursor: crosshair; }
.in-sw { width: 18px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.layer.vo .name span { color: var(--dim); font-style: italic; }
.layer button.icon { padding: 4px 3px; }
/* tick boxes and radio buttons in the app's style */
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; flex: none;
  border: 1.5px solid var(--dim); border-radius: 4px; background: var(--panel-2); cursor: pointer; display: inline-grid; place-content: center;
  padding: 0; vertical-align: -3px; transition: background .1s, border-color .1s; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--ink); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ''; width: 8px; height: 4px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg); }
input[type=radio]:checked::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--on-accent); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label.check { cursor: pointer; padding: 3px 0; }
/* the Assets page: the whole library, no canvas */
#assets-page { grid-area: 1 / 1 / -1 / -1; min-height: 0; display: grid; grid-template-columns: 240px 1fr 300px; gap: 8px; }
#app.assets > #left, #app.assets > #center, #app.assets > #right, #app.assets > #dock { display: none; }
.as-side, .as-main, .as-detail { min-height: 0; overflow: auto; }
.as-tabs { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.as-tab { display: flex; align-items: center; border-radius: var(--radius); }
.as-tab > button:first-child { flex: 1; background: transparent; display: flex; gap: 8px; align-items: center; text-align: left; }
.as-tab.active { background: var(--panel-2); }
.as-tab.active > button:first-child { color: var(--accent-ink); }
.as-tab .icon { background: transparent; }
.as-main .form input[type=search] { flex: 1; }
.as-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 8px; }
.as-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; background: var(--panel-2); font-size: 12px; }
.as-card img { width: 96px; height: 114px; object-fit: contain; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
.as-card.sel { outline: 2px solid var(--accent); }
.as-card.on img { box-shadow: inset 0 0 0 2px var(--select); }
.as-card .badge { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 4px; }
.badge.pack { background: var(--line); color: var(--ink); }
.as-big { width: 100%; max-width: 256px; aspect-ratio: 128 / 152; object-fit: contain; image-rendering: pixelated; background: var(--stage); border-radius: var(--radius); }
.as-detail h3 { color: var(--ink); font-size: 15px; margin: 10px 0 2px; }
/* the Character page */
.subtabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.subtabs button.active { background: var(--panel-2); color: var(--accent-ink); outline: none; }
.ex-face { display: flex; flex-direction: column; gap: 4px; }
.ex-face label { display: grid !important; grid-template-columns: 56px 1fr; align-items: center; }
.ex-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.ex-row { display: flex; align-items: flex-start; background: var(--panel-2); border-radius: var(--radius); }
.ex-row.on { outline: 2px solid var(--accent); }
.ex-pick { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; padding: 4px; font-size: 12px; }
.ex-pick canvas { width: 96px; height: 114px; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
.ex-row .icon { background: transparent; }
#ex-cols { width: 60px; }
.ex-list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.ex-row { position: relative; min-width: 0; }
.ex-row .icon { position: absolute; top: 2px; right: 2px; padding: 2px; }
.ex-pick canvas { width: 72px; height: 86px; }
.subtabs { flex-wrap: nowrap; }
.subtabs button { padding: 6px 8px; font-size: 12px; }
/* the Character page's tabs: three equal buttons, icon above the label, always inside the panel */
.subtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; flex-wrap: unset; }
.subtabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; min-width: 0; }
.subtabs button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* face pickers: ◀ dropdown ▶ and a thumbnail grid on the base body */
.ex-pick-row { display: grid; grid-template-columns: 44px auto 1fr auto auto; align-items: center; gap: 2px; margin: 2px 0; }
.ex-pick-row select { min-width: 0; }
.ex-pick-row .icon { padding: 4px; }
.ex-label { font-size: 12px; color: var(--dim); }
.ex-browse { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; margin: 4px 0 8px; }
.ex-browse button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px; font-size: 10px; background: var(--panel-2); min-width: 0; }
.ex-browse button.on { outline: 2px solid var(--accent); }
.ex-browse img, img.face { width: 64px; height: 64px; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
.ex-browse span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-mode { display: flex; margin-bottom: 10px; }
.build-mode button { flex: 1; justify-content: center; }
.row select.value { min-width: 0; padding: 4px 6px; text-align: left; }
.char-name { margin-bottom: 10px; }
.char-name input { flex: 1; }
.follow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0; font-size: 12px; }
.follow b { flex-basis: 100%; font-weight: 600; }
:root[data-theme=light] button:not(.primary):not(.on):not(.active):not(.menu-btn):not(.bgsw):not(#rail button):not(.menu-list button) { box-shadow: inset 0 0 0 1px var(--line); }
/* the shell: menu bar, page rail, panels */
#menubar { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
#menubar .brand { color: var(--accent-ink); margin-right: 6px; letter-spacing: .02em; }
.menus { display: flex; gap: 2px; }
.menu-btn { background: transparent; padding: 4px 10px; }
.menu.open .menu-btn { background: var(--field); }
.menus .menu-list { left: 0; right: auto; }
.menus .menu-list button { position: relative; padding-left: 26px; }
.menu-list button.on::before { content: '✓'; position: absolute; left: 9px; }
.menu-list .keys { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; max-width: 280px; font-size: 12px; color: var(--dim); }
#body { flex: 1; min-height: 0; display: flex; }
#rail { flex: none; width: 48px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0;
  background: var(--rail); border-right: 1px solid var(--line); }
#rail button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; background: transparent; }
#rail button svg.ic { width: 20px; height: 20px; }
#rail button:hover { background: var(--field); }
#rail button.active { background: var(--accent); color: var(--on-accent); outline: none; }
#app { gap: 0; padding: 0; grid-template: "left center right" 1fr "dock dock dock" auto / 260px 1fr 300px; }
#app > .panel, #dock { border-radius: 0; }
#left { border-right: 1px solid var(--line); } #right { border-left: 1px solid var(--line); } #dock { border-top: 1px solid var(--line); }
#center { padding: 8px; }
@media (max-width: 900px) {
  #app { grid-template: "center" auto "left" auto "right" auto "dock" auto / 1fr; }
  #body { flex-direction: column; } #rail { flex-direction: row; width: auto; overflow-x: auto; padding: 4px 8px; }
}
/* test backgrounds and the export option */
#stage { background: var(--stage-bg, transparent); }
#stage.checker, .bgsw.checker { background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px; }
.bg-swatches { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
.bgsw { width: 22px; height: 22px; padding: 0; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--swatch-edge); }
.bgsw.on { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
.bgsw.custom { background: var(--field); font-size: 13px; line-height: 1; }
label.check.inline { display: inline-flex; margin: 0 4px; font-size: 12px; color: var(--dim); }
#center > #stage { flex: 1; min-height: 0; }
#center > #stage #canvas-wrap { flex: 1; height: auto; min-height: 0; }
* { scrollbar-color: color-mix(in srgb, var(--dim) 45%, transparent) transparent; scrollbar-width: thin; }
button:disabled, input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
#right input[type=range] { flex: 1; }
#right details summary { margin-top: 8px; }
/* properties panels (props.ts): folding sections, label | control rows, segmented choices, switches, sliders */
.prop-head { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.prop-head b { font-size: 14px; }
.prop-head .kind { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin-left: auto; }
.prop-sec { border-bottom: 1px solid var(--line); }
.prop-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 9px 0 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); background: none; margin: 0; border-radius: 0; }
.prop-sec > summary::-webkit-details-marker { display: none; }
.prop-sec > summary::before { content: '▸'; font-size: 10px; transition: transform .12s; }
.prop-sec[open] > summary::before { transform: rotate(90deg); }
.prop-sec > summary:hover { color: var(--ink); }
.prop-body { padding: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.prop-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 28px; }
.prop-row.wide { grid-template-columns: minmax(0, 1fr); }
.prop-label { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.prop-ctl > select, .prop-ctl > input:not([type=checkbox]):not([type=range]):not([type=color]) { flex: 1; min-width: 0; padding: 4px 6px; }
.prop-ctl > button { flex: 1; padding: 5px 8px; font-size: 12px; justify-content: center; }
.prop-seg { display: flex; flex: 1; background: var(--field); border-radius: var(--radius); padding: 2px; gap: 2px; }
.prop-seg button { flex: 1; background: transparent; padding: 4px 6px; font-size: 12px; border-radius: 4px; box-shadow: none !important; }
.prop-seg button.on { background: var(--accent); color: var(--on-accent); }
.prop-slider { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.prop-slider input[type=range] { flex: 1; min-width: 0; }
.prop-slider output { font: 12px ui-monospace, monospace; color: var(--ink); min-width: 38px; text-align: right; }
.prop-switch { position: relative; display: inline-block; width: 34px; height: 18px; flex: none; cursor: pointer; }
.prop-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.prop-switch span { position: absolute; inset: 0; background: var(--field); border: 1px solid var(--line); border-radius: 9px; transition: background .12s; }
.prop-switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--dim); transition: transform .12s, background .12s; }
.prop-switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.prop-switch input:checked + span::after { transform: translateX(16px); background: var(--on-accent); }
.prop-switch input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.prop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.prop-grid label { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 2px !important; margin: 0 !important; font-size: 11px; }
.prop-grid input { width: 100%; padding: 4px 6px; }
.prop-note { font-size: 12px; color: var(--dim); margin: 0; line-height: 1.4; }
.prop-list { display: flex; flex-direction: column; gap: 2px; }
.prop-list button { display: flex; justify-content: space-between; text-align: left; background: transparent; padding: 5px 8px; font-size: 12px; }
.prop-list button.on { background: var(--field); color: var(--accent-ink); }
button.danger { color: var(--danger); }
.prop-ctl > button.primary { flex: 1.4; }
/* Animate: layers per frame */
.layer-list { display: flex; flex-direction: column; gap: 1px; }
.layer-row { display: flex; align-items: center; gap: 4px; border-radius: var(--radius); padding: 1px 2px; }
.layer-row:hover { background: var(--field); }
.layer-row.sel { background: var(--field); box-shadow: inset 2px 0 0 var(--accent-ink); }
.layer-row.off .layer-name { color: var(--dim); text-decoration: line-through; }
.layer-row .icon { background: transparent; padding: 3px; flex: none; }
.sets-list { display: flex; flex-direction: column; gap: 1px; margin-bottom: 4px; }
.layer-name { flex: 1; min-width: 0; text-align: left; background: transparent; padding: 3px 4px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row input[type=number], .layer-add input[type=number] { width: 42px; padding: 2px 4px; flex: none; }
.layer-add { display: flex; align-items: center; gap: 4px; }
.layer-add select { flex: 1; min-width: 0; padding: 4px; }
.layer-add button { padding: 4px 6px; flex: none; }
button.icon.text { font-size: 11px; font-weight: 600; width: 30px; }
.sub-cats { display: flex; flex-wrap: wrap; gap: 3px; margin: -2px 0 8px; }
.sub-cats button { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--panel-2); }
.sub-cats button.active { outline: none; background: var(--accent); color: #241f18; }
.as-sub { display: block; width: calc(100% - 24px); margin: 1px 0 1px 24px; text-align: left; font-size: 12px; padding: 3px 8px; background: transparent; color: var(--dim); }
.as-sub.active { color: var(--accent); background: var(--panel-2); }
.as-tab.drop, .as-sub.drop { outline: 2px dashed var(--accent); }
.as-card[draggable="true"] { cursor: grab; }
/* Edit: the tool options bar under the canvas panel's top bar */
.ws-options { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: nowrap; height: 38px; box-sizing: border-box; overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
.ws-options > * { flex: none; }
.ws-options .prop-seg { flex: none; }
.ws-options .prop-seg button { padding: 3px 10px; }
.ws-options button:not(.prop-seg button) { padding: 4px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.opt-label { font-size: 12px; color: var(--dim); margin-left: 4px; }
.opt-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.ws-options input:not([type]) { width: 120px; font-size: 12px; }
.ws-options .opt-num { width: 46px; font-size: 12px; padding: 2px 4px; }
/* View > Canvas size */
.cs-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cs-presets button { font-size: 12px; padding: 4px 8px; }
.cs-sides { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cs-side { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.cs-side input { width: 100%; }
/* compact panel rows (Properties): small controls side by side, wrapping when narrow */
.props-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; }
.props-row button { font-size: 12px; padding: 4px 8px; }
.props-row label.check { margin: 0 0 0 4px; font-size: 12px; }
.props-row select { flex: 1; min-width: 0; font-size: 12px; padding: 3px 6px; }
.props-row input:not([type=checkbox]) { flex: 1; min-width: 0; font-size: 12px; padding: 3px 6px; }
.props-row.cs-sides { display: flex; flex-wrap: wrap; }
.props-row .cs-side { flex-direction: row; align-items: center; gap: 2px; flex: 1 1 50px; min-width: 50px; font-size: 11px; }
.props-row .cs-side input { width: 100%; min-width: 0; padding: 3px 2px; text-align: center; }
.props-row.cs-sides button { flex: 1 0 auto; }
#e-audit { font-size: 11px; margin: 0 0 6px; }
/* the Edit page: export lives in Properties, so the stage toolbar drops its copy */
.ws-stage #export-png, .ws-stage label:has(#export-bg) { display: none; }
.grad { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.grad button[data-grad-end] { display: flex; align-items: center; gap: 6px; flex: 1; }
.grad .sw { width: 18px; height: 18px; border-radius: 3px; outline: 1px solid rgba(255,255,255,0.2); }
.grad .arrow { color: var(--dim); }
.grad-strip { display: flex; height: 18px; border-radius: 3px; overflow: hidden; outline: 1px solid rgba(255,255,255,0.2); margin-bottom: 6px; }
.grad-strip span { flex: 1; }
.grad-opts { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; }
.grad-opts label.check { margin: 0; white-space: nowrap; }
.grad-opts .bands { display: flex; align-items: center; gap: 4px; color: var(--dim); white-space: nowrap; }
.grad-opts .bands input { width: 44px; flex: none; }
.grad-pick { display: flex; gap: 6px; margin-bottom: 6px; }
.grad-pick select { flex: 1; min-width: 0; }
.grad button[data-grad-end] { min-width: 0; overflow: hidden; }
.grad-edit { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.grad-edit input[type=color] { width: 26px; height: 22px; padding: 0; }
.rand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.rand-pct label { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin: 4px 0; }
.rand-pct output { text-align: right; }
.modal-box h3 { margin: 12px 0 4px; }
.row.look .grad-strip { flex: 1; margin: 0; }
.grad-builtin { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.grad-builtin .card { display: flex; flex-direction: column; gap: 4px; }
.grad-builtin .grad-strip { margin: 0; }
.tex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.tex-card { display: flex; flex-direction: column; gap: 4px; }
.tex-card.active { outline: 2px solid var(--accent); }
.tex-card .actions { display: flex; flex-wrap: wrap; gap: 4px; }
.tex-card .actions button { font-size: 11px; padding: 3px 6px; }
.tex-thumb { width: 48px; height: 48px; image-rendering: pixelated; border-radius: 3px; }
.tex-editor { background: var(--panel-2); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; }
.tex-brushes { flex-wrap: wrap; margin-bottom: 8px; }
.tex-brushes button { display: flex; align-items: center; gap: 4px; }
.tex-cell { width: 10px; height: 10px; border-radius: 2px; outline: 1px solid rgba(255,255,255,0.2); }
.tex-grid { display: grid; gap: 1px; max-width: 256px; margin-bottom: 8px; touch-action: none; cursor: crosshair; user-select: none; }
.tex-px { aspect-ratio: 1; }
.tex-preview { width: 128px; height: 128px; image-rendering: pixelated; border-radius: 3px; }
.chip .tex-chip { width: 48px; height: 48px; image-rendering: pixelated; border-radius: 3px; display: block; }
.row.look .tex-mini { width: 24px; height: 24px; image-rendering: pixelated; border-radius: 2px; flex: none; }
.row.look .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row { background: var(--panel-2); border-radius: var(--radius); padding: 6px 8px; margin-bottom: 4px; }
.cat-row > button { float: right; padding: 0 6px; }
.cat-pals { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; }
.cat-pal { position: relative; display: inline-flex; }
.cat-pal .sw { width: 16px; height: 16px; border-radius: 3px; outline: 1px solid var(--swatch-edge); display: inline-block; }
.cat-pal button { position: absolute; top: -6px; right: -6px; width: 14px; height: 14px; padding: 0; font-size: 10px; line-height: 1; border-radius: 50%; display: none; }
.cat-pal:hover button { display: block; }
.cat-row select { width: 100%; }
.layer.effect { padding-left: 36px; font-size: 11px; }
.layer.effect .name { color: var(--dim); font-style: italic; }
.eye-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.eye-presets button { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.eye-presets button:hover { transform: scale(1.15); }
.eye-stops { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.eye-stop { position: relative; display: inline-flex; }
.eye-stop button.x { position: absolute; top: -5px; right: -5px; width: 13px; height: 13px; padding: 0; border-radius: 50%; display: none;
  background: var(--panel-2); border: 1px solid var(--line); }
.eye-stop button.x svg { width: 9px; height: 9px; }
.eye-stop:hover button.x, .eye-stop button.x:focus-visible { display: grid; place-items: center; }
button.icon.small { width: 22px; height: 22px; padding: 0; }
.nudge-pad { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; width: 100%; }
.nudge-pad button { padding: 4px 0; font-size: 12px; }
.fx, .eye-colour { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 14px 0 4px; }
.sec-head h3 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-head h3 .muted { font-weight: 400; }
.sec-head button.icon { width: 24px; height: 24px; padding: 0; flex: none; }
.swatch-in { width: 26px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; flex: none; }
.prop-ctl .hex { font-size: 11px; font-family: ui-monospace, monospace; }
.row.look .sw { width: 16px; height: 16px; border-radius: 50%; outline: 1px solid rgba(255,255,255,0.25); flex: none; }
/* narrow panels (Build's left column): a slimmer label column, buttons that never wrap */
.eye-colour .prop-row { grid-template-columns: 50px minmax(0, 1fr); gap: 6px; }
.eye-colour .prop-seg button, .fx .prop-seg button { padding: 4px 3px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.eye-presets { gap: 3px; flex-wrap: nowrap; }
.eye-presets button { width: 14px; height: 14px; }

/* Animate: physics switches two to a row; the animation library's tiles show the character in each animation */
.phys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
#left label.phys, #right label.phys { justify-content: space-between; margin: 2px 0; }
.anim-grid .piece canvas { width: 64px; height: 76px; image-rendering: pixelated; background: var(--stage); border-radius: 4px; }
.prop-ctl > button.icon { flex: none; padding: 5px 7px; }
#new-ms { flex: none !important; width: 64px; }
.prop-ctl > label.phys { margin-left: auto; }
.anim-preview { display: block; width: 100%; height: auto; image-rendering: pixelated; background: var(--stage); border-radius: 6px; margin-bottom: 8px; }

/* Colour grading (gradepanel.ts) */
.grade-looks { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.grade-looks button { padding: 3px 8px; font-size: 12px; text-transform: capitalize; }
.grade-sliders { display: grid; gap: 4px; }
.grade-sliders label.grade-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 34px; align-items: center; gap: 6px; font-size: 12px; margin: 0; }
.grade-sliders label.grade-row input[type=range] { width: 100%; min-width: 0; margin: 0; }
.grade-sliders output { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }
/* Maps list: the swatch is the map's own colour, the stripe its legend colour on the canvas */
.maplist .map-sw { box-shadow: inset 5px 0 0 var(--legend); }
/* Help > Keyboard shortcuts */
.keys-list { max-height: 60vh; overflow: auto; min-width: 340px; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.keys-table td { padding: 2px 6px; }
.keys-table td:first-child { white-space: nowrap; width: 1%; }
.layers-bar { display: flex; gap: 6px; margin-bottom: 6px; }
.layers-bar button { padding: 3px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.npc-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.npc-row input { width: 64px; }
/* Build: Random race */
.race-pick { margin-bottom: 8px; }
.race-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.race-chips button { padding: 3px 8px; font-size: 12px; }
.right-tabs { margin-bottom: 8px; }
.random-panel h3 { margin: 10px 0 4px; }
.random-actions { margin-top: 10px; }
.right-tabs { display: flex; }
.right-tabs button { flex: 1; }
.race-chips button.active { outline: none; background: var(--accent); color: var(--on-accent); }
.random-panel .rand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* updates and original assets */
.update-pill { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 4px 12px; }
.update-pill.failed { background: var(--danger); }
.upd-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.upd-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; background: var(--panel-2); }
.upd-row.done { opacity: 0.45; }
.upd-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.upd-notes { background: var(--panel-2); border-radius: 6px; padding: 8px 10px; margin: 6px 0; font-size: 13px; line-height: 1.45; }
.upd-ver { margin: 0 0 6px; }

.upd-log { max-height: 42vh; overflow: auto; margin: 6px 0 10px; }
.upd-entry { background: var(--panel-2); border-radius: 6px; padding: 8px 12px; margin: 0 0 6px; }
.upd-entry h3 { margin: 0 0 4px; font-size: 13px; }
.upd-entry ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.upd-label { margin: 8px 0 4px; font-size: 12px; color: var(--dim); }
.upd-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.upd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); font-size: 12px; }
.upd-chip.yours { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-ink); }
.upd-chip svg { width: 12px; height: 12px; }

/* activation screen (license.ts) */
.activate { max-width: 420px; margin: 18vh auto 0; display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.activate input { font: inherit; padding: 8px; }
.activate #lic-msg { min-height: 2.6em; color: var(--danger); }

/* a style pack the license doesn't own (stylepick.ts) */
.style-tile.locked { cursor: default; }
.style-tile.locked img { opacity: 0.45; }
.pack-buy { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }

/* The demo's padlocks, Early access panel and tour; colours come from the app's theme tokens (styles.css). */
.demo-locked { position: relative; opacity: 0.55; }
.demo-locked::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 9px; height: 9px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 -3px 0 -1px var(--accent-ink); pointer-events: none; }
#menubar #ea-open { margin-right: 8px; }

#ea-panel { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); }
.ea-box { position: relative; width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px 24px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow); }
.ea-box h2 { margin: 0 32px 6px 0; }
.ea-box h3 { margin: 18px 0 6px; font-size: 14px; color: var(--accent-ink); }
.ea-box ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.ea-lead { color: var(--dim); margin: 0; }
.ea-note { color: var(--dim); margin: 0 0 6px; }
.ea-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; font-size: 18px; line-height: 1; }
.ea-box table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ea-box th, .ea-box td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ea-box th { color: var(--dim); font-weight: 600; }
.ea-box tr.ea-here td { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ea-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.ea-buy { display: inline-block; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent);
  font-weight: 600; text-decoration: none; }

.demo-panel-lock { display: grid; justify-items: center; gap: 8px; padding: 24px 12px; text-align: center; color: var(--dim); }
.demo-panel-lock svg { width: 28px; height: 28px; }

#tour { position: fixed; inset: 0; z-index: 900; pointer-events: none; }
.tour-hole { position: fixed; border-radius: var(--radius); box-shadow: 0 0 0 9999px color-mix(in srgb, #000 45%, transparent);
  outline: 2px solid var(--accent); transition: all 0.15s ease; }
.tour-card { position: fixed; width: 300px; max-width: calc(100vw - 24px); padding: 14px 16px; pointer-events: auto;
  background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 8px 28px var(--shadow); }
.tour-card h3 { margin: 2px 0 6px; font-size: 15px; }
.tour-card p { margin: 0 0 8px; line-height: 1.45; }
.tour-count { color: var(--dim); font-size: 12px; }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; }
