.pde-workspace {
  --pde-accent: #b52b3d;
  --pde-soft: #fff0f2;
  --pde-panel: var(--surface, #fff);
  --pde-text: var(--text, #172033);
  --pde-line: var(--line, #dce3ed);
  --pde-muted: var(--muted, #64748b);
  color: var(--pde-text);
  position: relative;
  min-width: 0;
  width: 100%;
  font-family: inherit;
}
html[data-theme="dark"] .pde-workspace {
  --pde-accent: #ff8596;
  --pde-soft: #40212c;
}
.pde-section {
  padding: 0 20px 24px;
  max-width: 2000px;
  margin: auto;
}
.pde-intro {
  padding: 12px 20px !important;
}
.pde-intro h1 {
  font-size: 24px !important;
  margin: 0;
}
.pde-intro p {
  font-size: 14px !important;
  margin: 4px 0 12px;
  color: var(--muted);
}
.pde-app {
  border: 1px solid var(--pde-line);
  border-radius: 16px;
  background: var(--pde-panel);
  overflow: clip;
  box-shadow: 0 8px 30px #10203508;
}
.pde-workspace [hidden],
.pde-modal [hidden] {
  display: none !important;
}
.pde-workspace * {
  box-sizing: border-box;
}
.pde-workspace :is(button, input, select, textarea) {
  font: inherit;
  color: var(--pde-text);
}
.pde-workspace :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--pde-accent);
  outline-offset: 2px;
}
.pde-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px;
  background: transparent;
  color: inherit;
  white-space: nowrap;
  font-size: 14px !important;
  cursor: pointer;
  line-height: 1.2;
}
.pde-btn svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  display: block;
}
.pde-btn:hover:not(:disabled),
.pde-btn.is-active {
  background: var(--pde-soft);
  color: var(--pde-accent);
  border-color: var(--pde-line);
}
.pde-btn:disabled {
  opacity: 0.38;
  cursor: default;
}
.pde-btn.pde-primary {
  background: var(--pde-accent);
  color: white;
  padding-inline: 16px;
  font-weight: 650;
}
html[data-theme="dark"] .pde-btn.pde-primary {
  color: #271019;
}
.pde-btn.pde-primary:hover {
  filter: brightness(0.96);
}
.pde-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--pde-line);
}
.pde-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pde-name > svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--pde-accent);
}
.pde-name input {
  min-width: 70px;
  width: min(330px, 100%);
  border: 1px solid transparent;
  padding: 7px;
  background: transparent;
  border-radius: 6px;
  font-weight: 650;
}
.pde-name input:hover {
  border-color: var(--pde-line);
}
.pde-local {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  white-space: nowrap;
  color: var(--pde-muted);
}
.pde-local svg {
  width: 15px;
  height: 15px;
}
.pde-quick {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pde-export {
  position: relative;
}
.pde-download-menu {
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  width: 245px;
  padding: 7px;
  background: var(--pde-panel);
  border: 1px solid var(--pde-line);
  border-radius: 10px;
  box-shadow: 0 8px 32px #0003;
  z-index: 70;
}
.pde-download-menu .pde-btn {
  width: 100%;
  justify-content: flex-start;
}
.pde-tabs-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--pde-line);
  padding-inline: 8px;
}
.pde-tabs {
  display: flex;
  overflow: auto;
  scrollbar-width: thin;
  flex: 1;
  gap: 2px;
}
.pde-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 12px;
  background: transparent;
  white-space: nowrap;
  font-size: 14px;
  cursor: pointer;
}
.pde-tabs button[aria-selected="true"] {
  border-color: var(--pde-accent);
  color: var(--pde-accent);
  font-weight: 650;
}
.pde-pane {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 108px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: thin;
}
.pde-group {
  border-inline-end: 1px solid var(--pde-line);
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: space-between;
  flex-shrink: 0;
}
.pde-group > div {
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 540px;
  flex-wrap: wrap;
}
.pde-group > small {
  color: var(--pde-muted);
  font-size: 12px;
  text-align: center;
}
.pde-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--pde-muted);
  font-size: 12px;
}
.pde-field :is(select, input) {
  border: 1px solid var(--pde-line);
  border-radius: 6px;
  background: var(--pde-panel);
  font-size: 14px;
  min-height: 35px;
  padding: 5px;
}
.pde-field input[type="color"] {
  width: 58px;
}
.pde-file-note {
  max-width: 490px;
  min-width: 280px;
  padding: 0 16px;
  margin: 0;
  font-size: 13px;
  color: var(--pde-muted);
  line-height: 1.7;
}
.pde-draft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--pde-soft);
  color: var(--pde-muted);
  padding: 4px 14px;
  font-size: 12px;
}
.pde-draft .pde-btn {
  font-size: 12px !important;
  min-height: 30px;
  padding: 4px;
}
.pde-notice {
  padding: 12px 16px;
  line-height: 1.6;
  font-size: 14px;
  border-bottom: 1px solid var(--pde-line);
  background: var(--pde-soft);
}
.pde-notice.error {
  background: #fff0f1;
  color: #a0152b;
}
.pde-start {
  padding: 62px 20px;
  text-align: center;
  max-width: 850px;
  margin: 30px auto;
  border: 2px dashed var(--pde-line);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--pde-soft), var(--pde-panel));
}
.pde-start > svg {
  width: 55px;
  height: 55px;
  color: var(--pde-accent);
  margin: auto;
}
.pde-start h2 {
  font-size: 24px;
  margin: 20px 0 10px;
}
.pde-start p {
  font-size: 16px;
  color: var(--pde-muted);
  margin: 0 0 20px;
}
.pde-start > div {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pde-start > div .pde-btn:first-child {
  background: var(--pde-accent);
  color: var(--pde-panel);
  font-weight: 650;
}
.pde-start small {
  display: block;
  margin-top: 24px;
  color: var(--pde-muted);
  font-size: 13px;
}
.pde-start.drag {
  border-color: var(--pde-accent);
}
.pde-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--pde-line);
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}
.pde-nav > label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pde-nav input {
  width: 55px;
  border: 1px solid var(--pde-line);
  border-radius: 5px;
  background: var(--pde-panel);
  padding: 6px;
  text-align: center;
  direction: ltr;
}
.pde-nav-spacer {
  flex: 1;
}
.pde-nav .pde-btn {
  font-size: 13px !important;
}
.pde-body {
  display: flex;
  min-width: 0;
  height: clamp(420px, calc(100dvh - 340px), 950px);
  position: relative;
}
.pde-viewport {
  flex: 1;
  min-width: 0;
  overflow: auto;
  position: relative;
  background: #e4e8ee;
  overscroll-behavior: contain;
  direction: ltr;
  padding: 24px;
  outline-offset: -3px;
  scrollbar-width: thin;
  touch-action: pan-x pan-y;
}
html[data-theme="dark"] .pde-viewport {
  background: #131b2a;
}
#pde-stage {
  position: relative;
  margin-inline: auto;
  flex-shrink: 0;
  box-shadow: 0 5px 24px #0002;
  background: white;
}
#pde-paper {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  background: white;
}
#pde-canvas,
#pde-overlay {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none !important;
  display: block;
}
#pde-overlay {
  overflow: hidden;
  touch-action: none;
}
#pde-overlay.panning {
  pointer-events: none;
  touch-action: auto;
}
#pde-overlay.drawing {
  touch-action: none;
  cursor: crosshair;
}
.pde-selection {
  pointer-events: none;
  fill: none;
  stroke: #2b66e9;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.pde-handle {
  fill: #fff;
  stroke: #2b66e9;
  stroke-width: 1.5;
  cursor: nwse-resize;
}
.pde-element {
  cursor: move;
  touch-action: none;
}
.pde-handle {
  touch-action: none;
}
.pde-element[data-locked="true"] {
  cursor: default;
}
#pde-sidebar {
  flex: 0 0 144px;
  overflow: auto;
  border-inline-end: 1px solid var(--pde-line);
  background: var(--pde-panel);
  scrollbar-width: thin;
}
.pde-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--pde-line);
  font-size: 14px;
  position: sticky;
  top: 0;
  background: var(--pde-panel);
  z-index: 2;
}
.pde-sidebar-head .pde-btn {
  min-height: 30px;
  padding: 4px;
}
.pde-thumb {
  position: relative;
  padding: 10px 20px;
  border-bottom: 1px solid var(--pde-line);
}
.pde-thumb.active {
  background: var(--pde-soft);
}
.pde-thumb button {
  display: block;
  border: 2px solid transparent;
  background: transparent;
  width: 100%;
  padding: 4px;
  cursor: pointer;
  color: var(--pde-muted);
  font-size: 12px;
}
.pde-thumb.active button {
  border-color: var(--pde-accent);
  border-radius: 7px;
  color: var(--pde-accent);
}
.pde-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  background: white;
  box-shadow: 0 2px 8px #0002;
  margin-bottom: 6px;
}
.pde-thumb input {
  position: absolute;
  top: 16px;
  inset-inline-start: 4px;
  accent-color: var(--pde-accent);
  width: 16px;
  height: 16px;
}
.pde-thumb.drag-over {
  outline: 2px solid var(--pde-accent);
  outline-offset: -3px;
}
.pde-properties {
  flex: 0 0 275px;
  background: var(--pde-panel);
  border-inline-start: 1px solid var(--pde-line);
  overflow: auto;
  scrollbar-width: thin;
}
#pde-properties-body {
  padding: 12px;
  display: grid;
  gap: 12px;
  font-size: 14px;
}
#pde-properties-body > p {
  color: var(--pde-muted);
  line-height: 1.65;
  margin: 0;
}
.pde-props-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pde-prop {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--pde-muted);
  min-width: 0;
}
.pde-prop :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  background: var(--pde-panel);
  border: 1px solid var(--pde-line);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  color: var(--pde-text);
}
.pde-prop input[type="color"] {
  height: 38px;
}
.pde-prop textarea {
  resize: vertical;
  min-height: 100px;
}
.pde-prop input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--pde-accent);
}
.pde-prop.wide {
  grid-column: 1/-1;
}
.pde-prop .pde-check {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pde-element-list {
  display: grid;
  gap: 5px;
}
.pde-element-list .pde-btn {
  justify-content: flex-start;
  overflow: hidden;
}
.pde-element-list .pde-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.pde-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--pde-muted);
  border-top: 1px solid var(--pde-line);
}
.pde-busy {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: color-mix(in srgb, var(--pde-panel) 94%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 300px;
  border-radius: 16px;
}
.pde-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--pde-line);
  border-top-color: var(--pde-accent);
  border-radius: 50%;
  animation: pde-spin 1s linear infinite;
}
@keyframes pde-spin {
  to {
    transform: rotate(360deg);
  }
}
.pde-busy progress {
  width: min(320px, 80%);
  accent-color: var(--pde-accent);
}
.pde-modal-overlay {
  position: fixed;
  inset: 0;
  background: #06102799;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  backdrop-filter: blur(3px);
}
.pde-modal {
  background: var(--surface, #fff);
  color: var(--text, #172033);
  border: 1px solid var(--line, #dce3ed);
  border-radius: 16px;
  padding: 22px;
  width: 520px;
  max-width: 100%;
  max-height: 88dvh;
  overflow: auto;
  box-shadow: 0 18px 70px #0004;
  box-sizing: border-box;
}
.pde-modal h2 {
  font-size: 21px;
  margin: 0 0 14px;
}
.pde-modal p {
  font-size: 14px;
  color: var(--muted, #64748b);
  line-height: 1.65;
}
.pde-modal .pde-form {
  display: grid;
  gap: 14px;
}
.pde-modal label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.pde-modal :is(input, select, textarea) {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line, #ddd);
  border-radius: 7px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
  min-width: 0;
  box-sizing: border-box;
  max-width: 100%;
}
.pde-modal textarea {
  min-height: 100px;
}
.pde-modal input[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.pde-modal .pde-btn {
  color: var(--text, #172033);
  border-color: var(--line, #ddd);
}
.pde-modal .pde-btn.pde-primary {
  background: #b52b3d;
  color: white;
}
.pde-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.pde-sign-pad {
  width: 100%;
  height: 180px;
  display: block;
  border: 1px solid #b8c5d4;
  border-radius: 8px;
  touch-action: none;
  background: white;
}
.pde-modal :focus-visible {
  outline: 2px solid #d84862;
  outline-offset: 2px;
}
.pde-workspace:fullscreen {
  padding: 8px;
  background: var(--pde-panel);
  overflow: auto;
}
.pde-workspace:fullscreen .pde-body {
  height: calc(100dvh - 275px);
}
@media (max-width: 1100px) {
  .pde-local {
    display: none;
  }
  .pde-section {
    padding-inline: 10px;
  }
  .pde-properties {
    flex-basis: 235px;
  }
  .pde-group {
    padding-inline: 8px;
  }
}
@media (max-width: 800px) {
  .pde-body {
    height: clamp(380px, calc(100dvh - 290px), 850px);
  }
  #pde-sidebar {
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 145px;
    z-index: 40;
    box-shadow: 0 6px 30px #0003;
  }
  .pde-properties {
    position: fixed;
    inset-inline: 8px;
    bottom: 8px;
    top: auto;
    width: auto;
    max-height: 65dvh;
    z-index: 10010;
    border: 1px solid var(--pde-line);
    border-radius: 14px;
    box-shadow: 0 -10px 50px #0004;
  }
  .pde-props-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pde-viewport {
    padding: 12px;
  }
}
@media (max-width: 640px) {
  .pde-section {
    padding-inline: 5px;
  }
  .pde-intro {
    padding: 8px !important;
  }
  .pde-intro h1 {
    font-size: 21px !important;
  }
  .pde-app {
    border-radius: 10px;
  }
  .pde-titlebar {
    flex-wrap: wrap;
    padding: 8px;
    gap: 5px;
  }
  .pde-name {
    flex-basis: 100%;
    gap: 5px;
  }
  .pde-name input {
    width: 100%;
    font-size: 14px;
  }
  .pde-quick {
    width: 100%;
    justify-content: flex-end;
  }
  .pde-quick > .pde-btn:first-child {
    margin-inline-end: auto;
  }
  .pde-tabs-row {
    padding-inline: 2px;
  }
  .pde-tabs button {
    padding: 11px 9px;
    font-size: 13px;
  }
  .pde-pane {
    flex-wrap: wrap;
    max-height: 230px;
    overflow: auto;
    gap: 12px;
    padding: 10px;
  }
  .pde-group {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--pde-line);
    padding: 0 0 10px;
  }
  .pde-group > div {
    gap: 5px;
  }
  .pde-group > small {
    text-align: start;
  }
  .pde-start {
    margin: 16px 10px;
    padding: 36px 14px;
  }
  .pde-start p {
    font-size: 15px;
  }
  .pde-draft {
    padding-inline: 8px;
  }
  .pde-draft .pde-btn span {
    display: none;
  }
  .pde-nav {
    gap: 2px;
    padding: 4px;
  }
  .pde-nav .pde-btn span {
    display: none;
  }
  .pde-nav .pde-btn {
    padding: 6px;
    min-width: 32px;
  }
  .pde-nav input {
    width: 43px;
  }
  .pde-nav > label {
    font-size: 12px;
  }
  .pde-status {
    font-size: 12px;
    padding: 8px;
  }
  .pde-modal {
    padding: 17px;
  }
  .pde-body {
    height: clamp(360px, calc(100dvh - 355px), 720px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pde-spinner {
    animation: none;
  }
}
