:root { color-scheme: light dark; --accent: #0a84ff; --danger: #ff453a; --muted: #8e8e93;
        --surface: rgba(120,120,128,.16); --line: rgba(120,120,128,.28); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: grid; place-items: center;
       min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
       background: light-dark(#f5f5f7, #1c1c1e); color: light-dark(#1d1d1f, #f5f5f7); }
#mojoui-root { padding: 32px 20px; width: 100%; max-width: 560px; display: flex; justify-content: center; }
.vstack { display: flex; flex-direction: column; align-items: center; }
.vstack.drag { cursor: grab; } .vstack.drop.drop-over { outline: 2px solid currentColor; outline-offset: -2px; border-radius: 10px; }
.embed { display: flex; align-self: stretch; } .embed iframe { flex: 1; width: 100%; height: 100%; border: 0; }
.webcomponent { display: block; min-width: 0; }  /* a JS widget's box (mojoui-widgets.js puts the widget's element in it) */
.hstack { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; justify-content: center; }
.spacer { flex: 1; }
.text { margin: 0; text-align: center; }
.text.paragraph { text-align: start; overflow-wrap: anywhere; }  /* a Paragraph: runs inline, the browser wraps them */
.text.paragraph.lead { display: flex; align-items: center; }  /* a lead run in a column of its own (its trailing space hangs) */
.run.strong { font-weight: 700; } .run.em { font-style: italic; } .run.code { font-family: ui-monospace, monospace; } a.run.link { color: inherit; }
.text.title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.text.headline { font-size: 17px; font-weight: 600; }
.text.caption { font-size: 13px; color: var(--muted); }
button { font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 10px 20px; min-height: 48px;
         cursor: pointer; background: var(--surface); color: inherit; transition: transform .08s, filter .15s; }
button:hover { filter: brightness(1.08); }
button:active { transform: scale(.97); }
button.prominent { background: var(--accent); color: #fff; padding: 10px 26px; }
button.destructive { color: var(--danger); }
button.token { background: transparent; padding: 0 3px; min-height: 0; border-radius: 4px; font-weight: 600; color: var(--accent);
  text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: background .15s; }
button.token:hover { filter: none; background: color-mix(in srgb, var(--accent) 12%, transparent); }
[data-tag=sentence-line] { flex-wrap: nowrap; }
[data-tag=sentence-line] > .text { white-space: pre; text-align: left; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
form.field { margin: 0; }
form.field { display: flex; }
input[type=text] { font: inherit; width: var(--control-width, 220px); max-width: var(--control-max, 70vw); min-height: 48px; padding: 8px 12px; border-radius: 12px;
                   border: 1px solid var(--line); background: light-dark(#fff, #2c2c2e); color: inherit; }
label.toggle { display: inline-flex; gap: 10px; align-items: center; min-height: 48px; cursor: pointer; }
label.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
select { font: inherit; width: var(--control-width, auto); min-height: 48px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line);
         background: light-dark(#fff, #2c2c2e); color: inherit; }
input[type=range] { width: var(--control-width, 240px); min-height: 48px; accent-color: var(--accent); }
progress { width: var(--control-width, 240px); height: 8px; accent-color: var(--accent); }
hr { width: var(--control-width, 280px); border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
[data-tag=status-bar] { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; flex-shrink: 0; }  /* one line, as on GTK: a long message is cut, not wrapped */
button.icon-only.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.hstack > hr { width: 0; min-width: 0; align-self: center; height: var(--control-height, 28px); border-top: 0; border-left: 1px solid var(--line); margin: 0 6px; }
.hstack > hr[style*="align-self:stretch"] { height: auto; }  /* a filling divider in a row: its full height */
img.image { max-width: 100%; height: auto; border-radius: 12px; image-rendering: auto; }
.scroll { overflow-y: auto; width: 100%; display: flex; flex-direction: column; align-items: center; }  /* like a VStack */
table.table { border-collapse: collapse; width: 100%; }  /* the browser's own column widths, across its parent */
table.table th { text-align: left; font-weight: inherit; vertical-align: middle; } table.table td { vertical-align: middle; }
table.table th.num, table.table td.num { text-align: right; } table.table tbody tr:last-child > td { border-bottom: 0; }
table.table .text { text-align: inherit; } table.table .hstack { flex-wrap: nowrap; justify-content: flex-start; }  /* cells read from their leading edge */
table.table td.num > .hstack { justify-content: flex-end; } table.table td.num .text { white-space: nowrap; }
table.table.dense th, table.table.dense td { white-space: nowrap; } table.table.dense td { overflow: hidden; text-overflow: ellipsis; }
table.table.dense td.wrap { white-space: normal; } table.table.dense td.wrap .hstack { flex-wrap: wrap; row-gap: 4px; }
table.table.dense td .text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }  /* (one line, cut: the cell's widest) */
table.table.dense td.wrap .text { white-space: nowrap; overflow: visible; }
[data-tag=side-scroll] { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } [data-tag=side-scroll] > table.table { flex: 1 0 auto; }
[data-tag=side-scroll] table.table td { white-space: nowrap; }  /* (mojoui.lists.SideScroll: a wide table scrolls, its cells on one line) */
table.table label.toggle { min-height: 0; display: flex; } label.toggle.check span:empty { display: none; }  /* (a tick box alone: no gap for an empty title) */
.segmented, .tabs { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface); }
.segmented label, .tabs label { position: relative; }
.segmented input, .tabs input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span, .tabs span { display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 9px; font-weight: 600; }
.segmented[style*="align-self:stretch"] label, .tabs[style*="align-self:stretch"] label { flex: 1 1 0; }  /* a filling one: equal segments, as GTK's homogeneous group and the Mac's */
.segmented[style*="align-self:stretch"] span, .tabs[style*="align-self:stretch"] span { justify-content: center; width: 100%; box-sizing: border-box; }
.segmented input:checked + span, .tabs input:checked + span { background: light-dark(#fff, #3a3a3c); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.segmented input:focus-visible + span, .tabs input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.tabs span { padding: 0 20px; }
.radio { display: flex; flex-direction: column; gap: 2px; }
.radio label { display: inline-flex; gap: 10px; align-items: center; min-height: 48px; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--accent); }
textarea { font: inherit; width: var(--control-width, 320px); max-width: var(--control-max, 80vw); padding: 10px 12px; border-radius: 12px; resize: vertical;
           border: 1px solid var(--line); background: light-dark(#fff, #2c2c2e); color: inherit; }
input[type=date] { font: inherit; min-height: 48px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line);
                   background: light-dark(#fff, #2c2c2e); color: inherit; }
header.nav { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 420px; }
header.nav h2 { margin: 0; font-size: 22px; }
header.nav button { padding: 10px 14px; }
.alert-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
dialog.alert { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 11; border: 0; border-radius: 18px;
               padding: 22px; max-width: 320px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3);
               background: light-dark(#fff, #2c2c2e); color: inherit; }
dialog.alert h3 { margin: 0 0 6px; } dialog.alert p { margin: 0 0 16px; color: var(--muted); }
dialog.alert .buttons { display: flex; gap: 8px; justify-content: center; }
.icon { display: inline-flex; color: var(--accent); }
.grid { display: grid; justify-items: center; align-items: center; }
.grid > [style*="align-self:stretch"] { justify-self: stretch; }  /* a child that fills takes its cell's width, as on GTK */
.lazylist { position: relative; overflow-y: auto; width: var(--control-width, 340px); max-width: 90vw; border-radius: 12px;
            background: light-dark(#fff, #2c2c2e); border: 1px solid var(--line); }
.lazylist .row { position: absolute; left: 0; right: 0; display: flex; align-items: center; padding: 0 14px; cursor: pointer;
                 border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lazylist .row:hover, .lazylist .row:focus-visible { background: var(--surface); }
#mojoui-root.full { max-width: none; padding: 0; height: 100dvh; align-items: stretch; }
#mojoui-root.full > div { flex: 1 1 0; min-width: 0; }
.canvas { position: relative; overflow: hidden; background: var(--surface); }
.overlay { position: relative; min-height: 0; overflow: hidden; }
.overlay > .overlay-base { position: absolute; inset: 0; display: flex; flex-direction: column; }
.overlay > .overlay-base > * { flex: 1 1 0; min-height: 0; }
.overlay > .island { position: absolute; z-index: 5; margin: 12px; }
.overlay > .island.h-start { left: 0; } .overlay > .island.h-end { right: 0; }
.overlay > .island.h-center { left: 50%; transform: translateX(-50%); }
.overlay > .island.v-start { top: 0; } .overlay > .island.v-end { bottom: 0; }
.overlay > .band { position: absolute; z-index: 5; left: 0; right: 0; display: flex; flex-direction: column; } .overlay > .band.v-start { top: 0; } .overlay > .band.v-end { bottom: 0; } .overlay > .band > * { flex: none; min-width: 0; }  /* a band across the overlay's edge (.pin(STRETCH, END)), no island's chrome: mojoui.stage's TV and chat bar (goal 77 M7d) */
.overlay > .island.cover { inset: 0; margin: 0; transform: none; display: flex; flex-direction: column; } .overlay > .island.cover > * { flex: 1 1 0; min-height: 0; }  .overlay > .island.cover { pointer-events: none; }  /* a layer over the whole overlay (the cloud frame, the pointer ring): it only shows, presses go to the page (goal 77) */
.menubar { display: flex; align-items: center; gap: 2px; }
.menu { position: relative; }
.menu-title { border: 0; background: transparent; padding: 4px 9px; border-radius: 4px; font: inherit; font-size: 12.5px; cursor: default; color: inherit; }
.menu.open > .menu-title { background: var(--surface); }
.menu > .menu-items { display: none; position: absolute; left: 0; top: 100%; z-index: 20; min-width: 270px; padding: 4px; border-radius: 6px;
  background: light-dark(#fff, #2c2c2e); color: inherit; box-shadow: 0 4px 16px rgba(16,24,40,.12), 0 0 0 1px var(--line); }
.menu.open > .menu-items, .menu.context > .menu-items { display: block; }
.menu.context { position: fixed; z-index: 30; }
.menu.context > .menu-items { position: static; }
.menu.sub { position: relative; } .menu.sub > .menu-items { left: 100%; top: -4px; }
.menu.sub:hover > .menu-items { display: block; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent;
  color: inherit; font: inherit; font-size: 12.5px; text-align: left; white-space: nowrap; cursor: default; }
.mi:hover:not([disabled]) { background: var(--surface); }
.mi[disabled] { opacity: .5; } .mi.danger { color: var(--danger); } .mi svg { stroke: currentColor; fill: none; stroke-width: 1.6; flex: none; opacity: .75; }
.mi .mi-blank { width: 15px; flex: none; } .mi .mi-title { flex: 1; } .mi .mi-key { margin-left: 24px; font-size: 11px; opacity: .6; font-family: "JetBrains Mono", monospace; }
.menu-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.menu-label { padding: 6px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; opacity: .6; }
.dialog-layer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: start center; padding-top: 80px; }
.dialog-layer .scrim { position: absolute; inset: 0; background: rgba(17,22,28,.32); }
.dialog { position: relative; max-width: calc(100vw - 32px); max-height: calc(100vh - 100px); display: flex; flex-direction: column; border-radius: 8px;
  background: light-dark(#fff, #2c2c2e); color: inherit; box-shadow: 0 16px 48px rgba(0,0,0,.28); overflow: hidden; }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.dialog-close, .toast-close { border: 0; background: transparent; font: inherit; padding: 2px 8px; min-height: 0; border-radius: 4px; color: inherit; opacity: .7; }
.dialog-body { padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border-radius: 6px; background: #1b1f24; color: #fff; font-size: 12.5px; box-shadow: 0 4px 16px rgba(16,24,40,.25); white-space: nowrap; }
.toast-action { border: 0; background: transparent; color: #7fd1d8; font: inherit; font-weight: 600; min-height: 0; padding: 2px 6px; }
.toast .toast-close { color: #fff; }
.popover { position: fixed; z-index: 35; min-width: 260px; padding: 12px 14px; border-radius: 6px; display: flex; flex-direction: column; gap: 8px;
  background: light-dark(#fff, #2c2c2e); color: inherit; box-shadow: 0 4px 16px rgba(16,24,40,.12), 0 0 0 1px var(--line); }
.popover-title { margin: 0; font-size: 13px; font-weight: 600; }
label.toggle.check input { accent-color: var(--accent); }
.board-scroll { overflow: auto; position: relative; min-height: 0; }
.board { position: relative; flex: none; min-width: 100%; min-height: 100%; box-sizing: border-box; }
.board > .object[data-tag=cell-editor] { overflow: visible; z-index: 4; }
.board > .object[data-tag=cell-editor]::after { display: none; }
.board > .object[data-tag=cell-editor] form, .board > .object[data-tag=cell-editor] input { width: 100%; height: 100%; box-sizing: border-box; margin: 0; }
.board > .object.revealed { animation: mojoui-revealed 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .board > .object.revealed { animation: none; } }
@keyframes mojoui-revealed { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button.with-icon, button.icon-only { display: inline-flex; align-items: center; gap: 6px; }
button svg { flex: none; }
.board > .object { position: absolute; box-sizing: border-box; overflow: hidden; }  /* content never covers the resize corner */
.board > .object > .vstack.card > :first-child { touch-action: none; cursor: move; }
.board > .object > .vstack.card { width: 100%; height: 100%; box-sizing: border-box; }
.board > .object::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 12px; height: 12px; cursor: nwse-resize;
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); border-radius: 0 0 4px 0; }
.board > .object.moving { opacity: .92; box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 2; }
@media (max-width: 719px) { .board > .object[data-tag=cell-editor] { display: none !important; }  /* (no place over a cell in the list) */
  .board { width: auto !important; height: auto !important; display: flex; flex-direction: column; gap: 16px; }
  .board > .object { position: static !important; width: auto !important; left: auto; top: auto; } .board > .object::after { display: none; }
  .board > .object > .vstack.card > :first-child { touch-action: auto; cursor: default; } }
.canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.canvas canvas:active { cursor: grabbing; }
.canvas[data-taps="1"] canvas, .canvas[data-taps="1"] canvas:active { touch-action: pan-y pinch-zoom; cursor: pointer; }  /* Canvas(taps=True): a swipe scrolls the page (goal 92) */
.vstack.card { background: light-dark(#fff, #2c2c2e); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
@media (prefers-reduced-motion: reduce) { button { transition: none; } button:active { transform: none; } }
/* the components' own layout (tools, the file picker, islands): every theme builds on it */
.island .hstack { flex-wrap: nowrap; white-space: nowrap; }
label.picker { position: relative; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
label.picker.tool { flex-direction: column; } label.picker input.picker-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
button.tool { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 58px; min-height: 48px; padding: 4px 6px; }
button.tool span { font-size: 11px; line-height: 13px; }
label.picker.tool:not(.inline):not(.icon-only) { justify-content: center; gap: 2px; min-width: 58px; min-height: 48px; padding: 4px 6px; }  /* (a picker as a tool: the same box as a button tool, goal 76's ribbon) */
label.picker.tool:not(.inline) span { font-size: 11px; line-height: 13px; }
button.tool.inline, label.picker.tool.inline { flex-direction: row; gap: 6px; min-width: 0; min-height: 34px; padding: 0 10px; }
button.tool.inline span, label.picker.tool.inline span { font-size: 12px; }
[data-tag=toolbar] button.icon-only, [data-tag=toolbar] label.picker.icon-only { min-width: 34px; min-height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (pointer: coarse) { [data-tag=toolbar] button.icon-only, [data-tag=toolbar] label.picker.icon-only, button.tool.inline, label.picker.tool.inline { min-width: 48px; min-height: 48px; } }

/* .arrive() (goal 48): a new view fades and rises into place on a spring (stiffness 220, critical damping: the same
   curve as mojoui.spring and GTK's AdwSpringAnimation), once, when it's inserted */
@keyframes mojoui-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mojoui-arrive { animation: mojoui-arrive 420ms linear(0, 0.18 6%, 0.45 14%, 0.7 24%, 0.86 35%, 0.94 47%, 0.98 61%, 0.995 78%, 1) both; }
.mojoui-arrive.mojoui-arrived { animation: none; }
@media (prefers-reduced-motion: reduce) { .mojoui-arrive { animation: none; } }
/* The host's own notices on a public copy (goal 62): a tab the server ended (idle, or restarted), and the busy page
   past the session cap. Opaque, one soft shadow, the theme's colours where it has them. */
.mojoui-gone { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: light-dark(rgba(246,247,249,.92), rgba(18,20,24,.92)); }
.mojoui-gone p { max-width: 420px; margin: 0; padding: 18px 20px; border-radius: 10px; line-height: 1.45; font-size: 14px;
  background: light-dark(#fff, #2c2c2e); box-shadow: 0 4px 16px rgba(16,24,40,.18), 0 0 0 1px var(--line, rgba(0,0,0,.08)); }
.mojoui-busy-page { max-width: 460px; margin: 18vh auto 0; padding: 28px; border-radius: 12px; display: flex; flex-direction: column; gap: 12px;
  background: light-dark(#fff, #2c2c2e); box-shadow: 0 4px 16px rgba(16,24,40,.12), 0 0 0 1px var(--line, rgba(0,0,0,.08)); }
.mojoui-busy-page a.button { align-self: flex-start; text-decoration: none; }
.mojoui-busy-page a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 8px; font-weight: 600;
  background: var(--accent, #2f7d6d); color: light-dark(#fff, #0b0d10); }
/* the page's audio (docs/web-audio.md): shown only while an app wants sound and nobody has tapped the page yet */
.mojoui-audio-pill { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  padding: 12px 20px; border: 0; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; color: #fff;
  background: var(--o-accent, var(--accent)); box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.mojoui-audio-pill[hidden] { display: none; }

/* View transitions (App.transition, mojoui.transition): the old page fades over the new one while it settles from 0.985 on
   omxqua's soft spring (--oq-spring, 710 ms); the browser's default crossfade otherwise. */
::view-transition-old(root) { animation: mojoui-morph-out 420ms cubic-bezier(0.55, 0, 0.1, 1) both; mix-blend-mode: normal; }
::view-transition-new(root) { animation: mojoui-morph-in 710ms linear(0, 0.023, 0.079, 0.154, 0.237, 0.322, 0.405, 0.482, 0.553, 0.617, 0.674, 0.723, 0.766, 0.803, 0.835, 0.862, 0.885, 0.905, 0.921, 0.935, 0.946, 0.955, 0.963, 0.97, 0.975, 0.98, 0.983, 0.986, 0.989, 0.991, 0.993, 0.994, 0.995, 0.996, 0.997, 0.997, 0.998, 0.998, 0.999, 0.999, 1) both; mix-blend-mode: normal; }
@keyframes mojoui-morph-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes mojoui-morph-in { from { transform: scale(0.985); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }
