@font-face {
  font-family: "Source Sans 3";
  src: url("assets/fonts/source-sans-3.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}
:root {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  color: var(--ink);
  --ink: #302d37;
  --muted: #827b8b;
  --bg: #f5f3ef;
  --surface: #fcfaf7;
  --input: #fff;
  --hover: #eee8f1;
  --line: #ddd6df;
  --strong: #5c5269;
  --dot: #ccc3d4;
  --selection: #9065c8;
  --selection-bg: #e9ddfa;
  --pink: #f5b3d1;
  --yellow: #f8dc7e;
  --purple: #d8c5f3;
  --blue: #c2deed;
  --info: #bf8e1b;
  --interaction: #199cb0;
  --note: #fcf8e8;
  --shadow: 2px 3px 0 #30273525;
  --left-width: 260px;
  --right-width: 330px;
  --notes-height: 190px;
  background: var(--bg);
}
:root[data-theme="dark"] {
  --ink: #e6dfed;
  --muted: #a59aad;
  --bg: #1e1c23;
  --surface: #28252e;
  --input: #302b37;
  --hover: #3b3344;
  --line: #463c50;
  --strong: #a79ab5;
  --dot: #4b4058;
  --selection: #c3a1fa;
  --selection-bg: #4c3966;
  --pink: #9b5877;
  --yellow: #a88537;
  --purple: #785e9e;
  --blue: #4e7a8f;
  --info: #f1c75c;
  --interaction: #64cfdb;
  --note: #2d2927;
  --shadow: 2px 3px 0 #0005;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6dfed;
    --muted: #a59aad;
    --bg: #1e1c23;
    --surface: #28252e;
    --input: #302b37;
    --hover: #3b3344;
    --line: #463c50;
    --strong: #a79ab5;
    --dot: #4b4058;
    --selection: #c3a1fa;
    --selection-bg: #4c3966;
    --pink: #9b5877;
    --yellow: #a88537;
    --purple: #785e9e;
    --blue: #4e7a8f;
    --info: #f1c75c;
    --interaction: #64cfdb;
    --note: #2d2927;
    --shadow: 2px 3px 0 #0005;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
input,
textarea,
select,
summary {
  font: inherit;
}
button,
summary {
  color: inherit;
  cursor: pointer;
}
button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 13px;
  line-height: 1.3;
}
button:hover {
  background: var(--hover);
}
button:focus-visible,
summary:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--selection);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
input,
textarea,
select {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
  padding: 8px 9px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--selection);
  box-shadow: 0 0 0 1px var(--selection);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
kbd {
  font:
    10px ui-monospace,
    Consolas,
    monospace;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 4px;
  background: var(--surface);
  color: var(--muted);
}
.menubar {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-bottom: 1px solid var(--strong);
  position: relative;
  z-index: 30;
  background: var(--surface);
}
.brand {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.8px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand > span:first-child {
  font-style: italic;
}
.brand-mark {
  display: inline-block;
  margin-left: 6px;
  background: var(--pink);
  border: 1px solid var(--strong);
  border-radius: 50%;
  width: 21px;
  height: 21px;
  line-height: 19px;
  text-align: center;
  font-size: 15px;
  vertical-align: 1px;
}
.file-actions {
  display: flex;
  gap: 1px;
}
.file-actions button {
  padding: 6px 8px;
}
.shortcut {
  display: none;
}
.project-name {
  border-left: 1px solid var(--line);
  padding-left: 14px;
  flex: 1;
  min-width: 100px;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.project-name input {
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  padding: 4px;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
#file-state { flex: none; color: var(--muted); font-size: 11px; white-space: nowrap; }
#file-state::before { content: "•"; margin-right: 6px; }
#file-state[data-state="edited"] { color: var(--selection); }
.search-wrap {
  position: relative;
  width: 310px;
  margin-left: auto;
}
.search-field {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  margin: 0;
}
.search-field > span {
  font-size: 24px;
  line-height: 1;
}
.search-field input {
  border: 0;
  box-shadow: none !important;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 12px;
}
.search-field kbd {
  font-size: 9px;
}
.panel-toggle {
  font-size: 17px;
  padding: 4px 6px;
}
#theme-toggle {
  font-size: 18px;
  padding: 2px 6px;
}
#save-status:not([hidden]) {
  position: absolute;
  top: 50px;
  left: 15px;
  background: var(--yellow);
  padding: 8px;
  border: 1px solid var(--strong);
  font-size: 12px;
}
.export-menu {
  position: relative;
}
.export-menu summary {
  display: block;
  background: var(--yellow);
  border: 1px solid var(--strong);
  border-radius: 4px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.export-menu summary::-webkit-details-marker {
  display: none;
}
.menu-popover {
  position: absolute;
  right: 0;
  top: 37px;
  width: 225px;
  background: var(--surface);
  border: 1px solid var(--strong);
  border-radius: 5px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.menu-popover button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 10px;
}
.menu-popover span {
  font-size: 11px;
  color: var(--muted);
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
}
.app {
  height: calc(var(--visible-height, 100dvh) - var(--menubar-height, 56px));
  display: flex;
  position: relative;
}
aside {
  width: var(--left-width);
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.panel-heading {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}
.panel-heading h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}
.panel-heading h2 span {
  font-size: 11px;
  color: var(--muted);
  margin-left: 7px;
  font-weight: 400;
}
#library {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 17px 12px 25px 8px;
}
.tree-item {
  position: relative;
}
.tree-card {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.tree-card:hover {
  background: var(--hover);
}
.tree-card.selected {
  background: var(--selection-bg);
  border-color: var(--selection);
}
.tree-card.search-match {
  box-shadow: inset 3px 0 0 var(--info);
}
.node-text {
  min-width: 0;
  flex: 1;
}
.node-text strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tree-item > .tree-card .node-text strong {
  font-weight: 600;
}
.tree-children .tree-card .node-text strong {
  font-weight: 450;
}
.card-toggle {
  width: 15px;
  flex-shrink: 0;
  padding: 0;
  font-size: 12px;
  align-self: flex-start;
  line-height: 21px;
}
.card-toggle:disabled {
  opacity: 0;
}
.add-child {
  padding: 0 3px;
  opacity: 0;
  font-size: 17px;
}
.tree-card:hover .add-child,
.tree-card:focus-within .add-child {
  opacity: 1;
}
.tree-children {
  margin-left: 19px;
  padding-left: 17px;
  position: relative;
}
.tree-children > .tree-item::before {
  content: ""; position: absolute; left: -10px; top: 0;
  width: 9px; height: 18px; border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line); pointer-events: none;
}
.tree-children > .tree-item:not(:last-child)::after {
  content: ""; position: absolute; left: -10px; top: 18px; bottom: 0;
  border-left: 1px solid var(--line); pointer-events: none;
}
.tree-children > .tree-item > .tree-card:after {
  content: "";
  position: absolute;
  left: -5px;
  top: 14px;
  width: 5px;
  height: 5px;
  border-top: 1px solid var(--strong);
  border-right: 1px solid var(--strong);
  transform: rotate(45deg);
  opacity: 0.65;
}
.root-drop {
  padding: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.panel-bottom {
  display: flex;
  justify-content: space-between;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
}
.panel-bottom button {
  font-size: 12px;
}
.hierarchy-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  padding: 0 9px;
}
.panel-resizer {
  position: relative;
  z-index: 15;
  flex: 0 0 5px;
  cursor: col-resize;
  touch-action: none;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.panel-resizer:hover,
.panel-resizer:focus-visible {
  background: var(--selection-bg);
  border-color: var(--selection);
}
.panel-resizer:after {
  content: "";
  position: absolute;
  top: 45%;
  left: 1px;
  height: 35px;
  border-left: 1px solid var(--muted);
  opacity: 0.5;
}
body.resizing-panels,
body.resizing-panels * {
  cursor: col-resize !important;
  user-select: none !important;
}
body.resizing-notes,
body.resizing-notes * {
  cursor: row-resize !important;
  user-select: none !important;
}
main {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.canvas-viewbar {
  position: absolute;
  top: 14px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 5;
  pointer-events: none;
}
.canvas-viewbar > * {
  pointer-events: auto;
}
.view-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  box-shadow: 0 1px 3px #00000009;
}
.view-tabs button {
  font-size: 12px;
  padding: 5px 12px;
}
.view-tabs .active {
  background: var(--hover);
  color: var(--ink);
  font-weight: 600;
}
.canvas-viewbar > button {
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  padding: 7px 12px;
}
#workspace {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 0.65px, transparent 0.65px);
  background-size: 24px 24px;
  touch-action: none;
}
#workspace.table-mode {
  overflow: auto;
  touch-action: auto;
  background: var(--bg);
}
.canvas-world {
  position: absolute;
  inset: 0;
  transform: none;
  pointer-events: none;
}
.graph-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.graph-edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
}
.graph-edge.interaction {
  stroke: var(--interaction);
  stroke-width: 1.7;
}
.arrow-hierarchy {
  fill: var(--muted);
}
.arrow-interaction {
  fill: var(--interaction);
}
.graph-node {
  position: absolute;
  border: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  user-select: none;
  pointer-events: auto;
  cursor: default;
}
.frame-title {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  padding: 0 0 7px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
}
.graph-node.selected > .frame-title {
  color: var(--selection);
  font-weight: 600;
}
.frame-surface {
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--surface);
}
.frame-image-layer { position: absolute; }
.graph-node.selected > .frame-surface {
  outline: 1.5px solid var(--selection);
  outline-offset: 3px;
}
.node-resize {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 4px;
  background: var(--selection);
  cursor: nwse-resize;
  touch-action: none;
}
.graph-node.search-match > .frame-surface {
  outline: 2px solid var(--info);
  outline-offset: 4px;
}
.graph-node.search-muted {
  opacity: 0.35;
}
.frame-screenshot,
.frame-crop {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  object-fit: contain;
  image-rendering: auto;
}
.frame-pagination {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
}
.frame-pagination button {
  font-size: 20px;
  padding: 0 8px;
  line-height: 25px;
}
.frame-pagination span {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
.text-node {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px;
  display: grid;
  grid-template-columns: 23px 1fr;
  gap: 7px 10px;
  align-content: center;
}
.text-node strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Notes sit in the text column, not the badge column, and stay short; the
   inspector has the full text. */
.text-node > .markdown-preview {
  grid-column: 2;
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.text-node > .markdown-preview :is(p, ul) { margin: 0; white-space: normal; }
.text-node p {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid #827b8b66;
  border-radius: 4px;
  background: var(--pink);
  flex-shrink: 0;
  font-size: 12px;
}
.badge.information {
  background: var(--yellow);
}
.badge.interaction {
  background: var(--blue);
}
.badge.view {
  background: var(--purple);
}
.badge.group {
  background: var(--hover);
}
.canvas-region {
  position: absolute;
  border: 1.5px solid var(--info);
  background: #efbf3110;
  min-width: 1px;
  min-height: 1px;
  cursor: pointer;
}
.canvas-region.interaction {
  border-color: var(--interaction);
  background: #37c7d010;
}
.canvas-region:hover,
.canvas-region.selected {
  background: #dfc38818;
  outline: 1px solid var(--info);
  outline-offset: 1px;
}
.canvas-region.interaction:hover,
.canvas-region.interaction.selected {
  background: #37c7d029;
  outline-color: var(--interaction);
}
.canvas-region .region-name {
  position: absolute;
  left: -1px;
  bottom: 100%;
  max-width: 260px;
  font-size: 11px;
  line-height: 16px;
  padding: 1px 4px;
  background: var(--info);
  color: #211d12;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.canvas-region.interaction .region-name {
  background: var(--interaction);
  color: #061f22;
}
.canvas-region:hover > .region-name,
.canvas-region.selected > .region-name,
.canvas-region.search-match > .region-name {
  opacity: 1;
}
.canvas-region.selected {
  z-index: 3;
}
.canvas-region.interaction {
  z-index: 2;
}
.canvas-region.search-match {
  outline: 3px solid var(--selection);
  outline-offset: 2px;
}
.link-port {
  position: absolute;
  top: 50%;
  right: -13px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--interaction);
  border-radius: 50%;
  background: var(--surface);
  color: var(--interaction);
  box-shadow: 0 1px 3px #0003;
  font-size: 22px;
  line-height: 1;
  opacity: 0;
  cursor: crosshair;
  z-index: 8;
  touch-action: none;
}
.canvas-region:hover > .link-port,
.canvas-region.selected > .link-port,
.graph-node:hover > .link-port,
.graph-node.selected > .link-port,
.link-port:focus-visible {
  opacity: 1;
}
.link-port:hover {
  background: var(--interaction);
  color: var(--surface);
}
.graph-node.snap-target > .frame-surface,
.canvas-region.snap-target {
  outline: 3px solid var(--interaction);
  outline-offset: 5px;
}
.connection-preview {
  fill: none;
  stroke: var(--interaction);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}
.region.selection {
  position: absolute;
  border: 1.5px dashed var(--selection);
  background: #b68bed25;
  pointer-events: none;
  z-index: 10;
}
.region {
  position: absolute;
  border: 2px solid var(--selection);
  pointer-events: none;
}
#workspace[data-tool="information"] [data-frame-image],
#workspace[data-tool="interaction"] [data-frame-image],
#workspace[data-tool="information"] .canvas-region,
#workspace[data-tool="interaction"] .canvas-region {
  cursor: crosshair;
}
#workspace[data-tool="hand"],
#workspace[data-tool="hand"] * {
  cursor: grab;
}
#workspace.connecting,
#workspace.connecting * {
  cursor: crosshair;
}
#workspace.panning,
#workspace.panning * {
  cursor: grabbing !important;
}
#canvas-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 20px);
}
.drawing-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--strong);
  border-radius: 9px;
  padding: 7px;
  box-shadow: 0 4px 16px #29202e17;
  white-space: nowrap;
}
.drawing-tools button {
  height: 35px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 12px;
}
.drawing-tools svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.drawing-tools [data-tool="select"] svg {
  fill: currentColor;
  stroke-width: 1;
}
.drawing-tools .active {
  background: var(--selection-bg);
  color: var(--selection);
}
.drawing-tools [data-tool="information"].active {
  background: var(--yellow);
  color: var(--ink);
}
.drawing-tools [data-tool="interaction"].active {
  background: var(--blue);
  color: var(--ink);
}
.tool-divider {
  height: 23px;
  border-left: 1px solid var(--line);
  margin: 0 3px;
}
#add-node {
  font-size: 23px;
  font-weight: 350;
}
#zoom-level {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 41px;
  padding: 3px;
}
#fit-graph kbd {
  font-size: 9px;
}
#tool-status {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
#inspector {
  width: var(--right-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}
