:root {
  color-scheme: only light;
  --bg: #f5f6f8;
  --panel: rgba(255,255,255,0.86);
  --panel-strong: rgba(255,255,255,0.96);
  --border: rgba(15,23,42,0.08);
  --hair: rgba(15,23,42,0.06);
  --text: #0f172a;
  --muted: #667085;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15,23,42,0.04);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --accent: #111827;
  --accent-soft: #eef2ff;
  --danger: #b91c1c;
  --grid-light: rgba(15,23,42,0.06);
  --grid-strong: rgba(15,23,42,0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: radial-gradient(circle at top, #fbfbfd 0%, #f4f6f9 62%, #eef2f6 100%); color: var(--text); }
body { overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* V95: app chrome must never trigger native browser zoom. Canvas zoom stays app-owned. */
html, body, .app-shell, .editor-screen {
  overscroll-behavior: none !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}
button, [role="button"], .icon-btn, .tool-btn, .primary-btn, .secondary-btn, .zoom-hud, .focus-chrome, .bottom-action-bar {
  touch-action: manipulation;
}
.canvas-wrap, .board-svg, .board-svg * {
  touch-action: none !important;
}
input, textarea, select, #floatingEditor {
  touch-action: manipulation;
}

body,
.app-shell,
.library-screen,
.editor-screen,
.canvas-wrap,
.board-svg,
.board-svg *,
.focus-chrome,
.zoom-hud,
.minimap,
.left-panel,
.right-panel,
.utility-dock,
.present-overlay,
.object-context-menu,
.focus-text-bar {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

textarea,
input,
select,
option,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: rgba(255,255,255,0.84); color: var(--text); border-radius: 12px; padding: 10px 14px; transition: transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease; }
button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,23,42,0.06); }
button:active { transform: translateY(0); }
button.compact { padding: 8px 10px; border-radius: 10px; }
button.full { width: 100%; justify-content: center; }
button.danger { color: var(--danger); }
input[type="search"], input[type="text"], input[type="number"] { width: 100%; border: 1px solid var(--border); background: rgba(255,255,255,0.94); border-radius: 12px; padding: 12px 14px; color: var(--text); }
input[type="range"] { width: 100%; }
.hidden { display: none !important; }
.glass { backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.primary-btn { background: linear-gradient(180deg, #111827 0%, #1f2937 100%); color: #fff; border-color: rgba(17,24,39,0.28); }
.secondary-btn { background: rgba(255,255,255,0.9); }
.icon-btn { width: 42px; height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.subtle { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.eyebrow { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: #6b7280; }
.app-shell, .library-screen, .editor-screen { width: 100%; height: 100%; }
.library-screen { padding: 24px; display: flex; flex-direction: column; gap: 18px; overflow: auto; }
.library-header, .library-toolbar { border-radius: 28px; padding: 24px; display: flex; gap: 24px; align-items: center; justify-content: space-between; }
.library-header h1 { margin: 0 0 8px; font-size: clamp(34px, 4vw, 58px); line-height: 1; letter-spacing: -0.05em; }
.library-header .subtle { max-width: 720px; font-size: 16px; }
.library-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.search-wrap { flex: 1; }
.toolbar-meta { display: flex; gap: 12px; align-items: center; }
.board-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); padding-bottom: 40px; }
.board-card { border-radius: 24px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.open-board-card { all: unset; cursor: pointer; display: block; }
.board-thumb-wrap { aspect-ratio: 1.55 / 1; background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(243,244,246,0.95)); border-radius: 18px; overflow: hidden; border: 1px solid var(--hair); }
.board-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.board-card-body { padding: 10px 4px 0; }
.board-title { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.board-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.board-card-actions { display: flex; gap: 10px; }
.editor-screen { display: flex; flex-direction: column; }
.topbar { margin: 14px 14px 0; border-radius: 22px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 1.25fr) minmax(220px, 1fr); align-items: center; gap: 12px; padding: 10px 14px; z-index: 30; }
.topbar-left, .topbar-right, .topbar-center { display: flex; align-items: center; gap: 12px; }
.topbar-center { justify-content: center; min-width: 0; overflow: hidden; }
.topbar-right { justify-content: flex-end; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.topbar-right::-webkit-scrollbar { display: none; }
.board-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.board-title-input { width: min(360px, 42vw); border: none; background: transparent; font-size: 20px; letter-spacing: -0.03em; padding: 8px 4px; }
.board-title-input:focus { outline: none; }
.save-state { font-size: 12px; color: var(--muted); }
.tool-pills { display: flex; flex-wrap: nowrap; overflow: auto hidden; gap: 8px; padding: 4px; }
.tool-pills::-webkit-scrollbar { display: none; }
.tool-btn.active { background: #111827; color: #fff; border-color: rgba(17,24,39,0.25); }
.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: 276px minmax(0, 1fr) 318px; gap: 14px; padding: 14px; }
.left-panel, .right-panel { border-radius: 24px; padding: 18px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel-section { display: flex; flex-direction: column; gap: 14px; }
.panel-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-header h2 { margin: 0; font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase; color: #475467; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid.single { grid-template-columns: 1fr; }
.field-row { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: #475467; }
.toggle-row { flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--hair); border-radius: 14px; background: rgba(255,255,255,0.66); }
.layers-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.layer-item { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hair); background: rgba(255,255,255,0.7); }
.layer-item.active { outline: 2px solid rgba(17,24,39,0.12); background: rgba(17,24,39,0.06); }
.canvas-shell { position: relative; min-width: 0; min-height: 0; }
.canvas-wrap { position: relative; width: 100%; height: 100%; border-radius: 28px; overflow: hidden; background: #fcfcfd; box-shadow: inset 0 0 0 1px rgba(15,23,42,0.06), var(--shadow); }
.canvas-wrap::before, .canvas-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
}
.canvas-wrap.grid-on::before {
  background-image:
    linear-gradient(to right, var(--grid-light) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-light) 1px, transparent 1px),
    linear-gradient(to right, transparent 63px, var(--grid-strong) 64px),
    linear-gradient(to bottom, transparent 63px, var(--grid-strong) 64px);
  background-size: var(--grid-size-small, 16px) var(--grid-size-small, 16px), var(--grid-size-small, 16px) var(--grid-size-small, 16px), var(--grid-size-big, 64px) var(--grid-size-big, 64px), var(--grid-size-big, 64px) var(--grid-size-big, 64px);
  background-position: var(--grid-offset-x, 0px) var(--grid-offset-y, 0px), var(--grid-offset-x, 0px) var(--grid-offset-y, 0px), var(--grid-offset-x, 0px) var(--grid-offset-y, 0px), var(--grid-offset-x, 0px) var(--grid-offset-y, 0px);
}
.board-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.floating-editor { position: absolute; min-width: 160px; min-height: 60px; border-radius: 14px; border: 1px solid rgba(17,24,39,0.14); box-shadow: 0 18px 42px rgba(15,23,42,0.16); padding: 14px; resize: both; background: rgba(255,255,255,0.98); color: var(--text); z-index: 25; }
.minimap { position: absolute; right: 18px; bottom: 18px; width: 220px; height: 140px; border-radius: 18px; overflow: hidden; }
.minimap svg { width: 100%; height: 100%; display: block; }
.zoom-hud { position: absolute; left: 18px; bottom: 18px; display: flex; align-items: center; gap: 8px; border-radius: 16px; padding: 10px; }
.selection-summary { padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.66); border: 1px solid var(--hair); }
.inspector-actions, .action-stack, .layer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.shortcut-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.present-overlay { position: fixed; inset: 0; background: radial-gradient(circle at top, rgba(255,255,255,0.14) 0%, rgba(244,246,249,0.18) 46%, rgba(233,238,244,0.22) 100%); opacity: 0; pointer-events: none; transition: opacity 180ms ease; z-index: 95; }
.present-overlay.active { opacity: 1; pointer-events: none; }
.present-top { position: absolute; top: max(18px, env(safe-area-inset-top, 0px) + 12px); right: max(18px, env(safe-area-inset-right, 0px) + 12px); display: flex; gap: 10px; pointer-events: auto; }
body.present-mode { background: #eef2f6; }
body.present-mode .library-screen { display: none !important; }
body.present-mode .editor-screen { position: fixed; inset: 0; z-index: 90; background: radial-gradient(circle at top, #fbfbfd 0%, #f4f6f9 58%, #eef2f6 100%); }
body.present-mode .topbar,
body.present-mode .left-panel,
body.present-mode .right-panel,
body.present-mode .focus-chrome,
body.present-mode .zoom-hud,
body.present-mode .minimap { display: none !important; }
body.present-mode .workspace { grid-template-columns: 1fr; padding: 0; gap: 0; }
body.present-mode .canvas-shell,
body.present-mode .canvas-wrap { width: 100%; height: 100%; min-height: 100vh; }
body.present-mode .canvas-wrap { border-radius: 0; box-shadow: none; }
body.present-mode .canvas-wrap::after { opacity: 0; }
#presentBtn.is-active,
#focusPresentBtn.is-active { background: linear-gradient(180deg, #0f172a 0%, #111827 100%); color: #fff; border-color: rgba(15,23,42,0.18); }
.selected-outline { fill: none; stroke: #2563eb; stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-dasharray: 7 5; pointer-events: none; }
.handle { pointer-events: all; }
.handle-hit { fill: rgba(37,99,235,0.001); stroke: transparent; vector-effect: non-scaling-stroke; }
.handle-core { fill: #fff; stroke: #2563eb; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.handle.cursor-line { cursor: grab; }
.handle.cursor-ns { cursor: ns-resize; }
.handle.cursor-ew { cursor: ew-resize; }
.handle.cursor-nesw { cursor: nesw-resize; }
.handle.cursor-nwse { cursor: nwse-resize; }
.object-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.object-highlighter { mix-blend-mode: multiply; }
.object-sticky-shadow { filter: drop-shadow(0 12px 18px rgba(15,23,42,0.08)); }
.object-selected > * { filter: drop-shadow(0 0 0 rgba(0,0,0,0)); }
.empty-state { padding: 24px; color: var(--muted); }
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr) 240px; }
}
@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar-center { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .left-panel, .right-panel { max-height: 220px; }
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr) minmax(220px, auto);
  }

  .topbar-center {
    justify-content: flex-start;
  }

  .tool-pills-shell {
    width: 100%;
    max-width: 100%;
  }

  .tool-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .topbar-right {
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .topbar-right > * {
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .library-screen { padding: 14px; }
  .library-header, .library-toolbar { padding: 18px; border-radius: 22px; flex-direction: column; align-items: flex-start; }
  .topbar { margin: 10px 10px 0; padding: 10px; border-radius: 18px; }
  .board-title-input { width: 100%; }
  .workspace { padding: 10px; gap: 10px; }
  .canvas-wrap { min-height: 46vh; border-radius: 22px; }
  .minimap { width: 160px; height: 110px; }
  .zoom-hud { left: 10px; bottom: 10px; }
  .left-panel, .right-panel { border-radius: 20px; }
}

.swatch-block { display:flex; flex-direction:column; gap:10px; padding: 12px 14px; border:1px solid var(--hair); border-radius:16px; background: rgba(255,255,255,0.64); }
.swatch-label-row { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; color:#475467; }
.swatch-row { display:flex; flex-wrap:wrap; gap:10px; }
.swatch-chip { width:24px; height:24px; min-width:24px; padding:0; border-radius:999px; border:1.5px solid rgba(15,23,42,0.08); background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.38); }
.swatch-chip.swatch-light { border-color: rgba(15,23,42,0.12); }
.swatch-chip.active { outline: 2px solid rgba(37,99,235,0.24); outline-offset: 3px; }
.action-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; }
.board-svg .object-diamond, .board-svg .object-connector { fill: none; }
.layer-item span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }


.icon-tool {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
}
.icon-tool svg {
  width: 18px;
  height: 18px;
  display: block;
}
.icon-tool svg * {
  vector-effect: non-scaling-stroke;
}
.tool-btn.icon-tool {
  font-size: 0;
  line-height: 0;
}

/* ===== Inevitable polish pass ===== */
:root {
  --bg: #eef2f6;
  --panel: rgba(255,255,255,0.78);
  --panel-strong: rgba(255,255,255,0.92);
  --border: rgba(15,23,42,0.07);
  --hair: rgba(15,23,42,0.055);
  --text: #0b1220;
  --muted: #667085;
  --shadow: 0 26px 60px rgba(15,23,42,0.09), 0 8px 24px rgba(15,23,42,0.05);
  --shadow-soft: 0 18px 40px rgba(15,23,42,0.06), 0 2px 8px rgba(15,23,42,0.03);
  --accent: #0f172a;
  --accent-soft: rgba(15,23,42,0.06);
}

body.theme-inevitable {
  background:
    radial-gradient(1200px 520px at -5% -10%, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.7) 38%, transparent 72%),
    radial-gradient(980px 460px at 104% -6%, rgba(221,232,246,0.68) 0%, rgba(233,239,246,0.42) 44%, transparent 72%),
    linear-gradient(180deg, #f8fafc 0%, #f1f4f8 44%, #eef2f6 100%);
}

body.theme-inevitable::before,
body.theme-inevitable::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

body.theme-inevitable::before {
  width: 340px;
  height: 340px;
  left: -80px;
  bottom: 8vh;
  background: radial-gradient(circle, rgba(191,219,254,0.32) 0%, rgba(191,219,254,0.08) 48%, transparent 72%);
}

body.theme-inevitable::after {
  width: 420px;
  height: 420px;
  right: -120px;
  top: 10vh;
  background: radial-gradient(circle, rgba(221,214,254,0.22) 0%, rgba(221,214,254,0.06) 42%, transparent 70%);
}

#app { position: relative; z-index: 1; }

.glass {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.72));
  border: 1px solid rgba(255,255,255,0.58);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.72);
}

button,
input[type="search"],
input[type="text"],
input[type="number"],
.floating-editor {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

button {
  border-color: rgba(15,23,42,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(245,247,250,0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 1px 2px rgba(15,23,42,0.04);
  font-weight: 500;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 12px 26px rgba(15,23,42,0.08);
}

button:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 1px rgba(15,23,42,0.05), 0 2px 6px rgba(15,23,42,0.05);
}

.primary-btn {
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border-color: rgba(2,6,23,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 16px 30px rgba(15,23,42,0.18);
}

.secondary-btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,248,250,0.88));
}

.chrome-icon-btn {
  color: #475467;
}

.chrome-icon-btn svg,
.action-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 12px 14px;
}

.action-btn-soft {
  color: #334155;
}

.library-screen {
  padding: 26px;
  gap: 20px;
}

.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(420px 220px at 12% 0%, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.34) 48%, transparent 76%),
    radial-gradient(360px 180px at 92% 20%, rgba(219,234,254,0.34) 0%, rgba(219,234,254,0.12) 42%, transparent 72%);
}

.control-ribbon {
  padding-block: 16px;
}

.library-header,
.library-toolbar,
.topbar,
.left-panel,
.right-panel,
.board-card,
.minimap,
.zoom-hud {
  border-color: rgba(255,255,255,0.62);
}

.library-header h1 {
  letter-spacing: -0.065em;
}

.library-header .subtle {
  color: #526071;
  line-height: 1.6;
}

.search-wrap input {
  height: 48px;
  padding-inline: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 1px 2px rgba(15,23,42,0.03);
}

.board-card {
  position: relative;
  padding: 15px;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.board-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 50px rgba(15,23,42,0.11), 0 8px 20px rgba(15,23,42,0.05);
}

.board-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.28), transparent 28%);
}

.board-thumb-wrap {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), inset 0 0 0 1px rgba(15,23,42,0.04);
}

.topbar-inevitable {
  padding: 12px 14px;
  gap: 14px;
  box-shadow: 0 18px 36px rgba(15,23,42,0.08), 0 2px 10px rgba(15,23,42,0.04), inset 0 1px 0 rgba(255,255,255,0.74);
}

.topbar-left,
.topbar-right {
  min-width: 0;
}

.topbar-left .icon-btn,
.topbar-right .icon-btn {
  flex: 0 0 auto;
}

#backToLibraryBtn {
  font-size: 19px;
  font-weight: 600;
}

.board-title-wrap {
  gap: 14px;
  min-width: 0;
}

.board-title-input {
  font-size: 22px;
  font-weight: 630;
  color: #0b1220;
  letter-spacing: -0.045em;
}

.board-title-input::placeholder {
  color: #98a2b3;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(15,23,42,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.tool-pills-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 4px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(246,248,251,0.74));
  border: 1px solid rgba(15,23,42,0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.88), 0 8px 18px rgba(15,23,42,0.04);
}

.tool-pills {
  gap: 6px;
  padding: 2px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.tool-pills::-webkit-scrollbar { display: none; }
.tool-pills > * { scroll-snap-align: start; }

.icon-tool {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 14px;
  color: #344054;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.icon-tool:hover {
  background: rgba(15,23,42,0.06);
  color: #0f172a;
  box-shadow: none;
}

.tool-btn.active.icon-tool {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  border-color: rgba(15,23,42,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 18px rgba(15,23,42,0.18);
}

.tool-btn.active.icon-tool:hover,
.tool-btn.active.icon-tool:focus-visible {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  border-color: rgba(15,23,42,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 18px rgba(15,23,42,0.18);
}

.workspace {
  gap: 16px;
  padding: 16px;
}

.side-panel {
  padding: 16px;
  gap: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.62));
}
.side-panel > *,
.side-panel .surface-card,
.side-panel .panel-section,
.side-panel .field-grid,
.side-panel .field-row,
.side-panel .action-grid,
.side-panel .action-stack,
.side-panel .inspector-actions,
.side-panel .text-align-row,
.side-panel .type-preview,
.side-panel .size-presets,
.side-panel .font-gallery {
  min-width: 0;
}

.surface-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(15,23,42,0.045);
  background: linear-gradient(180deg, rgba(255,255,255,0.76), rgba(248,250,252,0.62));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), 0 8px 20px rgba(15,23,42,0.03);
}

.panel-section {
  gap: 12px;
}

.panel-header h2 {
  letter-spacing: 0.08em;
  color: #5b6472;
}

.field-row,
.swatch-label-row,
.shortcut-list {
  color: #526071;
}

input[type="search"],
input[type="text"],
input[type="number"],
.floating-editor {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 1px 2px rgba(15,23,42,0.03);
}

input[type="search"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
.floating-editor:focus {
  outline: none;
  border-color: rgba(37,99,235,0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 0 0 4px rgba(37,99,235,0.08);
}

input[type="color"] {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.9));
  padding: 6px;
}

input[type="range"] {
  accent-color: #111827;
}

.toggle-row,
.selection-summary,
.layer-item,
.swatch-block {
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(249,250,251,0.66));
  border-color: rgba(15,23,42,0.045);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.layer-item {
  min-height: 46px;
}

.layer-item.active {
  background: linear-gradient(180deg, rgba(17,24,39,0.08), rgba(17,24,39,0.06));
  outline: 1px solid rgba(17,24,39,0.1);
}

.swatch-chip {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border: 1.5px solid rgba(15,23,42,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.54), 0 2px 6px rgba(15,23,42,0.05);
}

.canvas-shell::before {
  content: "";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  border-radius: 36px;
  background: radial-gradient(240px 120px at 18% 0%, rgba(255,255,255,0.9) 0%, transparent 72%);
  z-index: 0;
}

.canvas-shell > * {
  position: relative;
  z-index: 1;
}

.canvas-wrap {
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.46) 34%, transparent 72%),
    linear-gradient(180deg, #fdfdfe 0%, #fbfcfe 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 0 0 1px rgba(15,23,42,0.055),
    0 28px 55px rgba(15,23,42,0.08),
    0 8px 20px rgba(15,23,42,0.04);
}

.canvas-wrap::after {
  background: linear-gradient(180deg, rgba(255,255,255,0.16), transparent 24%);
}

.minimap {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(247,249,252,0.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 20px 34px rgba(15,23,42,0.12), 0 6px 14px rgba(15,23,42,0.05);
}

.zoom-hud {
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(247,249,252,0.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 18px 34px rgba(15,23,42,0.1), 0 4px 12px rgba(15,23,42,0.04);
}

.zoom-hud button {
  min-width: 36px;
}

#zoomLabel {
  min-width: 56px;
  text-align: center;
  color: #475467;
}

.floating-editor {
  border-radius: 18px;
}

.shortcut-list {
  gap: 10px;
}

.shortcut-list li {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(15,23,42,0.06);
}

.shortcut-list li:last-child {
  border-bottom: 0;
}

.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar,
.library-screen::-webkit-scrollbar,
.layers-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb,
.library-screen::-webkit-scrollbar-thumb,
.layers-list::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.38);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.left-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track,
.library-screen::-webkit-scrollbar-track,
.layers-list::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: minmax(180px, 1fr) minmax(0, 1fr) minmax(180px, auto);
  }

  .tool-pills-shell {
    width: 100%;
  }

  .topbar-inevitable {
    gap: 12px;
  }

  .topbar-right {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 720px) {
  .library-screen {
    padding: 14px;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .topbar-inevitable {
    padding: 10px;
  }

  .tool-pills-shell {
    border-radius: 18px;
  }

  .action-btn span {
    display: none;
  }

  .action-btn {
    padding-inline: 10px;
  }

  .surface-card {
    padding: 12px;
    border-radius: 16px;
  }
}

select {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}

.context-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.06);
  color: #475467;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.typography-grid .field-row input[type="range"] {
  margin-top: 2px;
}

.size-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.size-preset {
  padding-inline: 0;
}

.text-align-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.align-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.82);
}

.align-chip svg {
  width: 18px;
  height: 18px;
}

.align-chip.active {
  background: #111827;
  color: #fff;
  border-color: rgba(17,24,39,0.18);
}

.type-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(246,248,251,0.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}

.type-preview-text {
  color: var(--text);
  font-size: 24px;
  line-height: 1.34;
  letter-spacing: 0;
}

.right-panel .panel-section.hidden {
  display: none !important;
}



.utility-dock {
  margin-top: auto;
}

.utility-dock-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding-inline: 12px;
}

.utility-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.right-panel {
  padding-right: 14px;
}

.right-panel .surface-card {
  width: 100%;
}

.right-panel select,
.right-panel input,
.right-panel button,
.left-panel button {
  max-width: 100%;
}

#typeFamilySelect {
  min-width: 0;
}

.font-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.font-chip {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.9));
  border: 1px solid rgba(15,23,42,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 1px 2px rgba(15,23,42,0.03);
}

.font-chip-name,
.font-chip-meta {
  display: block;
  min-width: 0;
}

.font-chip-name {
  font-family: var(--font-preview);
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.font-chip-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.font-chip.active {
  background: linear-gradient(180deg, rgba(15,23,42,0.08), rgba(15,23,42,0.06));
  border-color: rgba(15,23,42,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.typography-grid {
  gap: 10px;
}

.shortcut-list {
  gap: 10px;
}

.shortcut-sheet-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(15,23,42,0.06);
  padding: 10px 0;
}

.shortcut-sheet-list li:last-child {
  border-bottom: none;
}

.shortcut-keys {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(243,244,246,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  color: #334155;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.utility-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11,18,32,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.utility-sheet {
  width: min(560px, calc(100vw - 48px));
  max-height: min(82vh, 820px);
  overflow: auto;
  border-radius: 28px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,249,252,0.94));
  border: 1px solid rgba(255,255,255,0.68);
  box-shadow: 0 30px 80px rgba(15,23,42,0.22), inset 0 1px 0 rgba(255,255,255,0.8);
}

#settingsSheet.utility-sheet {
  width: min(920px, calc(100vw - 48px));
}

.utility-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.utility-sheet-header h2 {
  margin: 3px 0 0;
  font-size: 24px;
  letter-spacing: -0.04em;
  color: var(--text);
}

.utility-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.utility-overlay.hidden,
.utility-sheet.hidden {
  display: none !important;
}

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr) 292px; }
}

@media (max-width: 980px) {
  .utility-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 14px;
  }

  .utility-sheet,
  #settingsSheet.utility-sheet {
    width: min(100%, 560px);
    max-height: 72vh;
  }
}

/* Focus mode — canvas-first, reduced chrome, optional fullscreen companion */
.focus-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  pointer-events: none;
  display: flex;
  justify-content: center;
  padding-top: max(16px, var(--sat) + 10px);
  padding-inline: max(12px, env(safe-area-inset-left, 0px) + 12px) max(12px, env(safe-area-inset-right, 0px) + 12px);
}
.focus-chrome-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 16px 44px rgba(15,23,42,0.12), 0 4px 16px rgba(15,23,42,0.06);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.focus-chrome-pill button,
.focus-chrome-pill select,
.focus-chrome-pill input,
.focus-chrome-pill textarea,
.focus-chrome-pill label {
  touch-action: manipulation;
  user-select: auto;
  -webkit-user-select: auto;
}
.focus-cluster { display: inline-flex; align-items: center; gap: 8px; }
.focus-tools-scroll {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: min(54vw, 880px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}
.focus-tools-scroll::-webkit-scrollbar { display: none; }
.focus-tools {
  flex-wrap: nowrap;
  min-width: max-content;
  padding-inline: 1px;
}
.focus-divider { width: 1px; height: 28px; background: rgba(15,23,42,0.08); flex: 0 0 auto; }
.focus-textbar {
  position: fixed;
  z-index: 92;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  transition: left 180ms cubic-bezier(.22,.61,.36,1), top 180ms cubic-bezier(.22,.61,.36,1), opacity 140ms ease;
  will-change: left, top;
}
.focus-textbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 16px 42px rgba(15,23,42,0.16), 0 6px 16px rgba(15,23,42,0.07);
  backdrop-filter: blur(22px);
  pointer-events: auto;
}
.focus-textbar-cluster { display: inline-flex; align-items: center; gap: 8px; }
.focus-textbar-leading { gap: 10px; }
.focus-textbar-trailing { gap: 10px; }
.focus-textbar-typemark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.focus-text-select,
.focus-text-size-input {
  appearance: none;
  border: 1px solid rgba(15,23,42,0.08);
  background: rgba(248,250,252,0.94);
  color: #0f172a;
  border-radius: 12px;
  height: 38px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}
.focus-text-select { min-width: 158px; }
.focus-text-weight { min-width: 110px; }
.focus-text-size-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 38px;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 12px;
  background: rgba(248,250,252,0.94);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}
.focus-text-size-step {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: rgba(226,232,240,0.76);
  color: #0f172a;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.focus-text-size-step:hover {
  background: rgba(203,213,225,0.92);
}
.focus-text-size-step:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.focus-text-size-input {
  width: 54px;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-weight: 600;
  text-align: center;
}
.focus-text-size-input:focus {
  outline: none;
}
.focus-text-select:focus,
.focus-text-size-input:focus {
  outline: none;
  border-color: rgba(37,99,235,0.42);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.focus-text-align-row-mini { gap: 6px; }
.focus-text-align-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  background: transparent;
}
.focus-text-align-btn svg { width: 18px; height: 18px; }
.focus-text-align-btn:hover { background: rgba(15,23,42,0.06); color: #111827; }
.focus-text-align-btn.active {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 10px 18px rgba(15,23,42,0.18);
}
.focus-text-color-wrap {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(15,23,42,0.08);
  background: rgba(248,250,252,0.94);
}
.focus-text-color-wrap input {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.focus-text-menu-toggle { width: 38px; height: 38px; border-radius: 12px; }
.focus-text-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 196px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 22px 46px rgba(15,23,42,0.18), 0 8px 18px rgba(15,23,42,0.08);
  backdrop-filter: blur(18px);
}
.focus-text-menu-item {
  width: 100%;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 14px;
  font-weight: 560;
  color: #0f172a;
}
.focus-text-menu-item:hover { background: rgba(15,23,42,0.06); }
.focus-text-menu-item.danger { color: #b42318; }
.focus-text-menu-divider {
  height: 1px;
  background: rgba(15,23,42,0.08);
  margin: 8px 4px;
}

.object-context-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 212px;
  max-width: min(280px, calc(100vw - 24px));
  max-height: min(76vh, calc(100dvh - 24px));
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 24px 52px rgba(15,23,42,0.22), 0 10px 20px rgba(15,23,42,0.12);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,23,42,0.22) transparent;
  z-index: 90;
}
.object-context-menu::-webkit-scrollbar {
  width: 10px;
}
.object-context-menu::-webkit-scrollbar-track {
  background: transparent;
}
.object-context-menu::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.object-context-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.object-context-menu-item {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 14px;
  font-weight: 560;
  color: #0f172a;
}

.object-context-menu-item:hover {
  background: rgba(15,23,42,0.06);
}

.object-context-menu-item:disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.object-context-menu-item.danger {
  color: #b42318;
}

.object-context-menu-divider {
  height: 1px;
  margin: 8px 4px;
  background: rgba(15,23,42,0.08);
}
.focus-control-btn,
.focus-tool-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-color: transparent;
  color: #344054;
  box-shadow: none;
  overflow: visible;
  flex: 0 0 auto;
}
.focus-control-btn::before,
.focus-tool-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  transition: background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  z-index: -1;
}
.focus-control-btn svg,
.focus-tool-btn svg { width: 20px; height: 20px; }
.focus-control-btn:hover::before,
.focus-tool-btn:hover::before {
  background: rgba(15,23,42,0.06);
}
.focus-control-btn:hover,
.focus-tool-btn:hover {
  color: #111827;
  box-shadow: none;
}
.focus-control-btn.is-active::before,
.focus-tool-btn.active::before {
  inset: -1px;
  border-radius: 13px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 10px 18px rgba(15,23,42,0.18);
}
.focus-control-btn.is-active,
.focus-tool-btn.active {
  color: #ffffff;
  border-color: rgba(15,23,42,0.16);
  box-shadow: none;
}
#focusModeBtn.is-active {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  border-color: rgba(15,23,42,0.18);
}
body.focus-mode {
  background: #eef2f6;
}
body.focus-mode .library-screen { display: none !important; }
body.focus-mode .editor-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at top, #fbfbfd 0%, #f4f6f9 58%, #eef2f6 100%);
}
body.focus-mode .topbar {
  display: none;
}
body.focus-mode .workspace {
  grid-template-columns: 1fr;
  padding: 0;
  gap: 0;
}
body.focus-mode .left-panel,
body.focus-mode .right-panel {
  display: none;
}
body.focus-mode .canvas-shell,
body.focus-mode .canvas-wrap {
  width: 100%;
  height: 100%;
  min-height: 100vh;
}
body.focus-mode .canvas-wrap {
  border-radius: 0;
  box-shadow: none;
}
body.focus-mode .minimap {
  right: 22px;
  bottom: 22px;
}
body.focus-mode .zoom-hud {
  left: 22px;
  bottom: 22px;
}
body.focus-mode .focus-textbar,
body.present-mode .focus-textbar {
  display: block;
}
body.focus-mode.focus-panels-visible .left-panel,
body.focus-mode.focus-panels-visible .right-panel {
  display: flex;
  position: fixed;
  top: max(74px, env(safe-area-inset-top, 0px) + 68px);
  bottom: 18px;
  z-index: 85;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.84));
  box-shadow: 0 22px 54px rgba(15,23,42,0.16), 0 6px 18px rgba(15,23,42,0.06);
}
body.focus-mode.focus-panels-visible .left-panel {
  left: 18px;
  width: min(var(--workspace-left-track, var(--workspace-left-width)), calc(100vw - 140px));
}
body.focus-mode.focus-panels-visible .right-panel {
  right: 18px;
  width: min(var(--workspace-right-track, var(--workspace-right-width)), calc(100vw - 140px));
}
body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel,
body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding: 0;
  border-width: 0;
  box-shadow: none;
  width: 0 !important;
  min-width: 0 !important;
}
body.focus-mode.focus-panels-visible .canvas-wrap::after {
  background: rgba(255,255,255,0.18);
}
@media (max-width: 820px) {
  .focus-chrome-pill {
    gap: 8px;
    padding: 8px 10px;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
  }
  .focus-tools-scroll {
    max-width: min(62vw, calc(100vw - 180px));
  }
  .focus-textbar {
    max-width: calc(100vw - 16px);
  }
  .focus-textbar-pill {
    width: min(calc(100vw - 16px), 760px);
    gap: 8px;
    padding: 8px 10px;
    overflow-x: auto;
  }
  .focus-text-select { min-width: 132px; }
  .focus-text-weight { min-width: 102px; }
  .focus-text-size-input { width: 64px; }
  .focus-divider { height: 24px; }
  body.focus-mode.focus-panels-visible .left-panel,
  body.focus-mode.focus-panels-visible .right-panel {
    top: max(68px, env(safe-area-inset-top, 0px) + 62px);
    bottom: 12px;
  }
  body.focus-mode.focus-panels-visible .left-panel {
    left: 12px;
    width: min(var(--workspace-left-track, var(--workspace-left-width)), calc(100vw - 120px));
  }
  body.focus-mode.focus-panels-visible .right-panel {
    right: 12px;
    width: min(var(--workspace-right-track, var(--workspace-right-width)), calc(100vw - 120px));
  }
}

/* ===== Mobile-first productized workspace pass ===== */
.mobile-bottom-bar,
.mobile-tools-sheet,
.mobile-more-sheet,
.mobile-ui-backdrop {
  display: none;
}

@media (max-width: 820px) {
  .topbar {
    margin: 0;
    border-radius: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 70;
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(18px);
  }

  .topbar-left {
    min-width: 0;
    gap: 10px;
  }

  .board-title-wrap {
    min-width: 0;
    gap: 8px;
  }

  .board-title-input {
    width: 100%;
    font-size: 17px;
    font-weight: 600;
    padding: 6px 0;
  }

  .save-state {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .topbar-right .action-btn span,
  .topbar-right .secondary-btn.compact span,
  .topbar-right .primary-btn.compact span {
    display: none;
  }

  .topbar-right .action-btn,
  .topbar-right .secondary-btn.compact,
  .topbar-right .primary-btn.compact {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    justify-content: center;
  }

  .topbar-center {
    display: none !important;
  }

  .mobile-tools-sheet {
    display: block;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
    z-index: 82;
    padding: 16px;
    border-radius: 26px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 34px 70px rgba(15,23,42,0.2), 0 10px 24px rgba(15,23,42,0.08);
  }

  .mobile-tools-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-tool-pills {
    gap: 10px;
    padding: 2px;
    flex-wrap: nowrap;
  }

  .tool-pills-shell {
    width: 100%;
    border-radius: 24px;
    padding: 8px;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(22px);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 22px 48px rgba(15,23,42,0.18), 0 8px 20px rgba(15,23,42,0.08);
  }

  .tool-pills {
    gap: 10px;
    padding: 2px;
  }

  .tool-btn,
  .icon-tool {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 92px);
    gap: 0;
  }

  .canvas-shell {
    min-height: calc(100dvh - 148px);
  }

  .canvas-wrap {
    min-height: calc(100dvh - 156px);
    border-radius: 24px;
  }

  .left-panel,
  .right-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
    max-height: min(68vh, 620px);
    border-radius: 26px;
    z-index: 81;
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition: transform 200ms ease, opacity 200ms ease;
    box-shadow: 0 34px 70px rgba(15,23,42,0.2), 0 10px 24px rgba(15,23,42,0.08);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(22px);
    overscroll-behavior: contain;
  }

  body.mobile-left-open .left-panel,
  body.mobile-right-open .right-panel {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .right-panel {
    overflow-x: hidden;
  }

  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .font-gallery {
    grid-template-columns: 1fr;
  }

  .utility-dock {
    display: none;
  }

  .minimap {
    display: none !important;
  }

  .zoom-hud {
    left: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px + 72px);
    padding: 8px 10px;
    border-radius: 16px;
    gap: 6px;
    z-index: 74;
  }

  .zoom-hud .compact {
    min-width: 34px;
    height: 34px;
  }

  .mobile-bottom-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 6px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    z-index: 78;
    padding: 8px;
    border-radius: 24px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(22px);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 26px 60px rgba(15,23,42,0.18), 0 10px 24px rgba(15,23,42,0.08);
  }

  .mobile-nav-btn {
    min-height: 58px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    color: #425166;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: transparent;
  }

  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-btn.is-active,
  .mobile-nav-btn[aria-pressed="true"] {
    background: #111827;
    color: #fff;
  }

  .mobile-ui-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12,18,28,0.22);
    backdrop-filter: blur(6px);
    z-index: 75;
  }

  .mobile-tools-sheet .mobile-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-more-sheet {
    display: block;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
    z-index: 82;
    padding: 16px;
    border-radius: 26px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 34px 70px rgba(15,23,42,0.2), 0 10px 24px rgba(15,23,42,0.08);
  }

  .mobile-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-sheet-header h2 {
    margin: 2px 0 0;
    font-size: 20px;
    letter-spacing: -0.03em;
  }

  .mobile-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
  }

  .mobile-sheet-action {
    min-height: 46px;
    border-radius: 16px;
    justify-content: center;
  }

  .focus-chrome {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 94px);
  }

  body.present-mode .mobile-bottom-bar,
  body.present-mode .topbar-center,
  body.present-mode .left-panel,
  body.present-mode .right-panel,
  body.present-mode .mobile-more-sheet,
  body.present-mode .mobile-ui-backdrop,
  body.present-mode .zoom-hud {
    display: none !important;
  }

  body.focus-mode .mobile-bottom-bar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
  }
}

@media (max-width: 560px) {
  .topbar-right {
    display: grid;
    grid-auto-flow: column;
    gap: 4px;
  }

  .topbar-right > *:nth-child(n+4) {
    display: none;
  }

  .board-title-input {
    font-size: 16px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .mobile-action-grid {
    grid-template-columns: 1fr 1fr;
  }

  .floating-editor {
    min-width: 140px;
  }
}

@media (max-width: 820px) {
  body.focus-mode .mobile-tools-sheet,
  body.focus-mode .mobile-more-sheet { display: none !important; }
}


/* ===== Tablet/mobile library header hardening fix ===== */
.hero-card::before {
  z-index: 0;
}
.hero-card > * {
  position: relative;
  z-index: 1;
}
.library-header > div:first-child,
.library-toolbar > div:first-child {
  min-width: 0;
}
.library-header h1 {
  text-wrap: balance;
}

@media (max-width: 1180px) {
  .library-screen {
    padding: 18px;
    gap: 16px;
  }
  .library-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-content: stretch;
    gap: 16px;
    padding: 18px 20px;
  }
  .library-header > div:first-child {
    width: 100%;
    padding-top: 2px;
  }
  .library-header h1 {
    font-size: clamp(30px, 5.2vw, 46px);
    line-height: 0.96;
    margin: 0 0 10px;
    max-width: 10.5ch;
  }
  .library-header .subtle {
    max-width: 100%;
    font-size: 15px;
    line-height: 1.45;
  }
  .library-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }
  .library-actions > button {
    flex: 0 0 auto;
  }
  .library-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
  }
  .search-wrap {
    min-width: 0;
  }
  .toolbar-meta {
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

@media (max-width: 900px) {
  .library-header {
    gap: 14px;
    padding: 16px 18px;
  }
  .library-header h1 {
    font-size: clamp(28px, 6vw, 40px);
    max-width: 9.5ch;
  }
  .library-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .library-actions > button {
    width: 100%;
  }
  .library-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }
  .toolbar-meta {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 720px) {
  .library-screen {
    padding: 14px;
    gap: 14px;
  }
  .library-header {
    padding: 16px;
    border-radius: 22px;
  }
  .library-header h1 {
    font-size: clamp(26px, 8vw, 34px);
    line-height: 0.98;
    max-width: none;
  }
  .library-header .subtle {
    font-size: 14px;
  }
  .library-actions {
    grid-template-columns: 1fr;
  }
  .library-toolbar {
    padding: 14px 16px;
    border-radius: 22px;
  }
  .search-wrap input {
    height: 46px;
  }
}

/* ===== Library create-CTA hardening ===== */
.library-toolbar {
  position: relative;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-meta .primary-btn.compact,
.toolbar-meta .secondary-btn.compact {
  white-space: nowrap;
  flex: 0 0 auto;
}

.library-create-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(17,24,39,0.98), rgba(15,23,42,0.96));
  color: #fff;
  box-shadow: 0 20px 40px rgba(15,23,42,0.22), 0 8px 16px rgba(15,23,42,0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.library-create-fab svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.library-create-fab span {
  font-weight: 700;
  letter-spacing: -0.02em;
}

#editorScreen + .library-create-fab,
.editor-screen:not(.hidden) ~ .library-create-fab {
  display: none;
}

@media (min-width: 1181px) {
  .library-create-fab {
    display: none;
  }
}

@media (max-width: 1180px) {
  .library-actions {
    display: none !important;
  }

  .library-header {
    min-height: auto;
    overflow: visible;
  }

  .library-header h1,
  .library-header .subtle {
    display: none;
  }

  .library-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 900px) {
  .toolbar-meta {
    justify-content: flex-start;
  }

  .toolbar-meta .primary-btn.compact,
  .toolbar-meta .secondary-btn.compact {
    min-height: 42px;
  }
}

@media (max-width: 720px) {
  .toolbar-meta {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .toolbar-meta #refreshLibraryBtn,
  .toolbar-meta #libraryStats {
    grid-column: span 1;
  }

  .toolbar-meta #quickCreateBoardBtn,
  .toolbar-meta #importBoardBtnToolbar {
    grid-column: span 1;
  }

  .toolbar-meta #libraryStats {
    align-self: center;
    justify-self: end;
  }

  .library-create-fab {
    padding: 14px 16px;
  }

  .library-create-fab span {
    display: none;
  }
}


