:root {
  --paper: #FFFFFF; --surface: #F4F5F7; --line: #D9E0EA; --ink: #1B1B1B; --muted: #4A4F55;
  --accent: #003366; --accent-hover: #00264D; --accent-tint: #E8EEF5; --danger: #9B1C1C;
  --font: Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --rail: 240px; --editor: 340px; --radius: 6px; --focus: 0 0 0 3px #FFFFFF, 0 0 0 6px var(--accent);
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5; color: var(--ink); background: var(--surface); height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.125rem; font-weight: 700; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
button, input, select, textarea { font: inherit; color: inherit; }
/* The ring is a shadow; the transparent outline is there for Windows High Contrast (forced colors), which removes
   shadows and paints outlines in a system color. Without it there was no visible focus at all in that mode. */
:focus-visible { outline: 3px solid transparent; outline-offset: 2px; box-shadow: var(--focus); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 12px 16px; border-radius: var(--radius); z-index: 10; }
.skip:focus { left: 8px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: #fff; color: var(--accent); border-bottom: 4px solid var(--accent); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { white-space: nowrap; }
.brand-mark { width: auto; height: 60px; display: block; }
.top nav { display: flex; gap: 8px; }
.top .link { display: inline-flex; align-items: center; text-decoration: none; font: inherit; white-space: nowrap; background: var(--accent); border: 1px solid var(--accent); color: #fff; padding: 8px 12px; border-radius: var(--radius); min-height: 44px; cursor: pointer; }
.top .link:hover { background: var(--accent-hover); }
.top .link:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent); }

.studio { flex: 1; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) var(--editor); min-height: 0; overflow: hidden; }
.rail { background: var(--paper); border-right: 1px solid var(--line); padding: 16px 12px 24px; overflow-y: auto; }
.rail h2 { font-size: 0.8125rem; color: var(--muted); margin: 16px 8px 6px; font-weight: 700; }
.rail h2:first-child { margin-top: 0; }
.rail-find { margin: 0 0 12px; }
.rail-find label { display: block; font-size: 0.8125rem; color: var(--muted); margin: 0 8px 4px; font-weight: 700; }
.rail-find input { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: inherit; }
.rail-count { font-size: 0.8125rem; color: var(--muted); margin: 4px 8px 0; min-height: 1em; }
.rail-list > h2 { margin-top: 0; }
.rail-group { border-top: 1px solid var(--line); }
.rail-group > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.rail-group > summary::-webkit-details-marker { display: none; }
.rail-group > summary::before { content: ""; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); flex: none; }
.rail-group[open] > summary::before { transform: rotate(45deg); }
.rail-group > summary:hover { background: var(--accent-tint); }
.rail-group > summary h2 { margin: 0; flex: 1; }
.rail-n { font-size: 0.8125rem; color: var(--muted); }
.rail-group[open] { padding-bottom: 8px; }
.rail button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius); padding: 10px 10px; min-height: 44px; cursor: pointer; }
.rail button:hover { background: var(--accent-tint); }
.rail button .glyph { width: 22px; height: 22px; flex: none; border: 2px solid var(--accent); border-radius: 4px; }
.rail button .glyph.banner { background: var(--accent); }
.rail button .glyph.text { border-width: 0; background: repeating-linear-gradient(180deg, var(--accent) 0 2px, transparent 2px 5px); height: 14px; }
.rail button .glyph.heading { border-width: 0 0 3px; border-radius: 0; height: 12px; }
.rail button .glyph.columns { background: linear-gradient(90deg, var(--accent) 45%, transparent 45% 55%, var(--accent) 55%); }
.rail button .glyph.callout { border-left-width: 6px; }
.rail button .glyph.card { border-radius: 4px 4px 2px 2px; }
.rail button .glyph.cardgrid { background: linear-gradient(90deg, transparent 30%, var(--accent) 30% 36%, transparent 36% 64%, var(--accent) 64% 70%, transparent 70%); }
.rail button .glyph.button { border-radius: 11px; background: var(--accent); width: 30px; height: 16px; }
.rail button .glyph.buttonrow { border-radius: 11px; width: 30px; height: 16px; background: linear-gradient(90deg, var(--accent) 45%, transparent 45% 55%, var(--accent) 55%); border: none; }
.rail button .glyph.linklist { border: none; background: repeating-linear-gradient(180deg, var(--accent) 0 3px, transparent 3px 8px); }
.rail button .glyph.accordion { border-width: 2px 2px 6px; }
.rail button .glyph.tabs { border-radius: 6px 6px 0 0; border-bottom-width: 4px; }
.rail button .glyph.popup { border-radius: 50%; }
.rail button .glyph.embed { border-style: dashed; }
.rail button .glyph.table { border-radius: 2px; background: linear-gradient(180deg, var(--accent) 30%, transparent 30%), repeating-linear-gradient(90deg, transparent 0 9px, var(--accent) 9px 11px); }
.rail button .glyph.divider { border-width: 0; height: 4px; background: var(--accent); border-radius: 2px; }
.rail button .glyph.kcheck { border-radius: 4px; background: linear-gradient(180deg, var(--accent) 28%, transparent 28%); }
.rail button .glyph.flashcards { border-top-width: 5px; border-radius: 4px; background: linear-gradient(90deg, transparent 47%, var(--accent) 47% 53%, transparent 53%); }
.rail button .glyph.steps { border: none; background: radial-gradient(circle at 5px 50%, var(--accent) 4px, transparent 5px), linear-gradient(180deg, transparent 42%, var(--accent) 42% 58%, transparent 58%) 12px 0 / 100% 100% no-repeat; }
.rail button .glyph.deflist { border: none; background: linear-gradient(180deg, var(--accent) 0 3px, transparent 3px 7px, var(--accent) 7px 9px, transparent 9px 12px, var(--accent) 12px 15px, transparent 15px); background-size: 100% 100%, 100% 100%; }
.rail button .glyph.timeline { border-width: 0 0 0 3px; border-radius: 0; background: radial-gradient(circle at 2px 30%, var(--accent) 3px, transparent 4px), radial-gradient(circle at 2px 75%, var(--accent) 3px, transparent 4px); }
.rail button .glyph.box { border-radius: 4px; background: var(--tint, #e8eef5); }
.rail button .glyph.highlight { border: none; border-radius: 3px; height: 12px; background: var(--accent); opacity: .6; }
.rail button .glyph.quote { border-width: 0 0 0 5px; border-radius: 0; }
.rail button .glyph.objectives { border-left-width: 5px; background: repeating-linear-gradient(180deg, transparent 0 4px, var(--accent) 4px 6px, transparent 6px 10px); }
.rail button .glyph.modulelist { border: none; background: radial-gradient(circle at 5px 25%, var(--accent) 4px, transparent 5px), radial-gradient(circle at 5px 75%, var(--accent) 4px, transparent 5px); }
.rail button .glyph.toc { border-width: 0 0 0 4px; border-radius: 0; background: repeating-linear-gradient(180deg, var(--accent) 0 2px, transparent 2px 6px); }
.rail button .glyph.gallery { border: none; background: linear-gradient(90deg, var(--accent) 30%, transparent 30% 35%, var(--accent) 35% 65%, transparent 65% 70%, var(--accent) 70%); }
.width-pick { color: var(--ink); background: var(--paper); display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; margin-right: 8px; }
.width-pick select { color: var(--ink); min-height: 44px; border: 1px solid var(--line, #c9d2dd); border-radius: 6px; padding: 0 8px; font: inherit; background: #fff; }
.rail button .glyph.instructor { border-radius: 50% 50% 4px 4px; }
.rail button .glyph.pills { border-radius: 11px; width: 30px; height: 14px; background: linear-gradient(90deg, var(--accent) 45%, transparent 45%); }
.rail button .glyph.tasks { border: none; background: repeating-linear-gradient(180deg, var(--accent) 0 3px, transparent 3px 8px); border-right: 7px solid var(--accent); border-radius: 0 6px 6px 0; }
.rail button .glyph.mediatext { border-style: dashed; background: linear-gradient(90deg, transparent 55%, var(--accent) 55% 100%) center / 100% 2px no-repeat; }
.rail button .glyph.videogrid { border-style: dashed; background: linear-gradient(90deg, transparent 46%, var(--accent) 46% 54%, transparent 54%); }
.rail button .glyph.labeled { background: radial-gradient(circle at 30% 35%, var(--accent) 3px, transparent 4px), radial-gradient(circle at 70% 65%, var(--accent) 3px, transparent 4px); }
.rail button .glyph.scenario { border-radius: 4px; border-bottom-width: 6px; background: linear-gradient(90deg, transparent 47%, var(--accent) 47% 53%, transparent 53%); }
.rail button .glyph.ordering { border: none; background: repeating-linear-gradient(180deg, var(--accent) 0 4px, transparent 4px 9px); border-left: 4px dotted var(--accent); }
.rail button .glyph.blanks { border-width: 0 0 3px; border-radius: 0; height: 14px; border-style: dashed; }
.rail button .glyph.barchart { border-width: 0 0 2px 2px; border-radius: 0; background: linear-gradient(0deg, var(--accent) 40%, transparent 40%) 3px 0 / 4px 100% no-repeat, linear-gradient(0deg, var(--accent) 75%, transparent 75%) 9px 0 / 4px 100% no-repeat, linear-gradient(0deg, var(--accent) 55%, transparent 55%) 15px 0 / 4px 100% no-repeat; }
.rail button .glyph.references { border-width: 2px 0 0; border-radius: 0; background: repeating-linear-gradient(180deg, transparent 0 4px, var(--accent) 4px 6px); }
.rail button .glyph.filecard { border-left-width: 6px; border-radius: 4px; }
.rail button .glyph.compare { background: linear-gradient(90deg, var(--accent) 46%, transparent 46% 54%, var(--accent) 54%); opacity: .8; }
.rail button .glyph.figure { background: linear-gradient(180deg, transparent 60%, var(--accent) 60%); }

.build { padding: 24px; overflow-y: auto; }
.page-frame { max-width: 900px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; min-height: 70vh; }
.crumbs { margin: 0; padding: 12px 24px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.crumbs span { color: var(--ink); }
.canvas { padding: 24px; }
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { color: var(--ink); display: block; font-size: 1.125rem; margin-bottom: 4px; }
.empty p { margin: 0 0 16px; }
.start-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; text-align: left; }
.start-list button { display: block; width: 100%; height: 100%; min-height: 44px; text-align: left; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--muted); }
.start-list button:hover { background: var(--accent-tint); border-color: var(--accent); }
.start-list button strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
.start-list button span { font-size: 0.875rem; }
.item { position: relative; border: 2px solid transparent; border-radius: var(--radius); padding: 8px; margin: 0 -8px 8px; }
.item:hover { border-color: var(--line); }
.item.is-selected { border-color: var(--accent); }
.item-tools { display: flex; gap: 4px; justify-content: flex-end; margin: 0 0 6px; }
.item-tools .name { margin-right: auto; align-self: center; font-size: 0.8125rem; color: var(--muted); }
.item-tools .grip { display: inline-flex; align-items: center; justify-content: center; width: 28px; min-height: 44px; color: var(--muted); cursor: grab; }
.item-tools .grip:active { cursor: grabbing; }
.item.is-dragging { opacity: 0.5; }
.item.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.item.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.link-btn { background: none; border: 0; padding: 0 4px; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 24px; font: inherit; }
.link-btn:hover { color: var(--accent-hover); }
.item-tools button { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 44px; min-height: 44px; cursor: pointer; }
.item-tools button:hover { background: var(--accent-tint); border-color: var(--accent); }
.item-tools button[disabled] { opacity: 1; color: var(--line); cursor: default; }
.preview-wrap { position: relative; min-height: 44px; }
.place-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.place-col { min-width: 0; }
.place-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
@media (max-width: 1023px) { .place-row { grid-template-columns: minmax(0, 1fr); } }
.item-select { position: absolute; inset: 0; background: transparent; border: 0; cursor: pointer; }
.item-select:focus-visible { box-shadow: var(--focus); border-radius: var(--radius); }
.item.is-selected .item-select, .item:hover .item-select { }
.preview { position: relative; z-index: 1; pointer-events: none; }
.item.is-selected .preview { pointer-events: auto; }

.editor { background: var(--paper); border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; }
.editor h2 { font-size: 1.125rem; margin-bottom: 4px; }
.editor .hint { color: var(--muted); font-size: 0.875rem; }
.field { margin: 0 0 16px; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 0.9375rem; }
.field input[type="text"], .field input[type="url"], .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-height: 44px; }
.field textarea { min-height: 96px; resize: vertical; }
.field .problem { color: var(--danger); font-size: 0.875rem; margin: 4px 0 0; }
.field .note { color: var(--muted); font-size: 0.875rem; margin: 4px 0 0; }
.rich { border: 1px solid var(--line); border-radius: var(--radius); }
.rich-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.rich-tools button { min-width: 44px; min-height: 44px; border: 1px solid transparent; background: transparent; border-radius: 4px; cursor: pointer; }
.rich-tools button:hover { background: var(--accent-tint); border-color: var(--accent); }
.rich-area { min-height: 96px; padding: 10px 12px; outline: 3px solid transparent; outline-offset: -3px; }
.rich-area:focus-visible { box-shadow: inset var(--focus); }
.rich-area p { margin: 0 0 0.5rem; }
.rows { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.row-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--line); }
.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 0.9375rem; }
.row-head button { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 36px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.row-head button:hover { background: var(--accent-tint); border-color: var(--accent); }
.row-head .row-toggle { flex: 1; min-width: 0; min-height: 44px; justify-content: flex-start; gap: 8px; border-color: transparent; background: transparent; text-align: left; padding: 0 6px; font: inherit; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.row-actions button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font: inherit; font-size: 0.875rem; }
.row-actions button:hover { background: var(--accent-tint); border-color: var(--accent); }
.row-actions button[disabled] { color: var(--muted); opacity: .55; cursor: default; }
.row-actions button[data-row-act="remove"]:hover { background: #F9E5E5; border-color: var(--danger); color: var(--danger); }
.row-head .row-toggle .row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-head .row-toggle .chev { width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); flex: none; }
.row-head .row-toggle[aria-expanded="true"] .chev { transform: rotate(45deg); }
.row-edit { flex: none; font-size: 0.8125rem; font-weight: 700; color: var(--accent); text-decoration: underline; }
.rows-how { margin: 0 0 6px; }
.row-flag { display: none; flex: none; font-size: 0.75rem; color: var(--danger); border: 1px solid var(--danger); border-radius: 10px; padding: 1px 8px; }
.row.has-problem .row-flag { display: inline-block; }
.row-fields[hidden] { display: none; }
.row:has(.row-fields[hidden]) .row-head { border-bottom: 0; }
.row-head button[disabled] { color: var(--line); cursor: default; }
.row-head button[data-row-act="remove"]:hover { background: #F9E5E5; border-color: var(--danger); color: var(--danger); }
.row-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px 12px; background: var(--paper); border-radius: 0 0 var(--radius) var(--radius); }
.row-field label, .row-field > .label { display: block; font-size: 0.8125rem; color: var(--muted); margin-bottom: 2px; font-weight: 400; }
.row-field input, .row-field select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-height: 40px; }
.add-row { width: 100%; min-height: 44px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--paper); color: var(--accent); cursor: pointer; }
.add-row:hover { background: var(--accent-tint); }
.add-row[disabled] { border-color: var(--line); color: var(--muted); cursor: default; }
@media (max-width: 1023px) { .row-head button { min-width: 44px; min-height: 44px; } .row-field input, .row-field select { min-height: 44px; } }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; position: relative; }
.swatches button.is-on { border-color: var(--ink); }
.swatches button.is-on::after { content: ""; position: absolute; inset: 11px; border: 3px solid #fff; border-width: 0 0 3px 3px; transform: rotate(-45deg) translate(2px, -3px); width: 12px; height: 7px; }
.swatches button.is-light { border-color: #6B7280; }
.swatches button.is-light.is-on { border-color: var(--ink); }
.swatches button.is-light.is-on::after { border-color: #000; }
.swatch-grid { display: grid; grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr)); gap: 4px; margin-top: 8px; max-width: 360px; }
.swatch-grid button { aspect-ratio: 1; min-width: 24px; min-height: 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; position: relative; padding: 0; }
.swatch-grid button.is-light { border-color: #6B7280; }
.swatch-grid button.is-on { border-color: var(--ink); outline: 2px solid var(--paper); outline-offset: -4px; }
.swatch-grid button.is-on::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 3px 3px; transform: translate(-50%, -70%) rotate(-45deg); }
.swatch-grid button.is-light.is-on::after { border-color: #000; }
@media (max-width: 1023px) { .swatch-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-width: none; } }
.swatches button.default-swatch { width: auto; padding: 0 12px; border-radius: 22px; background: var(--paper); border-color: var(--line); color: var(--muted); font-size: 0.8125rem; }
.swatches button.default-swatch.is-on { border-color: var(--ink); }
.swatches button.default-swatch.is-on::after { content: none; }
details.advanced { margin-top: 8px; }
details.more { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 700; min-height: 44px; display: flex; align-items: center; list-style: none; }
details.more > summary::before { content: ''; width: 8px; height: 8px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(-45deg); margin-right: 10px; transition: transform 144ms; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary::-webkit-details-marker { display: none; }
details.advanced summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.custom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.8125rem; background: var(--accent-tint); color: var(--accent); }
.badge.fail { background: #F9E5E5; color: var(--danger); }
.caution { background: #F7F1E0; border-left: 4px solid #8A6400; padding: 8px 12px; font-size: 0.875rem; border-radius: 0 var(--radius) var(--radius) 0; }

.bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: var(--paper); border-top: 1px solid var(--line); }
.status-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.status { margin: 0; color: var(--muted); font-size: 0.9375rem; }
#undo, .checks { min-height: 44px; }
.checks.has-items { color: #8A6400; font-weight: 700; }
.status.fail { color: var(--danger); }
.status.todo { color: var(--ink); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary, .secondary { min-height: 44px; padding: 10px 18px; border-radius: var(--radius); cursor: pointer; border: 1px solid var(--accent); }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); }
.primary[disabled] { background: var(--muted); border-color: var(--muted); cursor: not-allowed; }
.primary.is-blocked { background: var(--muted); border-color: var(--muted); }
.secondary { background: var(--paper); color: var(--accent); }
.secondary:hover { background: var(--accent-tint); }
.html-out { padding: 16px 24px 24px; background: var(--paper); border-top: 1px solid var(--line); }
.html-out pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow: auto; max-height: 40vh; font-size: 0.8125rem; line-height: 1.45; }

dialog { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 560px; width: calc(100% - 32px); color: var(--ink); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; }
dialog::backdrop { background: rgba(27,27,27,.5); }
dialog h2 { margin-bottom: 12px; }
dialog h3 { margin: 12px 0 6px; }
dialog ol, dialog ul { padding-left: 1.25rem; }
dialog li { margin-bottom: 6px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dlg-actions a.primary { display: inline-flex; align-items: center; text-decoration: none; }
.save-controls select { flex: 1 1 200px; min-width: 0; max-width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: inherit; }
.save-row { margin: 0 0 12px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; }
.check-row input { width: 24px; height: 24px; flex: none; margin: 0; }
#fb-out { width: 100%; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: .85rem; }
#fb-text[aria-invalid="true"] { border-color: var(--danger); }
.save-row label { display: block; font-weight: 700; margin-bottom: 4px; }
.save-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.save-warn { margin: 0; border-radius: 0; }
.warn { background: #FFF4D6; border-left: 6px solid #8A5A00; color: var(--ink); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 0 0 16px; }
.save-controls textarea { flex: 1 1 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: .85rem; min-height: 44px; }
.save-controls input { flex: 1 1 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); min-height: 44px; }
.page-list { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.page-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 8px 12px; }
.page-list .pl-name { flex: 1 1 160px; min-width: 0; }
.page-list .pl-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-list .pl-name span { color: var(--muted); font-size: 0.8125rem; }
.page-list button { min-height: 44px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--paper); color: var(--accent); cursor: pointer; }
.page-list button.danger { border-color: var(--line); color: var(--danger); }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { box-shadow: var(--focus); }
.bookmarklet { display: inline-block; padding: 8px 14px; border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 700; text-decoration: none; cursor: grab; min-height: 44px; line-height: 24px; }
.page-list .empty-pages { color: var(--muted); border: 1px dashed var(--line); text-align: center; padding: 16px; }

.tabbar { display: none; }
@media (max-width: 1023px) {
  .studio { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: 8px 16px; }
  .brand { gap: 10px; }
  .brand-mark { height: 44px; }
  .brand h1 { font-size: 1.05rem; }
  .top nav { flex-wrap: wrap; width: 100%; }
  .rail, .editor { border: 0; border-bottom: 1px solid var(--line); }
  .studio > [data-pane]:not(.is-active) { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); }
  .tabbar button { min-height: 48px; border: 0; border-bottom: 3px solid transparent; background: transparent; cursor: pointer; }
  .tabbar button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); font-weight: 700; }
  .build { padding: 16px; }
  .bar { flex-direction: column; align-items: stretch; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1; }
  .link-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .check-row input { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-contrast: more) { :root { --line: #4A4F55; --muted: #1B1B1B; } .item:hover { border-color: var(--ink); } }

/* Per-row extras and the click-to-place pad */
details.row-more { border-top: 1px solid var(--line); padding-top: 4px; display: grid; gap: 8px; }
details.row-more > summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 0.875rem; min-height: 44px; display: flex; align-items: center; }
details.row-more[open] > summary { margin-bottom: 4px; }
details.row-more > .row-field { margin-bottom: 8px; }
.placer { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); cursor: crosshair; overflow: hidden; min-height: 60px; }
.placer img { display: block; width: 100%; height: auto; pointer-events: none; }
.placer-dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff; font-size: 0.8125rem; font-weight: 700; line-height: 22px; text-align: center; pointer-events: none; }
.place-hint { margin-top: 6px; }