.inspector-heading {
  height: 49px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.inspector-heading h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}
.inspector-heading button {
  font-size: 17px;
}
.inspector-body {
  flex: 1;
  overflow: auto;
  padding: 0 17px 16px;
  min-height: 80px;
}
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 13px 0;
}
label input,
label textarea,
label select {
  margin-top: 5px;
}
.detail-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-pair label {
  margin-top: 0;
}
.required {
  float: right;
  font-size: 10px;
  color: var(--muted);
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin: 19px 0 10px;
  color: var(--ink);
}
.section-title > span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.section-title button {
  font-size: 12px;
  padding: 3px 6px;
}
.thumbs {
  display: flex;
  gap: 8px;
  margin: 9px 0;
  overflow: auto;
  padding-bottom: 3px;
}
.thumb {
  position: relative;
  width: 65px;
  min-width: 65px;
  height: 49px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.thumb.active {
  border-color: var(--selection);
  box-shadow: 0 0 0 1px var(--selection);
}
.thumb img, .thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb small {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--surface);
  padding: 1px 3px;
  font-size: 8px;
}
.screenshot-actions {
  display: flex;
  gap: 5px;
  justify-content: space-between;
}
.screenshot-actions button {
  font-size: 12px;
  border: 1px solid var(--line);
}
.destination-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 5px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.destination-row button:first-child {
  flex: 1;
  text-align: left;
  font-size: 12px;
}
.pick-destination {
  width: 100%;
  text-align: left;
  background: var(--selection-bg);
  border: 1px solid var(--line);
  padding: 9px 10px;
  font-size: 13px;
}
.manual-link {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  margin: 10px 0 7px;
}
.manual-link label {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.manual-link button {
  align-self: flex-end;
  white-space: nowrap;
  border: 1px solid var(--line);
  height: 37px;
}
.manual-link input { height: 37px; }
.manual-link label input { box-sizing: border-box; width: 100%; margin: 0; }
.multi-selection-list { margin: 8px 0; padding-left: 20px; color: var(--strong); line-height: 1.6; }
.interaction-row {
  display: block;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 9px 2px;
}
.interaction-row span {
  font-size: 13px;
  display: block;
}
.interaction-row small {
  font-size: 11px;
  color: var(--muted);
}
.incoming {
  margin-top: 20px;
  font-size: 12px;
}
.incoming summary {
  color: var(--muted);
}
.incoming button {
  display: block;
  text-align: left;
  font-size: 12px;
}
.inspector-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.danger {
  color: #c25661;
}
#notes-resizer {
  height: 6px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  cursor: row-resize;
  touch-action: none;
  position: relative;
  background: var(--note);
}
#notes-resizer:after {
  content: "";
  width: 35px;
  border-top: 1px solid var(--muted);
  position: absolute;
  left: calc(50% - 17px);
  top: 2px;
  opacity: 0.5;
}
.notes-panel {
  height: var(--notes-height);
  max-height: 55%;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--note);
  padding: 8px 17px 10px;
}
.notes-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notes-heading h3 { margin: 2px 0 7px; color: var(--ink); font-size: 13px; font-weight: 600; }
.notes-heading button { color: var(--selection); font-size: 12px; }
.markdown-preview { white-space: normal; overflow-wrap: anywhere; }
.markdown-preview p { margin: 0 0 8px; }
.markdown-preview ul { margin: 0 0 8px; padding-left: 20px; }
.markdown-preview hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.notes-rendered { flex: 1; min-height: 0; overflow: auto; text-align: left; font-size: 14px; line-height: 1.6; }
.notes-rendered[hidden] { display: none; }
.create-notes { padding: 10px 12px; background: var(--md-surfaceContainerHigh, var(--note)); border: 1px solid var(--line); border-radius: 6px; }
.create-notes .notes-heading h3 { margin: 0 0 8px; }
.create-notes textarea { width: 100%; min-height: 120px; border: 0; }
.create-notes textarea:focus { outline: 0; box-shadow: none; }
.create-notes .notes-rendered { min-height: 120px; }
.notes-panel textarea {
  flex: 1;
  min-height: 0;
  resize: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  line-height: 25px;
  font-size: 14px;
  padding: 0 1px;
  background: transparent;
  color: var(--ink);
}
.notes-editor { flex: 1; min-height: 0; overflow: auto; outline: none; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.notes-editor p { margin: 0 0 8px; }
.notes-editor ul, .notes-editor ol { margin: 0 0 8px; padding-left: 20px; }
.notes-editor li { padding-left: 2px; }
.notes-editor hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.notes-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.notes-editor:focus-visible { outline: 2px solid var(--selection); outline-offset: 3px; border-radius: 2px; }
.create-notes .notes-editor { min-height: 120px; max-height: min(35dvh, 260px); }
.notes-panel textarea:focus {
  outline: 0;
  box-shadow: none;
}
.muted {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  text-align: center;
  pointer-events: none;
  padding: 65px 20px 110px;
}
.empty-art {
  position: relative;
  width: 205px;
  height: 140px;
  margin-bottom: 30px;
}
.paper {
  position: absolute;
  width: 105px;
  height: 122px;
  border: 1.5px solid var(--strong);
  border-radius: 5px;
  background: var(--yellow);
  transform: rotate(-12deg);
  top: 7px;
  left: 15px;
  box-shadow: 3px 3px 0 var(--strong);
}
.paper:before {
  content: "";
  display: block;
  margin: 16px 13px;
  width: 50px;
  height: 7px;
  background: var(--strong);
  box-shadow:
    0 18px 0 #827b8b55,
    0 36px 0 #827b8b55;
}
.paper.photo {
  transform: rotate(10deg);
  left: 84px;
  top: 0;
  background: var(--pink);
}
.paper.photo:before {
  width: 72px;
  height: 52px;
  background: var(--surface);
  border: 1.5px solid var(--strong);
  box-shadow: none;
  margin: 13px;
}
.paper.photo:after {
  content: "↗";
  position: absolute;
  bottom: 9px;
  right: 10px;
  font-size: 31px;
  font-weight: bold;
}
.empty h1 {
  font-size: 25px;
  letter-spacing: -0.5px;
  font-weight: 650;
  margin: 0 0 10px;
}
.empty p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
  margin: 0;
}
.empty-action {
  pointer-events: auto;
  margin-top: 18px;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--selection);
}
#drop-overlay {
  position: absolute;
  inset: 60px 12px 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--selection-bg);
  border: 2px dashed var(--selection);
  border-radius: 9px;
  font-size: 25px;
  font-weight: 650;
  pointer-events: none;
}
#drop-overlay span {
  font-size: 13px;
  font-weight: 400;
}
dialog {
  position: fixed;
  top: var(--dialog-center-top, 50dvh);
  left: var(--dialog-center-left, 50vw);
  transform: translate(-50%, -50%);
  margin: 0;
  border: 1.5px solid var(--strong);
  border-radius: 9px;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  max-width: calc(var(--dialog-visible-width, 100vw) - 24px);
  max-height: calc(var(--dialog-visible-height, 100dvh) - 24px);
  box-sizing: border-box;
  overflow: auto;
  box-shadow: 5px 5px 0 #30273544;
  width: 760px;
}
dialog::backdrop {
  background: #231e3155;
  backdrop-filter: blur(2px);
}
.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.dialog-title h2 {
  font-size: 21px;
  font-weight: 650;
  margin: 0;
}
.dialog-title button {
  font-size: 17px;
}
.create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-top: 7px;
}
.create-screenshots {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}
.create-screenshots .section-title {
  margin-top: 12px;
}
.upload {
  width: 100%;
  background: var(--hover);
  border: 1px dashed var(--muted);
  padding: 15px 10px;
  text-align: center;
  border-radius: 5px;
  font-size: 13px;
  color: var(--ink);
}
.upload span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.draft-image {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 9px 0;
  overflow: hidden;
  background: var(--input);
}
.draft-image img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.draft-source svg { display: block; max-width: 100%; height: auto; max-height: 240px; margin: auto; }
.draft-image button {
  position: absolute;
  right: 5px;
  top: 5px;
  background: var(--surface);
  border: 1px solid var(--strong);
  border-radius: 50%;
  padding: 3px 7px;
}
.draft-image small {
  display: block;
  font-size: 11px;
  padding: 6px 9px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-top: 1px solid var(--line);
}
#draft-preview {
  max-height: 390px;
  overflow: auto;
}
.dialog-actions {
  border-top: 1px solid var(--line);
  margin-top: 13px;
  padding-top: 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.accent {
  background: var(--pink);
  border: 1px solid var(--strong);
  box-shadow: var(--shadow);
  font-weight: 600;
  padding: 9px 17px;
}
.accent:hover {
  background: var(--purple);
}
.dialog-actions .accent {
  white-space: nowrap;
}
#image-dialog {
  width: 900px;
}
#gallery-dialog {
  width: min(900px, calc(var(--dialog-visible-width, 100vw) - 24px));
  padding: clamp(12px, 2.5vw, 24px);
  overflow: auto;
}
#gallery-dialog[open] { display: flex; flex-direction: column; }
#gallery-dialog .dialog-title { flex: none; gap: 10px; }
#gallery-dialog .dialog-title h2 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(17px, 2.5vw, 21px);
}
#gallery-dialog .dialog-title button { flex: none; min-width: 40px; min-height: 40px; }
#gallery-image {
  display: grid;
  place-items: center;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 90px;
  max-height: clamp(100px, calc(var(--dialog-visible-height, 100dvh) - 220px), 600px);
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  background: #fff;
}
#gallery-image img, #gallery-image svg {
  display: block;
  max-width: 100%;
  max-height: clamp(100px, calc(var(--dialog-visible-height, 100dvh) - 220px), 600px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.gallery-controls { display: flex; align-items: center; justify-content: center; flex: none; gap: 16px; margin-top: 8px; }
.gallery-controls button { font-size: 25px; min-width: 44px; min-height: 40px; }
#gallery-position { font-variant-numeric: tabular-nums; }
#gallery-caption {
  text-align: center;
  color: var(--muted);
  white-space: pre-wrap;
  flex: none;
  max-height: 5em;
  margin: 8px 0 0;
  overflow: auto;
  overflow-wrap: anywhere;
}
.context-menu[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
  max-width: calc(var(--dialog-visible-width, 100vw) - 16px);
  max-height: calc(var(--dialog-visible-height, 100dvh) - 16px);
  overflow: auto;
}
@media (max-width: 760px) {
  #gallery-dialog { width: calc(var(--dialog-visible-width, 100vw) - 16px); }
  #gallery-image { max-height: clamp(100px, calc(var(--dialog-visible-height, 100dvh) - 200px), 450px); }
  #gallery-image img, #gallery-image svg { max-height: clamp(100px, calc(var(--dialog-visible-height, 100dvh) - 200px), 450px); }
  .gallery-controls { gap: 10px; margin-top: 6px; }
  #gallery-caption { max-height: 4.5em; margin-top: 6px; }
}
.image-stage {
  position: relative;
  line-height: 0;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}