/* ===== Parity fix: library hero/tablet regression ===== */
@media (max-width: 1180px) and (min-width: 821px) {
  .library-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border-radius: 24px;
    overflow: visible;
  }

  .library-header > :first-child {
    min-width: 0;
  }

  .library-header .eyebrow,
  .library-header h1,
  .library-header .subtle {
    display: block !important;
  }

  .library-header h1 {
    font-size: clamp(28px, 4.2vw, 40px);
    line-height: 0.96;
    max-width: 12ch;
    margin-bottom: 6px;
  }

  .library-header .subtle {
    font-size: 14px;
    line-height: 1.4;
    max-width: 46ch;
  }

  .library-actions {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .library-actions::-webkit-scrollbar {
    display: none;
  }

  .library-actions > button {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
  }

  .library-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 24px;
  }

  .toolbar-meta {
    flex-wrap: nowrap;
    justify-content: flex-end;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .toolbar-meta::-webkit-scrollbar {
    display: none;
  }

  .toolbar-meta > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .library-create-fab {
    display: none !important;
  }
}

@media (max-width: 820px) {
  .library-header .eyebrow,
  .library-header h1,
  .library-header .subtle {
    display: block !important;
  }
}

/* ===== Final cross-device polish pass ===== */

@media (hover: hover) and (pointer: fine) {
  .board-card,
  .surface-card,
  .library-header,
  .library-toolbar,
  .canvas-wrap,
  .tool-pills-shell,
  .topbar {
    transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease, background 180ms ease;
  }

  .board-card:hover,
  .surface-card:hover {
    box-shadow: 0 20px 44px rgba(15,23,42,0.10), 0 8px 18px rgba(15,23,42,0.05);
    border-color: rgba(15,23,42,0.09);
  }
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(37,99,235,0.18);
  outline-offset: 2px;
}

.tool-pills,
.topbar-right,
.library-actions,
.toolbar-meta,
.mobile-tools-scroller {
  scrollbar-width: none;
}

.tool-pills::-webkit-scrollbar,
.topbar-right::-webkit-scrollbar,
.library-actions::-webkit-scrollbar,
.toolbar-meta::-webkit-scrollbar,
.mobile-tools-scroller::-webkit-scrollbar {
  display: none;
}

/* Desktop polish */
@media (min-width: 1281px) {
  .library-screen {
    padding: 28px;
    gap: 20px;
  }

  .library-header,
  .library-toolbar {
    padding: 24px 26px;
    border-radius: 30px;
  }

  .library-header h1 {
    font-size: clamp(36px, 4.1vw, 58px);
    line-height: 0.94;
    max-width: 12ch;
  }

  .library-header .subtle {
    font-size: 16px;
    line-height: 1.5;
    max-width: 62ch;
  }

  .board-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
  }

  .board-card {
    padding: 16px;
    border-radius: 26px;
  }

  .topbar {
    margin: 16px 16px 0;
    padding: 12px 16px;
    gap: 14px;
    border-radius: 24px;
  }

  .tool-pills-shell {
    padding: 6px;
    border-radius: 18px;
    background: rgba(255,255,255,0.72);
  }

  .tool-pills {
    gap: 10px;
    padding: 2px;
  }

  .workspace {
    grid-template-columns: 288px minmax(0, 1fr) 330px;
    gap: 16px;
    padding: 16px;
  }

  .left-panel,
  .right-panel {
    padding: 20px;
    border-radius: 26px;
  }

  .canvas-wrap {
    border-radius: 30px;
  }

  .zoom-hud {
    left: 20px;
    bottom: 20px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .minimap {
    right: 20px;
    bottom: 20px;
  }
}

/* iPad / tablet polish */
@media (min-width: 821px) and (max-width: 1280px) {
  .library-screen {
    padding: 18px;
    gap: 16px;
  }

  .library-header,
  .library-toolbar {
    padding: 18px 20px;
    border-radius: 26px;
  }

  .library-header h1 {
    font-size: clamp(30px, 4vw, 42px);
    line-height: 0.95;
    letter-spacing: -0.045em;
  }

  .library-header .subtle {
    font-size: 14px;
    line-height: 1.45;
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  @media (min-width: 1081px) and (max-width: 1280px) {
    .board-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  .board-card {
    padding: 14px;
    border-radius: 24px;
  }

  .topbar {
    margin: 12px 12px 0;
    padding: 10px 12px;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr) auto;
  }

  .board-title-input {
    width: min(300px, 34vw);
    font-size: 18px;
  }

  .tool-pills-shell {
    width: 100%;
    padding: 5px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.62));
  }

  .tool-pills {
    gap: 8px;
    padding: 2px;
  }

  .topbar-right {
    gap: 8px;
    padding-bottom: 2px;
  }

  .topbar-right > * {
    flex: 0 0 auto;
  }

  .workspace {
    grid-template-columns: 246px minmax(0, 1fr) 286px;
    gap: 12px;
    padding: 12px;
  }

  .left-panel,
  .right-panel {
    padding: 16px;
    border-radius: 24px;
  }

  .canvas-wrap {
    border-radius: 28px;
  }

  .zoom-hud {
    bottom: 16px;
    left: 16px;
  }

  .minimap {
    width: 200px;
    height: 128px;
    right: 16px;
    bottom: 16px;
  }
}

/* Mobile polish */
@media (max-width: 820px) {
  html, body {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  }

  .library-screen {
    padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 92px);
    gap: 12px;
  }

  .library-header,
  .library-toolbar {
    padding: 16px;
    border-radius: 24px;
  }

  .library-header {
    gap: 14px;
  }

  .library-header h1 {
    font-size: clamp(26px, 9vw, 34px);
    line-height: 0.96;
    max-width: 11ch;
    margin-bottom: 6px;
  }

  .library-header .subtle {
    font-size: 14px;
    line-height: 1.45;
    max-width: none;
  }

  .library-actions,
  .toolbar-meta {
    width: 100%;
  }

  .library-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .library-actions > *,
  .toolbar-meta > *,
  .board-card-actions > * {
    min-height: 46px;
  }

  .search-wrap input {
    min-height: 52px;
    border-radius: 16px;
    font-size: 18px;
    padding-inline: 16px;
  }

  .board-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 112px);
  }

  .board-card {
    padding: 12px;
    border-radius: 22px;
    gap: 10px;
  }

  .board-thumb-wrap {
    border-radius: 16px;
  }

  .board-title {
    font-size: 17px;
    line-height: 1.08;
  }

  .board-meta {
    font-size: 12.5px;
    line-height: 1.45;
  }

  .board-card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .board-card-actions button {
    width: 100%;
    padding-inline: 8px;
    justify-content: center;
  }

  .topbar {
    box-shadow: 0 10px 26px rgba(15,23,42,0.08);
  }

  .topbar-right {
    gap: 8px;
    padding-bottom: 2px;
  }

  .topbar-right .action-btn,
  .topbar-right .secondary-btn.compact,
  .topbar-right .primary-btn.compact,
  .topbar-right .icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 15px;
  }

  .canvas-wrap {
    border-radius: 24px;
  }

  .left-panel,
  .right-panel,
  .mobile-tools-sheet,
  .mobile-more-sheet {
    border-radius: 28px;
  }

  .mobile-bottom-bar {
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    padding: 8px;
    border-radius: 26px;
  }

  .mobile-nav-btn {
    min-height: 60px;
    border-radius: 18px;
    font-size: 11px;
  }

  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .zoom-hud {
    left: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  }

  .floating-editor {
    border-radius: 16px;
    padding: 14px;
  }
}

/* Reduce motion polish */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== v9 mobile focus safe-area integrity fix ===== */
@media (max-width: 820px) {
  body.focus-mode .editor-screen,
  body.present-mode .editor-screen {
    min-height: 100dvh;
    height: 100dvh;
    overflow: clip;
  }

  body.focus-mode .canvas-shell,
  body.focus-mode .canvas-wrap,
  body.present-mode .canvas-shell,
  body.present-mode .canvas-wrap {
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  body.focus-mode .focus-chrome,
  body.present-mode .focus-chrome {
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: auto;
    justify-content: center;
    z-index: 86;
    pointer-events: none;
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    padding-inline: 12px;
  }

  body.focus-mode .focus-chrome-pill,
  body.present-mode .focus-chrome-pill {
    max-width: min(calc(100vw - 24px), 720px);
    pointer-events: auto;
  }

  body.focus-mode .zoom-hud,
  body.present-mode .zoom-hud {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    max-width: calc(100vw - 24px);
    padding: 8px 10px;
    border-radius: 18px;
    z-index: 84;
  }

  body.focus-mode .zoom-hud #zoomLabel,
  body.present-mode .zoom-hud #zoomLabel {
    min-width: 54px;
    text-align: center;
  }

  body.focus-mode .mobile-bottom-bar,
  body.focus-mode .mobile-tools-sheet,
  body.focus-mode .mobile-more-sheet,
  body.focus-mode .mobile-ui-backdrop,
  body.present-mode .mobile-bottom-bar,
  body.present-mode .mobile-tools-sheet,
  body.present-mode .mobile-more-sheet,
  body.present-mode .mobile-ui-backdrop {
    display: none !important;
    box-shadow: none !important;
  }

  body.focus-mode .utility-overlay:not(.hidden),
  body.present-mode .utility-overlay:not(.hidden) {
    display: flex !important;
    z-index: 110;
    align-items: flex-end;
    justify-content: center;
    padding: 14px;
  }

  body.focus-mode .utility-sheet:not(.hidden),
  body.present-mode .utility-sheet:not(.hidden) {
    display: block !important;
    width: min(100%, 560px);
    max-height: 72vh;
    z-index: 111;
    box-shadow: 0 30px 80px rgba(15,23,42,0.22), inset 0 1px 0 rgba(255,255,255,0.8) !important;
  }

  body.focus-mode .left-panel,
  body.focus-mode .right-panel,
  body.present-mode .left-panel,
  body.present-mode .right-panel {
    display: none !important;
    box-shadow: none !important;
  }

  body.focus-mode.focus-panels-visible .left-panel,
  body.focus-mode.focus-panels-visible .right-panel {
    display: flex !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}


/* ===== Surgical create-entry cleanup ===== */
/* Keep only one create-board entry on desktop/iPad: the hero/header button. */
#quickCreateBoardBtn {
  display: none !important;
}

/* On mobile, keep only the bottom plus FAB as the create entry. */
@media (max-width: 820px) {
  #createBoardBtn {
    display: none !important;
  }

  .library-create-fab {
    padding-inline: 0;
    width: 56px;
    min-width: 56px;
    height: 56px;
    justify-content: center;
    gap: 0;
    border-radius: 999px;
  }

  .library-create-fab span {
    display: none !important;
  }
}


/* Surgical brand + create-entry cleanup */
.library-header {
  padding: 18px 20px;
  gap: 18px;
  border-radius: 24px;
  align-items: center;
}
.library-header > div:first-child {
  min-width: 0;
}
.library-header .eyebrow {
  display: none !important;
}
.library-header h1 {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-transform: lowercase;
}
.library-header .subtle {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  max-width: none;
}
.library-actions {
  gap: 10px;
  align-items: center;
}
#createBoardBtn.create-plus-btn,
#libraryCreateFab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
}
#createBoardBtn.create-plus-btn svg,
#libraryCreateFab svg {
  width: 18px;
  height: 18px;
}
#libraryCreateFab {
  font-size: 0;
}
#libraryCreateFab span {
  display: none !important;
}
#quickCreateBoardBtn {
  display: none !important;
}
@media (max-width: 900px) {
  .library-header {
    padding: 16px 16px;
    gap: 14px;
  }
  .library-header h1 {
    font-size: clamp(22px, 7vw, 28px);
  }
  .library-header .subtle {
    font-size: 12px;
  }
}
@media (max-width: 700px) {
  #createBoardBtn {
    display: none !important;
  }
}


/* ===== idea board alignment cleanup ===== */
#libraryScreen #importBoardBtn {
  display: none !important;
}

.library-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.library-header > :first-child {
  min-width: 0;
}

.library-actions {
  justify-content: flex-end;
  align-items: center;
}

.toolbar-meta {
  align-items: center;
}

.toolbar-meta .primary-btn.compact,
.toolbar-meta .secondary-btn.compact {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#libraryStats {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  line-height: 1;
}

@media (max-width: 1180px) {
  .library-header {
    padding: 16px 18px;
    gap: 14px;
  }

  .library-header h1 {
    max-width: none;
  }

  .library-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .toolbar-meta {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }
}

@media (max-width: 820px) {
  .library-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .library-header h1 {
    font-size: clamp(26px, 6.6vw, 34px);
    margin-bottom: 4px;
  }

  .library-header .subtle {
    font-size: 13px;
  }

  .library-toolbar {
    gap: 12px;
  }

  .toolbar-meta {
    gap: 8px;
  }
}

@media (max-width: 720px) {
  .library-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .library-actions {
    display: flex !important;
  }

  .toolbar-meta {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  #libraryStats {
    justify-self: auto;
    align-self: center;
  }
}


/* Focus chrome stays centered; no draggable behavior */
.focus-chrome,
.focus-chrome-pill {
  cursor: default !important;
}



/* ===== Real portrait/mobile focus chrome fix ===== */
@media (max-width: 820px) {
  body.focus-mode .focus-chrome,
  body.present-mode .focus-chrome {
    top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
    bottom: auto !important;
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-inline: 12px;
    pointer-events: none;
  }

  body.focus-mode .focus-chrome-pill,
  body.present-mode .focus-chrome-pill {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    align-self: flex-start;
    justify-content: center;
    width: max-content;
    min-width: 0;
    max-width: min(calc(100vw - 24px), 720px);
    height: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    pointer-events: auto;
  }

  body.focus-mode .focus-chrome-pill > *,
  body.present-mode .focus-chrome-pill > * {
    flex: 0 0 auto;
  }

  body.focus-mode .focus-cluster,
  body.present-mode .focus-cluster {
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0;
  }

  body.focus-mode .focus-tools-scroll,
  body.present-mode .focus-tools-scroll {
    max-width: min(100%, calc(100vw - 188px));
  }
}




