:root {
  color-scheme: light;
  --bg: #f8f9fc;
  --panel: #fff;
  --panel-soft: #f7f8fa;
  --text: #303546;
  --muted: #9096a6;
  --secondary: #6c7488;
  --line: #ebedf2;
  --accent: #7463d9;
  --accent-light: #f0edfc;
  --hover: #f3f4f8;
  --shadow: 0 3px 12px #2c325609;
  --input: #fafbfc;
  --danger: #c05a6c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #20232c;
  --panel: #252832;
  --panel-soft: #292d38;
  --text: #e2e5ef;
  --muted: #818a9e;
  --secondary: #a1a9ba;
  --line: #363b48;
  --accent: #aa9af8;
  --accent-light: #37304e;
  --hover: #303541;
  --shadow: 0 3px 12px #0002;
  --input: #21252f;
  --danger: #ed9ba9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
a,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select,
textarea {
  outline: none;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button {
  border: 0;
  background: none;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
svg {
  flex-shrink: 0;
}
button svg {
  pointer-events: none;
}
[hidden] {
  display: none !important;
}
input,
textarea {
  color: var(--text);
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
#app {
  height: 100dvh;
  min-height: 440px;
  display: flex;
  flex-direction: column;
}
.startup-status {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--secondary);
  text-align: center;
}
.startup-status button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.topbar {
  height: 74px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 23px;
  gap: 23px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
.schedule-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.schedule-link:hover { background: var(--hover); color: var(--text); }
.schedule-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.schedule-link > span:first-child { font-size: 16px; line-height: 1; }
.brand-mark {
  height: 34px;
  width: 34px;
  border-radius: 11px;
  background: #7564dc;
  color: white;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px #ffffff20;
}
.top-divider {
  width: 1px;
  height: 26px;
  background: var(--line);
  flex-shrink: 0;
}
.document-heading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 100px;
  flex: 1;
}
.document-heading input {
  width: 100%;
  max-width: 320px;
  border: 0;
  padding: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  text-overflow: ellipsis;
}
.document-heading input:hover {
  color: var(--accent);
}
#save-status {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 5px;
  align-items: center;
}
#save-status:before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #84b298;
}
#save-status.error:before {
  background: var(--danger);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.top-actions > .top-divider {
  margin: 0 6px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  border-radius: 7px;
  color: var(--secondary);
  padding: 0;
  flex-shrink: 0;
}
.icon-button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}
.icon-button.active {
  background: var(--accent-light);
  color: var(--accent);
}
.button {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px 13px;
  border-radius: 8px;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 2px #20283003;
}
.button:hover {
  background: var(--hover);
}
.button.primary {
  background: #7564d9;
  border-color: #7564d9;
  color: #fff;
  box-shadow: 0 2px 3px #7463d921;
}
.button.primary:hover {
  background: #6653cc;
}
@media (hover: none) {
  .button:hover {
    background: var(--panel);
  }
  .button.primary:hover {
    background: #7564d9;
  }
  .icon-button:hover:not(:disabled) {
    background: transparent;
    color: var(--secondary);
  }
  .icon-button.active:hover:not(:disabled) {
    background: var(--accent-light);
    color: var(--accent);
  }
  .schedule-link:hover {
    background: var(--panel-soft);
    color: var(--secondary);
  }
}
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}
.palette {
  width: 208px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 27px 17px 15px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.panel-label {
  font-size: 9px;
  letter-spacing: 1.3px;
  font-weight: 650;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-label > span {
  font-size: 9px;
  letter-spacing: 0.7px;
  font-weight: 450;
}
.tool-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 13px;
}
.tool-switch > span {
  font-size: 11px;
  color: var(--secondary);
  margin-left: 6px;
}
.shapes-label {
  margin-top: 30px;
  margin-bottom: 12px;
}
.shape-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.shape-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 55px;
  text-align: left;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  transition:
    border-color 0.15s,
    background 0.15s;
  user-select: none;
}
.shape-item:hover {
  background: var(--accent-light);
  border-color: #b6a9e8;
}
.shape-item:active {
  cursor: grabbing;
}
.shape-icon {
  display: grid;
  place-items: center;
  width: 32px;
  color: #7d8499;
}
.shape-item > span:nth-child(2) {
  font-size: 11px;
  white-space: nowrap;
}
.shape-item kbd {
  margin-left: auto;
  font-size: 9px;
  background: none;
  color: #b4b8c5;
  box-shadow: none;
}
.palette-note {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
  margin-top: 16px;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 28px 5px 0;
}
.tip-icon {
  width: 30px;
  height: 30px;
  background: var(--accent-light);
  border-radius: 9px;
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 11px;
}
.sidebar-bottom strong {
  font-size: 11px;
  font-weight: 550;
}
.sidebar-bottom p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.7;
  margin: 7px 0 12px;
}
.text-button {
  font-size: 10px;
  color: var(--accent);
  padding: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.text-button svg {
  transform: rotate(-90deg);
}
.local-note {
  font-size: 8px;
  color: var(--muted);
  margin-top: 25px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.green-dot {
  width: 5px;
  height: 5px;
  border-radius: 100%;
  background: #8eb49a;
}
.canvas-area {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
#canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  user-select: none;
}
.canvas-heading {
  position: absolute;
  top: 21px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 13px;
  pointer-events: none;
  z-index: 1;
  font-size: 10px;
  color: var(--muted);
}
.canvas-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.1px;
  color: var(--secondary);
}
#canvas-count {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.canvas-bottom {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}
.floating {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.floating .icon-button {
  height: 29px;
  width: 29px;
}
.floating .icon-button svg {
  width: 16px;
  height: 16px;
}
.zoom-value {
  width: 48px;
  height: 29px;
  font-size: 11px;
  color: var(--secondary);
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.zoom-value:hover {
  background: var(--hover);
}
.control-divider {
  height: 17px;
  width: 1px;
  background: var(--line);
  margin: 0 3px;
}
#canvas-hint {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}
#canvas-hint span {
  margin: 0 7px;
}
.inspector {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 27px 19px 16px;
  overflow-y: auto;
}
#inspector-content {
  padding-bottom: 25px;
}
.inspector-empty {
  text-align: center;
  padding-top: 48px;
}
.inspector-illustration {
  width: 54px;
  height: 54px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 15px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  color: #9892b6;
  transform: rotate(-5deg);
}
.inspector-empty h3 {
  font-size: 12px;
  font-weight: 550;
  margin: 0 0 10px;
}
.inspector-empty p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}
.document-stats {
  border-top: 1px solid var(--line);
  margin-top: 31px;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.document-stats > div {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--secondary);
}
.document-stats strong {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}
.quiet-tip {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 26px;
}
.canvas-settings {
  border-top: 1px solid var(--line);
  margin-top: auto;
  padding-top: 21px;
}
.setting {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  color: var(--secondary);
  margin-top: 20px;
  cursor: pointer;
}
.setting > input {
  appearance: none;
  width: 27px;
  height: 16px;
  border-radius: 100px;
  background: #c8cbd5;
  margin: 0 0 0 auto;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.setting > input:checked {
  background: #8b7cde;
}
.setting > input:before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 100px;
  background: white;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px #0001;
}
.setting > input:checked:before {
  transform: translateX(11px);
}
.canvas-settings p {
  font-size: 9px;
  color: var(--muted);
  margin: 16px 0 25px;
}
.canvas-settings p span {
  margin: 0 5px;
}
.shortcuts-link {
  display: flex;
  align-items: center;
  font-size: 10px;
  color: var(--secondary);
  gap: 8px;
  padding: 13px 0 0;
  border-top: 1px solid var(--line);
}
kbd {
  font-family: inherit;
  font-size: 10px;
  color: var(--secondary);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
  white-space: nowrap;
}
.shortcuts-link kbd {
  margin-left: auto;
}
.selected-kind {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 23px 0 25px;
  color: var(--secondary);
}
.selected-kind strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
}
.field-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--secondary);
  margin: 18px 0 9px;
}
.inspector input:not([type="checkbox"]),
.inspector textarea,
.inspector select {
  display: block;
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
}
.inspector textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 200px;
}
.inspector select {
  height: 35px;
}
.swatches {
  display: flex;
  gap: 9px;
}
.swatch {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid var(--swatch-border);
  color: var(--secondary);
  display: grid;
  place-items: center;
  padding: 0;
}
.swatch.active {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.dimension-fields {
  display: flex;
  gap: 8px;
}
.dimension-fields > label {
  position: relative;
  min-width: 0;
  flex: 1;
}
.dimension-fields span {
  position: absolute;
  left: 9px;
  top: 11px;
  font-size: 9px;
  color: var(--muted);
}
.dimension-fields input {
  padding-left: 26px !important;
}
.inspector-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  align-items: center;
}
.inspector-actions .button {
  font-size: 10px;
  flex: 1;
  padding: 9px;
}
.danger {
  color: var(--danger);
}
.full-width {
  width: 100%;
  margin-top: 18px;
  font-size: 11px;
}
.label-presets {
  display: flex;
  gap: 5px;
  margin-top: 9px;
}
.label-presets button {
  font-size: 9px;
  background: var(--panel-soft);
  border-radius: 5px;
  padding: 6px 8px;
}
.label-presets button:hover {
  background: var(--accent-light);
}
.multi-title {
  font-size: 15px;
  font-weight: 550;
  margin-top: 25px;
}
.muted {
  font-size: 11px;
  color: var(--muted);
}
.align-buttons {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.align-buttons .button {
  font-size: 10px;
}
.node {
  cursor: move;
}
.node text {
  pointer-events: none;
}
.node:hover > rect:first-child,
.node:hover > path:first-child {
  stroke: #a295dc;
}
.edge {
  cursor: pointer;
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
}
.edge:hover > path:nth-child(2) {
  stroke: #a295dc;
}
.selection-box {
  pointer-events: none;
}
.resize-handle {
  fill: var(--panel);
  stroke: #8272ed;
  pointer-events: all;
}
.resize-handle.nw,
.resize-handle.se {
  cursor: nwse-resize;
}
.resize-handle.ne,
.resize-handle.sw {
  cursor: nesw-resize;
}
.ports {
  opacity: 0;
  pointer-events: none;
}
.ports.visible,
.ports.hovered {
  opacity: 1;
}
.ports.visible .port,
.ports.hovered .port {
  pointer-events: all;
}
.port {
  fill: var(--panel);
  stroke: #9b8ae6;
  cursor: crosshair;
}
.port:hover {
  fill: #a493f5;
  stroke: #7463d9;
}
.connection-preview {
  fill: none;
  stroke: #9784e5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}
.marquee {
  fill: #9380ed19;
  stroke: #9380ed;
  pointer-events: none;
}
.hand-tool,
.space-pan {
  cursor: grab !important;
}
.hand-tool *,
.space-pan * {
  cursor: grab !important;
}
.panning,
.panning * {
  cursor: grabbing !important;
}
#text-editor {
  position: absolute;
  resize: none;
  z-index: 4;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 20px #3e31571c;
  padding: 12px;
  text-align: center;
  line-height: 1.35;
  color: var(--text);
}
#empty-state {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  width: 300px;
}
.empty-icon {
  width: 78px;
  height: 78px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 24px;
  color: #aa9bcf;
  display: grid;
  place-items: center;
  margin: 0 auto 23px;
}
#empty-state h1 {
  font-size: 20px;
  letter-spacing: -0.5px;
  font-weight: 550;
}
#empty-state p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 22px;
}
#empty-state button {
  pointer-events: auto;
}
.dropdown-wrap {
  position: relative;
}
.dropdown {
  position: absolute;
  right: 0;
  top: 44px;
  width: 233px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 40px #20284020;
  border-radius: 11px;
  padding: 8px;
  z-index: 20;
}
.dropdown:not([hidden]) {
  transform-origin: top right;
  animation: menu-appear 180ms cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes menu-appear {
  from { opacity: 0; transform: translateY(-5px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-caption {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 10px 8px;
}
.lockable-properties {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.waypoint-control {
  cursor: grab;
}
.waypoint-control:active {
  cursor: grabbing;
}
.waypoint-dot {
  fill: #28a28c;
  stroke: white;
  pointer-events: none;
}
.dropdown > button {
  display: flex;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
}
.dropdown > button:hover {
  background: var(--hover);
}
.dropdown > button > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}
.export-option {
  display: flex;
  align-items: center;
  font-size: 10px;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 11px 4px 4px;
  margin-top: 6px;
  color: var(--secondary);
}
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--panel);
  font-size: 12px;
  padding: 12px 19px;
  border-radius: 10px;
  box-shadow: 0 5px 30px #0002;
  z-index: 50;
  max-width: 600px;
  text-align: center;
}
#toast.error {
  background: #994c5a;
  color: white;
}
dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 100px #0003;
  padding: 29px;
  max-width: 660px;
  width: calc(100% - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
}
dialog::backdrop {
  background: #23233345;
  backdrop-filter: blur(4px);
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-weight: 650;
}
dialog h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin: 12px 0;
}
dialog p {
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.7;
}
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 25px;
  margin-top: 22px;
}
.shortcut-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  gap: 8px;
}
.shortcut-grid kbd {
  font-size: 9px;
}
.help-footer {
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin: 24px 0;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 25px;
  flex-wrap: wrap;
}
#confirm-dialog {
  max-width: 590px;
}
.error {
  color: var(--danger);
}
@media (min-width: 1500px) {
  .palette {
    width: 224px;
    padding-left: 21px;
    padding-right: 21px;
  }
  .inspector {
    width: 260px;
    padding-left: 23px;
    padding-right: 23px;
  }
}
@media (max-width: 1200px) {
  #canvas-hint {
    display: none;
  }
  .topbar {
    gap: 16px;
    padding: 0 18px;
  }
  .palette {
    width: 190px;
    padding-left: 13px;
    padding-right: 13px;
  }
  .inspector {
    width: 217px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .swatches {
    gap: 7px;
  }
  .shape-item {
    gap: 8px;
    padding: 0 8px;
  }
  .top-actions {
    gap: 5px;
  }
}
@media (max-height: 760px) {
  .sidebar-bottom {
    padding-top: 18px;
  }
  .sidebar-bottom > .tip-icon,
  .sidebar-bottom > strong,
  .sidebar-bottom > p,
  .sidebar-bottom > .text-button {
    display: none;
  }
  .local-note {
    margin-top: 15px;
  }
  .palette {
    padding-top: 22px;
  }
  .shape-item {
    height: 48px;
  }
  .shapes-label {
    margin-top: 22px;
  }
  .inspector-empty {
    padding-top: 32px;
  }
  .inspector {
    padding-top: 22px;
  }
  .field-label {
    margin-top: 13px;
  }
  .selected-kind {
    margin: 18px 0;
  }
  .quiet-tip {
    margin-top: 18px;
  }
}
@media (max-width: 960px) {
  .brand > span:last-child {
    display: none;
  }
  .palette {
    width: 76px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .palette .panel-label,
  .shape-item > span:nth-child(2),
  .shape-item kbd,
  .palette-note,
  .sidebar-bottom,
  .tool-switch > span {
    display: none;
  }
  .tool-switch {
    flex-direction: column;
    margin-top: 0;
    margin-bottom: 18px;
  }
  .shape-item {
    justify-content: center;
    padding: 0;
    height: 49px;
  }
  .shape-list {
    gap: 10px;
  }
  .topbar {
    gap: 12px;
    height: 65px;
  }
  .top-actions > .top-divider {
    display: none;
  }
  .shape-icon {
    width: 30px;
  }
  .canvas-heading {
    left: 17px;
  }
  .inspector {
    width: 215px;
  }
}
@media (max-width: 680px) {
  .schedule-link { width: 34px; padding: 0; }
  .schedule-link-label { display: none; }
  .inspector {
    display: none;
  }
  .topbar {
    padding: 0 10px;
    gap: 9px;
  }
  .document-heading {
    min-width: 65px;
  }
  .top-actions {
    gap: 1px;
  }
  .top-actions .button {
    padding: 8px;
  }
  .save-button span,
  .top-actions > .icon-button[data-action="help"],
  .top-actions .primary > span,
  .top-actions .primary > svg:last-child {
    display: none;
  }
  .topbar > .top-divider {
    display: none;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .palette {
    width: 61px;
    padding: 18px 7px;
  }
  .shape-item {
    height: 45px;
  }
  .canvas-bottom {
    left: 12px;
    right: 12px;
    bottom: 13px;
  }
  .canvas-heading {
    font-size: 9px;
    gap: 7px;
  }
  .shortcut-grid {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 22px;
  }
  .document-heading input {
    font-size: 11px;
  }
  #save-status {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Content stays in the existing inspector; advanced controls are progressive. */
.property-section {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 2px;
}
.property-section > summary {
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 0;
  color: var(--secondary);
}
.property-section > summary:before {
  content: "›";
  font-size: 17px;
  line-height: 10px;
  transition: transform 0.12s;
  color: var(--muted);
}
.property-section[open] > summary:before {
  transform: rotate(90deg);
}
.property-section > summary::-webkit-details-marker {
  display: none;
}
.property-section > summary:hover {
  color: var(--text);
}
.section-count {
  margin-left: auto;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--panel-soft);
}
.section-note {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
  margin: 12px 0 0;
}
.format-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.format-button {
  width: 32px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
}
.format-button.bold {
  font-weight: 750;
}
.format-button.italic {
  font-style: italic;
}
.format-button.underline {
  text-decoration: underline;
}
.format-button[aria-pressed="true"],
.segmented button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-light);
  border-color: var(--accent);
}
.inspector .format-row input {
  width: 65px;
  margin-left: auto;
  padding: 6px 8px;
}
.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.segmented button {
  font-size: 10px;
  flex: 1;
  min-height: 30px;
  padding: 4px 2px;
  border-right: 1px solid var(--line);
}
.segmented button:last-child {
  border: 0;
}
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.symbol-grid button,
.math-symbols button {
  font-size: 17px;
  min-height: 30px;
  border-radius: 5px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.symbol-grid button:hover,
.math-symbols button:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.content-add {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.content-add button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
  padding: 7px 3px;
}
.content-add button:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.object-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 180px;
  overflow: auto;
}
.object-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  color: var(--secondary);
  width: 100%;
  text-align: left;
}
.object-row > span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.object-row:hover {
  background: var(--hover);
}
.object-row.active {
  background: var(--accent-light);
  color: var(--accent);
}
.object-properties {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
  margin-top: 12px;
}
.object-heading {
  font-size: 11px;
  font-weight: 550;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
}
.object-geometry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.object-field {
  min-width: 0;
}
.object-field > span {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 4px;
}
.inspector .object-field > input {
  padding: 6px;
  font-size: 10px;
}
.clip-setting {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10px;
  line-height: 1.5;
  margin: 14px 0 10px;
}
.clip-setting input {
  margin: 1px 0 0;
}
.object-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}
.object-tools button {
  font-size: 10px;
  border: 1px solid var(--line);
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--panel);
}
.reset-text {
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}
.port-control {
  cursor: crosshair;
}
.port-stem {
  fill: none;
  stroke: #a397d0;
  pointer-events: none;
  stroke-dasharray: 2 2;
}
.ports.visible .port-control,
.ports.hovered .port-control,
.ports.visible .port-hit,
.ports.hovered .port-hit {
  pointer-events: all;
}
.port-control:hover .port {
  fill: #a493f5;
  stroke: #7463d9;
}
.resize-control,
.resize-hit {
  pointer-events: all;
}
.resize-control.n,
.resize-control.s {
  cursor: ns-resize;
}
.resize-control.e,
.resize-control.w {
  cursor: ew-resize;
}
.resize-control.nw,
.resize-control.se {
  cursor: nwse-resize;
}
.resize-control.ne,
.resize-control.sw {
  cursor: nesw-resize;
}
.resize-handle {
  pointer-events: none;
}
.resize-control:hover .resize-handle {
  fill: #c5b9ff;
}
.content-selection .resize-handle {
  stroke: #28a28c;
}
.content-selection .resize-control:hover .resize-handle {
  fill: #a0e6d8;
}
.content-object {
  cursor: move;
}
.content-object > svg,
.content-object > image,
.content-object > text {
  pointer-events: none;
}
.content-hit,
.main-text-hit {
  pointer-events: all;
  cursor: move;
}
.node:hover > rect,
.node:hover > path {
  stroke: #a295dc;
}
#formula-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
}
.math-templates {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 19px 0;
}
.math-templates button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  min-width: 65px;
  flex: 1;
  padding: 9px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.math-templates button:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.math-templates button > span {
  font:
    22px Georgia,
    serif;
}
.math-templates small {
  font-size: 9px;
  color: var(--muted);
}
math-field {
  display: block;
  min-height: 72px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 25px;
  background: var(--input);
  color: var(--text);
  --caret-color: var(--accent);
  --selection-background-color: #b8a4f540;
  --primary: var(--accent);
  --contains-highlight-background-color: var(--accent-light);
}
math-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
math-field::part(menu-toggle) {
  display: none;
}
.math-symbols {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 5px;
  margin-top: 14px;
}
.math-hint {
  font-size: 10px !important;
  color: var(--muted) !important;
}
#latex-source {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  padding: 10px;
  border-radius: 7px;
  resize: vertical;
  font-family: monospace;
  font-size: 12px;
}
#formula-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  max-height: 125px;
  overflow: hidden;
  padding: 12px;
  background: var(--panel-soft);
  border-radius: 9px;
  margin-top: 15px;
}
#formula-preview svg {
  max-height: 98px;
  max-width: 100%;
  width: auto;
  height: 75px;
}
#formula-error {
  font-size: 11px;
  color: var(--danger);
}
#math-keyboard-host {
  position: relative;
  min-height: 0;
  width: 100%;
  --keyboard-zindex: 10000;
}
@media (min-width: 961px) {
  .inspector {
    width: 264px;
    padding-left: 18px;
    padding-right: 18px;
  }
}
@media (max-width: 680px) {
  .math-symbols {
    grid-template-columns: repeat(6, 1fr);
  }
}

