@font-face { font-family: 'Fraunces Display'; src: url('/apps/web/tela/fonts/FrauncesDisplay-Light.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Fraunces Text'; src: url('/apps/web/tela/fonts/FrauncesText-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fraunces Text'; src: url('/apps/web/tela/fonts/FrauncesText-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/apps/web/tela/fonts/InstrumentSans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/apps/web/tela/fonts/InstrumentSans-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/apps/web/tela/fonts/InstrumentSans-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Atkinson Mono'; src: url('/apps/web/tela/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2') format('woff2'); font-display: swap; }

/* Atelier: paper, ink and a catalogue (the same colours and type as the pages made from the UI model, ui/theme.js, and
   the iPad app). Daytime is paper with ink on it, ultramarine for what's chosen and for links; dark is ink by night,
   the paper's colours turned round. It follows the computer's light or dark, unless the page has been set to light
   (data-theme="light") or dark (data-theme="dark"); appearance.js sets data-theme from the choice kept in this browser.
   --hov-*: what a control turns into under the pointer (quietly: a hairline in ink, a wash of paper). */
:root {
  --bg: #f4f1ea; --panel: #fffdf8; --panel-2: #ebe6db; --line: #e3dccd; --line-2: #d3cab8;
  --ink: #1b1a17; --muted: #6e695e; --faint: #8b8577;
  --accent: #2b3fd6; --accent-hover: #2233b0; --accent-ink: #ffffff; --accent-soft: rgba(43, 63, 214, 0.08); --accent-line: rgba(43, 63, 214, 0.55);
  --primary: #1b1a17; --primary-ink: #f4f1ea;
  --ok: #2f6b4f; --warn: #94590a; --bad: #b3392b; --danger: #b3392b; --warn-soft: rgba(148, 89, 10, 0.08);
  --field: #fffdf8; --hover: rgba(27, 26, 23, 0.05); --sunken: #ebe6db; --raised: #fffdf8; --menu: #fffdf8; --canvas: #ebe6db;
  --glass: rgba(244, 241, 234, 0.92); --scrim: rgba(27, 26, 23, 0.28); --chip-line: rgba(27, 26, 23, 0.14); --ring: rgba(43, 63, 214, 0.18);
  --shadow-1: 0 1px 0 rgba(27, 26, 23, 0.04);
  --shadow-2: 0 16px 40px rgba(27, 26, 23, 0.14), 0 1px 2px rgba(27, 26, 23, 0.06);
  --btn: transparent; --btn-hover: rgba(27, 26, 23, 0.04);
  --hov-bg: var(--hover); --hov-btn-bg: var(--btn-hover); --hov-ink: var(--ink); --hov-line: var(--ink); --hov-menu: var(--panel-2); --hov-card: var(--line-2);
  --hov-danger-bg: var(--btn); --hov-danger-flat: color-mix(in srgb, var(--bad) 8%, transparent); --hov-danger-menu: var(--panel-2); --hov-danger-ink: var(--bad); --hov-danger-line: var(--bad);
  --bar: var(--bg); --bar-edge: var(--line-2);
  --tl-bg: #ebe6db; --tl-dim: rgba(244, 241, 234, 0.7); --tl-mark: #a39c8e; --device-frame: #26221e;
  --r-sm: 2px; --r: 4px; --r-lg: 6px; --r-xl: 8px;
  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; --mono: 'Atkinson Mono', ui-monospace, Menlo, monospace; --serif: 'Fraunces Text', Georgia, serif; --display: 'Fraunces Display', 'Fraunces Text', Georgia, serif;
  color-scheme: light;
  accent-color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --panel: #1f1d1a; --panel-2: #26241f; --line: #2f2c27; --line-2: #3d3a33;
    --ink: #ece7dc; --muted: #a59f92; --faint: #7d776b;
    --accent: #8f9cff; --accent-hover: #a9b3ff; --accent-ink: #11143a; --accent-soft: rgba(143, 156, 255, 0.14); --accent-line: rgba(143, 156, 255, 0.6);
    --primary: #ece7dc; --primary-ink: #161513;
    --ok: #7cc49a; --warn: #e2ac55; --bad: #ec7a66; --danger: #ec7a66; --warn-soft: rgba(226, 172, 85, 0.1);
    --field: #1b1917; --hover: rgba(236, 231, 220, 0.06); --sunken: #121110; --raised: #2a2824; --menu: #1f1d1a; --canvas: #121110;
    --glass: rgba(22, 21, 19, 0.9); --scrim: rgba(0, 0, 0, 0.6); --chip-line: rgba(236, 231, 220, 0.16); --ring: rgba(143, 156, 255, 0.3);
    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(236, 231, 220, 0.04);
    --btn: transparent; --btn-hover: rgba(236, 231, 220, 0.05);
    --tl-bg: #121110; --tl-dim: rgba(22, 21, 19, 0.64); --tl-mark: #7d776b; --device-frame: #2a2824;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --panel: #1f1d1a; --panel-2: #26241f; --line: #2f2c27; --line-2: #3d3a33;
  --ink: #ece7dc; --muted: #a59f92; --faint: #7d776b;
  --accent: #8f9cff; --accent-hover: #a9b3ff; --accent-ink: #11143a; --accent-soft: rgba(143, 156, 255, 0.14); --accent-line: rgba(143, 156, 255, 0.6);
  --primary: #ece7dc; --primary-ink: #161513;
  --ok: #7cc49a; --warn: #e2ac55; --bad: #ec7a66; --danger: #ec7a66; --warn-soft: rgba(226, 172, 85, 0.1);
  --field: #1b1917; --hover: rgba(236, 231, 220, 0.06); --sunken: #121110; --raised: #2a2824; --menu: #1f1d1a; --canvas: #121110;
  --glass: rgba(22, 21, 19, 0.9); --scrim: rgba(0, 0, 0, 0.6); --chip-line: rgba(236, 231, 220, 0.16); --ring: rgba(143, 156, 255, 0.3);
  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(236, 231, 220, 0.04);
  --btn: transparent; --btn-hover: rgba(236, 231, 220, 0.05);
  --tl-bg: #121110; --tl-dim: rgba(22, 21, 19, 0.64); --tl-mark: #7d776b; --device-frame: #2a2824;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: calc(14px * var(--ui, 1))/1.45 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea):focus { box-shadow: 0 0 0 3px var(--ring); }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
button { transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s; }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
kbd { font-family: var(--mono); font-size: calc(12px * var(--ui, 1)); background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; color: var(--ink); white-space: nowrap; }
a { color: var(--ink); }

/* ---------- editor layout */
.app { display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: 1fr 300px; grid-template-areas: 'top top' 'stage side' 'time time'; height: 100vh; }
.top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.top .back { color: var(--muted); text-decoration: none; white-space: nowrap; }
.top .back:hover { color: var(--ink); }
.brand { font-family: var(--serif); font-size: calc(18px * var(--ui, 1)); letter-spacing: 0.01em; color: var(--ink); }
.title { flex: 1; min-width: 0; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 3px 8px; font-size: calc(15px * var(--ui, 1)); font-weight: 600; text-overflow: ellipsis; }
.title:hover { border-color: var(--line); background: var(--hover); }
.title:focus { border-color: var(--line-2); background: var(--field); outline: none; }
/* a label and a painting's status: small capitals, as a catalogue marks a work */
.pill { font-size: calc(11px * var(--ui, 1)); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: none; border: 0; border-radius: 0; padding: 1px 0; white-space: nowrap; }
.status { font-size: calc(11px * var(--ui, 1)); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; border: 0; border-radius: 0; padding: 1px 0; white-space: nowrap; color: var(--muted); }
.status.final { color: var(--ok); }
.status.changed { color: var(--warn); }
.iconbtn.finalbtn { color: var(--accent); border-color: var(--accent-line); font-weight: 600; }
.iconbtn.finalbtn:hover { background: var(--accent-soft); }
.iconbtn.finalbtn:disabled { opacity: 1; cursor: progress; color: var(--muted); border-color: var(--line-2); background: var(--btn); font-weight: 400; }
.top .iconbtn[aria-expanded="true"] { background: var(--btn-hover); }
.save { font-size: calc(13px * var(--ui, 1)); color: var(--muted); white-space: nowrap; min-width: calc(110px * var(--ui, 1)); text-align: right; }
.save.dirty { color: var(--warn); }
.save.error { color: var(--bad); }
.iconbtn { background: var(--btn); border: 1px solid var(--line-2); border-radius: var(--r); padding: 3px 11px; color: var(--ink); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-1); }
.iconbtn:hover { background: var(--hov-btn-bg); color: var(--hov-ink); border-color: var(--hov-line); }
.iconbtn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.iconbtn:disabled:hover { background: var(--btn); color: var(--ink); border-color: var(--line-2); }
#stage:focus, #stage:focus-visible { outline: none; }   /* the painting area only holds the keyboard; the selected stroke shows where you are */

.stage { grid-area: stage; position: relative; overflow: hidden; background: var(--canvas); display: grid; place-items: center; min-width: 0; min-height: 0; }
.frame { position: relative; }
.frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#paint { background: #ddd6c8; }
#overlay { pointer-events: none; }
.busy { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-1); border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px; font-size: calc(13px * var(--ui, 1)); color: var(--ink); pointer-events: none; }
.tools { position: absolute; left: 14px; top: 12px; display: flex; gap: 2px; align-items: center; background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px; z-index: 2; box-shadow: var(--shadow-2); }
.tools button { background: none; border: 1px solid transparent; border-radius: 8px; padding: 3px 10px; color: var(--muted); cursor: pointer; font-size: calc(13px * var(--ui, 1)); }
.tools button:hover { background: var(--hov-bg); color: var(--hov-ink); }
.tools button[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.tools button[aria-pressed="true"]#t-draw { background: var(--accent); color: var(--accent-ink); }
.tipbar { display: inline-flex; gap: 2px; align-items: center; }
.tools .tipbar { padding: 0 2px 0 6px; margin-left: 4px; border-left: 1px solid var(--line-2); }
.tipbtn { display: grid; place-items: center; width: 34px; height: 36px; padding: 0; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer; }
.tools .tipbtn { width: 28px; height: 30px; padding: 0; }
.tools .tipicon { width: 24px; height: 24px; }
.tipbtn:hover { color: var(--hov-ink); background: var(--hov-bg); }
.tipbtn:hover .tipicon .hl { stroke: currentColor; }
.tipbtn[aria-pressed="true"] { color: var(--ink); background: var(--accent-soft); border-color: var(--accent-line); }
.tipbtn:disabled { opacity: 0.35; cursor: default; }
.tipbtn:disabled:hover { color: var(--muted); border-color: transparent; background: none; }
.tipicon { width: 28px; height: 28px; display: block; }
.tipicon .hb { fill: currentColor; opacity: 0.85; }
.tipicon .hl { stroke: var(--panel); stroke-width: 0.9; fill: none; opacity: 0.6; }
.tipicon .fe { fill: currentColor; opacity: 0.45; }
.tipicon .ha { fill: currentColor; opacity: 0.3; }
.tipbtn[aria-pressed="true"] .tipicon .hb { fill: var(--accent); opacity: 1; }
.tipbar.wide { display: flex; justify-content: space-between; margin: 0 0 4px; }
.tiphint { margin: 2px 0 8px; font-size: calc(12px * var(--ui, 1)); color: var(--muted); line-height: 1.4; }
.tiphint b { color: var(--ink); font-weight: 600; }
.fields label.off .lbl, .fields label.off .k { opacity: 0.45; }
.fields input::placeholder { color: var(--faint); font-family: var(--sans); }
.tools .brushlbl { font-size: calc(12px * var(--ui, 1)); color: var(--muted); padding: 0 8px 0 6px; white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.notice { max-width: 440px; text-align: center; color: var(--muted); padding: 20px; }
.notice h2 { color: var(--ink); font-weight: 600; font-size: calc(19px * var(--ui, 1)); }

/* ---------- inspector */
.side { grid-area: side; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 14px 16px 24px; }
.side h2 { font-size: calc(13px * var(--ui, 1)); font-weight: 600; color: var(--ink); margin: 20px 0 8px; }
.side h2:first-child { margin-top: 0; }
.which { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.which .num { font-size: calc(24px * var(--ui, 1)); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.which .of { color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.tag { font-size: calc(12px * var(--ui, 1)); border: 1px solid var(--line); background: var(--panel-2); border-radius: 99px; padding: 0 8px; color: var(--ink); }
.tag.off { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
.tag.dim { color: var(--muted); }
.swatches { display: grid; grid-template-columns: 1fr; gap: 6px; }
.swatch > span { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.swatch > span small { flex: none; }
.swatch { display: flex; gap: 8px; align-items: center; min-width: 0; }
.swatch i { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--chip-line); flex: none; }
.swatch span { font-size: calc(13px * var(--ui, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch small { display: block; color: var(--muted); font-size: calc(11px * var(--ui, 1)); }
dl.props { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; margin: 0; align-items: center; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
dl.props dd.k { text-align: left; }
fieldset.edit { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.edit:disabled { opacity: 0.45; }
.swatch select { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 1px 2px; font-size: calc(13px * var(--ui, 1)); color: var(--ink); text-overflow: ellipsis; }
.swatch select:hover { border-color: var(--line-2); }
.swatch select:focus { border-color: var(--accent); outline: none; background: var(--field); }
.fields { display: grid; grid-template-columns: 1fr 92px 46px; gap: 3px 8px; align-items: center; }
.fields label { display: contents; }
.fields .lbl { color: var(--muted); }
.fields input, .fields select { width: 100%; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 2px 6px; font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.fields select { text-align: left; font-family: var(--sans); }
.fields input:hover, .fields select:hover { border-color: var(--line-2); }
.fields input:focus, .fields select:focus { border-color: var(--accent); outline: none; }
.fields .k { white-space: nowrap; }
.fields .ro { font-family: var(--mono); text-align: right; padding-right: 7px; font-size: calc(13px * var(--ui, 1)); }
.strokebtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.strokebtns .iconbtn { font-size: calc(12px * var(--ui, 1)); padding: 2px 8px; }
.strokebtns .iconbtn.danger:not(:disabled):hover { background: var(--hov-danger-bg); color: var(--hov-danger-ink); border-color: var(--hov-danger-line); }
.strokebtns .iconbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pathinfo { margin: 0 0 8px; font-size: calc(13px * var(--ui, 1)); color: var(--muted); }
.pathinfo b { color: var(--ink); font-weight: 600; }
.pathbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.pathbtns .iconbtn { font-size: calc(12px * var(--ui, 1)); padding: 2px 8px; }
.pathbtns .iconbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--chip-line); flex: none; padding: 0; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-expanded="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the colour editor */
.ced { margin: 10px 0 4px; padding: 10px 10px 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); }
.ced-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 600; font-size: calc(13px * var(--ui, 1)); }
.ced .x { background: none; border: 0; color: var(--muted); font-size: calc(18px * var(--ui, 1)); line-height: 1; cursor: pointer; padding: 0 4px; }
.ced .x:hover { color: var(--ink); }
.ced-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 5px; margin-bottom: 10px; }
.ced-swatches button { aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--chip-line); padding: 0; cursor: pointer; position: relative; }
.ced-swatches button:hover { border-color: var(--ink); }
.ced-swatches button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.ced-swatches button.own::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px #000; }
.ced-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ced-preview i { width: 34px; height: 26px; border-radius: 6px; border: 1px solid var(--chip-line); }
.ced .hex { width: 88px; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); color: var(--ink); text-transform: uppercase; }
.ced .hex:focus { border-color: var(--accent); outline: none; }
.ced .hex.bad { border-color: var(--bad); }
.ced .was { font-size: calc(12px * var(--ui, 1)); color: var(--muted); }
.slider { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 6px; font-size: calc(12px * var(--ui, 1)); color: var(--muted); margin: 2px 0; }
.slider input { width: 100%; height: 12px; -webkit-appearance: none; appearance: none; border-radius: 99px; border: 1px solid var(--chip-line); margin: 0; }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #1a1c22; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3); cursor: pointer; }
.slider input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #1a1c22; cursor: pointer; }
.slider input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ced-name { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 6px; font-size: calc(12px * var(--ui, 1)); color: var(--muted); margin: 6px 0 2px; }
.ced-name input { background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: calc(13px * var(--ui, 1)); color: var(--ink); }
.ced-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ced-actions .iconbtn { font-size: calc(12px * var(--ui, 1)); padding: 2px 8px; }
.ced-actions .iconbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ced .hint { font-size: calc(12px * var(--ui, 1)); margin-top: 6px; }

/* the painting's light: a picture of each room to choose by (the studio light, a lamp's glow), and its two sliders */
.lightsec { margin-top: 16px; }
.rooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.room { display: flex; flex-direction: column; gap: 2px; padding: 3px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--ink); font-size: calc(11px * var(--ui, 1)); line-height: 1.25; text-align: left; cursor: pointer; }
.room img, .room-studio { display: block; width: 100%; aspect-ratio: 2 / 1; height: auto; border-radius: 4px; border: 1px solid var(--chip-line); object-fit: cover; }
.room-studio { background: radial-gradient(circle at 78% 22%, #fffaf0 0, #f2e9da 18%, #b9b2a6 55%, #6f6a62 100%); }
.room:hover { background: var(--hov-bg); color: var(--hov-ink); }
.room[aria-checked="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.roomslider { grid-template-columns: 74px 1fr 92px; }
.roomslider output { font-size: calc(12px * var(--ui, 1)); color: var(--muted); text-align: right; }
.roomslider input { background: linear-gradient(90deg, var(--line), var(--muted)); }
.roomslider input:disabled { opacity: 0.4; }
/* the light's direction: a lamp in a circle (canvas/lamp.js), the canvas seen from above, its top the painting's top; the
   canvas's Light panel has it too (canvas.css sizes it there). Its glow is lamplight in either appearance. */
.lamp { display: flex; align-items: flex-start; gap: 12px; margin: 2px 0 12px; }
.lamp-dial { flex: none; width: 120px; height: 120px; overflow: visible; touch-action: none; cursor: grab; border-radius: 50%; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.lamp-dial.lamp-held { cursor: grabbing; }
.lamp-dial:focus { outline: none; }
.lamp-dial:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lamp-dish { fill: var(--sunken); stroke: var(--line-2); stroke-width: 1; }
.lamp-cross { fill: none; stroke: var(--line-2); stroke-width: 1; }
.lamp-start { fill: none; stroke: var(--faint); stroke-width: 1; opacity: 0.85; }
.lamp-way { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.7; }
.lamp-bulb { fill: #fff6df; stroke: var(--ink); stroke-width: 1.5; }
.lamp-glyph { fill: none; stroke: #3a3328; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.lamp-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding-top: 6px; }
.lamp-words { margin: 0; font-size: calc(13px * var(--ui, 1)); font-weight: 600; line-height: 1.3; color: var(--ink); }
.lamp-how { margin: 0; font-size: calc(11.5px * var(--ui, 1)); line-height: 1.35; color: var(--muted); }
.lamp-reset { margin-top: 2px; min-height: 26px; padding: 2px 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: none; color: var(--ink); font: 500 calc(12px * var(--ui, 1)) var(--sans); cursor: pointer; }
.lamp-reset:hover:not(:disabled) { border-color: var(--ink); }
.lamp-reset:disabled { opacity: 0.4; cursor: default; }

/* the painting's palette */
.palette { margin-top: 6px; }
.pal { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.palrow { width: 100%; display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; background: none; border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; color: var(--ink); text-align: left; cursor: pointer; font-size: calc(13px * var(--ui, 1)); }
.palrow:hover { background: var(--hov-bg); color: var(--hov-ink); }
.palrow:hover .n { color: inherit; }
.palrow[aria-expanded="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.palrow i { width: 22px; height: 18px; border-radius: 6px; border: 1px solid var(--chip-line); }
.palrow .n { font-family: var(--mono); font-size: calc(12px * var(--ui, 1)); color: var(--muted); }
.palrow .tag { margin-left: 6px; font-size: calc(11px * var(--ui, 1)); padding: 0 6px; }
.flash { animation: flash 0.6s ease-out; }
@keyframes flash { from { color: var(--accent); } to { color: inherit; } }
.hint { color: var(--muted); font-size: calc(13px * var(--ui, 1)); margin: 10px 0 0; }

/* ---------- timeline */
.time { grid-area: time; border-top: 1px solid var(--line); background: var(--panel); padding: 8px 14px 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.transport { display: flex; gap: 6px; align-items: center; }
.transport button { width: 34px; height: 30px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--btn); box-shadow: var(--shadow-1); color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0; }
.transport button:hover { background: var(--hov-btn-bg); color: var(--hov-ink); border-color: var(--hov-line); }
.transport button.play { width: 44px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.transport button.play:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.transport svg { width: 16px; height: 16px; fill: currentColor; }
.scrub { position: relative; height: 40px; cursor: pointer; }
.scrub canvas { width: 100%; height: 100%; display: block; border-radius: var(--r); }
.where { text-align: right; white-space: nowrap; }
.where .pos { font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); }
.where .speed { font-size: calc(12px * var(--ui, 1)); color: var(--muted); }
.goto { width: 72px; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--ink); padding: 1px 6px; font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); }

/* ---------- shortcuts */
dialog.keys { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 20px 24px 22px; max-width: calc(760px * var(--ui, 1)); width: calc(100vw - 32px); }
dialog.keys::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog.keys h2 { font-weight: 600; font-size: calc(19px * var(--ui, 1)); letter-spacing: -0.01em; margin: 0 0 12px; }
.keygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(220px * var(--ui, 1)), 1fr)); gap: 4px 28px; }
.keygrid h3 { font-size: calc(13px * var(--ui, 1)); color: var(--ink); margin: 14px 0 4px; font-weight: 600; }
.keygrid div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.keygrid div span:first-child { color: var(--muted); }
dialog.keys form { text-align: right; margin-top: 14px; }

@media (max-width: 1080px) {
  .top { gap: 10px; }
  .top .brand, #engine { display: none; }
  .save { min-width: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: 'top' 'stage' 'side' 'time'; grid-template-rows: auto 1fr auto auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: 34vh; }
}
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* ---------- library */
.lib { max-width: 1200px; margin: 0 auto; padding: 30px 24px 64px; }
.libhead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.lib h1 { font-family: var(--serif); font-weight: 400; font-size: calc(30px * var(--ui, 1)); margin: 0; }
.lib h2 { font-size: calc(15px * var(--ui, 1)); font-weight: 600; color: var(--ink); letter-spacing: -0.005em; margin: 28px 0 10px; }
.lib h2 .count, .trash summary .count { font-family: var(--mono); letter-spacing: 0; color: var(--faint); margin-left: 4px; }
.folders { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; font-size: calc(13px * var(--ui, 1)); color: var(--muted); }
.folders code, .folderbtn code { font-family: var(--mono); font-size: calc(12px * var(--ui, 1)); color: var(--ink); }
.folderbtn { background: none; border: 1px solid transparent; border-radius: 6px; padding: 0 4px; cursor: pointer; }
.folderbtn:hover { border-color: var(--line-2); }
.folderbtn:hover code { text-decoration: underline; }
.newform { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-1); }
.newform label { display: grid; gap: 3px; font-size: calc(12px * var(--ui, 1)); color: var(--muted); }
.newform select, .newform input { background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r); padding: 6px 9px; min-width: 120px; }
.newform .or { color: var(--faint); font-size: calc(13px * var(--ui, 1)); padding-bottom: 7px; }
.btn { background: var(--primary); color: var(--primary-ink); border: 1px solid var(--primary); border-radius: var(--r); padding: 7px 16px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: none; }
.btn:hover { background: color-mix(in srgb, var(--primary) 86%, var(--bg)); border-color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.ghost { background: var(--btn); color: var(--ink); border: 1px solid var(--line-2); font-weight: 400; }
.btn.ghost:hover { background: var(--hov-btn-bg); color: var(--hov-ink); border-color: var(--hov-line); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.listhead { display: flex; align-items: end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 26px 0 10px; }
.listhead h2 { margin: 0 0 4px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r); padding: 5px 10px; min-width: 220px; }
.search:focus { border-color: var(--accent); outline: none; }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); }
.seg button { background: none; border: 0; border-radius: var(--r-sm); padding: 3px 11px; color: var(--muted); cursor: pointer; font-size: calc(13px * var(--ui, 1)); }
.seg button:hover { background: var(--hov-bg); color: var(--hov-ink); }
.seg button:hover span { color: inherit; }
.seg button span { font-family: var(--mono); font-size: calc(11px * var(--ui, 1)); color: var(--faint); margin-left: 3px; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }
.seg button[aria-pressed="true"] span { color: var(--muted); }
.sort { font-size: calc(13px * var(--ui, 1)); color: var(--muted); display: flex; gap: 6px; align-items: center; }
.sort select { background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r); padding: 4px 7px; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 8px 10px; display: grid; gap: 3px; align-content: start; min-width: 0; box-shadow: var(--shadow-1); transition: border-color 0.15s, box-shadow 0.15s; }
.card > :not(.thumb) { margin-left: 4px; margin-right: 4px; }
.card:hover, .card:focus-within { border-color: var(--hov-card); box-shadow: var(--shadow-2); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
.card .thumb { position: relative; display: block; aspect-ratio: 16 / 10; margin: 0 0 7px; border-radius: var(--r); overflow: hidden; background: var(--panel-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: calc(12px * var(--ui, 1)); }
.card .thumb .prog { position: absolute; left: 8px; bottom: 8px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; font-size: calc(12px * var(--ui, 1)); color: var(--ink); }
.badge { position: absolute; right: 8px; top: 8px; font-size: calc(11px * var(--ui, 1)); font-weight: 600; border-radius: 99px; padding: 1px 8px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid color-mix(in srgb, currentColor 50%, transparent); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.card a.open { font-weight: 600; font-size: calc(15px * var(--ui, 1)); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card a.open:hover { text-decoration: underline; }
.card .rename { font: inherit; font-weight: 600; font-size: calc(15px * var(--ui, 1)); background: var(--field); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 6px; min-width: 0; }
.card .meta { color: var(--muted); font-size: calc(13px * var(--ui, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.linkbtn { background: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 1px 7px; font-size: calc(12px * var(--ui, 1)); color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--hov-ink); background: var(--hov-bg); }
.linkbtn.danger:hover { color: var(--hov-danger-ink); background: var(--hov-danger-flat); }
.linkbtn.more { margin-left: auto; }
.linkbtn[aria-expanded="true"] { color: var(--ink); background: var(--hover); }
.empty { color: var(--muted); }
.err { color: var(--bad); }
.trash { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 14px; }
.trash summary { cursor: pointer; font-size: calc(14px * var(--ui, 1)); font-weight: 600; color: var(--muted); }
.trash summary:hover { color: var(--accent); }
.trashlist { list-style: none; margin: 10px 0 12px; padding: 0; display: grid; gap: 6px; }
.trow { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 6px 6px; }
.tthumb { width: 64px; height: 40px; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.tthumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.75; }
.tinfo { display: grid; min-width: 0; }
.tinfo b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tinfo small { color: var(--muted); font-size: calc(12px * var(--ui, 1)); }
.iconbtn.danger:not(:disabled):hover { background: var(--hov-danger-bg); color: var(--hov-danger-ink); border-color: var(--hov-danger-line); }
.dropzone { position: fixed; inset: 0; background: var(--glass); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 20; }
.dropzone div { border: 2px dashed var(--accent); border-radius: 18px; padding: 40px 60px; font-weight: 600; font-size: calc(22px * var(--ui, 1)); color: var(--accent); background: var(--accent-soft); pointer-events: none; }
@media (max-width: 700px) { .folders { margin-left: 0; } .trow { grid-template-columns: 48px 1fr; } .trow .iconbtn { grid-column: span 1; } }

/* ---------- version history */
dialog.dlg.versions { width: min(680px, calc(100vw - 32px)); }
.vlist { list-style: none; margin: 12px 0 0; padding: 0; max-height: min(60vh, 520px); overflow-y: auto; border-top: 1px solid var(--line); }
.vrow { display: grid; grid-template-columns: 128px 1fr auto; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: calc(13px * var(--ui, 1)); }
.vrow.now .vwhen { font-weight: 600; }
.vwhen { font-family: var(--mono); font-size: calc(12px * var(--ui, 1)); }
.vmeta { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbtns { display: flex; gap: 6px; }
.vbtns .iconbtn { font-size: calc(12px * var(--ui, 1)); padding: 2px 8px; }
.vlist .hint { padding: 8px 2px; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }

/* ---------- shared: dialogs, menus, toasts */
dialog.dlg { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 20px 24px 20px; width: min(calc(460px * var(--ui, 1)), calc(100vw - 32px)); }
dialog.dlg::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog.dlg h2 { font-weight: 600; font-size: calc(19px * var(--ui, 1)); margin: 0 0 8px; text-transform: none; letter-spacing: -0.01em; color: var(--ink); }
dialog.dlg p { color: var(--muted); margin: 0 0 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.popmenu { position: fixed; z-index: 30; min-width: calc(220px * var(--ui, 1)); background: var(--menu); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 5px; box-shadow: var(--shadow-2); display: grid; overflow-y: auto; overscroll-behavior: contain; }
.popmenu button { background: none; border: 0; border-radius: var(--r-sm); padding: 6px 10px; text-align: left; color: var(--ink); cursor: pointer; font-size: calc(13px * var(--ui, 1)); white-space: nowrap; }
.popmenu button:hover, .popmenu button:focus-visible { background: var(--hov-menu); color: var(--hov-ink); outline: none; }
.popmenu button:disabled { color: var(--faint); cursor: default; background: none; }
.popmenu button.danger { color: var(--bad); }
.popmenu button.danger:hover, .popmenu button.danger:focus-visible { background: var(--hov-danger-menu); color: var(--hov-danger-ink); }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.popmenu .menuhead { margin: 8px 10px 3px; font: 600 calc(10px * var(--ui, 1))/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.popmenu button.pick { position: relative; padding-left: calc(30px * var(--ui, 1)); }
.popmenu button.pick[aria-checked="true"]::before { content: ''; position: absolute; left: calc(9px * var(--ui, 1)); top: 50%; width: calc(14px * var(--ui, 1)); height: calc(14px * var(--ui, 1)); margin-top: calc(-7px * var(--ui, 1)); background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.popmenu button small { margin-left: 10px; color: var(--muted); font-size: 0.85em; }
.menurow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 4px 3px 10px; font-size: calc(13px * var(--ui, 1)); color: var(--ink); }
.popmenu .seg button { padding: 2px 9px; font-size: calc(12px * var(--ui, 1)); text-align: center; color: var(--muted); }
.popmenu .seg button:hover, .popmenu .seg button:focus-visible { background: var(--hov-bg); color: var(--hov-ink); }
.popmenu .seg button[aria-checked="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.seg.appearance button { min-width: calc(48px * var(--ui, 1)); }
.authpage .appearance { position: fixed; top: 14px; right: 16px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px; max-width: min(720px, calc(100vw - 32px)); background: var(--menu); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 8px 8px 14px; box-shadow: var(--shadow-2); font-size: calc(13px * var(--ui, 1)); }
.toast.error { border-color: var(--bad); }
.toast span { overflow-wrap: anywhere; }
.toast-act { background: none; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; border-radius: var(--r); padding: 2px 10px; cursor: pointer; white-space: nowrap; }
.toast-act:hover { background: var(--accent); color: var(--accent-ink); }
.toast-x { background: none; border: 0; color: var(--muted); font-size: calc(18px * var(--ui, 1)); line-height: 1; cursor: pointer; padding: 0 4px; }
.toast-x:hover { color: var(--ink); }

/* ---------- people: who's signed in, sharing */
.avatar { display: inline-grid; place-items: center; width: calc(26px * var(--ui, 1)); height: calc(26px * var(--ui, 1)); border-radius: 50%; background: var(--accent-soft); border: 1px solid transparent; font-size: calc(11px * var(--ui, 1)); font-weight: 600; letter-spacing: 0.02em; color: var(--accent); flex: none; }
.personbtn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 99px; padding: 2px 10px 2px 2px; color: var(--ink); cursor: pointer; }
.personbtn:hover, .personbtn[aria-expanded="true"] { background: var(--hover); border-color: var(--line); }
.pname { font-size: calc(13px * var(--ui, 1)); max-width: calc(150px * var(--ui, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.viewonly { color: var(--warn); border-color: var(--warn); }
.pill.shared { color: var(--ink); }
.libhead .person { margin-left: 0; }
dialog.dlg.share { width: min(calc(540px * var(--ui, 1)), calc(100vw - 32px)); }
.sharelist { list-style: none; margin: 14px 0 12px; padding: 0; border-top: 1px solid var(--line); }
.srow { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.srow .who, .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.srow .who small { display: block; color: var(--muted); font-size: calc(12px * var(--ui, 1)); }
.srow .you { color: var(--muted); font-weight: 400; }
.srow .role { color: var(--muted); font-size: calc(13px * var(--ui, 1)); padding-right: 8px; }
.srow select, .shareadd select, .give select { background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 6px; color: var(--ink); }
.shareadd { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shareadd select:first-child { flex: 1; min-width: 180px; }
.giveto { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.giveto summary { cursor: pointer; color: var(--muted); font-size: calc(13px * var(--ui, 1)); }
.giveto summary:hover { color: var(--accent); }
.give { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: calc(13px * var(--ui, 1)); color: var(--muted); }
.card .whose { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: calc(13px * var(--ui, 1)); min-width: 0; }
.card .whose .avatar { width: calc(18px * var(--ui, 1)); height: calc(18px * var(--ui, 1)); font-size: calc(8px * var(--ui, 1)); }
.card .whose span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.share { right: auto; left: 8px; color: var(--ink); border-color: var(--line-2); font-weight: 400; }

/* ---------- signing in, and the account pages */
.authpage { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.authcard { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 30px 30px 22px; box-shadow: var(--shadow-2); }
.authcard h1 { font-family: var(--serif); font-weight: 400; font-size: calc(32px * var(--ui, 1)); margin: 0; }
.authcard .sub { color: var(--muted); margin: 2px 0 22px; }
.authcard .hint { font-size: calc(13px * var(--ui, 1)); }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: calc(13px * var(--ui, 1)); color: var(--muted); }
.form input:not([type="checkbox"]):not([type="radio"]), .form select { width: 100%; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px 11px; font-size: calc(15px * var(--ui, 1)); color: var(--ink); }
.form input:focus, .form select:focus { border-color: var(--accent); outline: none; }
.form label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: calc(14px * var(--ui, 1)); }
.form .btn { justify-self: start; padding: 8px 18px; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .note { font-size: calc(12px * var(--ui, 1)); color: var(--muted); margin: -6px 0 0; }
.err:empty { display: none; }
p.err { margin: 0; font-size: calc(14px * var(--ui, 1)); }
.ok-msg { color: var(--ok); font-size: calc(14px * var(--ui, 1)); margin: 0; }
.ok-msg:empty { display: none; }
.acct { max-width: 980px; }
.acct .libhead h1 a { color: inherit; text-decoration: none; font-style: italic; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px 20px; margin: 0 0 18px; box-shadow: var(--shadow-1); }
.panel h2 { margin: 0 0 12px; }
.panel .form { max-width: 460px; }
.banner { border: 1px solid var(--warn); color: var(--ink); background: var(--warn-soft); border-radius: 10px; padding: 10px 14px; margin: 0 0 18px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 14px; font-size: calc(14px * var(--ui, 1)); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.slist, .plist, .loglist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.slist li { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: calc(13px * var(--ui, 1)); }
.slist small, .plist small, .loglist small { color: var(--muted); }
.plist li { display: grid; grid-template-columns: 30px minmax(150px, 1.4fr) 120px 1fr auto; gap: 12px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: calc(14px * var(--ui, 1)); }
.plist li.off { opacity: 0.6; }
.plist .who b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist select { background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 6px; color: var(--ink); }
.plist .stats { color: var(--muted); font-size: calc(13px * var(--ui, 1)); }
.plist .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.plist .acts .iconbtn { font-size: calc(12px * var(--ui, 1)); padding: 2px 8px; }
.tempbox { margin-top: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r); padding: 10px 14px; }
.tempbox code { font-family: var(--mono); font-size: calc(18px * var(--ui, 1)); letter-spacing: 0.04em; user-select: all; }
.tempbox .iconbtn { margin-left: 10px; }
.loglist li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: calc(13px * var(--ui, 1)); }
.loglist .bad { color: var(--bad); }
@media (max-width: 760px) {
  .plist li { grid-template-columns: 30px 1fr; }
  .plist li > :nth-child(n + 3) { grid-column: 2; }
  .plist .acts { justify-content: flex-start; }
  .form .row2 { grid-template-columns: 1fr; }
}
.dlg select { background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; color: var(--ink); }
/* view only: the settings show, nothing changes them */
body.readonly .strokebtns, body.readonly .pathbtns, body.readonly #pal-add, body.readonly #ced, body.readonly .tools { display: none; }
body.readonly .palrow { cursor: default; }
body.readonly .title:hover { border-color: transparent; }
/* the header: title on the left, the person on the right; where the data is kept on a line below */
.libhead .person { margin-left: auto; }
.libhead .folders { order: 10; flex-basis: 100%; margin: -10px 0 0; }
.libhead .backlink { margin-left: auto; }
.libhead .backlink + .person { margin-left: 0; }
.backlink a { color: var(--muted); text-decoration: none; font-size: calc(14px * var(--ui, 1)); }
.backlink a:hover { color: var(--ink); }

/* ---------- export to a website */
dialog.dlg.export { width: min(calc(640px * var(--ui, 1)), calc(100vw - 32px)); }
dialog.dlg.export .form { gap: 10px; }
.form textarea { width: 100%; background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: calc(15px * var(--ui, 1)); color: var(--ink); resize: vertical; }
.form textarea:focus { border-color: var(--accent); outline: none; }
.form input.mono { font-family: var(--mono); font-size: calc(14px * var(--ui, 1)); }
.form label .opt { color: var(--faint); }
dialog.dlg.export .hint { color: var(--muted); margin: 0; }
.form label.portf input { max-width: calc(9em * var(--ui, 1)); }
.form .note.err { color: var(--bad); }
dialog.dlg.export code { font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); color: var(--ink); word-break: break-all; }
pre.cmd { font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); background: var(--field); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; word-break: break-all; color: var(--ink); user-select: all; }

/* ---------- sections, and the Websites page */
.tabs { display: inline-flex; gap: 2px; background: var(--sunken); border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); padding: 2px; align-self: center; }
.tabs a { padding: 3px 13px; border-radius: var(--r-sm); font-size: calc(13px * var(--ui, 1)); color: var(--muted); text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.newform .opt { color: var(--faint); }
.card.site .thumb { border: 0; padding: 0; width: 100%; cursor: pointer; font: inherit; color: inherit; text-decoration: none; }
.card.site .thumb img { object-fit: cover; }
.card.site .badge { color: var(--ink); border-color: var(--line-2); font-weight: 400; }
.card button.open { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; font-size: calc(15px * var(--ui, 1)); color: var(--ink); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card button.open:hover { text-decoration: underline; }
.muted { color: var(--muted); }
dialog.website-view { width: min(720px, calc(100vw - 32px)); }
dialog.website-edit { width: min(620px, calc(100vw - 32px)); }
dialog.website-view h2 .pill { font-family: var(--sans); font-size: calc(12px * var(--ui, 1)); vertical-align: middle; }
dialog.website-view h3 { font-size: calc(13px * var(--ui, 1)); font-weight: 600; color: var(--ink); margin: 18px 0 6px; }
dialog.website-view h3 .count { font-family: var(--mono); color: var(--faint); letter-spacing: 0; margin-left: 4px; }
dialog.website-view .facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 10px 0 0; font-size: calc(14px * var(--ui, 1)); }
dialog.website-view .facts dt { color: var(--muted); }
dialog.website-view .facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
table.pages { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--ui, 1)); }
table.pages th { text-align: left; font-weight: 400; font-size: calc(12px * var(--ui, 1)); color: var(--faint); padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); }
table.pages td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.pages td.mono { font-family: var(--mono); font-size: calc(13px * var(--ui, 1)); }
table.pages a { color: var(--ink); }
.website-edit label.check { align-self: end; padding-bottom: 8px; }
dialog.website-view .dlg-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- the bars at the top: paper, ruled off; the brand in the italic, a page's title in the serif */
.brand { font-family: var(--serif); font-style: italic; font-size: calc(22px * var(--ui, 1)); letter-spacing: -0.01em; }
.top { background: var(--bg); border-bottom-color: var(--line-2); }
.top .title { font-family: var(--serif); font-weight: 400; font-size: calc(18px * var(--ui, 1)); }