/* Collaboration layer */
.collab-status-badge {
  display:inline-flex; align-items:center; min-height:24px; padding:0 10px; border-radius:999px;
  border:1px solid rgba(15,23,42,.08); background:rgba(255,255,255,.74); color:#64748b;
  font-size:11px; letter-spacing:.01em; white-space:nowrap;
}
.collab-status-badge[data-tone="live"] { color:#065f46; background:rgba(236,253,245,.95); border-color:rgba(16,185,129,.24); }
.collab-status-badge[data-tone="syncing"] { color:#1d4ed8; background:rgba(239,246,255,.96); border-color:rgba(59,130,246,.22); }
.collab-status-badge[data-tone="warn"] { color:#92400e; background:rgba(255,251,235,.96); border-color:rgba(245,158,11,.24); }
.collab-status-badge[data-tone="error"] { color:#991b1b; background:rgba(254,242,242,.96); border-color:rgba(239,68,68,.22); }
.collab-settings-card {
  display:flex; flex-direction:column; gap:16px; padding:20px; border-radius:22px;
  border:1px solid rgba(15,23,42,.08); background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
  box-shadow:0 14px 34px rgba(15,23,42,.07);
}
.collab-settings-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.collab-settings-head h3 { margin:2px 0 0; font-size:24px; letter-spacing:-.03em; }
.collab-toggle-row { min-width:132px; padding:12px 14px; }
.collab-status-line { margin:0; line-height:1.5; }
.collab-simple-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(280px,.85fr); gap:16px; align-items:start; }
.collab-share-panel, .collab-side-card {
  display:flex; flex-direction:column; gap:14px; padding:18px; border-radius:18px;
  border:1px solid rgba(15,23,42,.08); background:rgba(255,255,255,.82);
}
.collab-share-panel h4 { margin:4px 0 0; font-size:21px; letter-spacing:-.03em; color:#0f172a; }
.collab-share-copy { margin:0; }
.collab-passcode-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:end; }
.collab-grid input[type="text"],
.collab-share-panel input[type="text"] { min-height:46px; }
.collab-actions-row { display:flex; flex-wrap:wrap; gap:10px; }
.collab-advanced { border:1px solid rgba(15,23,42,.08); border-radius:18px; background:rgba(248,250,252,.75); }
.collab-advanced summary { cursor:pointer; list-style:none; padding:16px 18px; font-weight:600; color:#0f172a; }
.collab-advanced summary::-webkit-details-marker { display:none; }
.collab-advanced > *:not(summary) { padding:0 18px 18px; }
.collab-presence-list { display:flex; flex-direction:column; gap:8px; min-height:100%; }
.collab-presence-empty { padding:12px 14px; border-radius:14px; background:rgba(255,255,255,.66); border:1px solid rgba(15,23,42,.08); color:#64748b; font-size:13px; }
.collab-presence-item {
  display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 14px; border-radius:14px;
  border:1px solid rgba(15,23,42,.08); background:rgba(255,255,255,.72);
}
.collab-presence-id { display:flex; align-items:center; gap:10px; min-width:0; }
.collab-presence-dot { width:12px; height:12px; border-radius:999px; flex:0 0 auto; box-shadow:0 0 0 3px rgba(255,255,255,.75); }
.collab-presence-copy { display:flex; flex-direction:column; min-width:0; }
.collab-presence-copy strong { font-size:13px; color:#0f172a; }
.collab-presence-copy span { font-size:12px; color:#64748b; }
.join-overlay {
  position:fixed; inset:0; z-index:95; display:flex; align-items:center; justify-content:center;
  background:rgba(11,18,32,.34); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  padding:20px;
}
.join-card {
  width:min(420px, calc(100vw - 32px)); display:flex; flex-direction:column; gap:14px; padding:22px;
  border-radius:24px; background:rgba(255,255,255,.98); border:1px solid rgba(255,255,255,.72);
  box-shadow:0 30px 80px rgba(15,23,42,.28);
}
.join-card h2 { margin:2px 0 0; font-size:28px; letter-spacing:-.04em; color:#0f172a; }
.join-actions { display:flex; gap:10px; flex-wrap:wrap; }
.presence-layer { position:absolute; inset:0; z-index:12; pointer-events:none; }
.presence-cursor { position:absolute; transform:translate(-4px, -4px); display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.presence-cursor-dot { width:12px; height:12px; border-radius:999px; border:2px solid rgba(255,255,255,.96); box-shadow:0 8px 18px rgba(15,23,42,.18); }
.presence-cursor-label {
  padding:5px 8px; border-radius:999px; background:rgba(15,23,42,.86); color:#fff; font-size:11px;
  line-height:1; letter-spacing:.01em; white-space:nowrap; box-shadow:0 10px 24px rgba(15,23,42,.18);
}
@media (max-width: 980px) {
  .collab-settings-head { flex-direction:column; }
  .collab-toggle-row { width:100%; }
  .collab-simple-grid { grid-template-columns:1fr; }
  .collab-passcode-row { grid-template-columns:1fr; }
  .collab-actions-row { display:grid; grid-template-columns:1fr; }
}



.more-shapes-btn.active,
#mobileMoreShapesOpenBtn.active {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  border-color: rgba(15,23,42,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 18px rgba(15,23,42,0.18);
}

.shape-sheet-body {
  gap: 18px;
}

.shape-sheet-copy {
  margin: 0;
}

.shape-library-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shape-library-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shape-library-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  color: #0f172a;
}

.shape-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.shape-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 110px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(15,23,42,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,248,251,0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 10px 24px rgba(15,23,42,0.05);
  color: #0f172a;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.shape-card:hover,
.shape-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(15,23,42,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 16px 30px rgba(15,23,42,0.09);
}

.shape-card.active {
  border-color: rgba(37,99,235,0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 16px 30px rgba(37,99,235,0.10);
}

.shape-card svg {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.shape-card span {
  font-size: 13px;
  line-height: 1.25;
  font-weight: 600;
  color: #344054;
}

@media (max-width: 820px) {
  .shape-library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shape-card {
    min-height: 98px;
    padding: 12px;
    border-radius: 18px;
  }

  .shape-card svg {
    width: 28px;
    height: 28px;
  }

  .shape-card span {
    font-size: 12px;
  }
}


@media (max-width: 1120px) {
  .focus-tools-scroll {
    max-width: min(50vw, calc(100vw - 260px));
  }
}

@media (max-width: 640px) {
  .focus-tools-scroll {
    max-width: calc(100vw - 164px);
  }
}

/* ===== V72.3.6 focus chrome collapse + adaptive zoom HUD ===== */
.focus-chrome-pill {
  transition: padding 180ms ease, border-radius 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease, opacity 280ms ease, filter 280ms ease;
}

.focus-compact-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  border-color: rgba(15,23,42,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 10px 18px rgba(15,23,42,0.18);
}
.focus-compact-toggle::before {
  display: none !important;
}
.focus-compact-toggle svg {
  width: 20px;
  height: 20px;
}

body.focus-mode.focus-chrome-collapsed .focus-compact-toggle,
body.present-mode.focus-chrome-collapsed .focus-compact-toggle {
  display: inline-flex;
}

body.focus-mode.focus-chrome-collapsed .focus-chrome-pill,
body.present-mode.focus-chrome-collapsed .focus-chrome-pill {
  padding: 8px;
  gap: 0;
  border-radius: 18px;
  max-width: none;
  overflow: visible;
}

body.focus-mode.focus-chrome-collapsed .focus-chrome-pill > :not(.focus-compact-toggle),
body.present-mode.focus-chrome-collapsed .focus-chrome-pill > :not(.focus-compact-toggle) {
  display: none !important;
}

body.focus-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill,
body.present-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill {
  opacity: 0.34;
  background: rgba(255,255,255,0.58);
  box-shadow: 0 10px 24px rgba(15,23,42,0.10), inset 0 1px 0 rgba(255,255,255,0.60);
  filter: saturate(0.92);
}

body.focus-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill:hover,
body.present-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill:hover,
body.focus-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill:focus-within,
body.present-mode.focus-chrome-collapsed.focus-chrome-collapsed-dim .focus-chrome-pill:focus-within {
  opacity: 0.92;
  filter: none;
}

body.focus-mode.focus-zoom-auto-hidden .zoom-hud,
body.present-mode.focus-zoom-auto-hidden .zoom-hud {
  display: none !important;
}

@media (max-width: 820px) {
  body.focus-mode.focus-chrome-collapsed .focus-chrome-pill,
  body.present-mode.focus-chrome-collapsed .focus-chrome-pill {
    max-width: none !important;
    padding: 8px !important;
  }
}


/* ===== v72.3.7 iPad landscape focus spacing + viewport integrity ===== */
.focus-chrome {
  top: var(--focus-chrome-top, max(16px, env(safe-area-inset-top, 0px) + 10px));
  padding-top: 0;
}

body.focus-mode .focus-chrome,
body.present-mode .focus-chrome {
  top: var(--focus-chrome-top, max(16px, env(safe-area-inset-top, 0px) + 10px));
}

@media (min-width: 821px) and (max-width: 1366px) {
  .topbar {
    margin-top: 8px;
  }

  body.focus-mode .editor-screen,
  body.present-mode .editor-screen {
    min-height: 100dvh;
    height: 100dvh;
    overflow: clip;
  }

  body.focus-mode .canvas-shell,
  body.focus-mode .canvas-wrap,
  body.present-mode .canvas-shell,
  body.present-mode .canvas-wrap {
    min-height: 100dvh;
    height: 100dvh;
  }

  body.focus-mode .minimap,
  body.present-mode .minimap {
    right: max(14px, env(safe-area-inset-right, 0px) + 14px);
    bottom: max(14px, env(safe-area-inset-bottom, 0px) + 14px);
  }

  body.focus-mode .zoom-hud,
  body.present-mode .zoom-hud {
    left: max(14px, env(safe-area-inset-left, 0px) + 14px);
    bottom: max(14px, env(safe-area-inset-bottom, 0px) + 14px);
  }
}


.publish-settings-card { margin-top: 16px; }
.publish-settings-card input[type="text"] { min-height: 46px; }
#publishStatusLine[data-tone="error"] { color: #b42318; }
#publishStatusLine[data-tone="live"] { color: #166534; }
#publishStatusLine[data-tone="syncing"] { color: #1d4ed8; }
body.read-only-mode .left-panel,
body.read-only-mode .right-panel,
body.read-only-mode #openSettingsBtn,
body.read-only-mode #topbarSettingsBtn,
body.read-only-mode #topbarCollaborateBtn,
body.read-only-mode #undoBtn,
body.read-only-mode #redoBtn,
body.read-only-mode #importImageBtn,
body.read-only-mode #exportBtn,
body.read-only-mode .mobile-bottom-bar,
body.read-only-mode #objectContextMenu,
body.read-only-mode #floatingEditor,
body.read-only-mode #pluginTopbarMount,
body.read-only-mode #focusSettingsBtn,
body.read-only-mode #focusCollaborateBtn,
body.read-only-mode #focusImportImageBtn,
body.read-only-mode #focusMoreShapesBtn,
body.read-only-mode #focusPanelsBtn,
body.read-only-mode .focus-tool-btn,
body.read-only-mode #focusTextBar { display: none !important; }
body.read-only-mode .topbar-center { display:none; }
body.read-only-mode .board-title-input { pointer-events:none; color:#334155; }
body.read-only-mode .save-state { display:none !important; }
body.read-only-mode .workspace {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
  padding: 14px !important;
}
body.read-only-mode .canvas-shell,
body.read-only-mode .canvas-wrap {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}
body.read-only-mode .canvas-shell {
  min-height: calc(100dvh - 110px) !important;
}
body.read-only-mode .canvas-wrap {
  min-height: calc(100dvh - 118px) !important;
}
body.read-only-mode .zoom-hud {
  left: 18px !important;
  right: auto !important;
  bottom: 18px !important;
}
body.read-only-mode.focus-panels-visible {
  --unused: 0;
}
body.read-only-mode.focus-panels-visible .left-panel,
body.read-only-mode.focus-panels-visible .right-panel {
  display: none !important;
}
@media (min-width: 821px) {
  body.read-only-mode .topbar {
    grid-template-columns: minmax(220px, 1fr) auto !important;
  }
  body.read-only-mode .topbar-right {
    justify-content: flex-end;
  }
}
@media (max-width: 820px) {
  body.read-only-mode .workspace {
    padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px) !important;
  }
  body.read-only-mode .canvas-shell {
    min-height: calc(100dvh - 84px) !important;
  }
  body.read-only-mode .canvas-wrap {
    min-height: calc(100dvh - 92px) !important;
    border-radius: 24px;
  }
  body.read-only-mode .zoom-hud {
    left: 10px !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px) !important;
  }
}


/* Built-in shape kit library */
.shape-sheet-body {
  gap: 18px;
}

.shape-sheet-copy {
  margin: 0;
}

.shape-catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(15,23,42,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,248,251,0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 10px 24px rgba(15,23,42,0.05);
}

.shape-search-input {
  flex: 1 1 280px;
  min-width: 220px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.96);
  color: #0f172a;
  padding: 12px 14px;
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.94);
}

.shape-search-input:focus {
  outline: none;
  border-color: rgba(37,99,235,0.28);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}

.shape-catalog-meta {
  white-space: nowrap;
  font-weight: 600;
}

.builtin-shape-kit-host {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.shape-section-count {
  font-size: 12px;
  font-weight: 700;
}

.builtin-shape-kit-section .shape-library-head {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.shape-kit-card svg {
  width: 44px;
  height: 44px;
}

.shape-library-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shape-library-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shape-library-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  color: #0f172a;
}

.shape-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.shape-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 110px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(15,23,42,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,248,251,0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 10px 24px rgba(15,23,42,0.05);
  color: #0f172a;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.shape-card:hover,
.shape-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(15,23,42,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 16px 30px rgba(15,23,42,0.09);
}

.shape-card.active {
  border-color: rgba(37,99,235,0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 16px 30px rgba(37,99,235,0.08);
}

.shape-card svg {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: #334155;
}

.shape-card span {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}


/* Attachment objects and previews */
.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 10px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}
.attachment-preview-card {
  width: min(1280px, calc(100vw - 20px));
  height: calc(100dvh - 20px);
  max-height: none;
  margin: 0 auto;
  border-radius: 28px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.attachment-preview-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.attachment-preview-header > div { min-width: 0; }
.attachment-preview-header h2 {
  margin: 2px 0 0;
  font-size: clamp(22px, 2.1vw, 28px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: min(100%, 980px);
}
.attachment-preview-header .eyebrow {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
}
.attachment-preview-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.attachment-preview-meta span {
  display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px;
  background: rgba(248,250,252,0.86); border: 1px solid rgba(203,213,225,0.78); color: #475569; font-size: 11.5px; font-weight: 750;
}
.attachment-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 23px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,250,252,0.98));
  border: 1px solid rgba(203,213,225,0.78);
  padding: 16px;
}
.attachment-preview-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 14px/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #0f172a;
}
.attachment-preview-image, .attachment-preview-frame, .attachment-preview-media {
  width: 100%;
  max-width: 100%;
  border-radius: 19px;
  border: 1px solid rgba(203,213,225,0.68);
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}
.attachment-preview-image {
  max-height: calc(100dvh - 168px);
  object-fit: contain;
}
.attachment-preview-frame {
  min-height: calc(100dvh - 178px);
}
.attachment-preview-media {
  display: block;
  max-height: calc(100dvh - 178px);
}
.attachment-preview-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 44px;
}
.attachment-preview-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  margin: -1px;
  padding: 0;
  border: 0;
}
.attachment-preview-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: nowrap; }
.attachment-action-btn {
  min-width: 108px;
  min-height: 42px;
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.attachment-preview-empty, .attachment-preview-fallback {
  display: flex; align-items: center; justify-content: center; min-height: 220px; color: #475569;
}
.attachment-preview-fallback { gap: 18px; justify-content: flex-start; align-items: flex-start; }
.attachment-preview-fallback-copy { min-width: 0; flex: 1 1 auto; }
.attachment-preview-fallback-copy h3,
.attachment-preview-archive-copy h3 {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.attachment-preview-fallback-copy p,
.attachment-preview-archive-copy p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.attachment-preview-fallback-badge {
  min-width: 80px; height: 80px; border-radius: 21px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF2FF 100%); color: #334155; border: 1px solid #CBD5E1; font-size: 21px; font-weight: 800;
}
@media (max-width: 980px) {
  .attachment-preview-overlay { padding: 0; align-items: stretch; }
  .attachment-preview-card {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
    padding: max(12px, env(safe-area-inset-top, 0px)) 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
    gap: 10px;
  }
  .attachment-preview-header { gap: 10px; }
  .attachment-preview-header h2 { font-size: 21px; line-height: 1.05; }
  .attachment-preview-meta { margin-top: 7px; gap: 6px; }
  .attachment-preview-meta span { padding: 5px 8px; font-size: 11px; }
  .attachment-preview-body { border-radius: 22px; padding: 14px; }
  .attachment-preview-text { font-size: 13.5px; line-height: 1.55; }
  .attachment-preview-frame { min-height: calc(100dvh - 166px); }
  .attachment-preview-frame,
  .attachment-preview-media,
  .attachment-preview-image { max-height: calc(100dvh - 166px); }
  .attachment-preview-footer { min-height: 42px; }
  .attachment-preview-actions { width: 100%; justify-content: flex-start; }
  .attachment-action-btn { min-width: 0; min-height: 42px; padding: 9px 16px; }
}
@media (max-width: 520px) {
  .attachment-preview-card { padding-left: 12px; padding-right: 12px; }
  .attachment-preview-header h2 { font-size: 20px; }
  .attachment-preview-body { padding: 12px; }
  .attachment-preview-actions { gap: 8px; }
  .attachment-action-btn { flex: 0 0 auto; border-radius: 13px; padding: 9px 15px; }
}


/* ===== Desktop collapsible + resizable side columns ===== */
:root {
  --workspace-left-width: 276px;
  --workspace-right-width: 318px;
  --workspace-left-handle: 18px;
  --workspace-right-handle: 18px;
}

.panel-collapse-btn,
.panel-peek-toggle,
.panel-resize-handle {
  display: none;
}

@media (min-width: 981px) {
  body:not(.present-mode):not(.focus-mode) .workspace {
    grid-template-columns:
      var(--workspace-left-track, var(--workspace-left-width))
      var(--workspace-left-handle, 12px)
      minmax(0, 1fr)
      var(--workspace-right-handle, 12px)
      var(--workspace-right-track, var(--workspace-right-width));
    align-items: stretch;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) {
    --workspace-left-track: 0px;
    --workspace-left-handle: 18px;
  }

  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) {
    --workspace-right-track: 0px;
    --workspace-right-handle: 18px;
  }

  body:not(.present-mode):not(.focus-mode) .left-panel,
  body:not(.present-mode):not(.focus-mode) .right-panel {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel,
  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    padding: 0;
    border-width: 0;
    box-shadow: none;
  }

  .panel-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 11px;
    border: 1px solid rgba(15,23,42,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.88));
    color: #475467;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, color 160ms ease, box-shadow 160ms ease;
    box-shadow: 0 4px 12px rgba(15,23,42,0.04);
  }

  .panel-collapse-btn:hover,
  .panel-collapse-btn:focus-visible {
    outline: none;
    color: #111827;
    border-color: rgba(15,23,42,0.12);
    background: linear-gradient(180deg, rgba(255,255,255,1), rgba(248,250,252,0.94));
    box-shadow: 0 8px 18px rgba(15,23,42,0.08);
  }

  .panel-collapse-btn svg {
    width: 16px;
    height: 16px;
    display: block;
  }

  .panel-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    gap: 5px;
    width: 18px;
    min-width: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
    position: relative;
    isolation: isolate;
  }

  .panel-resize-handle::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 84px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(148,163,184,0.10), rgba(100,116,139,0.18), rgba(148,163,184,0.10));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.52);
    transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
  }

  .panel-resize-grip {
    position: absolute;
    left: 7px;
    top: 50%;
    width: 4px;
    height: 84px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: transparent;
    opacity: 0;
    pointer-events: none;
  }

  .panel-edge-toggle-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,250,252,0.90));
    color: #667085;
    box-shadow: 0 8px 18px rgba(15,23,42,0.08);
    transition: color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease, opacity 160ms ease;
    z-index: 1;
    pointer-events: none;
  }

  .panel-edge-toggle-icon svg {
    width: 11px;
    height: 11px;
    display: block;
  }

  .left-panel-handle {
    justify-self: center;
  }

  .right-panel-handle {
    justify-self: center;
  }

  .left-panel-handle .panel-edge-toggle-icon {
    margin-left: 8px;
  }

  .right-panel-handle .panel-edge-toggle-icon {
    margin-right: 8px;
  }

  .panel-resize-handle:hover::before,
  .panel-resize-handle:focus-visible::before,
  body.panel-resizing .panel-resize-handle.is-active::before {
    background: linear-gradient(180deg, rgba(96,165,250,0.18), rgba(59,130,246,0.34), rgba(96,165,250,0.18));
    transform: translateY(-50%) scaleX(1.15);
  }

  .panel-resize-handle:hover .panel-edge-toggle-icon,
  .panel-resize-handle:focus-visible .panel-edge-toggle-icon,
  body.panel-resizing .panel-resize-handle.is-active .panel-edge-toggle-icon {
    color: #0f172a;
    border-color: rgba(15,23,42,0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
    box-shadow: 0 10px 22px rgba(15,23,42,0.12);
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel-handle,
  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel-handle {
    display: flex;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel-handle::before,
  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel-handle::before {
    opacity: 0;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel-handle .panel-edge-toggle-icon,
  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel-handle .panel-edge-toggle-icon {
    opacity: 0.98;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel-handle .panel-edge-toggle-icon {
    transform: translateX(1px);
  }

  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel-handle .panel-edge-toggle-icon {
    transform: translateX(-1px);
  }

  .panel-peek-toggle {
    display: none !important;
  }

  body.left-panel-collapsed:not(.present-mode):not(.focus-mode) .left-panel-handle .panel-edge-toggle-icon svg,
  body.right-panel-collapsed:not(.present-mode):not(.focus-mode) .right-panel-handle .panel-edge-toggle-icon svg {
    transform: rotate(180deg);
  }
  body.panel-resizing,
  body.panel-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
  }
}

@media (max-width: 980px) {
  .panel-collapse-btn,
  .panel-peek-toggle,
  .panel-resize-handle {
    display: none !important;
  }
}

body.present-mode .panel-collapse-btn,
body.present-mode .panel-peek-toggle,
body.present-mode .panel-resize-handle,
body.read-only-mode .panel-collapse-btn,
body.read-only-mode .panel-peek-toggle,
body.read-only-mode .panel-resize-handle {
  display: none !important;
}

body.focus-mode .panel-collapse-btn,
body.focus-mode .panel-peek-toggle {
  display: none !important;
}

@media (min-width: 981px) {
  body.focus-mode.focus-panels-visible .panel-resize-handle {
    display: flex !important;
    position: fixed;
    top: max(74px, env(safe-area-inset-top, 0px) + 68px);
    bottom: 18px;
    width: 18px;
    min-width: 18px;
    z-index: 86;
    align-self: auto;
  }

  body.focus-mode.focus-panels-visible .left-panel-handle {
    left: calc(18px + min(var(--workspace-left-track, var(--workspace-left-width)), calc(100vw - 140px)) - 9px);
  }

  body.focus-mode.focus-panels-visible .right-panel-handle {
    right: calc(18px + min(var(--workspace-right-track, var(--workspace-right-width)), calc(100vw - 140px)) - 9px);
  }

  body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel-handle {
    left: 9px;
  }

  body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel-handle {
    right: 9px;
  }

  body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel-handle::before,
  body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel-handle::before {
    opacity: 0;
  }

  body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel-handle .panel-edge-toggle-icon,
  body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel-handle .panel-edge-toggle-icon {
    opacity: 0.98;
  }

  body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel-handle .panel-edge-toggle-icon {
    transform: translateX(1px);
  }

  body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel-handle .panel-edge-toggle-icon {
    transform: translateX(-1px);
  }

  body.focus-mode.focus-panels-visible.left-panel-collapsed .left-panel-handle .panel-edge-toggle-icon svg,
  body.focus-mode.focus-panels-visible.right-panel-collapsed .right-panel-handle .panel-edge-toggle-icon svg {
    transform: rotate(180deg);
  }
}


/* ===== v5 compact focus panels for mobile + iPad portrait ===== */
.focus-compact-panels-bar {
  display: none;
}

@media (max-width: 980px) {
  body.focus-mode .focus-compact-panels-bar {
    position: fixed;
    top: calc(var(--focus-chrome-top, max(16px, env(safe-area-inset-top, 0px) + 10px)) + 62px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 88;
    width: min(calc(100vw - 24px), 420px);
  }

  body.focus-mode.focus-compact-panels-open .focus-compact-panels-bar {
    display: flex;
    justify-content: center;
  }

  .focus-compact-panels-pill {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 18px 40px rgba(15,23,42,0.14), 0 6px 18px rgba(15,23,42,0.08);
    backdrop-filter: blur(22px);
  }

  .focus-compact-segmented {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(15,23,42,0.04);
  }

  .focus-compact-segment,
  .focus-compact-close {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    color: #475467;
  }

  .focus-compact-segment {
    min-height: 38px;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 620;
    letter-spacing: -0.01em;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
  }

  .focus-compact-segment.active {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(15,23,42,0.18), inset 0 1px 0 rgba(255,255,255,0.14);
  }

  .focus-compact-close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15,23,42,0.08);
    background: rgba(248,250,252,0.92);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  }

  .focus-compact-close svg {
    width: 17px;
    height: 17px;
    display: block;
  }

  .focus-compact-close:hover,
  .focus-compact-close:focus-visible,
  .focus-compact-segment:hover,
  .focus-compact-segment:focus-visible {
    outline: none;
    color: #111827;
  }

  body.focus-mode.focus-compact-panels-open .left-panel,
  body.focus-mode.focus-compact-panels-open .right-panel {
    top: calc(var(--focus-chrome-top, max(16px, env(safe-area-inset-top, 0px) + 10px)) + 122px) !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    width: auto !important;
    max-height: none !important;
    border-radius: 28px !important;
    box-shadow: 0 30px 72px rgba(15,23,42,0.18), 0 10px 24px rgba(15,23,42,0.08) !important;
  }

  body.focus-mode.focus-compact-panels-open.mobile-left-open .left-panel,
  body.focus-mode.focus-compact-panels-open.mobile-right-open .right-panel {
    display: flex !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.focus-mode.focus-compact-panels-open.mobile-left-open .right-panel,
  body.focus-mode.focus-compact-panels-open.mobile-right-open .left-panel {
    display: none !important;
  }
}


.attachment-preview-archive {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
}
.attachment-preview-archive-top {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.attachment-preview-archive-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.attachment-preview-archive-list-wrap {
  border-radius: 22px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  background: rgba(255,255,255,0.92);
  overflow: hidden;
}
.attachment-preview-archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.attachment-preview-archive-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-top: 1px solid rgba(226,232,240,0.92);
}
.attachment-preview-archive-list li:first-child { border-top: 0; }
.attachment-archive-entry-name {
  min-width: 0;
  color: #0f172a;
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.attachment-archive-entry-meta {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.attachment-preview-archive-note {
  margin: 0;
}
@media (max-width: 980px) {
  .attachment-preview-archive-top,
  .attachment-preview-fallback {
    flex-direction: column;
  }
  .attachment-preview-archive-list li {
    grid-template-columns: 1fr;
  }
  .attachment-archive-entry-meta {
    white-space: normal;
  }
}


body.splash-locked {
  overflow: hidden;
}

body.splash-locked #app {
  opacity: 0;
  pointer-events: none;
  filter: blur(18px) saturate(0.9);
  transform: scale(1.012);
}

body.splash-unlocking #app {
  transition: opacity 440ms ease, filter 440ms ease, transform 440ms ease;
  opacity: 1;
  filter: blur(0) saturate(1);
  transform: scale(1);
}

.starter-splash {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 14% 16%, rgba(99, 102, 241, 0.22), transparent 24%),
    radial-gradient(circle at 86% 18%, rgba(34, 197, 94, 0.18), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(14, 165, 233, 0.18), transparent 26%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 46%, #e2e8f0 100%);
  transition: opacity 420ms ease, visibility 420ms ease;
}

body.splash-unlocked .starter-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.starter-splash-backdrop,
.starter-splash-card {
  position: relative;
}

.starter-splash-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.starter-grid {
  position: absolute;
  inset: -12%;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.88), transparent 76%);
  animation: starterGridDrift 18s linear infinite;
}

.starter-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.9;
  animation: starterFloat 12s ease-in-out infinite;
}

