*, *::before, *::after { box-sizing: border-box; }

* {
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #ffffff;
  color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.layout {
  display: flex;
  height: 100vh;
  width: 100%;
}

.pane-left {
  flex: 0 0 300px;
  border-right: 1px solid #000000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  background: #f6f6f6;
  position: relative;
}

.pane-right {
  flex: 0 0 420px;
  border-left: 1px solid #000000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-head {
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pane-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
}

.block {
  border: 1px solid #000000;
  margin-bottom: 16px;
}

.block-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 9px 12px;
  border-bottom: 1px solid #000000;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.block-body {
  padding: 12px;
}

.btn {
  border: 1px solid #000000;
  background: #ffffff;
  color: #000000;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .1s;
}
.btn:hover { background: #f0f0f0; }
.btn:active { background: #e0e0e0; }
.btn.primary {
  background: #000000;
  color: #ffffff;
}
.btn.primary:hover { opacity: 0.85; }

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #000000;
  padding: 7px 9px;
  font-size: 11px;
  cursor: pointer;
  background: #ffffff;
  user-select: none;
}
.layer-item:hover { background: #f0f0f0; }
.layer-item.active { background: #000000; color: #ffffff; }
.layer-item .layer-type {
  font-weight: 700;
  letter-spacing: 0.5px;
  flex: 0 0 46px;
}
.layer-item .layer-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.layer-item .layer-del {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.layer-item .layer-del:hover { opacity: 0.6; }

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  border: none;
  border-bottom: 1px solid #000000;
  background: transparent;
  color: #000000;
  font-family: inherit;
  font-size: 13px;
  padding: 5px 0;
  outline: none;
}

.field-row-2 {
  display: flex;
  gap: 10px;
}
.field-row-2 > * { flex: 1; min-width: 0; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: #000000;
}
.slider-row .slider-val {
  flex: 0 0 42px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.empty-hint {
  font-size: 11px;
  line-height: 1.6;
  color: #666666;
}

.bw-row {
  display: flex;
  gap: 8px;
}

.bw-btn {
  flex: 1;
  border: 1px solid #000000;
  background: #ffffff;
  color: #000000;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 7px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .1s;
}
.bw-btn:hover { background: #f0f0f0; }
.bw-btn.active {
  background: #000000;
  color: #ffffff;
}
.bw-btn .swatch {
  width: 11px;
  height: 11px;
  border: 1px solid #000000;
  display: block;
  flex: 0 0 auto;
}
.bw-btn.active .swatch {
  border-color: #ffffff;
}
.bw-btn .swatch.white { background: #ffffff; }
.bw-btn .swatch.black { background: #000000; }

.preview-wrap {
  position: relative;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 0 0 0 1px #ffffff, 0 8px 28px rgba(0,0,0,.12);
}

.preview-meta {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.preview-meta .zoom {
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #666666;
}

#canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  will-change: transform;
}

.guide {
  position: absolute;
  pointer-events: none;
  display: none;
  z-index: 50;
}

.guide.show {
  display: block;
}

.guide-v {
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed #000000;
  transform: translateX(-0.5px);
  opacity: 0.45;
}

.guide-h {
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed #000000;
  transform: translateY(-0.5px);
  opacity: 0.45;
}

.cv-el {
  position: absolute;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.cv-el.selected {
  outline: 1px dashed #000000;
  outline-offset: 1px;
}

.cv-el.dragging {
  cursor: grabbing;
}

.cv-el:not(.dragging) {
  cursor: grab;
}

.cv-text {
  display: flex;
  align-items: center;
  white-space: pre-wrap;
  word-break: break-word;
}

.cv-box {
  display: flex;
}

.cv-divider {
  display: flex;
}

.cv-bar-track {
  background: #ffffff;
  border: 1px solid #000000;
  overflow: hidden;
  display: flex;
}

.cv-bar-fill {
  background: #000000;
  height: 100%;
}

.code-area {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
}

.code-area pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre;
  color: #000000;
}

.pane-right .actions {
  flex: 0 0 auto;
  border-top: 1px solid #000000;
  padding: 12px 16px;
}

.status {
  font-size: 11px;
  line-height: 1.6;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.device-btn {
  border: none;
  background: transparent;
  color: #000000;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-btn:hover { opacity: 0.6; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-mask[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 440px;
  border: 1px solid #000000;
  background: #ffffff;
  padding: 24px;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
}

.modal-desc {
  margin: 0 0 22px;
  font-size: 12px;
  line-height: 1.6;
  color: #555555;
}

.modal .field { margin-bottom: 18px; }

.modal .field label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.modal .field input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #000000;
  background: transparent;
  color: #000000;
  font-family: inherit;
  font-size: 14px;
  padding: 7px 0;
  outline: none;
}
.modal .field input::placeholder { color: #bbbbbb; }

.modal-error {
  font-size: 11px;
  margin: -8px 0 14px;
  padding: 8px 10px;
  border: 1px solid #000000;
  display: none;
}
.modal-error.show { display: block; }

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  border: 1px solid #000000;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  padding: 12px;
  cursor: pointer;
}
.modal-btn.primary { background: #000000; color: #ffffff; }
.modal-btn.primary:hover { opacity: 0.85; }
.modal-btn.ghost { background: #ffffff; color: #000000; }
.modal-btn.ghost:hover { background: #f0f0f0; }

.pc-only {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  text-align: center;
}
.pc-only[hidden] { display: none; }
.pc-only .pc-only-inner {
  border: 1px solid #000000;
  padding: 32px 36px;
  max-width: 380px;
}
.pc-only h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}
.pc-only p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #555555;
}

@media (max-width: 900px) {
  .pc-only { display: flex; }
}