.image-stage img {
  display: block;
  width: 100%;
  pointer-events: none;
}
#crop-stage {
  max-width: 800px;
  margin: 14px auto;
}
.image-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.image-actions button {
  border: 1px solid var(--line);
}
#help-dialog {
  width: 560px;
}
.shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px 18px;
  font-size: 13px;
  margin: 25px 0;
}
.shortcuts dd {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  max-width: 90vw;
  z-index: 100;
  display: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--surface);
  background: var(--ink);
  padding: 10px 16px;
  border-radius: 5px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
#search-results {
  position: absolute;
  right: 0;
  top: 38px;
  width: 430px;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--strong);
  border-radius: 5px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.search-summary {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.search-result > span {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.search-result small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  padding-left: 31px;
  margin-top: 5px;
}
.search-result p {
  font-size: 12px;
  margin: 6px 0 0 31px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
mark {
  background: var(--yellow);
  color: var(--ink);
  padding: 0 1px;
}
.table-wrap {
  padding: 75px 23px 30px;
  min-width: 820px;
}
.table-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.table-heading h1 {
  font-size: 22px;
  font-weight: 650;
  margin: 0;
}
.table-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.ia-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  border: 1px solid var(--strong);
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
  font-size: 12px;
}
.ia-table th {
  background: var(--yellow);
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--strong);
  font-weight: 600;
}
.ia-table th:first-child {
  width: 25%;
}
.ia-table th:nth-child(2) {
  width: 27%;
}
.ia-table th:nth-child(3) {
  width: 26%;
}
.ia-table td {
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.ia-table td:last-child {
  border-right: 0;
}
.ia-table tr:last-child td {
  border-bottom: 0;
}
.ia-table .location button {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 0;
}
.ia-table .location small {
  font-size: 10px;
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.ia-table ul {
  margin: 0;
  padding-left: 12px;
}
.ia-table li + li {
  margin-top: 6px;
}
.ia-table li button {
  padding: 0;
  text-align: left;
  font-size: 12px;
}
.ia-table .notes-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  overflow: hidden;
}
.ia-table .notes-clamp.expanded {
  display: block;
}
.ia-table .notes-more {
  margin-top: 4px;
  padding: 0;
  font-size: 11px;
  color: var(--accent);
}
.ia-table tr.search-match td {
  background: var(--selection-bg);
}
.table-none {
  color: var(--muted);
}
#panel-backdrop {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1250px) {
  .menubar {
    gap: 7px;
  }
  .project-name {
    max-width: 190px;
  }
  .search-wrap {
    width: 230px;
  }
  .drawing-tools button[data-mode] span {
    display: none;
  }
  .drawing-tools {
    gap: 1px;
  }
  .drawing-tools button {
    padding: 6px;
    min-width: 30px;
  }
  .drawing-tools svg {
    width: 19px;
    height: 19px;
  }
  .tool-divider {
    margin: 0 2px;
  }
  .panel-toggle {
    padding: 3px;
  }
  .brand-mark {
    display: none;
  }
}
@media (max-width: 1000px) {
  .project-name {
    max-width: 160px;
    min-width: 80px;
  }
  .search-wrap {
    width: 190px;
  }
  .menubar {
    gap: 5px;
  }
  .brand {
    font-size: 19px;
  }
  .file-actions button {
    padding: 5px 6px;
  }
  .drawing-tools #zoom-out,
  .drawing-tools #zoom-in,
  .zoom-divider {
    display: none;
  }
  .canvas-viewbar {
    left: 12px;
    right: 12px;
  }
  .canvas-viewbar > button {
    padding: 6px;
    font-size: 11px;
  }
  .drawing-tools {
    padding: 5px;
  }
  .drawing-tools kbd {
    display: none;
  }
}
@media (max-width: 760px) {
  .project-name {
    display: flex;
    flex: 0 1 128px;
    max-width: 128px;
    min-width: 0;
    padding-left: 5px;
  }
  .project-name input { width: 0; font-size: 12px; }
  #file-state { font-size: 10px; }
  .menubar {
    height: 46px;
    padding: 0 8px;
    gap: 4px;
  }
  .brand {
    font-size: 19px;
  }
  .search-wrap {
    flex: 1;
    width: auto;
    min-width: 35px;
  }
  .search-field {
    border: 0;
    padding: 0 5px;
    background: none;
  }
  .search-field input {
    width: 25px;
    color: transparent;
  }
  .search-field input::placeholder {
    color: transparent;
  }
  .search-field kbd {
    display: none;
  }
  .search-wrap:focus-within {
    position: absolute;
    left: 9px;
    right: 9px;
    max-width: none;
    background: var(--surface);
    z-index: 40;
  }
  .search-wrap:focus-within .search-field {
    border: 1px solid var(--strong);
    padding: 0 9px;
    background: var(--input);
  }
  .search-wrap:focus-within input {
    width: 100%;
    color: var(--ink);
  }
  .search-wrap:focus-within input::placeholder {
    color: var(--muted);
  }
  #search-results {
    width: calc(100vw - 20px);
  }
  .export-menu summary {
    padding: 5px 8px;
  }
  .file-actions button {
    padding: 5px;
    font-size: 12px;
  }
  .panel-toggle {
    font-size: 17px;
    padding: 3px;
  }
  #theme-toggle {
    font-size: 17px;
    padding: 3px;
  }
  aside {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(85vw, 350px);
    z-index: 25;
    border-right: 1px solid var(--strong);
    box-shadow: 7px 0 25px #0002;
  }
  #inspector {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(90vw, 370px);
    z-index: 25;
    border-left: 1px solid var(--strong);
    box-shadow: -7px 0 25px #0002;
  }
  #panel-backdrop:not([hidden]) {
    position: fixed;
    inset: 46px 0 0;
    display: block;
    border: 0;
    border-radius: 0;
    background: #1710203b;
    z-index: 20;
  }
  main {
    width: 100%;
  }
  .drawing-tools button {
    min-height: 38px;
    min-width: 35px;
  }
  .drawing-tools {
    padding: 6px;
    border-radius: 9px;
    gap: 1px;
  }
  .drawing-tools [data-tool="information"] svg {
    color: var(--info);
  }
  .drawing-tools [data-tool="interaction"] svg {
    color: var(--interaction);
  }
  #canvas-controls {
    bottom: max(13px, env(safe-area-inset-bottom));
    max-width: calc(100% - 14px);
  }
  .canvas-viewbar {
    top: 11px;
    left: 10px;
    right: 10px;
  }
  .canvas-viewbar > button {
    padding: 7px 10px;
    font-size: 12px;
  }
  .view-tabs button {
    padding: 5px 11px;
  }
  .link-port {
    width: 30px;
    height: 30px;
    right: -15px;
    opacity: 1;
    font-size: 25px;
  }
  .frame-title {
    font-size: 12px;
  }
  .create-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .create-screenshots {
    border: 0;
    padding: 0;
  }
  .create-screenshots .section-title {
    margin-top: 0;
  }
  .dialog-actions > .muted {
    display: none;
  }
  .dialog-actions {
    justify-content: flex-end;
  }
  dialog {
    padding: 18px;
  }
  .empty h1 {
    font-size: 24px;
  }
  .empty-art {
    transform: scale(0.85);
    margin-bottom: 18px;
  }
  .empty p {
    font-size: 13px;
  }
  .shortcuts {
    gap: 13px 10px;
    font-size: 12px;
  }
  #tool-status {
    font-size: 11px;
    max-width: calc(100% - 24px);
    white-space: normal;
    text-align: center;
    bottom: 80px;
  }
  .inspector-body {
    padding: 0 15px 12px;
  }
  .notes-panel {
    height: var(--notes-height);
  }
  .add-child {
    opacity: 1;
  }
  .detail-pair {
    gap: 8px;
  }
}
@media (pointer: coarse) {
  .link-port {
    opacity: 1;
  }
  .canvas-region > .region-name {
    opacity: 1;
    max-width: 100%;
  }
}
@media (max-width: 390px) {
  .brand {
    font-size: 17px;
  }
  .menubar {
    gap: 2px;
  }
  .drawing-tools {
    padding: 4px;
    gap: 0;
  }
  .drawing-tools button {
    min-width: 32px;
  }
  .export-menu summary {
    font-size: 12px;
  }
  .file-actions button {
    font-size: 11px;
  }
  .tool-divider {
    margin: 0 1px;
  }
}
/* Ink, paper and a few bright tabs: keep the work surface quiet. */
:root {
  --selection: #8054bc;
  --pink: #f6a9cf;
}
.menubar {
  border-bottom: 1.5px solid var(--ink);
}
.brand {
  letter-spacing: -1px;
}
.drawing-tools {
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 4px 0 var(--ink);
}
.canvas-viewbar .view-tabs {
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
#add-node {
  background: #f6a9cf;
  color: #302633;
  border: 1px solid #302633;
  border-radius: 6px;
}
.export-menu summary {
  box-shadow: 2px 2px 0 var(--ink);
}
.panel-heading {
  border-bottom: 1px solid var(--line);
}
.hierarchy-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 16px 4px;
  font-size: 12px;
  color: var(--muted);
}
.hierarchy-filter input {
  width: 14px;
  height: 14px;
  accent-color: var(--selection);
}
.frame-title {
  color: var(--ink);
  font-weight: 600;
}
.frame-pagination {
  z-index: 8;
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  background: var(--surface);
}
.frame-pagination button {
  min-width: 32px;
  min-height: 30px;
  touch-action: manipulation;
}
.thumbs {
  display: grid;
  grid-template-columns: 1fr;
  max-height: 370px;
  overflow: auto;
  padding: 4px;
}
.thumb {
  width: 100%;
  min-width: 0;
  height: auto;
  aspect-ratio: 16/10;
  padding: 5px;
  background: var(--bg);
  border-radius: 6px;
}
.thumb img, .thumb svg {
  object-fit: contain;
}
.thumb small {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px 0 4px 0;
}
.inline-name {
  width: 100%;
  min-width: 80px;
  padding: 3px 5px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--selection);
  border-radius: 3px;
  cursor: text;
  user-select: text;
}
.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
}
.context-menu button {
  display: block;
  text-align: left;
  width: 100%;
  padding: 9px 12px;
}
.context-menu button:hover,
.context-menu button:focus {
  background: var(--selection-bg);
}
.rectangle-editor {
  position: absolute;
  z-index: 30;
  border: 2px solid var(--selection);
  cursor: move;
  touch-action: none;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--selection) 6%, transparent);
}
.resize-handle {
  position: absolute;
  width: 13px;
  height: 13px;
  min-height: 0;
  padding: 0;
  border: 2px solid var(--selection);
  border-radius: 50%;
  background: var(--surface);
  transform: translate(-50%, -50%);
  touch-action: none;
}
.resize-handle::after {
  content: "";
  position: absolute;
  inset: -7px;
}
.handle-n {
  left: 50%;
  top: 0;
  cursor: ns-resize;
}
.handle-s {
  left: 50%;
  top: 100%;
  cursor: ns-resize;
}
.handle-w {
  left: 0;
  top: 50%;
  cursor: ew-resize;
}
.handle-e {
  left: 100%;
  top: 50%;
  cursor: ew-resize;
}
.handle-nw {
  left: 0;
  top: 0;
  cursor: nwse-resize;
}
.handle-ne {
  left: 100%;
  top: 0;
  cursor: nesw-resize;
}
.handle-sw {
  left: 0;
  top: 100%;
  cursor: nesw-resize;
}
.handle-se {
  left: 100%;
  top: 100%;
  cursor: nwse-resize;
}
.rectangle-actions {
  position: absolute;
  bottom: calc(100% + 15px);
  right: -2px;
  display: flex;
  gap: 5px;
  white-space: nowrap;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 6px;
  box-shadow: 2px 2px 0 var(--ink);
}
.rectangle-actions button {
  padding: 6px 10px;
}
.rectangle-actions [data-confirm] {
  background: #ffe183;
  color: #302633;
  border-radius: 3px;
}
.crop-editor {
  border: 1px solid white;
  box-shadow: 0 0 0 1000px #0008;
  background:
    linear-gradient(
      to right,
      transparent 33%,
      #ffffff60 33%,
      #ffffff60 33.2%,
      transparent 33.2%,
      transparent 66%,
      #ffffff60 66%,
      #ffffff60 66.2%,
      transparent 66.2%
    ),
    linear-gradient(
      to bottom,
      transparent 33%,
      #ffffff60 33%,
      #ffffff60 33.2%,
      transparent 33.2%,
      transparent 66%,
      #ffffff60 66%,
      #ffffff60 66.2%,
      transparent 66.2%
    );
}
.crop-editor .resize-handle {
  border-radius: 0;
  border-color: white;
  background: #242029;
  width: 15px;
  height: 15px;
}
.crop-editor .handle-n,
.crop-editor .handle-e,
.crop-editor .handle-s,
.crop-editor .handle-w {
  display: none;
}
#crop-stage {
  overflow: hidden;
  touch-action: none;
}
.ui-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.badge .ui-icon {
  width: 14px;
  height: 14px;
}
@media (max-width: 760px) {
  .thumbs {
    max-height: 260px;
  }
  .rectangle-actions {
    right: auto;
    left: 0;
  }
  .drawing-tools {
    box-shadow: 2px 3px 0 var(--ink);
  }
}

.graph-node.interaction > .frame-title {
  width: max-content;
  max-width: 260px;
  font-size: 12px;
}
.graph-node.interaction > .frame-surface {
  outline: 1px solid var(--line);
  outline-offset: 4px;
}
.rectangle-actions.inside {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
}
.rectangle-actions.below {
  top: calc(100% + 15px);
  bottom: auto;
}
/* Compact tools, quiet hierarchy, and semantic Material colour roles. */
.tree-children > .tree-item > .tree-card:after {
  display: none;
}
.tree-children {
  margin-left: 14px;
  padding-left: 14px;
}
.tree-children > .tree-item:before {
  left: -10px;
  border-color: var(--line);
  opacity: 1;
}
#node-count {
  display: inline-flex;
  margin-left: 9px;
  min-width: 23px;
  height: 22px;
  align-items: center;
  justify-content: center;
  background: var(--hover);
  border-radius: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
#expand-all {
  font-size: 11px;
  padding: 5px 7px;
  color: var(--muted);
}
.graph-node.interaction > .frame-title {
  display: none;
}
.detail-zoom .graph-node.interaction > .frame-title {
  display: block;
}
.drawing-tools button[data-mode] {
  gap: 0;
}
.drawing-tools button[data-mode] span {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    max-width 0.18s ease,
    opacity 0.18s ease,
    margin 0.18s ease;
  margin-left: 0;
}
.drawing-tools button[data-mode]:hover span,
.drawing-tools button[data-mode]:focus-visible span {
  max-width: 100px;
  opacity: 1;
  margin-left: 7px;
}
#add-node {
  background: var(--md-tertiaryContainer, var(--pink));
  color: var(--md-onTertiaryContainer, var(--ink));
  border-color: var(--strong);
}
.export-menu summary {
  background: var(--md-secondaryContainer, var(--yellow));
  color: var(--md-onSecondaryContainer, var(--ink));
}
.drawing-tools,
.export-menu summary,
.canvas-viewbar .view-tabs,
#back-to-content {
  box-shadow: 3px 3px 0 var(--md-outline, var(--strong));
}
.rectangle-actions [data-confirm] {
  background: var(--md-primaryContainer, var(--purple));
  color: var(--md-onPrimaryContainer, var(--ink));
}
.app-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 5px 5px 0 var(--strong);
}
.app-dialog h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
.app-dialog p {
  color: var(--muted);
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}
.dialog-actions button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  .drawing-tools button[data-mode] span {
    transition: none;
  }
}
.canvas-region.information {
  background: color-mix(in srgb, var(--info) 8%, transparent);
}
.canvas-region.interaction {
  background: color-mix(in srgb, var(--interaction) 8%, transparent);
}
.canvas-region.information .region-name {
  color: var(--md-onTertiary, var(--surface));
}
.canvas-region.interaction .region-name {
  color: var(--md-onSecondary, var(--surface));
}
.danger {
  color: var(--md-error, #b3261e);
}
/* Panel rails and shared interaction states. */
.pane-rail {
  display: flex;
  flex: 0 0 28px;
  width: 28px;
  padding: 14px 3px;
  align-items: center;
  gap: 18px;
  flex-direction: column;
  background: var(--surface);
  border: 0;
  border-inline: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
}
.pane-rail b {
  writing-mode: vertical-rl;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.pane-rail span {
  font-size: 23px;
  line-height: 1;
}
.panel-heading,
.inspector-heading {
  min-height: 48px;
  flex-shrink: 0;
  gap: 8px;
  padding-inline: 12px;
}
.panel-heading h2,
.inspector-heading h2 {
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.panel-heading button,
.inspector-heading button {
  flex: 0 0 28px;
  padding: 3px;
}
.hierarchy-tools {
  display: flex;
  gap: 4px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.hierarchy-tools button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 5px;
  border-radius: 5px;
}
.hierarchy-tools [aria-pressed="false"] {
  color: var(--muted);
  opacity: 0.65;
}
.hierarchy-tools [aria-pressed="true"] {
  color: var(--md-onPrimaryContainer);
  background: var(--md-primaryContainer);
}
.inspecting-type {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.count {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--md-surfaceContainerHighest, var(--hover));
  color: var(--md-onSurfaceVariant, var(--muted));
  font-size: 11px;
  font-weight: 500;
}
.section-title {
  justify-content: flex-start;
  gap: 8px;
}
.section-title button {
  margin-left: auto;
}
#library {
  overflow-x: hidden;
  position: relative;
}
.tree-card {
  min-height: 34px;
  white-space: nowrap;
  position: relative;
}
.node-text {
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(
    to right,
    #000 0,
    #000 calc(100% - 16px),
    transparent
  );
}
.node-text strong {
  white-space: nowrap;
  display: block;
  width: max-content;
  font-weight: 500;
}
.tree-card .add-child {
  display: none;
}
.tree-card:hover .add-child,
.tree-card:focus-within .add-child {
  display: block;
  flex-shrink: 0;
}
.tree-card .inline-name {
  width: 100%;
}
.node-text:has(.inline-name) {
  mask-image: none;
}
.drop-before::after,
.drop-after::after {
  content: "" !important;
  display: block !important;
  position: absolute;
  left: 0 !important;
  right: 0;
  width: auto !important;
  height: 3px !important;
  background: var(--selection);
  border: 0 !important;
  transform: none !important;
  opacity: 1 !important;
  z-index: 9;
}
.drop-before::after {
  top: -2px !important;
}
.drop-after::after {
  top: auto !important;
  bottom: -2px;
}
.drop-inside {
  outline: 2px solid var(--selection);
}
.drop-root {
  box-shadow: inset 0 -3px var(--selection);
}
#tooltip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  max-width: 280px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
  background: var(--md-inverseSurface, var(--ink));
  color: var(--md-inverseOnSurface, var(--surface));
  box-shadow: 0 3px 8px #0002;
}
button,
.export-menu summary {
  --state-ink: var(--md-onSurface, var(--ink));
  transition:
    background-color 0.12s ease,
    color 0.12s ease;
}
button:hover,
.export-menu summary:hover {
  background: color-mix(in srgb, var(--state-ink) 8%, var(--surface));
}
button:active {
  background: color-mix(in srgb, var(--state-ink) 12%, var(--surface));
}
button:focus-visible,
.export-menu summary:focus-visible {
  outline: 2px solid var(--selection);
  outline-offset: 2px;
}
.tree-card.selected,
.drawing-tools button.active,
.view-tabs button.active,
.pick-destination,
.hierarchy-tools [aria-pressed="true"] {
  --state-ink: var(--md-onPrimaryContainer);
  color: var(--md-onPrimaryContainer);
  background: var(--md-primaryContainer);
}
.tree-card.selected:hover,
.drawing-tools button.active:hover,
.view-tabs button.active:hover,
.pick-destination:hover,
.hierarchy-tools [aria-pressed="true"]:hover {
  background: color-mix(
    in srgb,
    var(--md-onPrimaryContainer) 8%,
    var(--md-primaryContainer)
  );
}
.tree-card.selected button {
  --state-ink: var(--md-onPrimaryContainer);
  color: inherit;
}
.tree-card.selected button:hover {
  background: color-mix(
    in srgb,
    var(--md-onPrimaryContainer) 12%,
    var(--md-primaryContainer)
  );
}
#add-node:hover {
  background: color-mix(
    in srgb,
    var(--md-onTertiaryContainer) 8%,
    var(--md-tertiaryContainer)
  );
}
.export-menu summary:hover {
  background: color-mix(
    in srgb,
    var(--md-onSecondaryContainer) 8%,
    var(--md-secondaryContainer)
  );
}
#tidy-graph:hover {
  background: var(--md-surfaceContainerHighest);
  color: var(--md-onSurface);
  border-color: var(--md-outline);
}
.paper {
  background: var(--md-secondaryContainer);
  border-color: var(--md-onSecondaryContainer);
  box-shadow: 3px 4px 0 var(--md-outline);
}
.paper:before {
  background: var(--md-onSecondaryContainer);
  box-shadow:
    0 18px 0 color-mix(in srgb, var(--md-onSecondaryContainer) 55%, transparent),
    0 36px 0 color-mix(in srgb, var(--md-onSecondaryContainer) 55%, transparent);
}
.paper.photo {
  background: var(--md-tertiaryContainer);
  border-color: var(--md-onTertiaryContainer);
  color: var(--md-onTertiaryContainer);
}
.paper.photo:after {
  color: var(--md-onTertiaryContainer);
}
@media (max-width: 760px) {
  .pane-rail {
    flex-basis: 25px;
    width: 25px;
    padding-inline: 2px;
  }
  .pane-rail b {
    font-size: 11px;
  }
  .app main {
    min-width: 0;
  }
  #hierarchy-panel {
    left: 25px;
  }
  #inspector {
    right: 25px;
  }
}
.graph-edge.return {
  stroke: var(--md-tertiary);
  stroke-dasharray: 6 4;
}
.arrow-return {
  fill: var(--md-tertiary);
}

/* One header, readable groups, and the same controls on both edges. */
.inspector-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 14px;
  overflow: hidden;
}
.inspector-heading .badge {
  flex: none;
}
.inspector-section {
  padding: 14px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--md-surfaceContainerLow, var(--surface));
}
.inspector-section h3,
.inspector-section .section-title {
  margin: 0 0 12px;
  font-size: 13px;
}
.inspector-section label {
  margin-bottom: 12px;
}
.inspector-section .manual-link label { margin: 0; }
.inspector-section .thumbs {
  margin-bottom: 0;
}
.inspector-section:nth-child(2) {
  background: var(--md-surfaceContainer, var(--surface));
}
.inspector-section:nth-child(3) {
  background: var(--md-surfaceContainerHigh, var(--surface));
}
.node-text {
  mask-image: linear-gradient(
    to right,
    #000 0%,
    #000 calc(100% - 36px),
    transparent 100%
  );
}
.name-suffix {
  color: var(--md-primary, var(--accent));
  font-weight: 500;
}
.name-suffix.view {
  color: var(--md-tertiary, var(--interaction));
}
.name-suffix.group,
.name-suffix.interaction {
  color: var(--muted);
}
.type-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
}
.type-filters button {
  padding: 7px;
  display: flex;
  border-radius: 6px;
}
.type-filters button[aria-pressed="true"] {
  color: var(--md-onPrimaryContainer);
  background: var(--md-primaryContainer);
}
.representation-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.ia-table {
  table-layout: auto;
}
.ia-table .location-branch {
  min-width: 22px;
  width: 22px;
  padding: 0;
  background: var(--md-surfaceContainerLow, var(--surface));
  border-right: 1px solid var(--line);
}
.ia-table .location {
  min-width: 160px;
}
.ia-table .location button {
  text-align: left;
  display: block;
}
.diagram-scroll {
  overflow: auto;
  padding: 16px;
}
.ia-diagram {
  position: relative;
}
.ia-diagram > svg {
  position: absolute;
  inset: 0;
  fill: none;
  stroke: var(--strong);
  stroke-width: 1.5;
}
.diagram-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: 1.5px solid var(--strong);
  background: var(--surface);
  border-radius: 4px;
  text-align: left;
}
.diagram-node small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.diagram-node strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.autocomplete {
  position: relative;
  width: 100%;
}
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 230px;
  overflow: auto;
  z-index: 30;
  padding: 4px;
  border: 1px solid var(--strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px #0003;
}
.suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
}
.suggestions button.active {
  background: var(--md-primaryContainer);
  color: var(--md-onPrimaryContainer);
}
.drawing-tools #zoom-out,
.drawing-tools #zoom-in {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#zoom-level { appearance: textfield; }
#zoom-level::-webkit-inner-spin-button {
  appearance: none;
}
@media (max-width: 760px) {
  .drawing-tools {
    gap: 1px;
  }
  .drawing-tools button {
    min-width: 30px;
    padding: 6px;
  }
  .view-tabs button {
    padding: 6px 8px;
    font-size: 12px;
  }
  .inspector-section {
    padding: 12px;
  }
}
.table-mode .representation-toolbar {
  padding-top: 62px;
}
.table-mode .table-wrap {
  padding: 16px 24px 32px;
}
.name-suffix {
  margin-inline-start: 0.18em;
}
.diagram-node.text-only {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.diagram-node.text-only strong { width: 100%; }
.diagram-node.text-only:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.diagram-node.text-only:focus-visible { outline: 2px dashed var(--selection); outline-offset: -8px; }
.diagram-node.text-only:hover,
.diagram-node.text-only:focus-visible {
  background: transparent;
}
.type-filters button[aria-pressed="mixed"] {
  background: var(--md-secondaryContainer);
  color: var(--md-onSecondaryContainer);
}
.filter-state {
  font-size: 11px;
  padding-inline: 4px;
}

/* Relationships stay compact; name and screenshot controls remain open. */
.inspector-section.inspector-accordion {
  padding: 0;
}
.inspector-accordion > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9px;
}
.inspector-accordion > summary::-webkit-details-marker {
  display: none;
}
.inspector-accordion > summary > .ui-icon {
  margin-left: auto;
  width: 15px;
  height: 15px;
  transition: transform 0.15s ease;
}
.inspector-accordion[open] > summary > .ui-icon {
  transform: rotate(90deg);
}
.inspector-accordion > summary:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.inspector-accordion > summary:focus-visible {
  outline: 2px solid var(--selection);
  outline-offset: -3px;
}
.accordion-content {
  padding: 0 14px 14px;
}
.accordion-content > .muted {
  margin: 4px 0 12px;
}
.interaction-list {
  padding: 0 6px 6px;
}
.interaction-list > .muted { margin-inline: 8px; }
.inspector-accordion .interaction-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  margin: 0;
  border: 0;
  border-radius: 5px;
}
.interaction-row .interaction-label {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.interaction-label .label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.interaction-label .name-suffix {
  flex: none;
}
.interaction-row > .ui-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
}
.name-suffix.interaction {
  color: var(--md-secondary, var(--interaction));
}
.name-suffix.group {
  color: var(--md-onSurfaceVariant, var(--muted));
}
.incoming-row {
  width: 100%;
  text-align: left;
  padding: 8px 0;
}
.destination-row > button:first-child {
  text-align: left;
}
@media (prefers-reduced-motion: reduce) {
  .inspector-accordion > summary > .ui-icon {
    transition: none;
  }
}

/* Review views use the same open workspace as the screenshot canvas. */
#workspace.table-mode {
  overflow: hidden;
  padding: 0;
  touch-action: none;
}
.representation-world {
  position: absolute;
  width: max-content;
  transform-origin: 0 0;
}
.table-mode .table-wrap {
  padding: 0;
  width: 1180px;
  overflow: visible;
}
.table-mode .ia-table {
  width: 100%;
  /* Every column has an explicit width, so Notes keeps its share. */
  table-layout: fixed;
}
.diagram-scroll {
  padding: 0;
  overflow: visible;
}
.canvas-viewbar {
  align-items: flex-start;
}
.canvas-viewbar #view-filters {
  position: static;
  padding: 0;
  border: 0;
  background: var(--surface);
  border-radius: 8px;
  margin-left: auto;
  display: flex;
  align-items: center;
}
.type-filters button {
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
}
.filter-state {
  line-height: 1;
  padding: 0 2px;
  transform: translateY(-0.5px);
}
.review-controls [data-tool],
.review-controls #add-node,
.review-controls .tool-divider {
  display: none;
}
.inspector-body {
  padding-top: 14px;
}
.inspector-section,
.inspector-section:nth-child(2),
.inspector-section:nth-child(3) {
  background: var(--md-surfaceContainer, var(--surface));
}
.inspector-accordion[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
  margin-bottom: 12px;
}
.zoom-control {
  position: relative;
}
.drawing-tools #zoom-trigger {
  min-width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}
#zoom-trigger > span {
  color: var(--muted);
}
#zoom-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 210px;
  padding: 12px;
  border: 1px solid var(--strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 3px 4px 0 var(--strong);
}
#zoom-popover .zoom-value {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  background: var(--input);
}
.zoom-value:focus-within {
  outline: 2px solid var(--selection);
  outline-offset: 1px;
}
#zoom-popover #zoom-level {
  width: 54px;
  min-height: 30px;
  padding: 4px;
  text-align: right;
  outline: none;
  box-shadow: none;
  border: 0;
  background: transparent;
}
.zoom-value > span {
  padding: 0;
}
.zoom-presets {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.drawing-tools .zoom-presets button {
  flex: 1;
  padding: 6px;
  font-size: 12px;
}
.drawing-tools #zoom-fit {
  width: 100%;
  text-align: left;
  padding: 8px;
}
@media (max-width: 760px) {
  .canvas-viewbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .canvas-viewbar #view-filters {
    margin-left: auto;
  }
  .drawing-tools #zoom-trigger {
    min-width: 54px;
    padding: 6px 4px;
  }
}
/* Compact controls share the same raised tray at every viewport size. */
.canvas-viewbar { flex-wrap: nowrap; gap: 8px; }
.canvas-viewbar .view-tabs, .canvas-viewbar #view-filters {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 3px;
  padding: 4px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); box-shadow: 3px 3px 0 var(--line);
}
.canvas-viewbar .view-tabs .nav, .canvas-viewbar #view-filters button,
.canvas-viewbar #tidy-graph { position: relative; display: inline-flex; align-items: center;
  justify-content: center; width: 38px; min-width: 38px; height: 38px; padding: 8px; }
.canvas-viewbar #view-filters { margin-left: auto; }
.mode-dot { position: absolute; right: 4px; bottom: 3px; width: 5px; height: 5px;
  border-radius: 1px; background: currentColor; }
.mode-dot.text { width: 8px; height: 2px; }
.mode-dot.hidden { background: transparent; border: 1px solid currentColor; }
.inspector-accordion .interaction-list { overflow-x: auto; padding: 8px 14px;
  mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent); }
.inspector-accordion .interaction-row { width: max-content; min-width: 100%; padding: 9px 0; }
.interaction-row .interaction-label { display: inline; flex: none; white-space: nowrap; }
.interaction-label .label-text { overflow: visible; }
.flow-arrow { margin-inline: 6px; color: var(--muted); }
.interaction-list > .muted { margin-inline: 0; }
.inspector-section .thumbs { max-height: 360px; overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent); padding-bottom: 16px; }
.inspector-section .thumbs:empty { display: none; }
.screenshot-add { display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 76px; border: 1px dashed var(--line); border-radius: 6px;
  margin-top: 8px; background: var(--md-surfaceContainerLow); }
.screenshot-add small { display: block; margin-top: 4px; color: var(--muted); font-weight: normal; }
#zoom-popover { width: 210px; }
#zoom-popover .zoom-value, #zoom-popover #zoom-level, #zoom-popover .zoom-value > span {
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 24px; }
#zoom-popover #zoom-level { appearance: textfield; width: 48px; padding: 4px 0; margin: 0; }
#zoom-level::-webkit-inner-spin-button, #zoom-level::-webkit-outer-spin-button { appearance: none; margin: 0; }
#zoom-popover .zoom-value { gap: 2px; }
#zoom-popover #zoom-fit { border: 0; background: transparent; box-shadow: none; }
#zoom-popover #zoom-fit:hover { background: var(--md-secondaryContainer); color: var(--md-onSecondaryContainer); }
#library [data-node] { touch-action: none; }
.hierarchy-touch-drag { opacity: .55; }
@media (max-width: 760px) {
  .canvas-viewbar { flex-wrap: nowrap; padding: 10px 6px; gap: 6px; }
  .canvas-viewbar .view-tabs .nav, .canvas-viewbar #view-filters button {
    width: 30px; min-width: 30px; height: 38px; padding: 6px;
  }
  .canvas-viewbar .view-tabs, .canvas-viewbar #view-filters { padding: 2px; gap: 0; }
  .canvas-viewbar #view-filters { margin-left: auto; }
}
.canvas-viewbar #filter-toggle { display: none; }
@media (max-width: 760px) {
  .canvas-viewbar .view-tabs .nav { width: 44px; min-width: 44px; height: 44px; }
  .canvas-viewbar #filter-toggle { display: inline-flex; margin-left: auto;
    width: 44px; height: 44px; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: var(--surface); box-shadow: 3px 3px 0 var(--line); }
  .canvas-viewbar #view-filters { display: none; }
  .canvas-viewbar #view-filters.filters-open { display: flex; position: absolute;
    top: calc(100% + 2px); right: 6px; z-index: 10; padding: 5px; }
  .canvas-viewbar #view-filters button { width: 44px; min-width: 44px; height: 44px; }
  .menubar button, .export-menu summary { min-height: 40px; }
  .menu-popover { max-height: calc(100dvh - 70px); overflow-y: auto; }
  input, textarea, select { font-size: 16px; }
  dialog { max-height: calc(var(--dialog-visible-height, 100dvh) - 24px); }
  .thumb { touch-action: pan-y; }
}
@media (max-width: 360px) {
  .brand { font-size: 16px; }
  .menubar { gap: 2px; padding-inline: 5px; }
  .file-actions button { padding-inline: 4px; }
  .export-menu summary { font-size: 12px; padding-inline: 6px; }
}
.interaction-row .interaction-label span { display: inline; }
@media (pointer: coarse) {
  .context-menu button { min-height: 44px; }
  .pane-rail { min-width: 24px; }
  .resize-handle::after { inset: -15px; }
}

.interaction-row { padding-right: 24px; }
@media (max-width: 760px) {
  #inspector input, #inspector textarea, dialog input, dialog textarea, dialog select,
  #zoom-popover #zoom-level, #zoom-popover .zoom-value > span { font-size: 16px; }
}
/* App identity and chrome use the same compact, outlined controls. */
.menubar .brand { display: inline-flex; align-items: center; gap: 0; padding: 0;
  border: 0; background: transparent; box-shadow: none; white-space: nowrap; }
.brand img { width: 27px; height: 27px; margin-right: 6px; }
#theme-toggle, #collapse-hierarchy, #close-inspector, #load-example, #toggle-help {
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
#theme-toggle, #collapse-hierarchy, #close-inspector, #toggle-help {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 5px;
}
.hierarchy-empty { padding: 8px 6px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.hierarchy-empty p { margin: 0 0 10px; }
.panel-bottom { gap: 8px; padding: 10px; }
#load-example { padding: 6px 10px; }
.canvas-viewbar #tidy-graph { border-radius: 9px; border: 1px solid var(--line); box-shadow: 3px 3px 0 var(--line); }
.nav-label { display: inline-block; max-width: 0; opacity: 0; overflow: hidden;
  white-space: nowrap; transition: max-width .18s ease, opacity .18s ease, margin .18s ease; }
@media (hover: hover) and (min-width: 1000px) {
  .canvas-viewbar:not(.joined):not(.compact) .view-tabs .nav { width: auto; }
  .canvas-viewbar:not(.joined):not(.compact) .nav:hover .nav-label,
  .canvas-viewbar:not(.joined):not(.compact) .nav:focus-visible .nav-label {
    max-width: 100px; opacity: 1; margin-left: 7px;
  }
}
.canvas-viewbar.joined { width: max-content; right: auto; justify-content: start; gap: 6px;
  border: 1px solid var(--line); border-radius: 9px; padding: 4px;
  background: var(--surface); box-shadow: 3px 3px 0 var(--line); }
.canvas-viewbar.joined .view-tabs, .canvas-viewbar.joined #view-filters {
  border: 0; border-radius: 0; background: transparent; box-shadow: none; margin: 0; padding: 0;
}
.canvas-viewbar.joined #view-filters { display: flex; position: static; border-left: 1px solid var(--line); padding-left: 6px; }
.canvas-viewbar.joined #filter-toggle { display: none; }
.canvas-viewbar.joined #tidy-graph { box-shadow: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; margin-left: 0; }
.canvas-viewbar.compact #filter-toggle { display: inline-flex; margin-left: auto; align-items: center;
  justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line); box-shadow: 3px 3px 0 var(--line); }
.canvas-viewbar.compact #view-filters { display: none; }
.canvas-viewbar.compact #view-filters.filters-open { display: flex; position: absolute; top: calc(100% + 5px); right: 0; padding: 5px; }
.canvas-viewbar.compact #view-filters button { width: 40px; min-width: 40px; height: 44px; }
.key-combo { display: inline-flex; align-items: center; gap: 4px; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px;
  min-height: 22px; padding: 1px 5px; font-family: inherit; font-size: 12px; line-height: 1.3; }
#about-dialog { width: min(380px, calc(100vw - 28px)); text-align: center; padding: 30px 24px; }
#about-dialog.show-changelog { width: min(660px, calc(100vw - 28px)); }
#about-dialog.show-changelog[open] { display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.about-close { position: absolute; top: 8px; right: 8px; }
.about-icon { width: 84px; height: 84px; }
#about-title { margin: 14px 0 0; font-size: 30px; }
#about-dialog.show-changelog .about-icon { width: 52px; height: 52px; }
#about-dialog.show-changelog #about-title { margin-top: 5px; font-size: 24px; }
#about-version { margin: 3px 0 12px; padding: 2px 4px; color: var(--selection); font-weight: 700; }
#about-version:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
#about-version span { display: inline-block; margin-left: 2px; font-size: 12px; }
#about-overview { padding-top: 4px; }
#about-changelog { align-self: stretch; flex: 0 1 auto; min-height: 0; max-height: 570px; margin-top: 8px; padding: 0 8px 4px 1px; overflow: auto; text-align: left; overscroll-behavior: contain; }
.changelog-era { margin-top: 20px; }
.changelog-era:first-of-type { margin-top: 0; }
.changelog-era h2 { margin: 0 0 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--selection-bg); font-size: 15px; font-weight: 400; line-height: 1.35; }
.changelog-entry { padding: 12px 12px 14px; border-bottom: 1px solid var(--line); }
.changelog-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.changelog-entry-head strong { color: var(--selection); white-space: nowrap; }
.changelog-entry h3 { margin: 0; font-size: 15px; font-weight: 400; }
.changelog-entry ul { margin: 7px 0 0; padding-left: 19px; color: var(--strong); line-height: 1.4; }
.changelog-entry li + li { margin-top: 3px; }
.offline-download { display: inline-block; margin-top: 12px; padding: 10px 14px;
  background: var(--md-primaryContainer); color: var(--md-onPrimaryContainer);
  border: 1px solid var(--line); border-radius: 7px; text-decoration: none; box-shadow: 3px 3px 0 var(--line); }
.offline-download:hover { filter: brightness(.95); }
#about-dialog .muted { font-size: 12px; margin-top: 18px; }
@media (max-width: 760px) {
  .brand img { width: 23px; height: 23px; margin-right: 4px; }
  .search-wrap { min-width: 28px; }
  .search-field { height: 34px; display: flex; align-items: center; padding: 0; }
  .search-field > span { display: inline-flex; align-items: center; justify-content: center; width: 28px; }
  .search-wrap:not(:focus-within) .search-field input { position: absolute; width: 28px; height: 34px; opacity: 0; }
  .export-menu summary { min-height: 32px; height: 32px; padding: 4px 8px; display: flex; align-items: center; gap: 4px; font-size: 12px; }
  .menubar #theme-toggle { min-height: 32px; min-width: 30px; }
  .menubar .brand { font-size: 17px; }
}
@media (max-width: 360px) {
  .brand img { display: none; }
  .menubar .brand { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .nav-label { transition: none; } }
.canvas-viewbar.compact ~ #canvas-controls .drawing-tools #zoom-trigger { min-width: 48px; }
.canvas-viewbar.compact ~ #canvas-controls .drawing-tools .tool-label,
.canvas-viewbar.compact ~ #canvas-controls .drawing-tools kbd { display: none; }
/* Hover surfaces keep their own inset, separate from section spacing. */
#show-source { display: inline-flex; align-items: center; min-height: 36px;
  margin: 10px 0 0; padding: 8px 10px; border-radius: 6px; }
.inspector-accordion .interaction-list { padding: 4px 8px; }
.inspector-accordion .interaction-row { padding: 7px 10px; min-height: 34px; }
.interaction-list > .muted { margin: 8px 6px; }
.inspector-section .incoming-row { padding: 8px 10px; border-radius: 6px; }
.inspector-actions button, #create-destination { padding: 8px 10px; border-radius: 6px; }
.inspector-accordion[data-inspector-section="interactions"] > summary { margin-bottom: 0; }
/* Touch drawers attach to the screen edge, with a dedicated resizing hit area. */
@media (max-width: 760px) {
  #hierarchy-panel { left: 0; width: var(--mobile-left-width); }
  #inspector { right: 0; left: auto; width: var(--mobile-right-width); }
  #left-resizer, #right-resizer { position: absolute; top: 0; bottom: 0;
    width: 16px; z-index: 30; margin: 0; background: transparent; touch-action: none; }
  #left-resizer { left: calc(var(--mobile-left-width) - 8px); }
  #right-resizer { right: calc(var(--mobile-right-width) - 8px); }
  #left-resizer::after, #right-resizer::after { content: ""; position: absolute;
    top: calc(50% - 20px); left: 6px; width: 4px; height: 40px; border-radius: 3px;
    background: var(--md-outline, var(--line)); }
  .canvas-viewbar #tidy-graph, .canvas-viewbar #filter-toggle { width: 50px; min-width: 50px; height: 50px; padding: 11px; }
  .canvas-viewbar.joined #tidy-graph { width: 44px; min-width: 44px; height: 44px; }
  .canvas-viewbar ~ #canvas-controls .drawing-tools button svg { flex-shrink: 0; width: 19px; height: 19px; }
  .canvas-viewbar ~ #canvas-controls .drawing-tools #zoom-trigger { height: var(--touch-tool-size, 32px); min-height: var(--touch-tool-size, 32px); }
  .drawing-tools { align-items: center; }
}
/* Keep each hit surface distinct, including in the merged control tray. */
.canvas-viewbar .view-tabs, .canvas-viewbar #view-filters { gap: 4px; }
.canvas-viewbar.joined { gap: 0; }
.canvas-viewbar.joined #view-filters { margin-left: 8px; padding-left: 8px; gap: 4px; }
.canvas-viewbar.joined #tidy-graph {
  position: relative; margin-left: 17px; border: 0; border-radius: 6px;
  width: 38px; min-width: 38px; height: 38px; padding: 8px;
}
.canvas-viewbar.joined #tidy-graph::before {
  content: ""; position: absolute; left: -9px; top: 2px; bottom: 2px;
  width: 1px; background: var(--line); pointer-events: none;
}
@media (max-width: 760px) {
  .canvas-viewbar.joined #tidy-graph { width: 44px; min-width: 44px; height: 44px; }
  .canvas-viewbar:not(.joined) #tidy-graph { width: 50px; min-width: 50px; height: 50px; }
}
@media (max-width: 360px) {
  .drawing-tools #zoom-out, .drawing-tools #zoom-in { display: none; }
}
/* Keep the type readable when the frame name runs out of space. */
.frame-title { display: flex; align-items: baseline; gap: 4px; }
.frame-title > .label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.frame-title > .name-suffix { flex: 0 0 auto; }
.graph-node.compact-frame > .frame-pagination { display: none; }
.graph-node.tiny-title > .frame-title > * { display: none; }
.graph-node.tiny-title > .frame-title::after { content: "…"; }
.graph-node.tiny-title.page > .frame-title { color: var(--md-primary, var(--accent)); }
.graph-node.tiny-title.view > .frame-title { color: var(--md-tertiary, var(--interaction)); }
.graph-node.tiny-title.interaction > .frame-title { color: var(--md-secondary, var(--interaction)); }
.graph-node.tiny-title.group > .frame-title { color: var(--md-onSurfaceVariant, var(--muted)); }
.canvas-viewbar.compact #view-filters button { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; }
.canvas-viewbar ~ #canvas-controls .drawing-tools #zoom-out,
.canvas-viewbar ~ #canvas-controls .drawing-tools #zoom-in { flex: 0 0 26px; width: 26px; min-width: 26px; padding-inline: 2px; }
.canvas-viewbar ~ #canvas-controls .drawing-tools #zoom-trigger { width: 44px; min-width: 44px; padding-inline: 2px; }
.about-close { display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; font-size: 28px; line-height: 1; border-radius: 6px; }
@media (max-width: 760px) {
  #left-resizer, #right-resizer { border: 0; }
}

#close-help, #close-image { min-width: 44px; min-height: 44px; font-size: 22px; }
/* Control geometry follows available canvas space, including browser zoom. */
.canvas-viewbar { --chrome-size: 40px; align-items: flex-start; }
.canvas-viewbar .view-tabs, .canvas-viewbar #view-filters { padding: 4px; gap: 4px; }
.canvas-viewbar .view-tabs .nav,
.canvas-viewbar #view-filters button,
.canvas-viewbar.compact #view-filters button {
  flex: 0 0 var(--chrome-size); width: var(--chrome-size); min-width: var(--chrome-size);
  height: var(--chrome-size); min-height: var(--chrome-size); padding: 8px; border-radius: 6px;
}
.canvas-viewbar:not(.joined) #tidy-graph,
.canvas-viewbar #filter-toggle, .canvas-viewbar.compact #filter-toggle {
  flex: none; width: calc(var(--chrome-size) + 10px); min-width: calc(var(--chrome-size) + 10px);
  height: calc(var(--chrome-size) + 10px); padding: 12px; border-radius: 9px;
}
.canvas-viewbar.joined .view-tabs, .canvas-viewbar.joined #view-filters { padding-block: 0; }
.canvas-viewbar.joined #tidy-graph {
  flex: none; width: var(--chrome-size); min-width: var(--chrome-size);
  height: var(--chrome-size); padding: 8px; border-radius: 6px;
}
.canvas-viewbar .nav-label { display: none; }
.canvas-viewbar ~ #canvas-controls .drawing-tools {
  display: flex; align-items: center; gap: 4px; padding: 5px;
}
.canvas-viewbar ~ #canvas-controls .drawing-tools > button[data-tool],
.canvas-viewbar ~ #canvas-controls .drawing-tools > #add-node {
  flex: 0 0 var(--tool-size, 40px); width: var(--tool-size, 40px); min-width: var(--tool-size, 40px);
  height: var(--tool-size, 40px); min-height: var(--tool-size, 40px); padding: 8px; border-radius: 6px;
}
.canvas-viewbar ~ #canvas-controls .drawing-tools button[data-mode] span,
.canvas-viewbar ~ #canvas-controls .drawing-tools kbd { display: none; }
.canvas-viewbar ~ #canvas-controls .drawing-tools .tool-divider { margin-inline: 2px; flex: 0 0 1px; }
.canvas-viewbar ~ #canvas-controls .drawing-tools #zoom-trigger { height: var(--tool-size, 40px); min-height: var(--tool-size, 40px); }
.zoom-symbol { display: none; }
#canvas-controls.compact-zoom #zoom-trigger .zoom-number { display: none; }
#canvas-controls.compact-zoom #zoom-trigger .zoom-symbol { display: flex; }
.canvas-viewbar ~ #canvas-controls.compact-zoom .drawing-tools #zoom-trigger {
  flex: none; width: var(--tool-size, 40px); min-width: var(--tool-size, 40px); padding: 8px;
}
.canvas-viewbar ~ #canvas-controls.compact-zoom .drawing-tools #zoom-out,
.canvas-viewbar ~ #canvas-controls.compact-zoom .drawing-tools #zoom-in { display: none; }
#zoom-popover #zoom-fit {
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); min-height: 36px;
}
#zoom-popover #zoom-fit { width: 100%; }
.panel-resizer, .panel-resizer:hover, .panel-resizer:focus-visible { border: 0; background: transparent; }
.panel-resizer::after { left: 1px; top: calc(50% - 18px); width: 3px; height: 36px;
  border: 0; border-radius: 3px; background: var(--muted); opacity: .55; }