.starter-orb.orb-a {
  width: 280px;
  height: 280px;
  left: 6%;
  top: 10%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.94), rgba(99, 102, 241, 0.26) 54%, rgba(99, 102, 241, 0));
}

.starter-orb.orb-b {
  width: 240px;
  height: 240px;
  right: 10%;
  top: 18%;
  animation-delay: -4s;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(14, 165, 233, 0.22) 54%, rgba(14, 165, 233, 0));
}

.starter-orb.orb-c {
  width: 220px;
  height: 220px;
  left: 50%;
  bottom: 4%;
  animation-delay: -7s;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(34, 197, 94, 0.20) 56%, rgba(34, 197, 94, 0));
}

.starter-splash-card {
  width: min(100%, 520px);
  padding: clamp(24px, 4vw, 34px);
  border-radius: 32px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255,255,255,0.7);
  backdrop-filter: blur(24px) saturate(1.15);
}

.starter-brand-lockup {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.starter-brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #0f172a;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(226,232,240,0.88));
  border: 1px solid rgba(148,163,184,0.28);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.starter-overline {
  margin: 0 0 6px;
  font-size: 0.76rem;
  line-height: 1.1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #64748b;
}

.starter-splash-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.starter-copy {
  margin: 10px 0 0;
  max-width: 34ch;
  color: #475569;
  font-size: 1rem;
  line-height: 1.5;
}

.starter-splash-form {
  display: grid;
  gap: 12px;
}

.starter-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}

.starter-input {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.32);
  background: rgba(255,255,255,0.92);
  padding: 0 18px;
  font-size: 1.2rem;
  letter-spacing: 0.28em;
  text-align: center;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.starter-input:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.55);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.14);
}

.starter-digit-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.starter-digit-track span {
  height: 6px;
  border-radius: 999px;
  background: rgba(148,163,184,0.28);
  transition: transform 160ms ease, background-color 160ms ease, opacity 160ms ease;
}

.starter-digit-track span.is-filled {
  background: linear-gradient(90deg, #4f46e5, #0ea5e9);
  transform: scaleY(1.15);
}

.starter-hint {
  margin: 0;
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.45;
}

.starter-error {
  min-height: 1.2em;
  margin: -2px 0 0;
  color: #b91c1c;
  font-size: 0.88rem;
  line-height: 1.3;
}

.starter-submit-btn {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.starter-submit-btn.is-busy {
  opacity: 0.8;
}

body.starter-shake .starter-splash-card {
  animation: starterShake 360ms ease;
}

@keyframes starterFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -18px, 0) scale(1.04); }
}

@keyframes starterGridDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(32px, 24px, 0); }
}

@keyframes starterShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-8px); }
  44% { transform: translateX(7px); }
  66% { transform: translateX(-5px); }
  88% { transform: translateX(4px); }
}

@media (max-width: 640px) {
  .starter-splash {
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .starter-splash-card {
    border-radius: 28px;
    padding: 22px 18px 18px;
  }

  .starter-brand-lockup {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .starter-brand-mark {
    width: 54px;
    height: 54px;
  }

  .starter-splash-card h1 {
    font-size: clamp(1.9rem, 10vw, 2.4rem);
  }

  .starter-copy {
    font-size: 0.96rem;
  }
}


/* Native Notes Surface plugin */
.board-card.note-card .board-thumb-wrap {
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}
.board-card.note-card .board-card-body::before {
  content: 'NOTE';
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.06);
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.library-create-fab.is-expanded {
  transform: translateY(-2px) scale(1.01);
}
.library-create-fab.is-expanded svg {
  transform: rotate(45deg);
}
#notesCreateDial {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.98);
  transition: opacity .18s ease, transform .22s cubic-bezier(.22,.8,.2,1);
}
#notesCreateDial.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
#notesCreateDial .notes-create-option {
  min-width: 148px;
  min-height: 44px;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  color: #0f172a;
  box-shadow: 0 18px 40px rgba(15,23,42,0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
#notesCreateDial .notes-create-option[data-kind="note"] {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
#notesCreateDial .notes-create-option:active { transform: scale(.98); }

body.note-board-mode .canvas-wrap,
body.note-board-mode .board-svg {
  background: #ffffff !important;
}
body.note-board-mode .canvas-wrap.grid-on {
  background-image: none !important;
}
body.note-board-mode .zoom-hud {
  opacity: .82;
}
body.note-board-mode #boardTitleInput {
  font-size: clamp(18px, 1.7vw, 22px);
  font-weight: 600;
  letter-spacing: -.02em;
}
body.note-board-mode #saveState,
body.note-board-mode #collabStatusBadge {
  opacity: .78;
}
body.note-board-mode .floating-editor.note-body-editor {
  resize: none;
  border: none;
  box-shadow: none;
  background: rgba(255,255,255,0.995);
  border-radius: 0;
  color: #0f172a;
  padding: 0;
  line-height: 1.58;
  letter-spacing: -0.01em;
  overflow: auto;
  caret-color: #0f172a;
}
body.note-board-mode .floating-editor.note-body-editor:focus {
  outline: none;
  box-shadow: none;
}
body.note-board-mode .focus-textbar {
  z-index: 80;
}
@media (max-width: 768px) {
  #notesCreateDial {
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
  #notesCreateDial .notes-create-option {
    min-width: 134px;
    min-height: 42px;
    border-radius: 14px;
    font-size: 14px;
  }
  body.note-board-mode #boardTitleInput {
    font-size: 18px;
  }
}

/* Native Notes Surface hardening: keep the latest note plugin acting like a true freeform note surface, not a normal tiny text object. */
body.note-board-mode .floating-editor.note-body-editor {
  min-width: min(2400px, 300vw);
  min-height: min(1800px, 300vh);
  white-space: pre-wrap;
  tab-size: 4;
}
.focus-text-size-input {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  opacity: 1 !important;
  font-variant-numeric: tabular-nums;
}
.focus-text-size-stepper,
.focus-text-size-step,
.focus-text-size-input {
  flex-shrink: 0;
}


/* V73 surgical input/presentation/mobile gesture hardening. */
html, body, .app-shell, .editor-screen, .canvas-shell, .canvas-wrap {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body.present-mode #presentOverlay.active {
  pointer-events: none;
}
body.present-mode #presentOverlay .present-top,
body.present-mode #presentOverlay button {
  pointer-events: auto;
}
body.note-board-mode .floating-editor.note-body-editor {
  white-space: pre-wrap !important;
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-user-select: text;
  user-select: text;
  touch-action: pan-x pan-y;
}
body.note-board-mode .focus-textbar.note-caret-following {
  transition: left 180ms cubic-bezier(.22,.61,.36,1), top 180ms cubic-bezier(.22,.61,.36,1), opacity 140ms ease;
}

/* V74 hardening: newline-safe notes editor, no browser zoom, reliable note-surface gestures, and non-overlapping text toolbar. */
html,
body {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.splash-unlocked #starterSplash,
body:not(.splash-locked) #starterSplash {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.note-board-mode .floating-editor.note-body-editor {
  white-space: pre-wrap !important;
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-user-select: text;
  user-select: text;
  touch-action: none !important;
  -webkit-overflow-scrolling: touch;
  line-height: 1.58 !important;
  resize: none !important;
}

body.note-board-mode .board-svg,
body.present-mode .board-svg,
body.note-board-mode .canvas-wrap,
body.present-mode .canvas-wrap {
  touch-action: none !important;
  overscroll-behavior: none !important;
}

body.present-mode #presentOverlay.active {
  pointer-events: none !important;
}
body.present-mode #presentOverlay .present-top,
body.present-mode #presentOverlay button {
  pointer-events: auto !important;
}

.focus-textbar {
  max-width: calc(100vw - 20px);
  box-sizing: border-box;
}
.focus-textbar-pill {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: max-content;
  max-width: min(760px, calc(100vw - 20px));
  box-sizing: border-box;
  overflow: visible !important;
}
.focus-textbar-cluster {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-width: 0;
}
.focus-textbar-leading {
  flex: 1 1 360px;
  flex-wrap: wrap !important;
  justify-content: center;
}
.focus-textbar-trailing,
.focus-text-align-row-mini {
  flex: 0 0 auto;
}
#focusTypeFamilySelect {
  width: min(180px, 42vw);
  min-width: 140px;
  max-width: 180px;
}
.focus-text-weight {
  width: 104px;
  min-width: 96px !important;
  max-width: 112px;
}
.focus-text-size-stepper {
  flex: 0 0 auto !important;
  min-width: 118px;
  justify-content: center;
}
.focus-text-size-input {
  width: 48px !important;
  min-width: 48px !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}
.focus-text-color-wrap,
.focus-text-menu-toggle,
.focus-text-align-btn {
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .focus-textbar-pill {
    max-width: calc(100vw - 14px);
    padding: 8px !important;
    gap: 7px !important;
  }
  .focus-textbar-leading {
    flex-basis: 100%;
  }
  .focus-textbar-typemark {
    display: none !important;
  }
  #focusTypeFamilySelect {
    width: min(170px, 48vw);
    min-width: 130px;
  }
  .focus-text-weight {
    width: 98px;
    min-width: 92px !important;
  }
  .focus-text-size-stepper {
    min-width: 112px;
  }
}

/* V75 correction: restore the notes font bar to one single horizontal row.
   This intentionally overrides the V74 wrapping rules. */
.focus-textbar {
  max-width: calc(100vw - 16px) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}
.focus-textbar-pill {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  width: auto !important;
  max-width: min(760px, calc(100vw - 16px)) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  overscroll-behavior-x: contain !important;
}
.focus-textbar-pill::-webkit-scrollbar { display: none !important; }
.focus-textbar-cluster,
.focus-textbar-leading,
.focus-textbar-trailing,
.focus-text-align-row-mini {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
  white-space: nowrap !important;
}
#focusTypeFamilySelect {
  flex: 0 0 auto !important;
  width: 168px !important;
  min-width: 136px !important;
  max-width: 176px !important;
}
.focus-text-weight {
  flex: 0 0 auto !important;
  width: 104px !important;
  min-width: 92px !important;
  max-width: 110px !important;
}
.focus-text-size-stepper {
  flex: 0 0 auto !important;
  min-width: 112px !important;
  justify-content: center !important;
}
.focus-text-size-input {
  width: 46px !important;
  min-width: 46px !important;
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}
.focus-text-color-wrap,
.focus-text-menu-toggle,
.focus-text-align-btn {
  flex: 0 0 auto !important;
}
@media (max-width: 560px) {
  .focus-textbar { max-width: calc(100vw - 12px) !important; }
  .focus-textbar-pill {
    max-width: calc(100vw - 12px) !important;
    padding: 7px 8px !important;
    gap: 6px !important;
    border-radius: 19px !important;
  }
  .focus-textbar-cluster,
  .focus-textbar-leading,
  .focus-textbar-trailing,
  .focus-text-align-row-mini { gap: 6px !important; }
  .focus-textbar-typemark { display: none !important; }
  #focusTypeFamilySelect {
    width: 132px !important;
    min-width: 124px !important;
    max-width: 136px !important;
    height: 34px !important;
    padding-inline: 10px !important;
  }
  .focus-text-weight {
    width: 86px !important;
    min-width: 82px !important;
    max-width: 92px !important;
    height: 34px !important;
    padding-inline: 9px !important;
  }
  .focus-text-size-stepper {
    min-width: 98px !important;
    height: 34px !important;
    padding-inline: 6px !important;
    gap: 5px !important;
  }
  .focus-text-size-step {
    width: 24px !important;
    height: 24px !important;
    border-radius: 8px !important;
  }
  .focus-text-size-input {
    width: 38px !important;
    min-width: 38px !important;
    height: 28px !important;
  }
  .focus-text-align-btn,
  .focus-text-color-wrap,
  .focus-text-menu-toggle {
    width: 34px !important;
    height: 34px !important;
    border-radius: 11px !important;
  }
}


/* V76 notes newline visibility fix: after Enter, keep the new line visible instead of leaving the textarea horizontally scrolled from tap-anywhere padding. */
body.note-board-mode .floating-editor.note-body-editor {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}


/* V78 notes zoom-coordinate fix: tap-anywhere note text must remain visible at every zoom level.
   Keep notes as a non-wrapping surface so leading-space positioning is stable and not reflowed by scale. */
body.note-board-mode .floating-editor.note-body-editor {
  white-space: pre !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-width: none !important;
}
body.note-board-mode .floating-editor.note-body-editor::-webkit-scrollbar {
  display: none !important;
}

/* V79: keep Notes/Board create dial anchored to the active create button on desktop/iPad landscape. */
#createBoardBtn.create-plus-btn.is-expanded,
#quickCreateBoardBtn.is-expanded {
  transform: translateY(-1px) scale(1.01);
}
#createBoardBtn.create-plus-btn.is-expanded svg {
  transform: rotate(45deg);
}


/* V88 attachment/import picker recovery: keep native file inputs browser-clickable while visually invisible. */
.native-file-input {
  position: fixed !important;
  left: -10000px !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0.01 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

/* V89: notes editor must be world-locked. Internal textarea scrolling was the
   root cause of typed text drifting/vanishing after pinch zoom. Board pan/zoom
   now owns movement; the editor is only a coordinate overlay. */
body.note-board-mode .floating-editor.note-body-editor {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  background: rgba(255,255,255,0.985) !important;
  transform-origin: 0 0 !important;
}
body.note-board-mode .floating-editor.note-body-editor::-webkit-scrollbar {
  display: none !important;
}


/* V91: note fragments are the real note typing surface. Keep the editor and SVG
   renderer using the same whitespace contract, and keep the font bar visible. */
body.note-board-mode .floating-editor.note-fragment-editor {
  white-space: pre !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  overflow: hidden !important;
  resize: none !important;
  background: rgba(255,255,255,0.985) !important;
  caret-color: #0f172a;
  -webkit-user-select: text;
  user-select: text;
  touch-action: none !important;
  z-index: 84 !important;
}
body.note-board-mode .floating-editor.note-fragment-editor:focus {
  outline: none !important;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.08), 0 18px 42px rgba(15,23,42,0.14) !important;
}
body.note-board-mode .focus-textbar {
  z-index: 93 !important;
  display: block;
}
body.note-board-mode .focus-textbar.hidden {
  display: none !important;
}


/* V92: board text-box tool now uses the same freeform typing contract as note fragments. */
.floating-editor.free-text-editor {
  white-space: pre !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  overflow: hidden !important;
  resize: none !important;
  background: rgba(255,255,255,0.985) !important;
  caret-color: #0f172a;
  -webkit-user-select: text;
  user-select: text;
}
.floating-editor.free-text-editor:focus {
  outline: none !important;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.08), 0 18px 42px rgba(15,23,42,0.14) !important;
}

/* V107 Workspace Handshake visibility + persistence */
.handshake-auto-sync-row {
  margin: 12px 0 10px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.72);
}
.handshake-saved-list {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}
.handshake-saved-empty,
.handshake-record-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}
.handshake-saved-empty {
  color: var(--muted);
  font-size: 0.86rem;
}
.handshake-record-card {
  display: grid;
  gap: 4px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.handshake-record-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.26);
  background: rgba(255, 255, 255, 0.94);
}
.handshake-record-card strong {
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.handshake-record-card span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* V108.1 Settings branding + modern typography polish */
#settingsSheet.utility-sheet {
  width: min(940px, calc(100vw - 48px));
}
#settingsSheet .utility-sheet-header {
  align-items: center;
  margin-bottom: 18px;
}
#settingsSheet .utility-sheet-header h2 {
  font-size: clamp(25px, 2.4vw, 34px);
  line-height: 1.04;
  font-weight: 520;
  letter-spacing: -0.055em;
}
#settingsSheet .utility-sheet-body {
  gap: 16px;
}
#settingsSheet .eyebrow {
  margin-bottom: 7px;
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 520;
  letter-spacing: 0.145em;
  color: rgba(71, 85, 105, 0.78);
}
#settingsSheet .field-row,
#settingsSheet .settings-toggle {
  font-size: 13px;
  font-weight: 430;
  letter-spacing: -0.006em;
  color: rgba(15, 23, 42, 0.78);
}
#settingsSheet .field-row > span,
#settingsSheet .settings-toggle > span,
#settingsSheet .toggle-row > span {
  font-weight: 470;
  color: rgba(15, 23, 42, 0.76);
}
#settingsSheet input[type="text"],
#settingsSheet input[type="number"],
#settingsSheet select {
  min-height: 46px;
  border-radius: 14px;
  border-color: rgba(15, 23, 42, 0.075);
  background: rgba(255, 255, 255, 0.86);
  font-weight: 420;
  letter-spacing: -0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
#settingsSheet .toggle-row,
#settingsSheet .settings-toggle {
  min-height: 50px;
  padding: 13px 15px;
  border-radius: 16px;
  border-color: rgba(15, 23, 42, 0.07);
  background: rgba(255, 255, 255, 0.72);
}
#settingsSheet .collab-settings-card {
  gap: 15px;
  padding: 22px;
  border-radius: 26px;
  border-color: rgba(15, 23, 42, 0.065);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.82));
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.055);
}
#settingsSheet .collab-settings-head {
  align-items: center;
  gap: 18px;
}
#settingsSheet .collab-settings-head h3 {
  margin: 0;
  font-size: clamp(20px, 2vw, 25px);
  line-height: 1.12;
  font-weight: 520;
  letter-spacing: -0.045em;
  color: rgba(15, 23, 42, 0.94);
}
#settingsSheet .collab-status-line,
#settingsSheet .collab-share-copy,
#settingsSheet .subtle {
  font-size: 13px;
  line-height: 1.55;
  font-weight: 410;
  letter-spacing: -0.006em;
  color: rgba(100, 116, 139, 0.92);
}
#settingsSheet .collab-actions-row {
  gap: 9px;
  align-items: center;
}
#settingsSheet button.compact {
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 13px;
  font-size: 12.5px;
  font-weight: 470;
  letter-spacing: -0.008em;
}
#settingsSheet .primary-btn.compact {
  font-weight: 500;
}
#settingsSheet .handshake-saved-list {
  gap: 9px;
  margin: 4px 0 8px;
}
#settingsSheet .handshake-saved-empty,
#settingsSheet .handshake-record-card {
  border-radius: 18px;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.70);
  padding: 13px 15px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}
#settingsSheet .handshake-record-card strong {
  font-size: 0.88rem;
  font-weight: 520;
  letter-spacing: -0.018em;
}
#settingsSheet .handshake-record-card span {
  font-size: 0.76rem;
  font-weight: 405;
  color: rgba(100, 116, 139, 0.92);
}
@media (max-width: 720px) {
  #settingsSheet.utility-sheet { width: calc(100vw - 22px); }
  #settingsSheet .collab-settings-card { padding: 18px; border-radius: 22px; }
  #settingsSheet .collab-settings-head { align-items: flex-start; }
}

/* ===== V109.5 iPad Portrait Library Grid Optimization =====
   Goal: iPad portrait should not behave like a stretched phone feed.
   This override intentionally targets tablet portrait CSS viewports that can
   report around 768px wide, while keeping phones single-column. */
@media (min-width: 740px) and (max-width: 900px) and (min-height: 900px) {
  .library-screen {
    padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
    gap: 14px;
  }

  .library-header,
  .library-toolbar {
    border-radius: 24px;
  }

  .library-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
  }

  .library-header h1 {
    font-size: clamp(32px, 5vw, 44px);
    max-width: none;
    margin-bottom: 6px;
  }

  .library-header .subtle {
    font-size: 14px;
    line-height: 1.35;
  }

  .library-actions {
    width: auto;
    display: flex !important;
    grid-template-columns: none;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .library-actions > * {
    width: auto;
    min-width: 46px;
  }

  .library-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
  }

  .toolbar-meta {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .toolbar-meta .compact {
    min-height: 44px;
    padding-inline: 14px;
  }

  .search-wrap input {
    min-height: 48px;
    height: 48px;
    font-size: 16px;
    border-radius: 16px;
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 36px);
  }

  .board-card {
    padding: 12px;
    border-radius: 22px;
    gap: 10px;
  }

  .board-thumb-wrap {
    aspect-ratio: 1.42 / 1;
    border-radius: 16px;
  }

  .board-card-body {
    padding: 8px 3px 0;
  }

  .board-title {
    font-size: 16px;
    line-height: 1.08;
    letter-spacing: -0.025em;
  }

  .board-meta {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
  }

  .board-card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .board-card-actions button {
    width: 100%;
    min-height: 40px;
    padding-inline: 6px;
    justify-content: center;
    border-radius: 14px;
    font-size: 14px;
  }

  .library-create-fab {
    right: 18px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }
}

/* V114 — Apple-grade contextual menu polish.
   Goal: remove the heavy “stacked button” look from both object/context menus and
   the focused text overflow menu while preserving every existing action and JS hook. */
.focus-text-menu,
.object-context-menu {
  isolation: isolate;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(248,250,252,0.88)) !important;
  border: 1px solid rgba(15,23,42,0.065) !important;
  box-shadow:
    0 30px 74px rgba(15,23,42,0.18),
    0 12px 28px rgba(15,23,42,0.10),
    inset 0 1px 0 rgba(255,255,255,0.82) !important;
  backdrop-filter: saturate(180%) blur(28px) !important;
  -webkit-backdrop-filter: saturate(180%) blur(28px) !important;
  outline: 1px solid rgba(255,255,255,0.62);
  outline-offset: -2px;
}

.focus-text-menu {
  min-width: 228px !important;
  max-width: min(292px, calc(100vw - 24px)) !important;
  padding: 7px !important;
  border-radius: 24px !important;
}

.object-context-menu {
  min-width: 238px !important;
  max-width: min(304px, calc(100vw - 24px)) !important;
  padding: 7px !important;
  border-radius: 24px !important;
}

.focus-text-menu-item,
.object-context-menu-item {
  position: relative;
  min-height: 39px !important;
  padding: 0 13px !important;
  border: 0 !important;
  border-radius: 13px !important;
  background: transparent !important;
  box-shadow: none !important;
  justify-content: flex-start !important;
  color: rgba(15,23,42,0.94) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, ui-sans-serif, system-ui, sans-serif !important;
  font-size: 13.5px !important;
  font-weight: 520 !important;
  letter-spacing: -0.018em !important;
  line-height: 1 !important;
  transform: none !important;
  transition: background .16s ease, color .16s ease, opacity .16s ease, transform .12s ease !important;
}

.focus-text-menu-item:hover,
.object-context-menu-item:hover {
  background: rgba(15,23,42,0.055) !important;
  box-shadow: none !important;
  transform: none !important;
}

.focus-text-menu-item:active,
.object-context-menu-item:active {
  background: rgba(15,23,42,0.085) !important;
  transform: scale(0.992) !important;
}

.focus-text-menu-item:focus-visible,
.object-context-menu-item:focus-visible {
  outline: 2px solid rgba(37,99,235,0.34) !important;
  outline-offset: 2px !important;
}

.focus-text-menu-item:disabled,
.object-context-menu-item:disabled {
  opacity: 0.32 !important;
  color: rgba(100,116,139,0.78) !important;
  background: transparent !important;
  cursor: default !important;
}

.focus-text-menu-item.danger,
.object-context-menu-item.danger {
  color: #b3261e !important;
  font-weight: 560 !important;
}

.focus-text-menu-item.danger:hover,
.object-context-menu-item.danger:hover {
  background: rgba(179,38,30,0.075) !important;
}

.focus-text-menu-divider,
.object-context-menu-divider {
  height: 1px !important;
  margin: 7px 8px !important;
  background: linear-gradient(90deg, transparent, rgba(15,23,42,0.105), transparent) !important;
}

.object-context-menu::-webkit-scrollbar {
  width: 8px !important;
}

.object-context-menu::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.16) !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
}

@media (max-width: 560px) {
  .focus-text-menu,
  .object-context-menu {
    border-radius: 25px !important;
    padding: 7px !important;
  }
  .focus-text-menu-item,
  .object-context-menu-item {
    min-height: 42px !important;
    padding-inline: 14px !important;
    font-size: 15px !important;
    font-weight: 540 !important;
    letter-spacing: -0.024em !important;
  }
}


/* V122 — animated welcome screen */
body.welcome-active {
  overflow: hidden;
}

.welcome-splash {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(250,252,255,0.96) 0%, rgba(255,255,255,0.985) 100%);
  isolation: isolate;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

body.welcome-entered .welcome-splash {
  opacity: 1;
}

body.welcome-exit .welcome-splash {
  opacity: 0;
  visibility: hidden;
}

.welcome-splash-backdrop,
.welcome-splash-stage {
  grid-area: 1 / 1;
}

.welcome-splash-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.welcome-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.8;
  transform: translateZ(0);
}

.welcome-glow.glow-a {
  width: 34vw;
  height: 34vw;
  min-width: 280px;
  min-height: 280px;
  top: 10%;
  left: -8%;
  background: radial-gradient(circle, rgba(59,130,246,0.16) 0%, rgba(59,130,246,0) 72%);
  animation: welcomeGlowFloatA 7.2s ease-in-out infinite;
}

.welcome-glow.glow-b {
  width: 28vw;
  height: 28vw;
  min-width: 220px;
  min-height: 220px;
  right: -6%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(15,23,42,0.09) 0%, rgba(15,23,42,0) 72%);
  animation: welcomeGlowFloatB 8.4s ease-in-out infinite;
}

.welcome-noise {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: radial-gradient(rgba(15,23,42,0.06) 0.7px, transparent 0.7px);
  background-size: 20px 20px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.38) 56%, rgba(0,0,0,0) 100%);
}

.welcome-splash-stage {
  position: relative;
  z-index: 1;
  padding: 32px;
}

.welcome-logo-lockup {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
}

body.welcome-entered .welcome-logo-lockup {
  animation: welcomeLockupIn 0.9s cubic-bezier(.22,1,.36,1) forwards;
}

body.welcome-exit .welcome-logo-lockup {
  animation: welcomeLockupOut 0.52s cubic-bezier(.4,0,.2,1) forwards;
}

.welcome-logo-mark {
  width: 126px;
  height: 154px;
  display: grid;
  place-items: center;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(247,250,252,0.94) 100%);
  box-shadow: 0 24px 60px rgba(15,23,42,0.12), inset 0 0 0 1px rgba(255,255,255,0.8);
}

.welcome-logo-svg {
  width: 92px;
  height: auto;
  overflow: visible;
}

.welcome-logo-dot,
.welcome-logo-stem {
  fill: #0f172a;
}

.welcome-logo-bowl {
  fill: none;
  stroke: #0f172a;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.welcome-entered .welcome-logo-dot {
  animation: welcomeDotDrop 0.52s cubic-bezier(.34,1.56,.64,1) 0.18s both;
}

body.welcome-entered .welcome-logo-stem {
  transform-origin: center bottom;
  animation: welcomeStemRise 0.56s cubic-bezier(.22,1,.36,1) 0.08s both;
}

body.welcome-entered .welcome-logo-bowl {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: welcomeBowlDraw 0.72s cubic-bezier(.22,1,.36,1) both;
}

body.welcome-entered .welcome-logo-bowl.upper { animation-delay: 0.22s; }
body.welcome-entered .welcome-logo-bowl.lower { animation-delay: 0.3s; }

.welcome-wording {
  display: grid;
  gap: 7px;
}

.welcome-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #64748b;
}

.welcome-wording h1 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(34px, 4vw, 44px);
  line-height: 0.96;
  letter-spacing: -0.08em;
  font-weight: 800;
}

.welcome-tagline {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 530;
}

body.welcome-active #app,
body.welcome-active #starterSplash {
  filter: blur(10px);
  transform: scale(1.01);
  transition: filter 0.6s ease, transform 0.6s ease;
}

body.welcome-exit #app,
body.welcome-exit #starterSplash,
body:not(.welcome-active) #app,
body:not(.welcome-active) #starterSplash {
  filter: none;
  transform: none;
}

@keyframes welcomeLockupIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.965); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeLockupOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(0.985); }
}

@keyframes welcomeDotDrop {
  0% { opacity: 0; transform: translateY(-14px) scale(0.75); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeStemRise {
  0% { opacity: 0; transform: scaleY(0.2); }
  100% { opacity: 1; transform: scaleY(1); }
}

@keyframes welcomeBowlDraw {
  0% { stroke-dashoffset: 220; opacity: 0.25; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes welcomeGlowFloatA {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(4%, -3%, 0) scale(1.04); }
}

@keyframes welcomeGlowFloatB {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(-5%, 4%, 0) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-glow,
  .welcome-logo-lockup,
  .welcome-logo-dot,
  .welcome-logo-stem,
  .welcome-logo-bowl {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 760px) {
  .welcome-splash-stage {
    padding: 24px;
  }
  .welcome-logo-mark {
    width: 112px;
    height: 140px;
    border-radius: 28px;
  }
  .welcome-logo-svg {
    width: 82px;
  }
  .welcome-wording {
    gap: 6px;
  }
  .welcome-tagline {
    font-size: 13px;
  }
  .welcome-glow.glow-a {
    width: 68vw;
    height: 68vw;
    left: -22%;
    top: 4%;
  }
  .welcome-glow.glow-b {
    width: 56vw;
    height: 56vw;
    right: -18%;
    bottom: 10%;
  }
}


/* V123 — iconic welcome refinement. Real repo patch; built on V122/V121, not a minimal rebuild. */
.welcome-v123 {
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,0.96) 0%, rgba(255,255,255,0.9) 34%, rgba(246,248,251,0.96) 66%, rgba(238,243,248,0.98) 100%);
}

.welcome-v123 .welcome-splash-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.15)),
    radial-gradient(circle at 50% 48%, transparent 0 22%, rgba(15,23,42,0.025) 100%);
  pointer-events: none;
}

.welcome-gradient {
  position: absolute;
  border-radius: 50%;
  filter: blur(54px);
  opacity: 0.86;
  transform: translateZ(0);
}

.welcome-gradient.gradient-a {
  width: 420px;
  height: 420px;
  left: max(-120px, -8vw);
  top: 8vh;
  background: radial-gradient(circle, rgba(59,130,246,0.17), rgba(59,130,246,0) 70%);
  animation: welcomeV123DriftA 7.6s ease-in-out infinite;
}

.welcome-gradient.gradient-b {
  width: 360px;
  height: 360px;
  right: max(-110px, -7vw);
  bottom: 7vh;
  background: radial-gradient(circle, rgba(99,102,241,0.12), rgba(15,23,42,0) 72%);
  animation: welcomeV123DriftB 8.8s ease-in-out infinite;
}

.welcome-gridline {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vw, 860px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15,23,42,0.08), transparent);
  transform-origin: center;
  opacity: 0.42;
}

.welcome-gridline.gridline-a { transform: translate(-50%, -50%) rotate(-11deg); }
.welcome-gridline.gridline-b { transform: translate(-50%, -50%) rotate(11deg); }

.welcome-v123 .welcome-logo-mark {
  width: 132px;
  height: 160px;
  border-radius: 38px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,253,0.96)),
    radial-gradient(circle at 40% 18%, rgba(255,255,255,1), transparent 40%);
  box-shadow:
    0 32px 80px rgba(15,23,42,0.15),
    0 8px 22px rgba(15,23,42,0.065),
    inset 0 0 0 1px rgba(255,255,255,0.9);
}

.welcome-v123 .welcome-logo-svg {
  width: 96px;
}

.welcome-v123 .welcome-logo-dot,
.welcome-v123 .welcome-logo-stem {
  fill: url(#ibWelcomeInk);
}

.welcome-v123 .welcome-logo-bowl {
  stroke: url(#ibWelcomeInk);
  stroke-width: 13;
}

.welcome-logo-sheen {
  fill: none;
  stroke: rgba(255,255,255,0.58);
  stroke-width: 3.8;
  stroke-linecap: round;
  opacity: 0;
}

body.welcome-entered .welcome-logo-sheen {
  animation: welcomeSheen 0.68s cubic-bezier(.22,1,.36,1) 0.72s both;
}

.welcome-v123 .welcome-kicker {
  color: #738095;
  letter-spacing: 0.25em;
}

.welcome-v123 .welcome-wording h1 {
  letter-spacing: -0.085em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.85);
}

.welcome-v123 .welcome-tagline {
  color: #66758a;
}

@keyframes welcomeSheen {
  0% { opacity: 0; stroke-dasharray: 40 80; stroke-dashoffset: 52; }
  45% { opacity: 1; }
  100% { opacity: 0; stroke-dasharray: 40 80; stroke-dashoffset: -62; }
}

@keyframes welcomeV123DriftA {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(18px,-12px,0) scale(1.035); }
}

@keyframes welcomeV123DriftB {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(-16px,14px,0) scale(1.04); }
}

@media (max-width: 760px) {
  .welcome-v123 .welcome-logo-mark {
    width: 116px;
    height: 144px;
    border-radius: 32px;
  }

  .welcome-v123 .welcome-logo-svg {
    width: 84px;
  }

  .welcome-gridline {
    width: 92vw;
  }

  .welcome-gradient.gradient-a {
    width: 72vw;
    height: 72vw;
    left: -28vw;
    top: 8vh;
  }

  .welcome-gradient.gradient-b {
    width: 62vw;
    height: 62vw;
    right: -25vw;
    bottom: 9vh;
  }
}


/* V124 — logo geometry rebuild: optically balanced iB mark */
.welcome-v124 {
  background:
    radial-gradient(circle at 50% 36%, rgba(255,255,255,0.97) 0%, rgba(255,255,255,0.93) 32%, rgba(246,248,252,0.97) 66%, rgba(240,244,249,0.99) 100%);
}

.welcome-v124 .welcome-splash-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.76), rgba(255,255,255,0.12)),
    radial-gradient(circle at 50% 44%, transparent 0 20%, rgba(15,23,42,0.03) 100%);
  pointer-events: none;
}

.welcome-v124 .welcome-logo-mark {
  width: 132px;
  height: 160px;
  border-radius: 38px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.985), rgba(248,250,253,0.965)),
    radial-gradient(circle at 38% 16%, rgba(255,255,255,1), transparent 42%);
  box-shadow:
    0 30px 76px rgba(15,23,42,0.13),
    0 9px 22px rgba(15,23,42,0.055),
    inset 0 0 0 1px rgba(255,255,255,0.9);
}

.welcome-v124 .welcome-logo-svg {
  width: 92px;
}

