/* SPDX-License-Identifier: GPL-3.0-only */
* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #050814;
  --surface: rgba(15, 22, 40, 0.84);
  --card: rgba(255, 255, 255, 0.045);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.36;
}
.orb-1 {
  width: 620px;
  height: 440px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.55), transparent 70%);
}
.orb-2 {
  width: 620px;
  height: 480px;
  top: -60px;
  right: -140px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.42), transparent 70%);
}
.grid-mesh {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.13) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 80%);
}

.ws-topbar-shell {
  position: sticky;
  top: 10px;
  z-index: 30;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px 0;
}
.ws-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 32px rgba(2, 6, 20, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}
.brand-group { display: flex; align-items: center; gap: 10px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #f8fafc;
  font-weight: 800;
  font-size: 16px;
}
.brand img { border-radius: 8px; box-shadow: 0 3px 12px rgba(56, 189, 248, 0.28); }
.ws-badge {
  font-size: 11.5px;
  font-weight: 650;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.20), rgba(56, 189, 248, 0.18));
  border: 1px solid rgba(244, 114, 182, 0.38);
  color: #f9a8d4;
}

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ghost-btn, .mini-btn, .primary-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .15s ease, border-color .15s ease, transform .14s ease, box-shadow .15s ease;
}
.ghost-btn, .mini-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
.ghost-btn:hover, .mini-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); }
.mini-btn { padding: 6px 10px; font-size: 12px; }
.mini-btn.accent { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.38); color: #bae6fd; }
.mini-btn.accent:hover { background: rgba(56, 189, 248, 0.26); color: #fff; }
.mini-btn.danger { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.34); color: #fda4af; }
.primary-btn {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  box-shadow: 0 5px 16px rgba(14, 165, 233, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }

.shared-banner {
  position: relative;
  z-index: 2;
  max-width: 1192px;
  margin: 14px auto 0;
  padding: 12px 16px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(236, 72, 153, 0.14));
  border: 1px solid rgba(125, 211, 252, 0.38);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sb-text { display: flex; flex-direction: column; gap: 3px; }
.sb-pill {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}
.sb-text strong { font-size: 14px; color: #f8fafc; }
.sb-text small { font-size: 12px; color: #cbd5e1; }
.sb-cta { display: flex; align-items: center; gap: 8px; }

.ws-workspace {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 24px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.stage-pane {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 13px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}
.orbit-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.orb-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.orb-pills { display: flex; gap: 4px; }
.orb-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-radius: 7px;
  padding: 4px 9px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.orb-btn.active { background: rgba(56, 189, 248, 0.22); border-color: rgba(56, 189, 248, 0.55); color: #fff; }
#orbit-slider { width: 110px; accent-color: #38bdf8; }

.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 560 / 380;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 24px 64px rgba(2, 6, 20, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.stage-wrap.dark {
  background:
    radial-gradient(circle at 50% 22%, rgba(56, 189, 248, 0.20), transparent 54%),
    radial-gradient(circle at 80% 78%, rgba(236, 72, 153, 0.14), transparent 52%),
    linear-gradient(180deg, #1b2747 0%, #10172b 65%, #090e1d 100%);
}
.stage-wrap.light {
  background:
    radial-gradient(circle at 50% 26%, rgba(96, 165, 250, 0.28), transparent 58%),
    linear-gradient(180deg, #f3f7ff 0%, #dce8fb 65%, #c7d9f5 100%);
}
.stage-spotlight {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 410px;
  height: 88px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(125, 211, 252, 0.28) 0%, rgba(236, 72, 153, 0.08) 54%, transparent 74%);
  pointer-events: none;
  z-index: 0;
}
.stage-wrap.light .stage-spotlight {
  background: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.18) 0%, transparent 72%);
}
.stage-wrap.light .stage-tip {
  background: rgba(255, 255, 255, 0.88);
  color: #1e293b;
  border-color: rgba(15, 23, 42, 0.12);
}

#stage3d, #stage2d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#stage3d { z-index: 1; }
#stage2d { z-index: 2; pointer-events: none; }

.pet-name-tag {
  position: absolute;
  top: 13px;
  left: 13px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5.5px 12px;
  border-radius: 999px;
  background: rgba(11, 16, 32, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  font-size: 12px;
}
.tag-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }
.pet-name-tag strong { color: #f8fafc; font-weight: 700; }
.pet-name-tag small { color: #94a3b8; font-size: 11px; }

.stage-tip {
  position: absolute;
  bottom: 11px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 4.5px 13px;
  border-radius: 999px;
  background: rgba(11, 16, 32, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  color: #cbd5e1;
  white-space: nowrap;
  pointer-events: none;
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.act-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.055);
  color: #e2e8f0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.act-btn:hover { transform: translateY(-1px); background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.42); }
.act-btn.active { background: rgba(56, 189, 248, 0.24); border-color: #38bdf8; color: #fff; }
.act-btn.gold { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.38); color: #fde68a; }
.act-btn.gold:hover { background: rgba(245, 158, 11, 0.25); }

.share-dock {
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(145deg, rgba(23, 33, 58, 0.88), rgba(12, 18, 35, 0.94));
  border: 1px solid rgba(125, 211, 252, 0.30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.sd-head { display: flex; flex-direction: column; gap: 2px; }
.sd-head strong { font-size: 13.5px; color: #f8fafc; }
.sd-head small { font-size: 11px; color: #94a3b8; }
.sd-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.sd-buttons .primary-btn, .sd-buttons .mini-btn { padding: 6.5px 11px; font-size: 11.5px; }

/* 右侧编辑器 */
.editor-pane {
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(2, 6, 20, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.ed-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.tab-btn {
  appearance: none;
  border: 0;
  border-radius: 8.5px;
  padding: 7px 4px;
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab-btn.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.26), rgba(37, 99, 235, 0.24));
  color: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.35);
}

.tab-panel { display: flex; flex-direction: column; gap: 10px; }
.panel-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.section-lbl { font-size: 11.5px; font-weight: 700; color: #cbd5e1; margin-top: 2px; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.preset-card {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.preset-card:hover {
  transform: translateY(-1px);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.38);
}
.preset-card.active {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.20), rgba(37, 99, 235, 0.14));
  border-color: #38bdf8;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.16);
}
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pc-swatches { display: inline-flex; gap: 3.5px; }
.pc-swatches i { width: 11.5px; height: 11.5px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); }
.preset-card strong { font-size: 13px; }
.preset-card small { font-size: 11px; color: #94a3b8; }

.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.field input, .field select, .import-body textarea {
  width: 100%;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 22, 0.90);
  color: #f8fafc;
  font: inherit;
  font-size: 12.5px;
}

.chip-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  padding: 5.5px 9.5px;
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e1;
  font: inherit;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.11); }
.chip.active { background: rgba(56, 189, 248, 0.22); border-color: #38bdf8; color: #fff; font-weight: 650; }

.slider-grid { display: flex; flex-direction: column; gap: 6px; }
.slider-row {
  display: grid;
  grid-template-columns: 74px 1fr 42px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.slider-row input { width: 100%; accent-color: #38bdf8; }
.slider-row output { text-align: right; font-variant-numeric: tabular-nums; color: #94a3b8; font-size: 11px; }

/* Custom macOS Pill Switch (replaces raw square checkbox) */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform .18s cubic-bezier(.22, 1, .36, 1);
}
.switch-row input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  border-color: rgba(125, 211, 252, 0.55);
}
.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.color-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5.5px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  color: #cbd5e1;
}
.color-item input[type="color"] {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.blk-add-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.blk-list { display: flex; flex-direction: column; gap: 5px; max-height: 150px; overflow-y: auto; }
.blk-item {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 9px;
  padding: 6.5px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font: inherit;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.blk-item.active { background: rgba(56, 189, 248, 0.18); border-color: #38bdf8; }
.blk-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.blk-inspector {
  border-radius: 13px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bi-head { display: flex; align-items: center; justify-content: space-between; }
.bi-actions { display: flex; gap: 5px; }

/* 弹窗 & Toast */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 8, 20, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-dialog {
  width: min(560px, 100%);
  border-radius: 18px;
  background: #11182c;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62);
}
.modal-dialog.small { width: min(460px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.modal-body { display: flex; justify-content: center; max-height: 66vh; overflow: auto; }
.modal-body img { max-width: 100%; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.modal-tip { font-size: 11.5px; color: var(--muted); }
.modal-actions, .im-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.import-body { display: flex; flex-direction: column; gap: 10px; }

.ws-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.94);
  color: #052e16;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

@media (max-width: 920px) {
  .ws-workspace { grid-template-columns: 1fr; }
  .editor-pane { max-height: none; }
}
