
/* Paperwall. Warm paper, ink, and one vermilion accent. */

:root {
  --paper: #f7f4ef;
  --panel: #ffffff;
  --panel-2: #f3f0ea;
  --ink: #16161d;
  --muted: #6b6b7b;
  --line: #e6e1d8;
  --accent: #f25c2a;
  /* Accent text and buttons with words on them: AA contrast (4.5:1) on paper and white. */
  --accent-2: #c43d12;
  --accent-btn: #c43d12;
  --accent-btn-hover: #a5320e;
  --accent-ink: #ffffff;
  --sel: #2f6fed;
  --stage: #e9e5de;
  --danger: #d92d20;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 22, 29, 0.06), 0 8px 24px rgba(22, 22, 29, 0.08);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121217; --panel: #1b1b22; --panel-2: #23232c; --ink: #ececf1; --muted: #9a9aab;
    --line: #2e2e39; --stage: #0c0c10; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --accent-2: #ff8b5e; --sel: #6f9bff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121217; --panel: #1b1b22; --panel-2: #23232c; --ink: #ececf1; --muted: #9a9aab;
  --line: #2e2e39; --stage: #0c0c10; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --accent-2: #ff8b5e; --sel: #6f9bff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
/* ---------- boot screen: a little design assembles itself while the app arrives ---------- */
/* Pure CSS, first in the body, so it runs from the first bytes; main.js fades it out once the app is ready. */
#boot { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--paper); color: var(--muted); transition: opacity .35s ease; }
body.ready #boot { opacity: 0; pointer-events: none; }
body.ready #app { animation: boot-in .4s ease both; }
.boot-scene { width: 132px; height: 168px; perspective: 600px; margin-bottom: 10px; }
.boot-page { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 10px; background: var(--panel); box-shadow: 0 1px 2px rgba(22,22,29,.08), 0 18px 40px rgba(22,22,29,.14); transform-origin: 50% 60%; animation: boot-page 3.6s cubic-bezier(.2,.8,.2,1) infinite; }
.boot-wash { position: absolute; inset: 0 0 52% 0; background: linear-gradient(135deg, #f25c2a, #ffb37a); transform-origin: top; animation: boot-wash 3.6s ease infinite; }
.boot-line { position: absolute; left: 14px; height: 10px; border-radius: 5px; background: var(--ink); transform-origin: left; animation: boot-line 3.6s cubic-bezier(.2,.8,.2,1) infinite; }
.boot-line-a { top: 92px; width: 78px; }
.boot-line-b { top: 110px; width: 56px; animation-delay: .12s; }
.boot-line-c { top: 134px; width: 40px; height: 6px; background: var(--muted); opacity: .55; animation-delay: .22s; }
.boot-dot { position: absolute; right: 14px; top: 86px; width: 26px; height: 26px; border-radius: 50%; background: #2f6fed; animation: boot-pop 3.6s cubic-bezier(.34,1.56,.64,1) infinite; }
.boot-sticker { position: absolute; left: 18px; top: 22px; width: 34px; height: 34px; border-radius: 8px; background: #ffd166; box-shadow: 0 4px 10px rgba(22,22,29,.18); animation: boot-sticker 3.6s cubic-bezier(.34,1.56,.64,1) infinite; }
.boot-sticker::after { content: ""; position: absolute; inset: 8px; background: #16161d; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
#boot .brand { font-size: 22px; }
.boot-text { margin: 0; font-size: 13px; }
.boot-bar { width: 120px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: boot-bar 1.4s ease-in-out infinite; }
@keyframes boot-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes boot-page {
  0% { transform: translateY(26px) rotate(-6deg) scale(.86); opacity: 0; }
  10%, 84% { transform: none; opacity: 1; }
  96%, 100% { transform: translateY(-20px) scale(.96); opacity: 0; }
}
@keyframes boot-wash { 0%, 12% { transform: scaleY(0); } 26%, 100% { transform: scaleY(1); } }
@keyframes boot-line { 0%, 28% { transform: scaleX(0); } 44%, 100% { transform: scaleX(1); } }
@keyframes boot-pop { 0%, 46% { transform: scale(0); } 58%, 100% { transform: scale(1); } }
@keyframes boot-sticker { 0%, 58% { transform: translateY(-80px) rotate(-30deg); opacity: 0; } 62% { opacity: 1; } 72%, 100% { transform: translateY(0) rotate(-8deg); opacity: 1; } }
@keyframes boot-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) {
  .boot-page, .boot-wash, .boot-line, .boot-dot, .boot-sticker, .boot-bar i { animation: none; }
  .boot-wash { transform: none; } .boot-line { transform: none; } .boot-dot { transform: none; } .boot-sticker { transform: rotate(-8deg); opacity: 1; }
  .boot-bar i { width: 100%; opacity: .5; }
  body.ready #app { animation: none; }
}

/* ---------- logo ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand.small { font-size: 16px; }
.logo { width: 28px; height: 28px; display: inline-block; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='14.5' y='16' width='3' height='14' rx='1.5' fill='%2316161d'/%3E%3Crect x='3' y='3' width='26' height='17' rx='3' fill='%23f25c2a' transform='rotate(-6 16 11)'/%3E%3Crect x='8' y='9' width='12' height='2.6' rx='1.3' fill='%23fff' transform='rotate(-6 16 11)'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .logo { filter: brightness(1.05); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent-btn); border-color: var(--accent-btn); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-btn-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn.on { border-color: var(--sel); color: var(--sel); }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.link-btn { border: 0; background: none; color: var(--accent-2); padding: 2px 0; cursor: pointer; font-size: 13px; text-align: start; }
.ic { display: inline-grid; place-items: center; line-height: 0; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
/* Read by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* The editor's "skip to the canvas": out of sight until reached with Tab. */
.skip-link { position: fixed; top: 8px; inset-inline-start: 8px; z-index: 90; padding: 8px 14px; border-radius: 8px; border: 0; background: var(--ink); color: var(--paper); font-weight: 600; cursor: pointer; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.search:focus-within { outline: 2px solid var(--sel); outline-offset: 2px; }

/* ---------- home ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 16px max(16px, 4vw); }
.home-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lang-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.lang-select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
.home { max-width: 1200px; margin: 0 auto; padding: 0 max(16px, 4vw) 48px; }
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(36px, 6vw, 68px); letter-spacing: -0.02em; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 16px 0 0; }
.block { margin-top: 40px; }
.block h2 { font-size: 22px; margin-bottom: 16px; letter-spacing: -0.01em; }
.block-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.block-head h2 { margin: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: start; min-height: 120px; }
.preset:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.preset-shape { display: block; height: 48px; max-width: 100%; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 3px; margin-bottom: 8px; }
.preset:hover .preset-shape { border-color: var(--accent); }
.preset small { color: var(--muted); }
.custom-size { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.custom-size .label { font-weight: 600; margin-inline-end: 4px; }
.custom-size input, .custom-size select { width: 96px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; min-width: 220px; color: var(--muted); }
.search input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; color: var(--ink); }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; align-items: start; }
.tpl-grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(150px, 40vw), 1fr)); gap: 16px; }
.tpl { display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; text-align: start; }
.tpl-img { display: block; width: 100%; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: #fff; transition: transform .15s; }
.tpl-frame { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 5; padding: 10px; border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.tpl-frame.tall .tpl-img { width: auto; height: 100%; }
.tpl-img svg { display: block; width: 100%; height: 100%; }
.tpl:hover .tpl-img { transform: translateY(-2px); }
.tpl-name { font-size: 12px; color: var(--ink); font-weight: 600; }
.tpl { position: relative; }
.tpl-meta { font-size: 11px; color: var(--muted); margin-top: -4px; }
.tpl-badge { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, .72); color: #fff; }
.tpl-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-tools .search { flex: 1 1 200px; min-width: 0; }
.tpl-tools select { min-width: 0; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chips.scroll .chip { flex: none; }
.tpl-count { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.btn.more { display: block; margin: 16px auto 0; }
.btn.more[hidden] { display: none; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.design-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.design-open { border: 0; padding: 12px; background: var(--panel-2); cursor: pointer; display: grid; place-items: center; height: 170px; }
.design-img { display: grid; place-items: center; max-height: 146px; max-width: 100%; height: 100%; background: #fff; box-shadow: var(--shadow); color: var(--muted); }
.design-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.design-meta { padding: 10px 12px 0; display: flex; flex-direction: column; min-width: 0; }
.design-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design-meta small { color: var(--muted); }
.design-actions { display: flex; gap: 2px; padding: 4px 6px 8px; }
.empty-note { color: var(--muted); grid-column: 1 / -1; margin: 8px 0; }
.home-foot { max-width: 1200px; margin: 0 auto; padding: 24px max(16px, 4vw) 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.home-foot p { display: flex; align-items: center; gap: 6px; margin: 4px 0; flex-wrap: wrap; }
.fine { color: var(--muted); font-size: 12px; }

/* ---------- editor layout ---------- */
.editor { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.doc-name { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 10px; font-weight: 600; min-width: 80px; width: min(320px, 30vw); }
.doc-name:hover, .doc-name:focus { border-color: var(--line); outline: 0; background: var(--panel-2); }
.doc-name:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.top-group { display: flex; align-items: center; gap: 2px; }
.top-group.right { margin-inline-start: auto; gap: 6px; }
.workspace { display: grid; grid-template-columns: auto 1fr 300px; min-height: 0; }

/* left: insert */
.insert { display: flex; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--panel); }
.rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-inline-end: 1px solid var(--line); overflow-y: auto; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; padding: 8px 2px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; font-size: 11px; color: var(--muted); }
.rail button:hover { background: var(--panel-2); color: var(--ink); }
.rail button[aria-current="true"] { background: var(--panel-2); color: var(--accent-2); }
.insert-panel { width: 300px; overflow-y: auto; padding: 14px; }
.insert.collapsed .insert-panel { display: none; }
.insert-body { display: flex; flex-direction: column; gap: 12px; }
.panel-section { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: 0; }
.panel-section h3 { font-size: 13px; font-weight: 700; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.text-add { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 10px 12px; text-align: start; cursor: pointer; }
.text-add.heading { font-size: 24px; font-weight: 800; }
.text-add.subheading { font-size: 18px; font-weight: 600; }
.text-add.body { font-size: 14px; }
.text-add:hover, .pair:hover, .thumb:hover { border-color: var(--accent); }
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 10px; cursor: pointer; text-align: start; }
.pair b { font-size: 18px; }
.pair small { color: var(--muted); font-size: 11px; }
.thumb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumb-grid.small { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.thumb-grid.two { grid-template-columns: 1fr 1fr; }
.thumb.wide { aspect-ratio: 3 / 2; background: #fff; }
.thumb { aspect-ratio: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; cursor: pointer; padding: 8px; min-width: 0; min-height: 0; display: grid; place-items: center; color: var(--ink); }
.thumb svg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; min-width: 0; overflow: visible; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.upload { position: relative; }
.upload .icon-btn { position: absolute; top: 4px; inset-inline-end: 4px; background: var(--panel); width: 28px; height: 28px; opacity: 0; }
.upload:hover .icon-btn { opacity: 1; }
.upload-img { width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; padding: 0; cursor: pointer; background: var(--panel-2); }
.upload-sound { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; padding: 6px; color: var(--muted); }
.upload-sound small { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.upload-play { position: absolute; inset-inline-start: 6px; top: 6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; pointer-events: none; }
.upload-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-img.photo.busy { opacity: 0.5; cursor: progress; }
.upload-img.photo.missing { background: repeating-linear-gradient(45deg, var(--panel-2) 0 8px, var(--panel) 8px 16px); }
.photos { display: flex; flex-direction: column; gap: 10px; }
.credit { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.online-feature { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.brand-colors { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.brand-color { position: relative; }
.brand-color .icon-btn { position: absolute; top: -10px; inset-inline-end: -10px; width: 22px; height: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 50%; opacity: 0; }
.brand-color:hover .icon-btn { opacity: 1; }
.add-color { width: 36px; height: 36px; border: 1px dashed var(--muted); border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }

/* center: stage */
/* The page is laid out left to right in every language (its own text says which way it reads). */
.stage { position: relative; overflow: auto; background: var(--stage); outline: 0; overscroll-behavior: contain; direction: ltr; }
.stage.dropping { box-shadow: inset 0 0 0 3px var(--sel); }
.stage:focus-visible { box-shadow: inset 0 0 0 3px var(--sel); }
.board { position: relative; }
.page-wrap { position: absolute; box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 18px 48px rgba(0,0,0,.14); background: #fff; touch-action: none; }
.page-svg, .page-svg svg { display: block; }
.page-svg svg { user-select: none; }
.overlay { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.overlay .handle { pointer-events: all; fill: #fff; stroke: var(--sel); stroke-width: 1.5; cursor: nwse-resize; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.overlay .handle.side { rx: 6; }
.overlay .handle[data-handle="n"], .overlay .handle[data-handle="s"] { cursor: ns-resize; }
.overlay .handle[data-handle="e"], .overlay .handle[data-handle="w"] { cursor: ew-resize; }
.overlay .handle[data-handle="ne"], .overlay .handle[data-handle="sw"] { cursor: nesw-resize; }
.overlay .handle.rot { cursor: grab; }
.overlay .rot-stem { stroke: var(--sel); stroke-width: 1.5; }
.overlay .sel-box { fill: none; stroke: var(--sel); stroke-width: 2; }
.overlay .sel-box.locked { stroke: var(--muted); stroke-dasharray: 5 4; }
.overlay .hover-box { fill: none; stroke: var(--sel); stroke-width: 1; stroke-opacity: .7; }
.overlay .group-box { fill: none; stroke: var(--sel); stroke-width: 1; stroke-dasharray: 4 4; }
.overlay .guide { stroke: #ff2e88; stroke-width: 1; }
.overlay .marquee { fill: rgba(47, 111, 237, 0.08); stroke: var(--sel); stroke-width: 1; }
.overlay .crop-ghost { opacity: 0.35; }
.overlay .crop-frame { fill: none; stroke: #fff; stroke-width: 2; stroke-dasharray: 6 4; }
.text-editor { position: absolute; margin: 0; padding: 0; border: 0; outline: 1px dashed var(--sel); background: transparent; resize: none; overflow: hidden; transform-origin: center; white-space: pre-wrap; word-break: break-word; caret-color: var(--sel); }

/* right: inspector */
.inspector { border-inline-start: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 12px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.inspector-body { overflow-y: auto; padding: 4px 14px 24px; }
.panel-head { display: flex; flex-direction: column; gap: 8px; padding: 12px 0 8px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.badge { font-size: 11px; font-weight: 600; background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 2px 8px; }
.action-row { display: flex; gap: 2px; }
.btn-grid { display: grid; gap: 4px; }
.btn-grid.six { grid-template-columns: repeat(6, 1fr); }
.btn-grid.three { grid-template-columns: repeat(3, 1fr); }
.btn-grid.two { grid-template-columns: 1fr 1fr; }
.btn-grid .icon-btn { width: 100%; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field > span { font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field select, .field input[type="text"], .field input[type="url"], .field textarea, .stack input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); width: 100%; }
.field.num { flex-direction: row; align-items: center; gap: 6px; }
.field.num input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.field.num > span { min-width: 14px; }
.geo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row .field.num { flex: 1; }
.sub { display: flex; flex-direction: column; gap: 10px; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); }
.slider-row { display: flex; align-items: center; gap: 8px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 0; }
.slider-row input[type="number"] { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.segmented { display: flex; background: var(--panel-2); border-radius: 8px; padding: 3px; gap: 2px; }
.segmented button { flex: 1; border: 0; background: transparent; border-radius: 6px; padding: 6px 4px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); display: grid; place-items: center; }
.segmented button.on, .segmented button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.meta { margin: 0; font-weight: 600; }
.layers { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 6px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--panel); }
.layer.on { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.layer.hidden { opacity: 0.5; }
.layer .icon-btn { width: 28px; height: 28px; }
.layer-thumb { width: 36px; height: 36px; flex: none; display: grid; place-items: center; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0 / 10px 10px; border-radius: 6px; overflow: hidden; }
.layer-thumb svg { max-width: 32px; max-height: 32px; overflow: visible; }
.layer-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; border: 0; background: none; padding: 4px 2px; color: inherit; text-align: start; cursor: pointer; border-radius: 4px; }

/* swatches and popovers */
.swatch-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; background: linear-gradient(var(--swatch), var(--swatch)), repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 10px 10px; flex: none; }
.swatch-btn.empty { background: linear-gradient(135deg, transparent 46%, var(--danger) 47% 53%, transparent 54%), var(--panel); }
.popover { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; width: 260px; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.color-top { display: flex; gap: 8px; align-items: center; }
.color-top input[type="color"] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); cursor: pointer; }
.color-top .hex { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-family: ui-monospace, monospace; }
.swatch-group p { margin: 0 0 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); background: var(--swatch); cursor: pointer; padding: 0; }

/* bottom: pages */
.pages-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-top: 1px solid var(--line); min-width: 0; }
.page-list { display: flex; gap: 8px; list-style: none; margin: 0; padding: 4px; overflow-x: auto; flex: 1; min-width: 0; }
.page-list li { flex: none; }
.page-thumb { position: relative; display: block; border: 2px solid transparent; border-radius: 8px; padding: 2px; background: none; cursor: pointer; }
.page-list li.on .page-thumb { border-color: var(--accent); }
.page-img { display: block; height: 52px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); border-radius: 3px; overflow: hidden; }
.page-img svg { display: block; width: 100%; height: 100%; }
.page-no { position: absolute; bottom: 4px; inset-inline-start: 6px; font-size: 10px; font-weight: 700; background: rgba(22,22,29,.75); color: #fff; padding: 0 5px; border-radius: 4px; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom-label { border: 0; background: transparent; min-width: 56px; font-weight: 600; cursor: pointer; color: var(--ink); }

/* dialogs and toasts */
.backdrop { position: fixed; inset: 0; background: rgba(12, 12, 16, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); width: min(480px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.dialog.wide { width: min(820px, 100%); }
.dialog header { display: flex; align-items: center; justify-content: space-between; padding-block: 14px 8px; padding-inline: 20px 16px; }
.dialog h2 { font-size: 18px; }
.dialog h3 { font-size: 14px; margin: 16px 0 8px; }
.dialog-body { padding: 0 20px 20px; overflow-y: auto; }
.cutout { max-width: 420px; }
.cutout progress { width: 100%; height: 8px; accent-color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.export { display: flex; flex-direction: column; gap: 8px; }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.page-picks { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.shortcuts { width: 100%; border-collapse: collapse; }
.shortcuts td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.shortcuts td:last-child { text-align: end; }
kbd { font: 12px ui-monospace, monospace; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; }
#toasts { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 70; pointer-events: none; align-items: center; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; max-width: min(520px, 90vw); text-align: center; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* presenting */
.presenter { position: fixed; inset: 0; z-index: 80; background: #000; display: grid; place-items: center; outline: 0; cursor: pointer; }
.slide { position: relative; max-width: 100vw; max-height: 100vh; width: 100vw; display: grid; place-items: center; }
.slide svg { max-width: 100vw; max-height: 100vh; width: auto; height: auto; display: block; }
.slide-video { width: 100%; height: 100%; object-fit: fill; display: block; }
.slide-video-box { position: absolute; overflow: hidden; }
.slide-video-box .slide-video { position: absolute; }
.presenter-view { position: fixed; inset: 0; z-index: 80; background: #15151c; color: #eee; display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 16px; outline: 0; }
.presenter-view header, .presenter-view footer { display: flex; align-items: center; gap: 12px; }
.presenter-view footer { justify-content: flex-end; }
.pv-timer { font: 600 28px/1 ui-monospace, monospace; letter-spacing: .02em; }
.pv-count { margin-inline-start: auto; color: #aaa; }
.pv-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 16px; min-height: 0; }
.pv-main aside { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.pv-main h3 { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: #999; }
.pv-slide { display: grid; place-items: center; min-height: 0; }
.pv-slide svg { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; background: #fff; }
.pv-slide.small { max-height: 30vh; }
.pv-end { color: #999; }
.pv-notes { flex: 1; overflow: auto; font-size: 20px; line-height: 1.45; white-space: pre-wrap; background: #1f1f29; border-radius: 8px; padding: 12px 14px; }
.pv-notes.empty { color: #888; font-size: 15px; }
textarea.notes { width: 100%; resize: vertical; font: inherit; }
.note-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.note-swatch { aspect-ratio: 1; border: 0; border-radius: 6px; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.note-swatch:hover { transform: translateY(-1px); }
.note-swatch.on { outline: 2px solid var(--sel); outline-offset: 2px; }
.slide-count { position: fixed; bottom: 16px; inset-inline-end: 20px; color: #999; font-size: 13px; }
.presenter-close { position: fixed; top: 12px; inset-inline-end: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }

/* printing */
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  #print-root img { display: block; width: 100%; page-break-after: always; break-after: page; }
}

/* ---------- small screens: one sheet at a time ---------- */
.sheet-close { display: none; }
@media (max-width: 900px) {
  .topbar { gap: 6px; padding: 6px 8px; }
  .doc-name { flex: 1; min-width: 0; width: auto; padding: 6px; }
  .brand-word { display: none; }
  .top-group.right { margin-inline-start: 0; gap: 2px; }
  .top-group.right .icon-btn:not([data-testid="present"]) { display: none; }
  .top-group.right .btn { padding: 8px 12px; }
  .top-group.right .btn span:not(.ic) { display: none; }
  .workspace { display: flex; flex-direction: column; min-height: 0; }
  .stage { flex: 1; min-height: 0; }
  .insert { display: contents; }
  .rail { order: 3; flex-direction: row; overflow-x: auto; border: 0; border-top: 1px solid var(--line); padding: 4px; background: var(--panel); flex: none; }
  .rail button { width: auto; min-width: 60px; flex: none; }
  .insert-panel, .inspector { order: 2; width: auto; max-height: 42vh; min-height: 0; border: 0; border-top: 1px solid var(--line); background: var(--panel); }
  .insert-panel, .inspector { display: none; }
  .workspace[data-sheet="insert"] .insert-panel { display: block; }
  .workspace[data-sheet="edit"] .inspector { display: flex; }
  .insert.collapsed .insert-panel { display: none; }
  .sheet-close { display: grid; position: sticky; top: 0; margin-inline-start: auto; z-index: 2; background: var(--panel); }
  .pages-bar { padding: 4px 8px; }
  .zoom [data-testid="zoom-in"], .zoom [data-testid="zoom-out"] { display: none; }
  .page-img { height: 40px; }
  .search { min-width: 0; }
}

/* font picker */
.font-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 17px; cursor: pointer; text-align: start; }
.font-btn .ic { font-family: var(--font); color: var(--muted); }
.popover.font-pop { width: 300px; max-height: none; overflow: visible; }
.font-list { display: flex; flex-direction: column; overflow-y: auto; max-height: min(50vh, 420px); margin: 0 -6px; }
.font-item { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border: 0; background: none; padding: 8px 10px; font-size: 19px; text-align: start; cursor: pointer; border-radius: 6px; color: var(--ink); }
.font-item small { font: 11px var(--font); color: var(--muted); flex: none; }
.font-item:hover { background: var(--panel-2); }
.font-item.on { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .font-item.on { box-shadow: inset -3px 0 0 var(--accent); }
.chips.small { margin: 0; gap: 4px; }
.chips.small .chip { padding: 3px 9px; font-size: 12px; }
.font-pop input[type="search"] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }

/* Text effect picker */
.fx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.fx { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; }
.fx.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fx-img { display: block; width: 100%; aspect-ratio: 64 / 44; border-radius: 6px; background: #f3f0ea; overflow: hidden; }
.fx-img svg { display: block; width: 100%; height: 100%; overflow: visible; }
.fx small { font-size: 11px; color: var(--muted); }

/* Text combinations */
.combo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.combo { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.combo:hover { border-color: var(--accent); }
.combo svg { display: block; max-width: 100%; max-height: 100%; overflow: visible; }

/* Gradient editor */
.grad-editor { display: grid; gap: 8px; }
.grad-bar { height: 18px; border-radius: 6px; border: 1px solid var(--line); }
.grad-stop { display: grid; grid-template-columns: auto 1fr 28px; gap: 8px; align-items: center; }
.grad-stop input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.grad-spacer { width: 28px; }
.grad-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.grad-preset { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.grad-preset:hover { outline: 2px solid var(--accent); }

/* Duotone */
.anim-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.anim { padding: 7px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 12px var(--font); cursor: pointer; }
.anim.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.duo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.duo { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 11px; cursor: pointer; padding: 0; }
.duo.on { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Drawing */
.stage.drawing, .stage.drawing * { cursor: crosshair !important; }
/* A stroke can start beside the page too: don't let the browser pan instead. */
.stage.drawing { touch-action: none; }
.tool-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; font-size: 12px; }
.tool.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tool-tip { display: block; width: 10px; height: 28px; border-radius: 3px 3px 6px 6px; border: 1px solid rgba(0, 0, 0, .15); }
.tool-tip.marker { width: 16px; }
.tool-tip.highlighter { width: 22px; opacity: .55; border-radius: 3px; }
.draw-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.draw-colors .swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-stroke { pointer-events: none; }

/* Rulers, guides, grid, margins, bleed (shown while editing, never exported) */
.ruler { position: absolute; background: var(--panel); color: var(--muted); font: 9px var(--font); cursor: copy; touch-action: none; z-index: 2; }
.ruler.x { left: 0; right: 0; top: -22px; height: 20px; border-bottom: 1px solid var(--line); cursor: row-resize; }
.ruler.y { top: 0; bottom: 0; left: -22px; width: 20px; border-right: 1px solid var(--line); cursor: col-resize; }
.ruler[hidden] { display: none; }
.ruler svg { display: block; overflow: visible; }
.ruler line { stroke: currentColor; stroke-width: 1; }
.ruler text { fill: currentColor; }
.overlay .grid-lines { fill: none; stroke: rgba(47, 111, 237, .22); stroke-width: 1; }
.overlay .margin-box { fill: none; stroke: #8e44ad; stroke-width: 1; stroke-dasharray: 6 4; }
.overlay .bleed-zone { fill: rgba(217, 45, 32, .08); }
.overlay .bleed-line { fill: none; stroke: var(--danger); stroke-width: 1; stroke-dasharray: 4 4; }
.overlay .user-guide line { stroke: #ff2d95; stroke-width: 1; }
.overlay .user-guide .hit { stroke: transparent; stroke-width: 9; pointer-events: stroke; }
.overlay .user-guide.x { cursor: col-resize; }
.overlay .user-guide.y { cursor: row-resize; }
.menu-pop { width: 280px; }

/* Connector ends */
.overlay .handle.end { cursor: move; }
.overlay .handle.end.attached { fill: var(--sel); }
.overlay .drop-target { fill: rgba(47, 111, 237, .08); stroke: var(--sel); stroke-width: 2; stroke-dasharray: 5 4; }

/* Page titles, hidden pages, page grid */
.page-list li { position: relative; }
.page-list li.hidden-page .page-img { opacity: .4; }
.page-hidden-mark { position: absolute; top: 4px; inset-inline-end: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; }
.page-title { display: block; max-width: 96px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); text-align: center; }
.page-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.pg-card { display: flex; flex-direction: column; gap: 6px; }
.pg-card.on .page-img { outline: 3px solid var(--accent); }
.pg-card.hidden-page .page-img { opacity: .4; }
.pg-open { border: 0; padding: 0; background: none; cursor: pointer; }
.pg-open .page-img { display: block; width: 100%; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.pg-open .page-img svg { display: block; width: 100%; height: 100%; }
.pg-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pg-meta span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pg-meta small { color: var(--danger); }

/* Version history */
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.version { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.version-img { display: block; width: 72px; max-height: 96px; border-radius: 4px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.version-img svg, .version-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.version-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.version-meta small { color: var(--muted); }

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }

/* While a download is being made, its choices wait. */
.export.busy .segmented, .export.busy .page-picks { opacity: .55; pointer-events: none; }

/* AI writing and AI design (online extras) */
.ai-writing, .ai-menu, .ai-setup { display: flex; flex-direction: column; gap: 8px; }
.ai-setup { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.ai-setup input[type="text"], .ai-setup input[type="password"], .ai-setup select, .ai-line input, .ai-line select { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.ai-line { display: flex; gap: 6px; align-items: center; }
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ai-grid.three { grid-template-columns: repeat(3, 1fr); }
.ai-grid .btn { white-space: normal; }
.ai-progress { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ai-progress > span:nth-child(2) { flex: 1; }
.ai-spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: ai-spin 0.8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; } }
.ai-error { color: var(--danger); font-size: 13px; margin: 0; }
.ai-design-form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.ai-paste { display: grid; gap: 8px; max-width: 720px; }
.ai-paste textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; resize: vertical; }
.ai-paste .ai-chat-prompt { font: 12px/1.5 ui-monospace, monospace; color: var(--muted); }
.ai-design-form textarea { width: 100%; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.ai-design-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.ai-status { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin-top: 10px; }
.ai-status:empty { display: none; }
.ai-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ai-choice { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; background: none; cursor: pointer; text-align: start; }
.ai-choice-img { display: block; width: 100%; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.ai-choice-img svg { display: block; width: 100%; height: 100%; }
.share input[type="text"] { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 12px/1.4 ui-monospace, monospace; }
.share-preview { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.share-preview svg { display: block; width: 100%; height: 100%; }
.share-name { margin: 0; font-weight: 700; }
.ai-choice small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Asked for less motion: the interface's own transitions and spinners stop.
   (A design's animations play as designed: they're the work, not the UI.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .tpl:hover .tpl-img, .note-swatch:hover { transform: none; }
}