.welcome-v124 .welcome-logo-dot,
.welcome-v124 .welcome-logo-stem {
  fill: url(#ibWelcomeInkV124);
}

.welcome-v124 .welcome-logo-dot {
  transform-origin: center;
}

.welcome-v124 .welcome-logo-stem {
  transform-origin: center bottom;
}

.welcome-v124 .welcome-logo-bowl {
  stroke: url(#ibWelcomeInkV124);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome-v124 .welcome-wording h1 {
  letter-spacing: -0.082em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.84);
}

.welcome-v124 .welcome-kicker {
  color: #738095;
  letter-spacing: 0.24em;
}

.welcome-v124 .welcome-tagline {
  color: #68778d;
}

body.welcome-entered .welcome-v124 .welcome-logo-dot {
  animation: welcomeDotDropV124 0.48s cubic-bezier(.34,1.56,.64,1) 0.16s both;
}

body.welcome-entered .welcome-v124 .welcome-logo-stem {
  animation: welcomeStemRiseV124 0.52s cubic-bezier(.22,1,.36,1) 0.05s both;
}

body.welcome-entered .welcome-v124 .welcome-logo-bowl {
  stroke-dasharray: 190;
  stroke-dashoffset: 190;
  animation: welcomeBowlDrawV124 0.68s cubic-bezier(.22,1,.36,1) both;
}

body.welcome-entered .welcome-v124 .welcome-logo-bowl.upper { animation-delay: 0.2s; }
body.welcome-entered .welcome-v124 .welcome-logo-bowl.lower { animation-delay: 0.28s; }

@keyframes welcomeDotDropV124 {
  0% { opacity: 0; transform: translateY(-10px) scale(0.78); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeStemRiseV124 {
  0% { opacity: 0; transform: scaleY(0.18); }
  100% { opacity: 1; transform: scaleY(1); }
}

@keyframes welcomeBowlDrawV124 {
  0% { stroke-dashoffset: 190; opacity: 0.2; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@media (max-width: 760px) {
  .welcome-v124 .welcome-logo-mark {
    width: 116px;
    height: 144px;
    border-radius: 30px;
  }
  .welcome-v124 .welcome-logo-svg {
    width: 82px;
  }
}


/* V125 — surgical logo polish */
.welcome-v125 .welcome-logo-mark {
  width: 124px;
  height: 152px;
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.985), rgba(248,250,253,0.968)),
    radial-gradient(circle at 40% 16%, rgba(255,255,255,0.96), transparent 42%);
  box-shadow:
    0 28px 70px rgba(15,23,42,0.118),
    0 8px 18px rgba(15,23,42,0.048),
    inset 0 0 0 1px rgba(255,255,255,0.9);
}

.welcome-v125 .welcome-logo-svg {
  width: 86px;
}

.welcome-v125 .welcome-logo-dot,
.welcome-v125 .welcome-logo-stem {
  fill: url(#ibWelcomeInkV125);
}

.welcome-v125 .welcome-logo-bowl {
  stroke: url(#ibWelcomeInkV125);
  stroke-width: 10.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome-v125 .welcome-kicker {
  letter-spacing: 0.21em;
  color: #77859a;
}

.welcome-v125 .welcome-wording {
  gap: 8px;
}

.welcome-v125 .welcome-wording h1 {
  font-size: clamp(32px, 3.8vw, 40px);
  font-weight: 760;
  letter-spacing: -0.074em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.88);
}

.welcome-v125 .welcome-tagline {
  color: #6f7d92;
  font-size: 13.5px;
  font-weight: 540;
}

.welcome-v125 .welcome-splash-stage {
  padding-top: 42px;
}

body.welcome-entered .welcome-v125 .welcome-logo-dot {
  animation: welcomeDotDropV125 0.46s cubic-bezier(.34,1.56,.64,1) 0.14s both;
}

body.welcome-entered .welcome-v125 .welcome-logo-stem {
  animation: welcomeStemRiseV125 0.5s cubic-bezier(.22,1,.36,1) 0.05s both;
}

body.welcome-entered .welcome-v125 .welcome-logo-bowl {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  animation: welcomeBowlDrawV125 0.64s cubic-bezier(.22,1,.36,1) both;
}

body.welcome-entered .welcome-v125 .welcome-logo-bowl.upper { animation-delay: 0.18s; }
body.welcome-entered .welcome-v125 .welcome-logo-bowl.lower { animation-delay: 0.26s; }

@keyframes welcomeDotDropV125 {
  0% { opacity: 0; transform: translateY(-9px) scale(0.8); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeStemRiseV125 {
  0% { opacity: 0; transform: scaleY(0.22); }
  100% { opacity: 1; transform: scaleY(1); }
}

@keyframes welcomeBowlDrawV125 {
  0% { stroke-dashoffset: 180; opacity: 0.2; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@media (max-width: 760px) {
  .welcome-v125 .welcome-logo-mark {
    width: 110px;
    height: 136px;
    border-radius: 30px;
  }
  .welcome-v125 .welcome-logo-svg {
    width: 77px;
  }
  .welcome-v125 .welcome-wording h1 {
    font-size: 36px;
  }
  .welcome-v125 .welcome-kicker {
    letter-spacing: 0.19em;
  }
}


/* V126 — wordmark spacing polish */
.welcome-v126 .welcome-wording {
  gap: 9px;
}

.welcome-v126 .welcome-wording h1 {
  font-size: clamp(32px, 3.85vw, 40px);
  font-weight: 735;
  letter-spacing: -0.028em;
  text-rendering: geometricPrecision;
  font-kerning: normal;
  text-shadow: 0 1px 0 rgba(255,255,255,0.88);
}

.welcome-v126 .welcome-kicker {
  letter-spacing: 0.19em;
}

.welcome-v126 .welcome-tagline {
  font-size: 13.5px;
  letter-spacing: -0.008em;
}

.welcome-v126 .welcome-logo-mark {
  width: 124px;
  height: 152px;
}

.welcome-v126 .welcome-logo-svg {
  width: 86px;
}

.welcome-v126 .welcome-logo-dot,
.welcome-v126 .welcome-logo-stem {
  fill: url(#ibWelcomeInkV125);
}

.welcome-v126 .welcome-logo-bowl {
  stroke: url(#ibWelcomeInkV125);
  stroke-width: 10.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .welcome-v126 .welcome-wording h1 {
    font-size: 36px;
    letter-spacing: -0.022em;
  }
  .welcome-v126 .welcome-kicker {
    letter-spacing: 0.17em;
  }
}


/* V127 — final lowercase-i wordmark polish */
.welcome-v127 .welcome-wording h1 {
  font-size: clamp(32px, 3.85vw, 40px);
  font-weight: 735;
  letter-spacing: -0.018em;
  text-rendering: geometricPrecision;
  font-kerning: normal;
}

.welcome-v127 .welcome-kicker {
  letter-spacing: 0.19em;
}

.welcome-v127 .welcome-logo-mark {
  width: 124px;
  height: 152px;
}

.welcome-v127 .welcome-logo-svg {
  width: 86px;
}

.welcome-v127 .welcome-logo-dot,
.welcome-v127 .welcome-logo-stem {
  fill: url(#ibWelcomeInkV125);
}

.welcome-v127 .welcome-logo-bowl {
  stroke: url(#ibWelcomeInkV125);
  stroke-width: 10.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .welcome-v127 .welcome-wording h1 {
    font-size: 36px;
    letter-spacing: -0.014em;
  }
}


/* V133 — presentation-only viewing, library rearrange/select, multi-board deck dots */
.board-card {
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.board-card.is-reorder-mode {
  cursor: grab;
}
.board-card.is-selected {
  box-shadow: 0 20px 48px rgba(37,99,235,.15), inset 0 0 0 2px rgba(37,99,235,.55);
  border-color: rgba(37,99,235,.32);
}
.board-card.is-selected::after {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(37,99,235,.28);
  z-index: 4;
}
.board-card.is-pressing,
.board-card.is-dragging {
  transform: scale(.985);
}
.board-card.is-dragging {
  opacity: .72;
}
.library-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  margin-left: auto;
}
.library-selection-bar.hidden {
  display: none;
}
.library-selection-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.library-selection-copy strong {
  font-size: 13px;
  font-weight: 760;
  letter-spacing: -.01em;
  color: #0f172a;
}
.library-selection-copy span {
  font-size: 12px;
  color: #64748b;
}
.library-selection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.presentation-deck-dots {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 18px 46px rgba(15,23,42,.16);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
}
.presentation-deck-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(15,23,42,.26);
  cursor: pointer;
}
.presentation-deck-dot.is-active {
  width: 22px;
  background: #0f172a;
}
body:not(.present-mode) .presentation-deck-dots {
  display: none;
}
body.present-mode .selection-layer,
body.present-mode .selected-outline,
body.present-mode .handle {
  display: none !important;
}
@media (max-width: 760px) {
  .library-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .library-selection-actions {
    justify-content: stretch;
  }
  .library-selection-actions button {
    flex: 1 1 auto;
  }
  .presentation-deck-dots {
    bottom: max(12px, env(safe-area-inset-bottom, 0px) + 12px);
    gap: 7px;
  }
}


/* V134 — floating board-selection actions + dedicated reorder mode */
.library-selection-bar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(18px, env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  width: min(92vw, 560px);
  max-width: calc(100vw - 28px);
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 18px 54px rgba(15,23,42,.17);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}
.library-selection-bar.hidden {
  display: none !important;
}
.library-selection-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 0 4px 0 8px;
}
.library-selection-copy strong {
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 760;
}
.library-selection-copy span {
  white-space: nowrap;
  font-size: 11.5px;
  color: rgba(71,85,105,.9);
}
.library-selection-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.library-selection-actions .hidden {
  display: none !important;
}
.library-selection-actions button {
  white-space: nowrap;
}
.library-selection-bar.is-drag-mode {
  width: min(92vw, 470px);
  background: rgba(17,24,39,.84);
  border-color: rgba(255,255,255,.14);
  color: #fff;
}
.library-selection-bar.is-drag-mode .library-selection-copy strong,
.library-selection-bar.is-drag-mode .library-selection-copy span {
  color: rgba(255,255,255,.92);
}
.library-selection-bar.is-drag-mode .library-selection-actions .secondary-btn {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.16);
  color: #fff;
}
body.library-drag-reorder-mode .library-screen::before {
  content: 'Drag boards to rearrange';
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top, 0px) + 10px);
  transform: translateX(-50%);
  z-index: 180;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(17,24,39,.78);
  color: #fff;
  font-size: 12px;
  font-weight: 680;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 34px rgba(15,23,42,.18);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.board-card.is-drag-reorder-mode {
  cursor: grab;
}
.board-card.is-drag-reorder-mode .open-board-card {
  cursor: grab;
}
.board-card.is-dragging {
  position: relative;
  z-index: 30;
  opacity: .86;
  transform: translate3d(var(--board-drag-x, 0), var(--board-drag-y, 0), 0) scale(.985) !important;
  box-shadow: 0 26px 70px rgba(15,23,42,.23), inset 0 0 0 2px rgba(37,99,235,.42);
  touch-action: none;
}
.board-card.is-drop-target {
  box-shadow: 0 22px 54px rgba(37,99,235,.18), inset 0 0 0 2px rgba(37,99,235,.58);
  transform: scale(.985);
}
body.library-drag-reorder-mode .board-grid {
  touch-action: pan-y;
}
body.library-drag-reorder-mode .board-card-actions {
  opacity: .25;
  pointer-events: none;
}
@media (max-width: 760px) {
  .library-selection-bar {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(94vw, 420px);
    padding: 8px 9px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px) + 10px);
  }
  .library-selection-copy {
    max-width: 126px;
    padding-left: 6px;
  }
  .library-selection-copy strong {
    font-size: 11.5px;
  }
  .library-selection-copy span {
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .library-selection-actions {
    gap: 6px;
  }
  .library-selection-actions button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    flex: 0 0 auto;
  }
  .library-selection-bar.is-drag-mode {
    width: min(94vw, 360px);
  }
}


/* V135 — file-or-board attachment picker */
.attachment-choice-overlay,.board-attachment-overlay{position:fixed;inset:0;z-index:140;display:grid;place-items:center;padding:max(18px,env(safe-area-inset-top)) 18px max(18px,env(safe-area-inset-bottom));background:rgba(15,23,42,.18);backdrop-filter:blur(12px) saturate(1.08);-webkit-backdrop-filter:blur(12px) saturate(1.08)}
.attachment-choice-overlay.hidden,.board-attachment-overlay.hidden{display:none}.attachment-choice-card,.board-attachment-card{width:min(560px,calc(100vw - 32px));max-height:min(720px,calc(100dvh - 36px));overflow:hidden;border-radius:28px;background:rgba(255,255,255,.96);border:1px solid rgba(15,23,42,.08);box-shadow:0 28px 70px rgba(15,23,42,.18),0 8px 22px rgba(15,23,42,.08)}
.attachment-choice-card{padding:24px;display:grid;gap:18px}.attachment-choice-head h2,.board-attachment-head h2{margin:2px 0 6px;letter-spacing:-.045em}.attachment-choice-actions{display:grid;gap:12px}.attachment-choice-option{width:100%;text-align:left;border:1px solid rgba(15,23,42,.08);background:linear-gradient(180deg,rgba(248,250,252,.98),rgba(255,255,255,.96));border-radius:20px;padding:17px 18px;display:grid;gap:5px;color:#0f172a;box-shadow:0 8px 20px rgba(15,23,42,.05)}.attachment-choice-option strong{font-size:17px;letter-spacing:-.025em}.attachment-choice-option span{color:#64748b;font-size:13px;line-height:1.42}.attachment-choice-option:hover{border-color:rgba(37,99,235,.22);background:#fff}
.board-attachment-card{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto}.board-attachment-head{display:flex;gap:16px;justify-content:space-between;align-items:flex-start;padding:22px 22px 12px}.board-attachment-search{margin:0 22px 14px;width:calc(100% - 44px);height:46px;border-radius:16px;border:1px solid rgba(15,23,42,.08);background:#fff;padding:0 15px;font:inherit;font-size:14px;outline:none}.board-attachment-list{overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 16px 10px;display:grid;gap:10px}.board-attachment-option{width:100%;display:grid;grid-template-columns:82px minmax(0,1fr) 28px;align-items:center;gap:12px;text-align:left;border:1px solid rgba(15,23,42,.08);background:rgba(255,255,255,.96);border-radius:18px;padding:10px;box-shadow:0 6px 16px rgba(15,23,42,.04)}.board-attachment-option.is-selected{border-color:rgba(37,99,235,.35);background:rgba(239,246,255,.92);box-shadow:0 10px 24px rgba(37,99,235,.1)}.board-attachment-thumb{width:82px;height:54px;border-radius:13px;object-fit:cover;background:#f8fafc;border:1px solid #e2e8f0}.board-attachment-copy{min-width:0;display:grid;gap:4px}.board-attachment-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14.5px;color:#0f172a}.board-attachment-copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#64748b}.board-attachment-check{width:24px;height:24px;display:grid;place-items:center;border-radius:999px;color:#2563eb;font-weight:800;background:rgba(37,99,235,.08)}.board-attachment-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 22px 20px;border-top:1px solid rgba(15,23,42,.06)}.board-attachment-empty{padding:26px 16px;text-align:center;color:#64748b;font-weight:560}.board-attachment-preview{display:grid;grid-template-columns:minmax(180px,44%) minmax(0,1fr);gap:18px;align-items:center;padding:8px}.board-attachment-preview img{width:100%;border-radius:20px;border:1px solid #e2e8f0;background:#f8fafc;box-shadow:0 10px 28px rgba(15,23,42,.08)}.board-attachment-preview h3{margin:0 0 8px;letter-spacing:-.035em}.board-attachment-preview p{margin:0;color:#64748b;line-height:1.45}
@media(max-width:640px){.attachment-choice-overlay,.board-attachment-overlay{align-items:end;padding:12px}.attachment-choice-card,.board-attachment-card{width:100%;border-radius:24px;max-height:calc(100dvh - 24px)}.attachment-choice-card{padding:20px}.board-attachment-head{padding:20px 18px 10px}.board-attachment-search{margin:0 18px 12px;width:calc(100% - 36px)}.board-attachment-list{padding:0 12px 10px}.board-attachment-option{grid-template-columns:74px minmax(0,1fr) 26px}.board-attachment-thumb{width:74px;height:50px}.board-attachment-footer{padding:12px 18px 18px}.board-attachment-preview{grid-template-columns:1fr}}


/* V136: make library board drag/drop real on mobile touch surfaces. */
body.library-drag-reorder-mode,
body.library-drag-reorder-mode .library-screen,
body.library-drag-reorder-mode .board-grid,
body.library-drag-reorder-mode .board-card,
body.library-drag-reorder-mode .open-board-card {
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
}

body.library-drag-reorder-mode .board-card.is-drag-reorder-mode {
  will-change: transform;
}

body.library-drag-reorder-mode .board-card.is-dragging {
  pointer-events: auto;
}


/* V137 — single subtle bottom-center reorder indicator only */
body.library-drag-reorder-mode .library-screen::before {
  content: none !important;
  display: none !important;
}

body.library-drag-reorder-mode .library-selection-bar,
.library-selection-bar.is-drag-mode {
  width: min(88vw, 440px);
  max-width: calc(100vw - 34px);
  padding: 9px 10px 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(15,23,42,0.07);
  color: #0f172a;
  box-shadow: 0 16px 44px rgba(15,23,42,0.13), inset 0 1px 0 rgba(255,255,255,0.78);
  backdrop-filter: blur(22px) saturate(1.16);
  -webkit-backdrop-filter: blur(22px) saturate(1.16);
}

body.library-drag-reorder-mode .library-selection-copy,
.library-selection-bar.is-drag-mode .library-selection-copy {
  padding-left: 4px;
}

body.library-drag-reorder-mode .library-selection-copy strong,
.library-selection-bar.is-drag-mode .library-selection-copy strong {
  color: rgba(15,23,42,0.88);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

body.library-drag-reorder-mode .library-selection-copy span,
.library-selection-bar.is-drag-mode .library-selection-copy span {
  color: rgba(71,85,105,0.76);
  font-size: 11px;
  font-weight: 560;
}

body.library-drag-reorder-mode .library-selection-actions button,
.library-selection-bar.is-drag-mode .library-selection-actions button {
  background: rgba(255,255,255,0.48);
  border-color: rgba(15,23,42,0.08);
  color: rgba(15,23,42,0.82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.68);
}

body.library-drag-reorder-mode .library-selection-actions button:hover,
.library-selection-bar.is-drag-mode .library-selection-actions button:hover {
  background: rgba(255,255,255,0.64);
}

body.library-drag-reorder-mode .library-selection-actions button:active,
.library-selection-bar.is-drag-mode .library-selection-actions button:active {
  background: rgba(226,232,240,0.62);
}

@media (max-width: 760px) {
  body.library-drag-reorder-mode .library-selection-bar,
  .library-selection-bar.is-drag-mode {
    width: min(90vw, 350px);
    padding: 8px 9px 8px 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px) + 12px);
  }

  body.library-drag-reorder-mode .library-selection-copy,
  .library-selection-bar.is-drag-mode .library-selection-copy {
    max-width: 165px;
  }
}


/* V138 — visible Done button + two-finger scroll in board reorder mode */
.library-selection-bar.is-drag-mode,
body.library-drag-reorder-mode .library-selection-bar {
  display: flex !important;
  justify-content: space-between;
}

.library-selection-bar.is-drag-mode .library-selection-actions,
body.library-drag-reorder-mode .library-selection-actions {
  margin-left: auto;
  display: inline-flex !important;
  flex: 0 0 auto;
}

.library-selection-bar.is-drag-mode .library-selection-actions [data-library-action="clear"],
body.library-drag-reorder-mode .library-selection-actions [data-library-action="clear"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(15,23,42,0.12);
  color: rgba(15,23,42,0.9);
  font-weight: 680;
  opacity: 1;
  visibility: visible;
}

.library-selection-bar.is-drag-mode .library-selection-actions [data-library-action="export"],
.library-selection-bar.is-drag-mode .library-selection-actions [data-library-action="present"],
body.library-drag-reorder-mode .library-selection-actions [data-library-action="export"],
body.library-drag-reorder-mode .library-selection-actions [data-library-action="present"] {
  display: none !important;
}

body.library-drag-reorder-mode,
body.library-drag-reorder-mode .library-screen,
body.library-drag-reorder-mode .board-grid,
body.library-drag-reorder-mode .board-card,
body.library-drag-reorder-mode .open-board-card {
  touch-action: pan-y pinch-zoom !important;
}

body.library-drag-reorder-mode .board-card.is-dragging,
body.library-drag-reorder-mode .board-card.is-dragging .open-board-card {
  touch-action: none !important;
}

@media (max-width: 760px) {
  .library-selection-bar.is-drag-mode,
  body.library-drag-reorder-mode .library-selection-bar {
    width: min(92vw, 380px);
    gap: 10px;
  }

  .library-selection-bar.is-drag-mode .library-selection-copy,
  body.library-drag-reorder-mode .library-selection-copy {
    max-width: 190px;
  }

  .library-selection-bar.is-drag-mode .library-selection-actions [data-library-action="clear"],
  body.library-drag-reorder-mode .library-selection-actions [data-library-action="clear"] {
    min-width: 64px;
    height: 34px;
    padding: 0 14px;
  }
}


/* V139 — remove two-finger scrolling; drag/reorder mode locks touch again */
body.library-drag-reorder-mode,
body.library-drag-reorder-mode .library-screen,
body.library-drag-reorder-mode .board-grid,
body.library-drag-reorder-mode .board-card,
body.library-drag-reorder-mode .open-board-card {
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
}

body.library-drag-reorder-mode .library-selection-bar,
.library-selection-bar.is-drag-mode {
  touch-action: manipulation !important;
}


/* V141 — HTML5 keynote export control in multi-board presentation */
.presentation-deck-controls {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(94vw, 980px);
  pointer-events: auto;
}
.presentation-deck-controls .presentation-deck-dots {
  position: static !important;
  transform: none !important;
  bottom: auto !important;
  left: auto !important;
}
.presentation-deck-export-btn {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  min-width: 58px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.44);
  color: rgba(255,255,255,.92);
  font-size: 11.5px;
  font-weight: 760;
  letter-spacing: .04em;
  box-shadow: 0 14px 38px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  cursor: pointer;
  touch-action: manipulation;
}
.presentation-deck-export-btn:active { transform: scale(.97); }
@media (max-width: 760px) {
  .presentation-deck-controls { gap: 7px; bottom: max(12px, env(safe-area-inset-bottom, 0px) + 10px); }
  .presentation-deck-export-btn { height: 30px; min-width: 48px; padding: 0 10px; font-size: 10.5px; }
}


/* V143 — make multi-board HTML export button visible after direct upload patch */
.presentation-deck-controls {
  position: fixed !important;
  left: 50% !important;
  bottom: max(14px, env(safe-area-inset-bottom, 0px) + 12px) !important;
  transform: translateX(-50%) !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  max-width: min(94vw, 980px) !important;
  pointer-events: auto !important;
}

.presentation-deck-controls .presentation-deck-dots {
  position: static !important;
  transform: none !important;
  bottom: auto !important;
  left: auto !important;
}

.presentation-deck-export-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  min-width: 92px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.48);
  color: rgba(255,255,255,.96);
  font-size: 11.5px;
  font-weight: 760;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 14px 38px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  cursor: pointer;
  touch-action: manipulation;
}

.presentation-deck-export-btn:active {
  transform: scale(.97);
}

@media (max-width: 760px) {
  .presentation-deck-controls {
    gap: 7px !important;
    bottom: max(12px, env(safe-area-inset-bottom, 0px) + 10px) !important;
    max-width: calc(100vw - 18px) !important;
  }

  .presentation-deck-export-btn {
    height: 31px;
    min-width: 78px;
    padding: 0 10px;
    font-size: 10.5px;
  }
}


/* ===== V179.19: restore visible create action + keep sync non-invasive ===== */
@media (max-width: 820px) {
  .library-toolbar {
    overflow: visible !important;
  }

  .toolbar-meta {
    display: grid !important;
    grid-template-columns: 46px minmax(82px, 1fr) minmax(92px, 1fr) auto !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }

  #quickCreateBoardBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 46px !important;
    width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    border-radius: 16px !important;
    font-size: 0 !important;
    line-height: 1 !important;
    flex: 0 0 46px !important;
  }

  #quickCreateBoardBtn::before {
    content: "+" !important;
    display: block !important;
    font-size: 30px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    transform: translateY(-1px);
  }

  #importBoardBtnToolbar,
  #refreshLibraryBtn {
    min-width: 0 !important;
    width: 100% !important;
    padding-inline: 12px !important;
    white-space: nowrap !important;
  }

  .toolbar-meta #libraryStats {
    justify-self: end !important;
    white-space: nowrap !important;
    font-size: 13px !important;
  }

  .search-wrap {
    min-width: 0 !important;
  }
}

@media (max-width: 420px) {
  .toolbar-meta {
    grid-template-columns: 46px minmax(74px, 1fr) minmax(82px, 1fr) auto !important;
  }

  #importBoardBtnToolbar,
  #refreshLibraryBtn {
    font-size: 14px !important;
  }

  .toolbar-meta #libraryStats {
    font-size: 12px !important;
  }
}

.saas-bridge-pill {
  display: none !important;
}

#saasBridgeDot {
  -webkit-tap-highlight-color: transparent;
}



/* ===== V179.21 UI / typography / settings polish ===== */
.library-header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.library-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.library-logo-mark {
  width: clamp(54px, 6vw, 76px);
  height: clamp(54px, 6vw, 76px);
  border-radius: 22px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(245,247,251,.78));
  border: 1px solid rgba(15,23,42,.075);
  box-shadow: 0 18px 44px rgba(15,23,42,.075), inset 0 1px 0 rgba(255,255,255,.88);
  overflow: hidden;
  flex: 0 0 auto;
  animation: libraryLogoFloatInV17921 .7s cubic-bezier(.2,.8,.2,1) both;
}

.library-logo-svg {
  width: 74%;
  height: 74%;
  overflow: visible;
}