.panel-resizer:hover::after, .panel-resizer:focus-visible::after { opacity: 1; background: var(--selection); }
#library:has(.hierarchy-empty) { padding: 16px; }
#library .hierarchy-empty { padding: 0; line-height: 1.5; }
#library .hierarchy-empty p { margin: 0; }
#library .hierarchy-empty p + p { margin-top: 6px; }
.search-field > span { display: flex; align-items: center; justify-content: center; flex: 0 0 20px; height: 100%; }
.search-field > span svg { width: 20px; height: 20px; display: block; }
.tree-card.search-match { box-shadow: none; outline: 1px solid var(--selection); outline-offset: -1px; }
.context-menu .danger { color: var(--md-error, #ba1a1a); }
.file-actions { align-items: center; gap: 4px; }
#undo, #redo { width: 32px; height: 32px; padding: 6px; flex: none; border: 1px solid var(--line); border-radius: 6px; }
#file-menu { position: relative; }
#file-menu > summary { display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; list-style: none; }
#file-menu > summary::-webkit-details-marker { display: none; }
#file-menu-content { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); box-shadow: 3px 3px 0 var(--line); }
#file-menu .file-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
#file-menu .file-actions > button { min-height: 40px; margin: 0; }
#file-menu .file-actions > button:not(#undo):not(#redo) { grid-column: 1 / -1; text-align: left; }
#file-menu #undo, #file-menu #redo { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
#file-menu #undo::after { content: 'Undo'; } #file-menu #redo::after { content: 'Redo'; }
#file-menu .export-menu { margin-top: 4px; }
#file-menu .export-menu summary { box-shadow: none; height: 40px; }
#file-menu .menu-popover { position: static; width: 100%; min-width: 0; max-height: 45dvh; box-shadow: none; }
@media (max-width: 760px) {
  .canvas-viewbar { --chrome-size: 40px; }
  #left-resizer::after { left: 0; width: 3px; border: 0; }
  #right-resizer::after { left: 13px; width: 3px; border: 0; }
}
@media (max-width: 899px) {
  #file-menu-content { position: fixed; left: 8px; top: 54px; width: min(280px, calc(100vw - 16px)); max-height: calc(100dvh - 64px); overflow-y: auto; }
}
#close-about .ui-icon, #close-help .ui-icon, #close-image .ui-icon { width: 24px; height: 24px; }
.drawing-tools svg { stroke-width: 1.7; }
.drawing-tools [data-tool="select"] svg { stroke-width: 1; }
/* App chrome uses one spacing scale across browsers and workspace modes. */
.menubar { height: 56px; padding: 0 14px; gap: 12px; }
#history-actions { display: flex; gap: 4px; align-items: center; }
#history-actions[hidden] { display: none; }
#file-menu > summary, .menubar #theme-toggle { width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 7px; }
.menubar .search-wrap { margin-left: auto; }
.menubar .search-field { height: 36px; }
#file-menu-content { top: calc(100% + 10px); }
#zoom-trigger .zoom-number { display: inline; color: var(--ink); }
#zoom-trigger .zoom-symbol { display: none; }
#canvas-controls.compact-zoom #zoom-trigger .zoom-number { display: none; }
#canvas-controls.compact-zoom #zoom-trigger .zoom-symbol { display: flex; }
.canvas-viewbar:not(.joined) { padding: 0; }
.canvas-viewbar { top: 12px; left: 12px; }
#library, .inspector-body { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#library::-webkit-scrollbar, .inspector-body::-webkit-scrollbar { width: 6px; height: 6px; }
#library::-webkit-scrollbar-thumb, .inspector-body::-webkit-scrollbar-thumb { background: var(--line); border: 1px solid var(--surface); border-radius: 4px; }
#library { margin-right: 10px; }
#hierarchy-panel .panel-heading, #hierarchy-panel .panel-bottom { flex-shrink: 0; }
@media (max-width: 1050px) {
  .menubar { gap: 10px; padding-inline: 10px; }
  .menubar .search-wrap:not(:focus-within) { flex: 0 0 36px; width: 36px; min-width: 36px; margin-left: 0; }
  .menubar .search-wrap:not(:focus-within) .search-field {
    width: 36px; height: 36px; padding: 7px; border: 1px solid var(--line);
    border-radius: 6px; display: flex; gap: 0; position: relative;
  }
  .menubar .search-wrap:not(:focus-within) .search-field > span { width: 20px; flex-basis: 20px; }
  .menubar .search-wrap:not(:focus-within) .search-field input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .menubar #theme-toggle { margin-left: auto; }
  .menubar .search-wrap:focus-within .search-field { height: 40px; }
}
@media (max-width: 760px) {
  .canvas-viewbar, .canvas-viewbar.joined, .canvas-viewbar.compact { top: 12px; left: 12px; }
  #left-resizer::after { left: 4px; }
}
@media (max-width: 899px) { #file-menu-content { top: 54px; } }
#canvas-controls.review-controls #zoom-popover { right: 50%; transform: translateX(50%); }
#zoom-popover { max-height: max(100px, calc(var(--visible-height, 100dvh) - 140px)); overflow-y: auto; }
.menubar .brand img { display: block; }
@media (max-width: 360px) {
  .menubar .brand { width: 36px; min-width: 36px; padding: 5px; font-size: 0; letter-spacing: 0; }
  .menubar .brand img { width: 24px; height: 24px; margin: 0; }
  #file-state::before { content: ""; margin: 0; }
}
#history-actions #undo, #history-actions #redo { width: 36px; height: 36px; padding: 7px; }
.menubar button:not(.brand) > .ui-icon, #file-menu > summary > .ui-icon { width: 20px; height: 20px; }
/* Compact zoom editor: one title, one control row, one fit action. */
#zoom-popover .zoom-title { font-size: 13px; margin-bottom: 10px; }
#zoom-popover .zoom-adjustment { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
#zoom-popover .zoom-adjustment button {
  flex: 0 0 36px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 7px;
  border: 1px solid var(--line); border-radius: 6px;
}
#zoom-popover .zoom-adjustment .ui-icon { width: 20px; height: 20px; }
#zoom-popover .zoom-value { flex: 1; min-width: 0; height: 36px; justify-content: center; padding: 0 4px; }
#zoom-popover #zoom-level { width: 44px; min-width: 0; font-size: 16px; }
#zoom-popover .zoom-value > span { font-size: 16px; }
#file-menu .file-actions > button:not(#undo):not(#redo), #file-menu .export-menu > summary {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  width: 100%; height: 40px; padding: 8px 10px; margin: 0;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--ink); font-size: 12px; font-weight: 400; line-height: 1.2; box-shadow: none;
}
#file-menu .export-menu > summary:hover, #file-menu .file-actions > button:hover { background: var(--hover); }
#file-menu .export-menu > summary span { display: flex; margin-left: auto; }
#file-menu .export-menu > summary .ui-icon { width: 20px; height: 20px; }
/* A single breakpoint governs both states of the compact search field. */
@media (max-width: 1050px) {
  .menubar .search-field kbd { display: none; }
  .menubar .search-wrap:focus-within {
    position: absolute; left: 10px; right: 10px; top: 8px;
    width: auto; min-width: 0; max-width: none; margin: 0; z-index: 40;
    background: var(--surface);
  }
  .menubar .search-wrap:focus-within .search-field {
    width: 100%; height: 40px; display: flex; gap: 8px; padding: 0 10px;
    background: var(--input); border: 1px solid var(--strong); border-radius: 6px;
  }
  .menubar .search-wrap:focus-within .search-field > span { flex: 0 0 20px; }
  .menubar .search-wrap:focus-within input {
    position: static; width: 100%; min-width: 0; height: auto; opacity: 1; color: var(--ink);
  }
  .menubar .search-wrap:focus-within input::placeholder { color: var(--muted); }
  .menubar #search-results { width: 100%; }
}

/* Keep menus above the mobile pane resize handles. */
.menubar { z-index: 40; }
/* File and export actions share one bounded scroll area. */
#file-menu-content {
  width: min(320px, calc(100vw - 16px));
  max-height: calc(var(--visible-height, 100dvh) - var(--menubar-height, 56px) - 18px);
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
#file-menu .menu-popover {
  position: static; width: 100%; min-width: 0; max-height: none; overflow: visible;
  padding: 8px 0 0; border: 0; border-radius: 0; box-shadow: none;
}
#file-menu #export-types { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 2px 12px; }
#file-menu #export-types button { flex: 0 0 36px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 7px; }
.export-option { padding: 12px 4px; border-top: 1px solid var(--line); }
.export-option h3 { margin: 0; font-size: 13px; font-weight: 600; }
.export-option p { margin: 5px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
#file-menu .export-formats { display: flex; gap: 6px; }
#file-menu .export-formats button { flex: 1; width: auto; min-width: 0; min-height: 36px; padding: 7px; justify-content: center; border: 1px solid var(--line); border-radius: 6px; }
#file-menu .menu-popover #compress-project { border-radius: 6px; }
.notes-panel, #notes-resizer { background: var(--md-surfaceContainerHigh, var(--note)); }
#notes-resizer { height: 12px; }
#notes-resizer::after { width: 36px; height: 3px; border: 0; border-radius: 3px; background: var(--muted); left: calc(50% - 18px); top: 4px; }
@media (max-width: 760px), (pointer: coarse) {
  #notes-resizer { height: 24px; }
  #notes-resizer::after { top: 10px; }
}

/* File actions and export choices share the same spacing and interaction states. */
#file-menu .file-actions > button:not(#undo):not(#redo):is(:hover, :focus-visible),
#file-menu .export-menu > summary:is(:hover, :focus-visible),
#file-menu .export-option > summary:is(:hover, :focus-visible),
#file-menu .export-filters > summary:is(:hover, :focus-visible) { background: var(--hover); }
#file-menu .export-option { padding: 2px 0; border: 0; }
#file-menu .export-option > summary, #file-menu .export-filters > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; padding: 8px 10px; border-radius: 6px; list-style: none;
  font-size: 12px; font-weight: 400; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid transparent; box-shadow: none; width: 100%; margin: 0;
}
#file-menu .export-option > summary::-webkit-details-marker,
#file-menu .export-filters > summary::-webkit-details-marker { display: none; }
#file-menu .export-option > summary::after, #file-menu .export-filters > summary::after {
  content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); margin-right: 4px;
}
#file-menu .export-option[open] > summary::after, #file-menu .export-filters[open] > summary::after { transform: rotate(45deg); }
#file-menu .export-option[open] > summary { background: var(--hover); }
#file-menu .export-option p, #file-menu .export-filters p { margin: 4px 10px 10px; font-size: 12px; color: var(--muted); line-height: 1.45; }
#file-menu .export-formats { margin: 0 10px 12px; }
#file-menu .export-filters { border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 6px; }
#file-menu #export-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 10px 10px; gap: 6px; }
#file-menu #export-types button { width: 100%; min-width: 0; height: 36px; padding: 7px; display: flex; justify-content: flex-start; gap: 8px; }
#file-menu #export-types .ui-icon { flex: 0 0 18px; width: 18px; height: 18px; }
#file-menu #export-types span { font-size: 12px; }
.figjam-instructions { max-height: calc(var(--dialog-visible-height, 100dvh) - 24px); overflow: auto; }
.figjam-instructions ol { padding-left: 22px; line-height: 1.6; }
.figjam-instructions li + li { margin-top: 6px; }
.figjam-instructions summary { cursor: pointer; padding-block: 8px; }
.figjam-instructions code { overflow-wrap: anywhere; }
.figjam-instructions a { color: var(--selection); }

/* Balanced export detail spacing and centered tonal format buttons. */
#file-menu .export-option p { margin: 12px 10px; }
#file-menu .export-formats { margin: 0 10px 12px; gap: 6px; }
#file-menu .export-formats button {
  display: flex; align-items: center; justify-content: center; text-align: center;
  height: 36px; min-height: 36px; padding: 0 10px; line-height: 1.2;
  background: var(--md-primaryContainer, var(--selection-bg));
  color: var(--md-onPrimaryContainer, var(--ink)); border: 1px solid transparent;
}
#file-menu .export-formats button:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--md-onPrimaryContainer, var(--ink)) 12%, var(--md-primaryContainer, var(--selection-bg)));
}
#back-to-content {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 14px;
  border: 1px solid var(--strong);
  border-radius: 9px;
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
}
#back-to-content[hidden] { display: none; }
#back-to-content:hover { background: var(--md-secondaryContainer); color: var(--md-onSecondaryContainer); }