.row-undo { margin: 6px 0; }
.linkish { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--accent); text-decoration: underline; font: inherit; font-weight: 700; cursor: pointer; }

/* The add-a-link form inside a rich text box */
.rich-link { display: grid; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--accent-tint); }
.rich-link label { display: block; font-size: 0.8125rem; margin-bottom: 2px; }
.rich-link input { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.rich-link-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.rich-link-acts button { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: inherit; cursor: pointer; }
.rich-link-acts button[data-link="add"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.rich-link[hidden] { display: none; }
.rich-link .link-problem { color: var(--danger); font-size: 0.875rem; margin: 0; }
.empty .linkish { min-height: 24px; padding: 2px 2px; }
@media (max-width: 1023px) { .empty .linkish { min-height: 44px; min-width: 44px; display: inline-block; padding: 10px 2px; } }

.status.done { color: #1E4D2B; font-weight: 700; }
#dlg-sample .page-list li { align-items: flex-start; }
#dlg-sample .page-list button { min-height: 44px; }
.bring-choice { border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px; margin-top: 12px; background: var(--accent-tint); }
.bring-choice .dlg-actions { flex-wrap: wrap; }

/* What a component is for, under its name in search results */
.pick-name { display: block; text-align: left; }
.pick-what { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--muted); line-height: 1.3; margin-top: 2px; }

#page-color { max-width: 150px; }
#page-width { max-width: 130px; }

/* Page-wide choices sit with the page they change, not in the top bar (which ran off a laptop screen). */
.page-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-bar .crumbs { margin: 0; flex: 1 1 200px; min-width: 0; }
.page-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.page-tools .width-pick { margin-right: 0; background: transparent; }
#page-color, #page-width { max-width: none; }
.page-bar { padding: 6px 16px 6px 24px; border-bottom: 1px solid var(--line); }
.page-bar .crumbs { padding: 6px 0; border-bottom: 0; }

/* A short window (a laptop at 200% zoom is 683 by 384) cannot afford a fixed header, tab bar and action bar: together
   they left 80px, sometimes 24px, to work in, and hid whatever had keyboard focus (WCAG 2.4.11, 1.4.10; found by a
   keyboard-only tester, 2026-11-26). Below 560px tall the whole page scrolls as one, and nothing is pinned. */
@media (max-height: 560px) {
  body { height: auto; min-height: 100vh; min-height: 100dvh; display: block; overflow: auto; }
  .studio { display: block; overflow: visible; min-height: 0; }
  .rail, .build, .editor { overflow: visible; }
  .tabbar { position: static; }
  .bar { position: static; }
  html { scroll-padding: 12px 0; }
}

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The action bar: the message may wrap to two lines, but the buttons stay on one row (a long message used to push Copy
   onto a row of its own). Component toolbars: name and placement tag on one line, buttons their own size. */
@media (min-width: 1024px) {
  .bar { flex-wrap: nowrap; }
  .bar .status-wrap { flex: 1 1 0; min-width: 0; }
  .bar .actions { flex: none; flex-wrap: nowrap; }
}
.item-tools { align-items: center; }
.item-tools .name { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.item-tools button { flex: none; align-self: center; }
.page-bar .crumbs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-tools .name > * { white-space: nowrap; }

/* Phone view of the page, in the studio only */
.page-frame.is-phone { max-width: 407px; margin-left: auto; margin-right: auto; border: 8px solid #2B2F33; border-radius: 28px; }
/* Phone view is a picture of the page: the editing buttons inside it made it look like the phone would show them (a tester, 2026-11-26). */
.page-frame.is-phone .item-tools { display: none; }
.page-frame.is-phone .canvas { padding-left: 8px; padding-right: 8px; }
#phone-view { min-height: 44px; padding: 0 12px; }
#phone-view[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
#page-name { min-height: 24px; padding: 2px 2px; font-weight: 400; color: var(--ink); }
.code-glyph { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; font-weight: 700; letter-spacing: -0.5px; }
.problem.is-todo, .field .problem.is-todo { color: var(--ink); }
.row-flag.is-todo { color: var(--ink); border-color: var(--muted); background: transparent; }
.page-list .list-heading { display: block; font-weight: 700; font-size: 0.875rem; color: var(--muted); padding: 12px 0 4px; border: 0; }
@media (max-width: 1023px) { #page-name { min-height: 44px; min-width: 44px; display: inline-block; padding: 10px 2px; } .page-bar .crumbs { white-space: normal; } }

.item-tools .name { cursor: pointer; }
.item-tools .name > * { white-space: normal; }
.rich-tools sub, .rich-tools sup { font-size: 0.75rem; }
/* Color for chosen words: a short row of named colors under the toolbar. */
.rich-tools .color-a { display: inline-block; font-weight: 700; border-bottom: 3px solid #9B1C1C; line-height: 1; padding: 0 1px; }
.rich-colors { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--accent-tint); }
.rich-colors[hidden] { display: none; }
.rich-colors button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: inherit; cursor: pointer; }
.rich-colors button:hover { border-color: var(--accent); }
.rich-colors .chip { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.rich-colors .note, .rich-colors .link-problem { flex: 1 1 100%; margin: 0; font-size: 0.8125rem; }
.rich-colors .link-problem { color: var(--danger); font-size: 0.875rem; }
/* One-line boxes that take bold, italics, subscript and superscript (table cells), and the row's small toolbar. */
.line-area { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-height: 40px; line-height: 1.5; overflow-wrap: anywhere; }
.line-area:focus-visible { outline: none; box-shadow: var(--focus); }
.line-tools { border: 1px solid var(--line); border-radius: var(--radius); align-items: center; }
.line-tools .line-how { margin: 0 0 0 6px; flex: 1 1 140px; font-size: 0.8125rem; }
.line-tools button[aria-pressed="true"], .rich-tools button[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); }
@media (max-width: 1023px) { .line-area { min-height: 44px; } }

/* A picture that cannot load in the preview: say why, in place. */
.img-missing { margin: 4px 0 0; padding: 8px 12px; border: 1px dashed #6B7480; border-radius: 6px; background: #F4F5F7; color: #1F2933; font-size: 0.875rem; font-style: normal; font-weight: 400; text-align: left; }

/* Pictures kept inside a text box: shown at a sensible size while editing, and outlined while their alt text is open. */
.rich-area img { max-width: 100%; height: auto; vertical-align: middle; cursor: pointer; }
.rich-area img.is-chosen { outline: 3px solid var(--ink); outline-offset: 2px; }
.rich-picture .note { margin: 0; font-size: 0.8125rem; }

/* Pictures on this page: a thumbnail, the alt text box, and a way to the part. */
.pic-list li { align-items: flex-start; }
.pic-list .pic-thumb { flex: 0 0 96px; width: 96px; max-height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #F4F5F7; }
.pic-list .pic-none { display: grid; place-items: center; height: 72px; font-size: 0.75rem; color: var(--muted); text-align: center; padding: 4px; }
.pic-list .pl-name { flex: 1 1 220px; display: grid; gap: 4px; }
.pic-list .pl-name > label:first-child { font-size: 0.875rem; font-weight: 700; }
.pic-list input[type=text] { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font: inherit; }
.pic-list input[type=text]:disabled { background: #F4F5F7; color: var(--muted); }
.pic-list .pic-decor { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.875rem; }
.pic-list .pic-decor input { width: 20px; height: 20px; }
.pic-list .pic-advice:empty { display: none; }
.pic-list .pic-advice { color: #7A4B00; }
.pic-list .note { margin: 0; font-size: 0.8125rem; }

/* About how long the page takes to read, for the author. */
.read-time { font-size: 0.875rem; color: var(--muted); white-space: nowrap; align-self: center; }

/* Emoji: the panel in a text box's toolbar and the copy dialog share one grid. */
.rich-emoji { display: block; }
.emoji-group { margin: 0 0 8px; }
.emoji-group-name { margin: 0 0 4px; font-size: 0.8125rem; font-weight: 700; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji-row button, #emoji-grid button { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 1.375rem; line-height: 1; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); cursor: pointer; }
.emoji-row button:hover, .emoji-row button:focus-visible { border-color: var(--accent); background: var(--accent-tint); }
.rich-emoji .note { margin: 6px 0; font-size: 0.8125rem; }
.rich-emoji [data-emoji-close] { margin-top: 2px; }
details.art-group > .note { margin: 6px 0 10px; }

.emoji-add { display: inline-flex; align-items: center; margin-top: 2px; min-height: 44px; min-width: 44px; font-size: 0.8125rem; }
.art-steps { margin: 0 0 10px; padding-left: 1.25rem; }
.art-steps li { margin-bottom: 2px; }