.library-logo-dot,
.library-logo-stem {
  fill: url(#ibLibraryInkV17921);
  transform-box: fill-box;
  transform-origin: center;
  animation: libraryLogoStrokeInV17921 .78s cubic-bezier(.19,1,.22,1) both;
}

.library-logo-bowl {
  fill: none;
  stroke: url(#ibLibraryInkV17921);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: libraryLogoDrawV17921 .84s cubic-bezier(.19,1,.22,1) forwards;
}

.library-logo-bowl.upper { animation-delay: .16s; }
.library-logo-bowl.lower { animation-delay: .24s; }

.library-tagline {
  margin: 0 !important;
  font-size: clamp(13px, 1.4vw, 15px) !important;
  line-height: 1.32 !important;
  letter-spacing: -0.012em;
  color: rgba(71,85,105,.86) !important;
}

@keyframes libraryLogoFloatInV17921 {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes libraryLogoStrokeInV17921 {
  from { opacity: 0; transform: translateY(4px) scale(.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes libraryLogoDrawV17921 { to { stroke-dashoffset: 0; } }

.library-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 14px 16px !important;
  min-height: 0 !important;
}

.library-toolbar .search-wrap {
  min-width: 0 !important;
  width: 100% !important;
}

.library-toolbar .search-wrap input {
  min-height: 42px !important;
  height: 42px !important;
  border-radius: 15px !important;
  font-size: 15px !important;
  padding: 0 14px !important;
}

.toolbar-meta {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  overflow: visible !important;
}

#refreshLibraryBtn,
#quickCreateBoardBtn {
  display: none !important;
}

.library-import-icon-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: rgba(15,23,42,.72) !important;
  background: rgba(255,255,255,.76) !important;
  border-color: rgba(15,23,42,.075) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 8px 20px rgba(15,23,42,.045) !important;
}

.library-import-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

#libraryStats {
  min-height: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  font-size: 12px !important;
  line-height: 1 !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
  color: rgba(100,116,139,.86) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.board-title {
  font-weight: 610 !important;
  letter-spacing: -0.024em !important;
  color: rgba(15,23,42,.92) !important;
}

.board-meta {
  font-weight: 410 !important;
  color: rgba(100,116,139,.82) !important;
}

.board-card-actions button {
  font-weight: 460 !important;
  letter-spacing: -0.01em !important;
  color: rgba(15,23,42,.72);
  background: rgba(255,255,255,.72);
  border-color: rgba(15,23,42,.065);
}

.board-card-actions button.danger {
  color: rgba(185,28,28,.76) !important;
}

#settingsSheet.utility-sheet {
  background: rgba(252,253,255,.94);
  border-color: rgba(15,23,42,.06);
  box-shadow: 0 30px 90px rgba(15,23,42,.12);
}

#settingsSheet .utility-sheet-body {
  gap: 14px !important;
}

#settingsSheet .collab-settings-card,
#settingsSheet .collab-share-panel,
#settingsSheet .collab-side-card,
#settingsSheet .collab-advanced,
#settingsSheet .toggle-row,
#settingsSheet .settings-toggle {
  border-color: rgba(15,23,42,.055) !important;
  background: rgba(255,255,255,.70) !important;
  box-shadow: 0 12px 34px rgba(15,23,42,.04) !important;
}

#settingsSheet .collab-settings-card {
  padding: 20px !important;
  gap: 14px !important;
}

#settingsSheet .collab-settings-head h3,
#settingsSheet .collab-share-panel h4,
#settingsSheet .publish-settings-card h3,
#settingsSheet h3,
#settingsSheet h4 {
  font-size: clamp(18px, 1.65vw, 21px) !important;
  line-height: 1.18 !important;
  font-weight: 500 !important;
  letter-spacing: -0.035em !important;
  color: rgba(15,23,42,.90) !important;
  margin-top: 0 !important;
}

#settingsSheet .collab-share-panel h4 {
  margin: 2px 0 0 !important;
  max-width: 26ch;
}

#settingsSheet .eyebrow {
  font-weight: 500 !important;
  color: rgba(100,116,139,.72) !important;
}

#settingsSheet .collab-status-line,
#settingsSheet .collab-share-copy,
#settingsSheet .subtle,
#settingsSheet .field-row,
#settingsSheet .settings-toggle {
  font-weight: 405 !important;
  color: rgba(100,116,139,.90) !important;
}

#settingsSheet button.compact,
#settingsSheet .secondary-btn,
#settingsSheet .primary-btn {
  font-weight: 470 !important;
  letter-spacing: -0.01em !important;
}

@media (max-width: 720px) {
  .library-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  .library-logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 18px;
  }
  .library-brand-lockup {
    gap: 10px;
  }
  .library-tagline {
    font-size: 12.5px !important;
  }
  .library-toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .toolbar-meta {
    gap: 7px !important;
  }
  .library-import-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 12px !important;
  }
  .library-import-icon-btn svg {
    width: 16px;
    height: 16px;
  }
  #libraryStats {
    height: 34px !important;
    min-height: 34px !important;
    font-size: 11.5px !important;
  }
}

@media (max-width: 390px) {
  .library-toolbar .search-wrap input {
    font-size: 14px !important;
    padding-inline: 12px !important;
  }
  #libraryStats { font-size: 11px !important; }
}


/* ===== V179.21.2: Library toolbar real-flow restore =====
   Fixes mobile toolbar collapsing into a white strip after board cards render.
   Scope: library header/toolbar only. No editor/canvas/tool/sync/backend changes. */
.library-screen {
  gap: 18px !important;
}

.library-header {
  position: relative !important;
  z-index: 2 !important;
  flex: 0 0 auto !important;
}

.library-toolbar {
  position: relative !important;
  z-index: 5 !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 66px !important;
  height: auto !important;
  padding: 12px 14px !important;
  margin: 0 !important;
  overflow: visible !important;
  border-radius: 26px !important;
  background: rgba(255,255,255,.94) !important;
  border: 1px solid rgba(15,23,42,.055) !important;
  box-shadow: 0 18px 46px rgba(15,23,42,.075), inset 0 1px 0 rgba(255,255,255,.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  transform: none !important;
}

.library-toolbar::before,
.library-toolbar::after {
  display: none !important;
  content: none !important;
}

.library-toolbar .search-wrap {
  position: relative !important;
  z-index: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 42px !important;
  display: block !important;
  overflow: visible !important;
  flex: initial !important;
}

.library-toolbar .search-wrap input,
#boardSearch {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 13px !important;
  border-radius: 15px !important;
  font-size: 15px !important;
  line-height: 42px !important;
  box-sizing: border-box !important;
  opacity: 1 !important;
  transform: none !important;
  background: rgba(255,255,255,.92) !important;
}

.library-toolbar .toolbar-meta {
  position: relative !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-width: 0 !important;
  width: auto !important;
  height: 42px !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
}

#refreshLibraryBtn,
#quickCreateBoardBtn {
  display: none !important;
}

#importBoardBtnToolbar,
.library-import-icon-btn {
  position: relative !important;
  z-index: 3 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 42px !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 15px !important;
  font-size: 0 !important;
  line-height: 1 !important;
  color: rgba(15,23,42,.70) !important;
  background: rgba(255,255,255,.78) !important;
  opacity: 1 !important;
  transform: none !important;
  box-sizing: border-box !important;
}

#importBoardBtnToolbar svg,
.library-import-icon-btn svg {
  display: block !important;
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  min-height: 17px !important;
  transform: none !important;
}

#libraryStats {
  position: relative !important;
  z-index: 3 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: max-content !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 2px !important;
  margin: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  font-size: 12px !important;
  line-height: 1 !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
  color: rgba(100,116,139,.86) !important;
  opacity: 1 !important;
  transform: none !important;
}

.board-grid,
#libraryGrid,
.library-list,
#libraryList,
#libraryView {
  position: relative !important;
  z-index: 1 !important;
  margin-top: 0 !important;
  clear: both !important;
}

@media (max-width: 720px) {
  .library-screen {
    gap: 16px !important;
  }

  .library-toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 60px !important;
    padding: 9px 10px !important;
    gap: 7px !important;
    border-radius: 24px !important;
  }

  .library-toolbar .search-wrap,
  .library-toolbar .toolbar-meta {
    height: 40px !important;
  }

  .library-toolbar .search-wrap input,
  #boardSearch {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    line-height: 40px !important;
    font-size: 14px !important;
    padding-inline: 11px !important;
    border-radius: 14px !important;
  }

  #importBoardBtnToolbar,
  .library-import-icon-btn {
    flex-basis: 40px !important;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    border-radius: 14px !important;
  }

  #importBoardBtnToolbar svg,
  .library-import-icon-btn svg {
    width: 16px !important;
    height: 16px !important;
  }

  #libraryStats {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    font-size: 11.5px !important;
  }
}

@media (max-width: 390px) {
  .library-toolbar {
    gap: 6px !important;
    padding-inline: 9px !important;
  }

  .library-toolbar .toolbar-meta {
    gap: 6px !important;
  }

  #importBoardBtnToolbar,
  .library-import-icon-btn {
    flex-basis: 38px !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
  }

  #libraryStats {
    font-size: 11px !important;
  }
}


/* IB_V18235_SYNC_INDICATOR_FALLBACK
   Fallback only; the primary bottom-left indicator is styled in saas-bridge.js. */
.ib-sync-status-chip{
  opacity:.18 !important;
}
.ib-sync-status-chip:hover,.ib-sync-status-chip:focus-within{
  opacity:.42 !important;
}


/* IB_V18245_SMART_LINK_APPLE_POLISH */
.smart-link-overlay,
.smart-link-video-overlay{
  position:fixed;
  inset:0;
  z-index:2500;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:22px;
  padding-bottom:calc(22px + env(safe-area-inset-bottom));
  background:rgba(15,23,42,.22);
  backdrop-filter:blur(20px) saturate(1.08);
  -webkit-backdrop-filter:blur(20px) saturate(1.08);
}
.smart-link-overlay.hidden,
.smart-link-video-overlay.hidden{display:none!important;}
.smart-link-sheet{
  width:min(604px, calc(100vw - 32px));
  border-radius:30px;
  padding:24px;
  background:linear-gradient(180deg,rgba(255,255,255,.97),rgba(248,250,252,.94));
  border:1px solid rgba(148,163,184,.16);
  box-shadow:0 24px 80px rgba(15,23,42,.18),0 8px 24px rgba(15,23,42,.08);
  color:#111827;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Helvetica Neue",Arial,sans-serif;
}
.smart-link-header,
.smart-link-video-top{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px;}
.smart-link-header .eyebrow{
  margin:0 0 7px;
  font-size:12px;
  line-height:1;
  font-weight:560;
  letter-spacing:.22em;
  color:#8A94A6;
}
.smart-link-header h2{
  margin:0;
  font-size:clamp(25px,4.8vw,34px);
  line-height:1.04;
  letter-spacing:-.035em;
  font-weight:640;
  color:#0F172A;
}
.smart-link-header .chrome-icon-btn{
  width:50px;
  height:50px;
  border-radius:18px;
  font-size:30px;
  font-weight:360;
  background:rgba(255,255,255,.86);
  border-color:rgba(148,163,184,.18);
  box-shadow:0 8px 22px rgba(15,23,42,.08);
}
.smart-link-field{margin-bottom:14px;}
.smart-link-field span{
  display:block;
  margin:0 0 8px;
  font-size:13px;
  line-height:1.2;
  font-weight:560;
  color:#64748B;
}
.smart-link-field input{
  font-size:17px;
  line-height:1.3;
  font-weight:460;
  padding:15px 17px;
  border-radius:18px;
  border:1px solid rgba(148,163,184,.24);
  background:rgba(255,255,255,.78);
  color:#111827;
  width:100%;
  box-sizing:border-box;
  outline:none;
  -webkit-user-select:text;
  user-select:text;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8),0 1px 2px rgba(15,23,42,.03);
}
.smart-link-field input:focus{
  border-color:rgba(59,130,246,.42);
  box-shadow:0 0 0 4px rgba(59,130,246,.10),inset 0 1px 0 rgba(255,255,255,.8);
  background:#fff;
}
.smart-link-preview{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px;
  border-radius:22px;
  border:1px solid rgba(226,232,240,.9);
  background:rgba(255,255,255,.72);
  margin:10px 0 14px;
  min-height:72px;
  box-shadow:0 8px 26px rgba(15,23,42,.045);
}
.smart-link-preview-icon{
  width:50px;
  height:50px;
  border-radius:16px;
  background:linear-gradient(180deg,#1F2937,#0F172A);
  color:#fff;
  display:grid;
  place-items:center;
  font-size:22px;
  font-weight:520;
  flex:none;
  box-shadow:0 10px 22px rgba(15,23,42,.16);
}
.smart-link-preview strong{
  display:block;
  font-size:17px;
  line-height:1.2;
  font-weight:620;
  letter-spacing:-.018em;
  color:#111827;
}
.smart-link-preview span{
  display:block;
  font-size:13.5px;
  line-height:1.35;
  font-weight:440;
  color:#64748B;
  margin-top:3px;
}
.smart-link-status{
  font-size:13.5px;
  line-height:1.45;
  font-weight:440;
  margin:0 0 18px;
  color:#7B8798;
}
.smart-link-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;}
.smart-link-actions .danger{margin-right:auto;}
.smart-link-actions .primary-btn.compact,
.smart-link-actions .secondary-btn.compact{
  min-height:44px;
  border-radius:16px;
  font-size:15px;
  font-weight:590;
  letter-spacing:-.01em;
}
.smart-link-video-sheet{
  width:min(980px,calc(100vw - 24px));
  background:rgba(15,23,42,.92);
  border-radius:28px;
  padding:16px;
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 28px 90px rgba(0,0,0,.42);
  color:#fff;
}
.smart-link-video-top{align-items:center;margin-bottom:12px;}
.smart-link-video-top strong{font-size:18px;font-weight:620;letter-spacing:-.02em;}
.smart-link-video-frame-wrap{position:relative;width:100%;aspect-ratio:16/9;border-radius:20px;overflow:hidden;background:#000;}
.smart-link-video-frame-wrap iframe{position:absolute;inset:0;width:100%;height:100%;border:0;display:block;}
.smart-link-video-actions{display:flex;justify-content:flex-end;margin-top:12px;}
@media (max-width:820px){
  .smart-link-overlay{align-items:flex-end;padding:10px;padding-bottom:calc(10px + env(safe-area-inset-bottom));}
  .smart-link-sheet{width:100%;border-radius:28px 28px 22px 22px;padding:20px;max-height:min(78dvh,680px);overflow:auto;-webkit-overflow-scrolling:touch;}
  .smart-link-header h2{font-size:30px;font-weight:640;}
  .smart-link-field input{font-size:17px;padding:14px 15px;}
  .smart-link-preview{border-radius:20px;padding:13px;}
  .smart-link-actions{position:sticky;bottom:0;background:linear-gradient(to top,rgba(248,250,252,.98),rgba(248,250,252,.76));padding-top:10px;}
  .smart-link-actions .primary-btn.compact,
  .smart-link-actions .secondary-btn.compact{flex:1 1 auto;}
  .smart-link-video-overlay{padding:8px;align-items:center;}
  .smart-link-video-sheet{border-radius:22px;padding:10px;}
}



/* V182.46 — Apple-grade rotation + curve handles */
.selected-outline-rotated { stroke-dasharray: 6 5; }
.rotation-tether { stroke: rgba(37,99,235,0.38); stroke-width: 1.15; vector-effect: non-scaling-stroke; stroke-linecap: round; pointer-events: none; }
.handle-rotate .handle-core { fill: rgba(255,255,255,0.96); stroke: #2563eb; stroke-width: 1.55; filter: drop-shadow(0 5px 10px rgba(37,99,235,0.20)); }
.handle-curve .handle-core { fill: #f8fbff; stroke: #2563eb; stroke-width: 1.55; filter: drop-shadow(0 5px 10px rgba(37,99,235,0.16)); }
.handle-glyph { fill: #2563eb; font-size: 10px; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; font-weight: 700; pointer-events: none; user-select: none; }
.handle.cursor-rotate { cursor: grab; }
.handle.cursor-rotate:active, .handle.cursor-line:active { cursor: grabbing; }


/* V182.47 — transform feature visibility / cache-rescue polish */
.selection-layer { pointer-events: none; }
.selection-layer .handle { pointer-events: all; }
.transform-rotation-row input { font-variant-numeric: tabular-nums; }
.handle-hit { fill: rgba(37,99,235,0.01); }
.handle-rotate .handle-core { fill: #ffffff; stroke: #0f62fe; stroke-width: 1.85; filter: drop-shadow(0 6px 14px rgba(37,99,235,0.28)); }
.handle-curve .handle-core { fill: #ffffff; stroke: #0f62fe; stroke-width: 1.85; filter: drop-shadow(0 6px 14px rgba(37,99,235,0.22)); }
.rotation-tether { stroke: rgba(15,98,254,0.52); stroke-width: 1.35; vector-effect: non-scaling-stroke; stroke-linecap: round; pointer-events: none; }
@media (pointer: coarse) {
  .handle-rotate .handle-core, .handle-curve .handle-core { stroke-width: 2; }
}


/* V182.48 — native connector blue-dot + add-object popover */
.connector-tether {
  stroke: rgba(37, 99, 235, 0.46);
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  pointer-events: none;
  stroke-dasharray: 4 5;
}
.handle-connect .handle-core {
  fill: #2563eb;
  stroke: rgba(255,255,255,0.98);
  stroke-width: 3.2;
  filter: drop-shadow(0 8px 18px rgba(37,99,235,0.34));
}
.handle-connect-plus {
  stroke: #ffffff;
  stroke-width: 1.85;
  stroke-linecap: round;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}
.handle[class*="handle-route-"] .handle-core,
.handle-curve .handle-core {
  fill: #2563eb;
  stroke: rgba(255,255,255,0.98);
  stroke-width: 2.5;
  filter: drop-shadow(0 5px 13px rgba(37,99,235,0.24));
}
.connector-drag-preview path:not(.object-hit-target) {
  filter: drop-shadow(0 5px 14px rgba(37,99,235,0.18));
}
.connector-add-popover {
  position: fixed;
  z-index: 9999;
  width: min(316px, calc(100vw - 24px));
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 24px 70px rgba(15,23,42,0.18), 0 8px 24px rgba(15,23,42,0.10);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: #111827;
}
.connector-add-same {
  width: 100%;
  min-height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.14);
  background: rgba(255,255,255,0.78);
  color: #475569;
  font-size: 21px;
  font-weight: 420;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
}
.connector-add-same:active,
.connector-add-shape:active,
.connector-add-all:active { transform: scale(0.985); }
.connector-add-return {
  font-size: 30px;
  line-height: 1;
  color: #6b7280;
}
.connector-add-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  padding: 18px 8px 14px;
}
.connector-add-shape {
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #1f2937;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.connector-add-shape:hover,
.connector-add-shape:focus-visible {
  background: rgba(37,99,235,0.08);
  outline: none;
}
.connector-add-shape svg {
  width: 44px;
  height: 44px;
  display: block;
}
.connector-add-all {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(15,23,42,0.10);
  background: transparent;
  padding: 15px 8px 2px;
  color: #6b7280;
  font-size: 24px;
  font-weight: 370;
  letter-spacing: -0.55px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .connector-add-popover {
    width: min(286px, calc(100vw - 20px));
    border-radius: 20px;
    padding: 16px;
  }
  .connector-add-same { min-height: 54px; font-size: 19px; }
  .connector-add-grid { gap: 10px 12px; padding: 16px 4px 12px; }
  .connector-add-all { font-size: 22px; }
}


/* ===== V182.54 Apple-grade ink tool family ===== */
.ink-tool svg { width: 22px; height: 22px; }
.tool-btn.ink-tool::after,
.focus-tool-btn.ink-tool::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  right: 6px;
  bottom: 6px;
  background: rgba(37,99,235,0.34);
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
}
.tool-btn.ink-tool.active::after,
.focus-tool-btn.ink-tool.active::after { opacity: 1; transform: scale(1.08); }
.object-path { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; }
.object-ink-pencil { stroke-linecap: round; stroke-linejoin: round; }
.object-ink-fountain { stroke-linecap: round; stroke-linejoin: round; }
.object-ink-marker { stroke-linecap: square; stroke-linejoin: round; }
.object-ink-brush { stroke-linecap: round; stroke-linejoin: round; }
.object-ink-technical { stroke-linecap: round; stroke-linejoin: round; }
.object-highlighter { mix-blend-mode: multiply; stroke-linecap: round; stroke-linejoin: round; }
.ink-preview { pointer-events: none; }
@media (max-width: 900px) {
  .tool-btn.ink-tool { width: 44px; min-width: 44px; height: 44px; border-radius: 16px; }
}
