@font-face {
  font-family: "Alibaba PuHui Ti 3";
  src:
    url("./AlibabaPuHuiTi-3-45-Light.woff2") format("woff2"),
    url("./AlibabaPuHuiTi-3-45-Light.woff") format("woff"),
    url("./AlibabaPuHuiTi-3-45-Light.ttf") format("truetype"),
    url("./AlibabaPuHuiTi-3-45-Light.otf") format("opentype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Alibaba PuHui Ti 3";
  src: url("./AlibabaPuHuiTi-3-55-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  font-family:
    "Alibaba PuHui Ti 3", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: #f3f3f3;
  color: #111111;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font: inherit;
}

.sidebar,
.topbar,
.toolbar,
.panel-section,
.color-picker-panel,
.text-panel,
.context-menu,
.toast {
  font-synthesis: none;
}

.app-shell {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #eeeeee;
  --surface-3: #e2e2e2;
  --text: #101010;
  --muted: #6c6c6c;
  --border: #d5d5d5;
  --strong-border: #111111;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  --canvas-dot: rgba(0, 0, 0, 0.07);
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.app-shell[data-theme="dark"] {
  --bg: #111111;
  --surface: #1b1b1b;
  --surface-2: #262626;
  --surface-3: #333333;
  --text: #f5f5f5;
  --muted: #a9a9a9;
  --border: #3a3a3a;
  --strong-border: #f0f0f0;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  --canvas-dot: rgba(255, 255, 255, 0.16);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  overflow: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-logo-anim {
  position: relative;
  width: 100%;
  height: 100%;
  transform: scale(0.31);
  transform-origin: center;
}

@keyframes dropAndShift {
  0% {
    transform: translate(0px, 15px);
  }
  16.67% {
    transform: translate(80px, 13px);
  }
  33.34% {
    transform: translate(40px, 10px);
  }
  50.01% {
    transform: translate(40px, -30px);
  }
  66.68% {
    transform: translate(40px, 55px);
  }
  83.35% {
    transform: translate(40px, 10px);
  }
  100% {
    transform: translate(0px, 15px);
  }
}

@keyframes bubbleGlint {
  0% {
    top: 3px;
    left: 4px;
    opacity: 0;
  }
  8.335% {
    top: 6px;
    left: 6px;
    opacity: 0.5;
  }
  16.67% {
    top: 3px;
    left: 4px;
    opacity: 0;
  }
  33.34% {
    top: 3px;
    left: 4px;
    opacity: 0.5;
  }
  50.01% {
    top: 3px;
    left: 4px;
    opacity: 0;
  }
  58.345% {
    top: 6px;
    left: 6px;
    opacity: 0.5;
  }
  66.68% {
    top: 3px;
    left: 4px;
    opacity: 0;
  }
  83.35% {
    top: 6px;
    left: 6px;
    opacity: 0.5;
  }
  100% {
    top: 3px;
    left: 4px;
    opacity: 0;
  }
}

.brand-mark .Strich1 {
  position: absolute;
  top: -4px;
  left: -44px;
  width: 130px;
  height: 50px;
  background: #000;
  border-radius: 25px;
  transform: rotate(45deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  z-index: 0;
}

.brand-mark .Strich2 {
  position: absolute;
  width: 130px;
  height: 50px;
  background: #000;
  border-radius: 25px;
  transform: rotate(-90deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  z-index: 0;
}

.app-shell[data-theme="dark"] .brand-mark .Strich1,
.app-shell[data-theme="dark"] .brand-mark .Strich2 {
  background: #ffffff;
}

.brand-mark .bubble,
.brand-mark .bubble1,
.brand-mark .bubble2,
.brand-mark .bubble3 {
  position: absolute;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.brand-mark .bubble {
  left: 15px;
  background: radial-gradient(circle at 30% 30%, #ffb3c1, #e64980, #ff8787);
  animation: dropAndShift 5s ease-in-out infinite;
  z-index: 1;
}

.brand-mark .bubble1 {
  left: 8px;
  background: radial-gradient(circle at 30% 30%, #edb3ff, #ac49e6, #fb87ff);
  animation: dropAndShift 6s ease-in-out infinite;
  z-index: 2;
}

.brand-mark .bubble2 {
  left: 12px;
  background: radial-gradient(circle at 30% 30%, #b3d8ff, #4963e6, #87a7ff);
  animation: dropAndShift 4s ease-in-out infinite;
  z-index: 3;
}

.brand-mark .bubble3 {
  left: 10px;
  background: radial-gradient(circle at 30% 30%, #b3ffbc, #35a32f, #75ba61);
  animation: dropAndShift 7s ease-in-out infinite;
  z-index: 4;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle,
.section-title,
.component-item small,
.component-group small {
  color: var(--muted);
  font-weight: 400;
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 0.78rem;
}

.panel-section {
  display: grid;
  gap: 12px;
}

.component-panel {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.parent-panel {
  align-content: start;
}

.parent-panel.is-disabled {
  opacity: 0.56;
}

.parent-panel.is-disabled .section-inline-hint {
  visibility: visible;
}

.parent-panel.is-disabled .parent-inline-picker,
.parent-panel.is-disabled .parent-candidate-list {
  pointer-events: none;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.visible-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.batch-button {
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.section-inline-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  visibility: hidden;
}

.parent-inline-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
  flex: 1 1 100%;
}

.parent-inline-picker input {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 9px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.82rem;
  outline: none;
}

.parent-toggle-button {
  min-width: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
}

.parent-toggle-button.is-open {
  transform: rotate(180deg);
}

.parent-toggle-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.parent-candidate-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.parent-candidate-popover {
  position: fixed;
  z-index: 34;
  width: 236px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.parent-candidate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.parent-candidate-item:hover,
.parent-candidate-item.active {
  border-color: var(--strong-border);
  background: var(--surface-2);
}

.parent-candidate-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.parent-candidate-type {
  color: var(--muted);
  font-size: 0.72rem;
}

.group-ui-panel {
  align-content: start;
}

.group-ui-scroll-shell {
  width: 100%;
  max-height: calc((34px * 14) + (6px * 13));
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface);
  scrollbar-gutter: stable;
}

.group-ui-scroll-shell::-webkit-scrollbar {
  width: 10px;
}

.group-ui-scroll-shell::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.group-ui-scroll-shell::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 999px;
}

.group-ui-scroll-shell::-webkit-scrollbar-thumb {
  border: 1px solid var(--surface);
  border-radius: 999px;
  background: var(--border);
}

.group-ui-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.group-ui-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.group-ui-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.group-ui-arrow {
  width: 22px;
  min-width: 22px;
  color: var(--muted);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.group-ui-hidden-icon {
  width: 16px;
  min-width: 16px;
  color: var(--muted);
  line-height: 1;
  text-align: center;
}

.group-ui-hidden-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.group-ui-item.is-hidden .group-ui-name {
  opacity: 0.56;
}

.group-ui-item:hover,
.group-ui-item.active {
  border-color: var(--strong-border);
  background: var(--surface-2);
}

.group-ui-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.group-ui-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.inspector-panel {
  gap: 10px;
}

.inspector-panel.is-disabled {
  opacity: 0.56;
}

.inspector-panel.is-disabled .section-inline-hint {
  visibility: visible;
}

.inspector-panel.is-disabled .property-row,
.inspector-panel.is-disabled .slider-row,
.inspector-panel.is-disabled .color-row {
  pointer-events: none;
}

.property-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 34px;
}

.property-row > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-row input {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 9px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 400;
  outline: none;
}

.property-row input::-webkit-outer-spin-button,
.property-row input::-webkit-inner-spin-button,
.color-fields input::-webkit-outer-spin-button,
.color-fields input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.property-row input:focus {
  border-color: var(--strong-border);
}

.color-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(44px, 1fr)) 30px;
  gap: 4px;
  align-items: center;
}

.color-fields input {
  padding: 0 4px;
  text-align: center;
  font-weight: 400;
}

.slider-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px;
  align-items: center;
}

.slider-fields input[type="text"] {
  padding: 0 6px;
  text-align: center;
}

.ui-slider {
  width: 100%;
  height: 24px;
  margin: 0;
  border: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.ui-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
}

.ui-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -4px;
  border: 1px solid var(--strong-border);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  appearance: none;
}

.ui-slider::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
}

.ui-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 1px solid var(--strong-border);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.color-swatch {
  display: block;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgb(16, 16, 16);
}

.color-swatch-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.color-swatch-button .color-swatch {
  width: 100%;
  height: 100%;
}

.color-picker-popover {
  position: fixed;
  z-index: 1200;
  pointer-events: auto;
}

.color-picker-panel {
  display: grid;
  gap: 10px;
  width: 232px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.color-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.color-pick-button {
  width: 32px;
  height: 32px;
}

.color-pick-button svg {
  width: 18px;
  height: 18px;
  transform: none;
  fill: currentColor;
  stroke: none;
}

.color-picker-rgb {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-rgb input {
  width: 44px;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.color-picker-rgb input:focus {
  border-color: var(--strong-border);
}

.stepper-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 4px;
  align-items: center;
}

.stepper-field input {
  min-width: 0;
  padding: 0 6px;
  text-align: center;
}

.stepper-buttons {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 4px;
  align-items: center;
  justify-content: end;
}

.stepper-button {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.stepper-button:hover {
  border-color: var(--strong-border);
  background: var(--surface-2);
}

.stepper-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.stepper-button:disabled:hover {
  border-color: var(--border);
  background: var(--surface);
}

.text-stepper-field {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.switch {
  font-size: 14px;
  position: relative;
  display: inline-block;
  width: 3.5em;
  min-width: 3.5em;
  height: 2em;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border: 2px solid #414141;
  border-radius: 50px;
  background: var(--surface);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.switch .slider::before {
  position: absolute;
  content: "";
  height: 1.4em;
  width: 1.4em;
  left: 0.2em;
  bottom: 0.2em;
  background: rgb(238, 238, 238);
  border-radius: inherit;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.switch input:checked + .slider {
  border-color: var(--strong-border);
  box-shadow: none;
  background: var(--surface-2);
}

.switch input:checked + .slider::before {
  transform: translateX(1.5em);
  background: #22c55e;
  box-shadow: none;
}

.switch input:disabled + .slider {
  opacity: 0.42;
  cursor: default;
}

.color-picker-palette {
  position: relative;
  height: 132px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  background:
    linear-gradient(to top, #000000, transparent),
    linear-gradient(to right, #ffffff, hsl(0 100% 50%));
}

.color-picker-palette-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.color-picker-slider {
  height: 22px;
  pointer-events: auto;
  position: relative;
  z-index: 3;
  touch-action: none;
}

.color-picker-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    rgb(255, 0, 0),
    rgb(255, 255, 0),
    rgb(0, 255, 0),
    rgb(0, 255, 255),
    rgb(0, 0, 255),
    rgb(255, 0, 255),
    rgb(255, 0, 0)
  );
}

.color-picker-slider::-moz-range-track {
  background: linear-gradient(
    to right,
    rgb(255, 0, 0),
    rgb(255, 255, 0),
    rgb(0, 255, 0),
    rgb(0, 255, 255),
    rgb(0, 0, 255),
    rgb(255, 0, 255),
    rgb(255, 0, 0)
  );
}

.eyedropper-ring {
  position: fixed;
  z-index: 1400;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  padding: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px var(--strong-border),
    0 6px 18px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transform: translate(-50%, -50%);
  -webkit-mask: radial-gradient(circle, transparent 0 19px, #000 20px);
  mask: radial-gradient(circle, transparent 0 19px, #000 20px);
}

.eyedropper-ring-inner {
  width: 38px;
  height: 38px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--strong-border);
}

body.eyedropper-mode,
body.eyedropper-mode * {
  cursor: crosshair !important;
}

.text-panel-popover {
  position: fixed;
  z-index: 1190;
}

.text-panel {
  display: grid;
  gap: 10px;
  width: 280px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.text-panel-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.text-panel-row-wide {
  align-items: center;
}

.text-panel-row > span,
.text-panel-toggle > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
}

.text-panel-row input,
.text-panel-row select {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.78rem;
  outline: none;
}

.text-panel-row input:focus,
.text-panel-row select:focus {
  border-color: var(--strong-border);
}

.text-panel-row .text-stepper-field input {
  padding: 0 6px;
  text-align: center;
}

.text-panel-segment-row {
  align-items: center;
}

.text-panel-segment-row > span {
  align-self: center;
}

.text-segment-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  align-items: center;
}

.text-segment-option {
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
}

.text-segment-option.active {
  border-color: var(--strong-border);
  color: var(--text);
  background: var(--surface-2);
}

.text-segment-option:hover {
  border-color: var(--strong-border);
}

.text-panel-toggle {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  line-height: 1;
}

.text-panel-toggle > span {
  grid-column: 1;
  display: block;
  line-height: 1;
  align-self: center;
}

.text-panel-toggle .switch {
  grid-column: 2;
  align-self: center;
  justify-self: start;
}

.text-stroke-color-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 30px;
  gap: 6px;
}

.text-stroke-color-fields input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.72rem;
  text-align: center;
  outline: none;
}

.component-list {
  display: grid;
  gap: 8px;
}

.component-list.compact {
  gap: 10px;
}

.component-item,
.component-group {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.component-item {
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.component-item:hover {
  border-color: var(--strong-border);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.component-item strong,
.component-item small,
.component-group strong,
.component-group small {
  display: block;
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-item strong {
  font-size: 0.9rem;
  font-weight: 400;
}

.component-item small,
.component-group small {
  margin-top: 4px;
  font-size: 0.72rem;
}

.component-group strong {
  font-size: 0.9rem;
  font-weight: 400;
}

.component-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 1rem;
  font-weight: 400;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.shape-button {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.shape-button:hover {
  border-color: var(--strong-border);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.shape-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--text);
}

.shape-preview svg {
  display: block;
  width: 100%;
  height: 100%;
  color: currentColor;
}

.shape-preview svg[data-shape-scale],
.shape-svg[data-shape-scale] {
  transform-origin: center;
}

.shape-preview svg[data-shape-scale="1.12"],
.shape-svg[data-shape-scale="1.12"] {
  transform: scale(1.12);
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 116px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.theme-option {
  min-width: 0;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.theme-option.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-title-input {
  width: 10ch;
  min-width: 10ch;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.25;
  outline: none;
}

.page-title-input::selection {
  color: var(--surface);
  background: var(--text);
}

.page-title-input:focus {
  border-bottom: 1px solid var(--strong-border);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.toolbar-component-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

.toolbar-component-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 36px;
  padding: 0 10px;
  grid-template-columns: none;
}

.toolbar-component-item .component-icon {
  width: 22px;
  height: 22px;
}

.toolbar-component-item .toolbar-component-label {
  font-size: 0.78rem;
  white-space: nowrap;
}

.toolbar-shape-grid {
  display: grid;
  grid-template-columns: repeat(12, 34px);
  gap: 6px;
}

.toolbar-shape-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  aspect-ratio: auto;
  border-radius: 7px;
}

.toolbar-shape-button .shape-preview {
  width: 18px;
  height: 18px;
}

.canvas-size-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.canvas-size-input {
  width: 56px;
  min-width: 0;
  height: 24px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  outline: none;
}

.canvas-size-separator {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.tool-button {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
}

.tool-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.tool-button.icon-button {
  padding: 0;
}

.tool-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.tool-button:hover {
  border-color: var(--strong-border);
  background: var(--surface-2);
}

.tool-button:disabled:hover {
  border-color: var(--border);
  background: var(--surface);
}

.tool-button.wide {
  min-width: 62px;
  font-size: 0.84rem;
}

.zoom-label {
  min-width: 54px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
  text-align: center;
}

.canvas-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: none;
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-position: 0 0;
  background-size: 20px 20px;
}

.canvas-stage.panning {
  cursor: grabbing;
}

.canvas-grid {
  display: grid;
  place-items: start center;
  min-width: 1854px;
  min-height: 100%;
  padding: 52px;
}

.artboard {
  width: 1750px;
  height: 982px;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: top center;
  will-change: transform;
}

.artboard-body {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: inherit;
  background: var(--surface);
}

.canvas-node {
  position: absolute;
  display: block;
  width: max-content;
  height: max-content;
  border: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.canvas-node.dragging {
  cursor: grabbing;
}

.node-content {
  width: 100%;
  height: 100%;
  color: var(--node-color, var(--text));
}

.node-text-content {
  display: flex;
  border: 0;
  background: transparent;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  padding: 2px 4px;
  justify-content: flex-start;
  align-items: flex-start;
}

.node-shape-content {
  display: block;
  padding: 0;
}

.shape-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

.node-selection {
  position: absolute;
  inset: 0;
  display: none;
  border: 1px dashed var(--strong-border);
  border-radius: 0;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
}

.canvas-node.selected .node-selection {
  display: block;
}

.artboard-body.multi-select .canvas-node.selected .node-selection {
  display: none;
}

.canvas-node[data-base-type="text"] .node-selection .resize-handle {
  display: none;
}

.group-selection-box {
  position: absolute;
  display: none;
  border: 1px dashed var(--strong-border);
  z-index: 2000;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  backface-visibility: hidden;
}

.group-selection-box.is-interactive {
  pointer-events: auto;
}

.group-selection-box.dragging {
  cursor: grabbing;
}

.artboard-body.multi-select .group-selection-box {
  display: block;
}

.rotation-control {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  display: block;
  width: 132px;
  height: 48px;
  pointer-events: auto;
  transform: translateX(-50%);
  z-index: 4;
}

.rotation-control .ui-slider {
  display: block;
  width: 132px;
  height: 20px;
  margin: 0;
}

.rotation-control .ui-slider::-webkit-slider-runnable-track,
.rotation-control .ui-slider::-moz-range-track {
  background: var(--surface-3);
}

.rotation-angle-input {
  width: 20px;
  height: 18px;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.64rem;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.rotation-angle-field {
  position: absolute;
  top: 28px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 46px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 0 6px;
  transform: translateX(-50%);
}

.rotation-angle-field:focus-within {
  border-color: var(--strong-border);
}

.rotation-angle-unit {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid var(--strong-border);
  border-radius: 2px;
  background: var(--surface);
  pointer-events: auto;
  appearance: none;
}

.canvas-node.dragging .resize-handle,
.group-selection-box.dragging .resize-handle {
  opacity: 0;
  visibility: hidden;
}

.handle-n {
  top: -5px;
  left: 50%;
  cursor: ns-resize;
  transform: translate(-50%, -50%);
}

.handle-s {
  right: auto;
  bottom: -5px;
  left: 50%;
  cursor: ns-resize;
  transform: translate(-50%, 50%);
}

.handle-e {
  top: 50%;
  right: -5px;
  cursor: ew-resize;
  transform: translate(50%, -50%);
}

.handle-w {
  top: 50%;
  left: -5px;
  cursor: ew-resize;
  transform: translate(-50%, -50%);
}

.handle-ne {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
  transform: translate(50%, -50%);
}

.handle-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
  transform: translate(50%, 50%);
}

.handle-sw {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
  transform: translate(-50%, 50%);
}

.handle-nw {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
  transform: translate(-50%, -50%);
}

.toast-region {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 168px;
  max-width: 280px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 400;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.context-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  display: none;
  min-width: 92px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.context-menu.show {
  display: block;
}

.context-menu-item {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.context-menu-item:hover {
  background: var(--surface-2);
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .shape-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar-component-panel {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar-shape-grid {
    grid-template-columns: repeat(6, 34px);
  }

  .theme-switch {
    width: 132px;
  }

  .canvas-grid {
    min-width: 1304px;
    padding: 22px;
  }

  .artboard {
    width: 1280px;
    height: 720px;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }

  .artboard-body {
    height: 100%;
    padding: 0;
  }
}

@media (max-width: 520px) {
  .shape-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-shape-grid {
    grid-template-columns: repeat(4, 34px);
  }

  .brand {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .property-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }
}
