:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #101521; color: #edf2fa; }
* { box-sizing: border-box; }
body { margin: 0; }
.editor { max-width: 1020px; margin: auto; padding: 32px 24px; }
.eyebrow { margin: 0 0 8px; color: #77d7ed; font-size: 11px; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); }
.instructions { color: #b5c5d9; font-size: 14px; line-height: 1.8; margin: 12px 0 28px; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 28px; align-items: start; }
.board-heading { display: flex; justify-content: space-between; margin-bottom: 10px; color: #94adca; font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(20, 1fr); width: 100%; aspect-ratio: 1; background: #182234; border: 1px solid #50617a; }
.cell { appearance: none; display: block; width: 100%; aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-right: 1px solid #364257; border-bottom: 1px solid #364257; border-radius: 0; background-color: transparent; background-repeat: no-repeat; background-position: center; background-size: 122.22%; }
.cell[data-id="4"] { background-size: 100%; }
.cell:focus-visible { outline: 2px solid #fff; outline-offset: -2px; z-index: 1; }
button, .file-button { cursor: pointer; font: inherit; touch-action: manipulation; }
.range-note { color: #95abc5; font-size: 12px; line-height: 1.8; }
.panel { background: #172132; border: 1px solid #2b3b51; border-radius: 12px; padding: 18px; }
.name-label { font-size: 12px; color: #b5c5d9; display: block; margin-bottom: 7px; }
input[type="text"] { width: 100%; padding: 10px; border: 1px solid #465c79; border-radius: 5px; background: #101a29; font: inherit; color: inherit; font-size: 16px; }
h2 { font-size: 13px; margin: 18px 0 10px; color: #b5c5d9; font-weight: 500; }
.palette { display: grid; gap: 7px; }
.palette button { display: flex; align-items: center; gap: 10px; text-align: left; background: #1b293d; border: 1px solid #354761; color: inherit; padding: 9px; border-radius: 6px; font-size: 13px; }
.palette button[aria-pressed="true"] { border-color: #82deee; background: #234155; box-shadow: inset 0 0 0 1px #82deee; }
.palette small { display: block; margin-top: 3px; font-size: 10px; color: #b5c5d9; }
.swatch { width: 24px; height: 24px; flex: none; background: center / contain no-repeat; }
.counts { font-size: 12px; color: #b5c5d9; margin: 18px 0 12px; }
.primary, .file-actions button, .file-button, .clear-all { display: block; width: 100%; padding: 12px 6px; border-radius: 6px; text-align: center; font-size: 12px; text-decoration: none; }
.primary { background: #9fe9f6; border: 1px solid #9fe9f6; color: #102737; font-weight: 700; font-size: 14px; }
.file-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.file-actions button, .file-button { background: #25364e; border: 1px solid #465c79; color: inherit; }
.publish-actions { margin-top: 12px; padding: 10px; border: 1px solid #547c8d; border-radius: 6px; background: #1c3041; }
.stage-save-buttons { display: grid; gap: 7px; margin-top: 10px; }
.stage-save-buttons button { width: 100%; min-height: 44px; padding: 11px 5px; border: 1px solid #8fcbd8; border-radius: 5px; background: #294a5b; color: #e5faff; font-size: 13px; }
#overwrite { background: #254c48; border-color: #8cd3c4; }
.publish-actions p { margin: 9px 0 0; font-size: 11px; line-height: 1.7; color: #b5c5d9; overflow-wrap: anywhere; }
.download-link { margin-top: 7px; padding: 3px 0; border: 0; background: transparent; color: #bfebf5; text-decoration: underline; font-size: 11px; }
[hidden] { display: none !important; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-button:has(+ input:focus-visible) { outline: 2px solid white; }
.clear-all { margin-top: 12px; background: transparent; color: #efb3be; border: 1px solid #674250; }
.status { font-size: 12px; min-height: 1.5em; color: #9ee1d7; line-height: 1.7; }
.status[data-error="true"] { color: #ffabb9; }
.notice { font-size: 11px; color: #95abc5; line-height: 1.8; margin: 12px 0; }
.normal-game { color: #b7d9f4; font-size: 12px; }
.stage-manager { margin-top: 28px; padding: 20px; background: #172132; border: 1px solid #2b3b51; border-radius: 12px; }
.list-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.list-heading h2 { margin: 0; font-size: 18px; color: #edf2fa; font-weight: 700; }
#list-state { font-size: 12px; color: #9ee1d7; }
.list-help { font-size: 12px; color: #b5c5d9; line-height: 1.8; overflow-wrap: anywhere; }
.stage-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.stage-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 10px 12px; background: #101a29; border: 1px solid #354761; border-radius: 6px; }
.stage-title { flex: 1; min-width: 120px; font-size: 14px; overflow-wrap: anywhere; }
.stage-title small { display: block; font-size: 11px; color: #95abc5; margin-bottom: 3px; }
.stage-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-controls button, .register-stage button { min-height: 44px; padding: 8px 12px; color: inherit; background: #25364e; border: 1px solid #465c79; border-radius: 5px; font-size: 12px; }
.stage-controls button[data-action="remove"] { color: #efb3be; border-color: #674250; }
.stage-controls button[data-action="edit"] { color: #c7f6ff; border-color: #547c8d; background: #294a5b; }
button:disabled { cursor: default; opacity: .45; }
.register-stage label { display: block; font-size: 12px; color: #b5c5d9; margin-bottom: 8px; }
.register-stage > div { display: flex; gap: 8px; }
.register-stage input { min-width: 0; flex: 1; }
.register-stage button { flex: none; }
.list-save-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.list-save-actions .primary { width: auto; padding: 12px 20px; }
.list-save-actions .download-link { margin: 0; font-size: 12px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #b3dfff; outline-offset: 2px; }
@media (max-width: 700px) {
  .editor { padding: 22px 12px; }
  .instructions { margin-bottom: 18px; font-size: 12px; }
  .workbench { grid-template-columns: 1fr; gap: 8px; }
  .panel { padding: 16px; }
  .stage-manager { padding: 16px; }
  .stage-title { flex-basis: 100%; }
  .palette { grid-template-columns: 1fr 1fr; }
  .board .palette { position: sticky; top: 6px; z-index: 2; margin: 0 0 12px; padding: 6px; border-radius: 8px; background: #101521; }
  .palette button { padding: 8px 5px; font-size: 12px; gap: 4px; }
  .palette small { font-size: 9px; }
}