.property-section[inert] {
  opacity: 0.5;
}

.mobile-properties-button,
.mobile-inspector-header,
.mobile-panel-backdrop {
  display: none;
}

@media (max-width: 680px), (max-width: 900px) and (max-height: 500px) {
  #app {
    min-height: 0;
  }
  .topbar {
    height: auto;
    min-height: 104px;
    flex-wrap: wrap;
    align-content: center;
    column-gap: 9px;
    row-gap: 5px;
    padding: calc(6px + env(safe-area-inset-top)) 10px 7px;
  }
  .schedule-link {
    width: auto;
    min-height: 36px;
    padding: 0 9px;
  }
  .schedule-link-label {
    display: inline;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .document-heading {
    min-width: 0;
    flex: 1;
  }
  .document-heading input {
    font-size: 15px;
  }
  .top-actions {
    width: 100%;
    flex: 0 0 100%;
    justify-content: space-between;
    gap: 2px;
  }
  .top-actions > .icon-button[data-action="help"] {
    display: inline-flex;
  }
  .top-actions > .icon-button {
    width: 40px;
    height: 40px;
  }
  .top-actions .button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
  .mobile-properties-button {
    display: inline-flex;
    gap: 5px;
  }
  .mobile-properties-button.has-selection {
    color: var(--accent);
    border-color: var(--accent);
  }
  .workspace {
    position: relative;
    flex-direction: column;
  }
  .canvas-area {
    order: 1;
  }
  .palette {
    order: 2;
    width: 100%;
    height: calc(72px + env(safe-area-inset-bottom));
    padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: center;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-top: 1px solid var(--line);
    scrollbar-width: none;
  }
  .palette::-webkit-scrollbar {
    display: none;
  }
  .palette .panel-label,
  .palette-note,
  .sidebar-bottom {
    display: none;
  }
  .tool-switch {
    flex-direction: row;
    flex: 0 0 auto;
    margin: 0;
    padding-right: 8px;
    border-right: 1px solid var(--line);
  }
  .tool-switch .icon-button {
    width: 44px;
    height: 48px;
  }
  .shape-list {
    flex-direction: row;
    flex: 0 0 auto;
    gap: 6px;
  }
  .shape-item {
    width: 57px;
    height: 58px;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 2px;
  }
  .shape-icon {
    width: 28px;
  }
  .shape-icon svg {
    width: 25px;
    height: 25px;
  }
  .shape-item > span:nth-child(2) {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-size: 9px;
  }
  .shape-item kbd {
    display: none;
  }
  .canvas-bottom {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
  .floating .icon-button {
    width: 36px;
    height: 36px;
  }
  .zoom-value {
    width: 42px;
    height: 36px;
  }
  .canvas-heading {
    top: 13px;
    left: 13px;
  }
  .mobile-panel-backdrop {
    position: absolute;
    inset: 0 0 calc(72px + env(safe-area-inset-bottom));
    z-index: 6;
    display: block;
    width: 100%;
    background: #080b1780;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 280ms ease, visibility 0s linear 280ms;
  }
  .mobile-panel-backdrop.mobile-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .inspector {
    display: flex;
    position: absolute;
    z-index: 7;
    left: 0;
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: 100%;
    height: min(70%, 560px);
    max-height: calc(100% - 88px);
    padding: 0 18px 18px;
    border: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 35px #10132033;
    overscroll-behavior: contain;
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 240ms ease, transform 300ms cubic-bezier(.2, .8, .2, 1), visibility 0s linear 300ms;
  }
  .inspector.mobile-open {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .mobile-inspector-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    background: var(--panel);
    font-size: 14px;
  }
  .mobile-inspector-header .icon-button {
    width: 40px;
    height: 40px;
  }
  .inspector input:not([type="checkbox"]),
  .inspector textarea,
  .inspector select,
  #text-editor {
    font-size: 16px;
  }
  dialog {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow: auto;
  }
}

@media (max-width: 360px) {
  .mobile-properties-button span {
    display: none;
  }
}

@media (min-width: 700px) and (max-width: 900px) and (max-height: 500px) {
  .topbar {
    height: 62px;
    min-height: 62px;
    flex-wrap: nowrap;
    padding: 0 12px;
  }
  .brand {
    display: none;
  }
  .document-heading {
    max-width: 190px;
  }
  .top-actions {
    width: auto;
    flex: 0 0 auto;
    margin-left: auto;
    gap: 4px;
  }
}

@media (hover: none) {
  .label-presets button:hover,
  .symbol-grid button:hover,
  .math-symbols button:hover,
  .content-add button:hover,
  .math-templates button:hover {
    background: var(--panel-soft);
    color: inherit;
    border-color: var(--line);
  }
  .shape-item:hover {
    background: var(--panel);
    border-color: var(--line);
  }
  .dropdown > button:hover,
  .object-row:hover:not(.active) {
    background: transparent;
  }
}

/* Code generation uses the editor's existing modal and theme colors. */
#ai-dialog { width: min(720px, calc(100% - 24px)); }
#ai-code { width: 100%; min-height: 230px; max-height: 45dvh; resize: vertical;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--input); color: var(--text); font: 13px/1.6 ui-monospace, Menlo, monospace; }
#ai-code:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#ai-dialog .ai-note { font-size: 12px; line-height: 1.6; color: var(--secondary); }
#ai-status { min-height: 22px; font-size: 13px; line-height: 1.6; }
.ai-progress { display: flex; justify-content: center; padding: 12px 0 2px; color: var(--accent); }
.ai-loading-star { animation: ai-star-turn 8s linear infinite; transform-origin: center; }
@keyframes ai-star-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ai-loading-star { animation: none; }
}
#ai-dialog [hidden] { display: none; }
#ai-dialog .dialog-actions { flex-wrap: wrap; }
#ai-dialog button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 680px), (max-width: 900px) and (max-height: 500px) {
  .top-actions .ai-button { font-size: 11px; gap: 4px; }
  #ai-dialog { padding: 20px; }
  #ai-code { min-height: 180px; font-size: 16px; }
  #ai-dialog .dialog-actions .button { flex: 1; min-height: 44px; }
}
@media (max-width: 360px) {
  .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-items: center;
    row-gap: 6px;
  }
}
