:root {
  --ink: #17304e;
  --muted: #59708b;
  --line: rgba(255, 255, 255, 0.22);
  --panel: rgba(255, 255, 255, 0.75);
  --panel-solid: #ffffff;
  --orange: #ff9d4d;
  --coral: #ff6b6b;
  --yellow: #ffd93d;
  --mint: #5fd3bc;
  --teal: #2f8f9d;
  --sky: #7ed7ff;
  --cream: #fff8eb;
  --shadow: 0 24px 60px rgba(19, 34, 62, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1,
h2,
h3 {
  font-family: "Baloo 2", "Space Grotesk", "PingFang SC", sans-serif;
  margin: 0;
}

p {
  margin: 0;
}

button,
a,
input {
  font: inherit;
}

.eyebrow,
.mode-tag,
.mini-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-page {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 222, 146, 0.3), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(95, 211, 188, 0.25), transparent 24%),
    linear-gradient(145deg, #0e1830 0%, #13284b 50%, #0f1f3b 100%);
  color: #f3f7ff;
}

.home-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 28px 48px;
}

.home-topbar,
.workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-mark {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.logo-copy {
  margin-top: 10px;
  color: rgba(243, 247, 255, 0.8);
  font-size: 14px;
}

.topbar-badge,
.mode-badge {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 14px;
  font-weight: 700;
}

.home-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 32px;
  align-items: center;
  padding: 44px 0 26px;
}

.hero-copy h1 {
  margin-top: 12px;
  font-size: clamp(42px, 5vw, 74px);
  line-height: 0.98;
}

.hero-copy > p {
  margin-top: 18px;
  max-width: 720px;
  color: rgba(243, 247, 255, 0.84);
  font-size: 18px;
  line-height: 1.7;
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.hero-point {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.hero-point strong {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
}

.hero-point span {
  color: rgba(243, 247, 255, 0.74);
  line-height: 1.6;
}

.hero-preview {
  display: flex;
  justify-content: center;
}

.preview-card {
  position: relative;
  width: min(100%, 470px);
  min-height: 460px;
  border-radius: 34px;
  background:
    radial-gradient(circle at top, rgba(126, 215, 255, 0.36), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-stage-card {
  padding: 40px;
}

.preview-grid {
  position: absolute;
  inset: 90px 50px 120px;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(19, 40, 75, 0.3), rgba(255, 255, 255, 0.05));
  background-size: 26px 26px, 26px 26px, 100% 100%;
  transform: perspective(1100px) rotateX(70deg);
  transform-origin: center top;
}

.preview-block {
  position: absolute;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
  animation: floaty 5s ease-in-out infinite;
}

.preview-block::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 18px;
  background-image:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.46) 0 10px, transparent 11px),
    radial-gradient(circle at calc(100% - 18px) 18px, rgba(255, 255, 255, 0.46) 0 10px, transparent 11px),
    radial-gradient(circle at 18px calc(100% - 18px), rgba(255, 255, 255, 0.46) 0 10px, transparent 11px),
    radial-gradient(circle at calc(100% - 18px) calc(100% - 18px), rgba(255, 255, 255, 0.46) 0 10px, transparent 11px);
}

.preview-block-a {
  top: 90px;
  left: 64px;
  background: linear-gradient(135deg, #ff9d4d, #ff6b6b);
}

.preview-block-b {
  top: 180px;
  right: 84px;
  width: 128px;
  background: linear-gradient(135deg, #5fd3bc, #2f8f9d);
  animation-delay: -1.5s;
}

.preview-block-c {
  bottom: 142px;
  left: 120px;
  width: 124px;
  background: linear-gradient(135deg, #ffd93d, #ff9d4d);
  animation-delay: -3.1s;
}

.preview-block-d {
  bottom: 120px;
  right: 70px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ed7ff, #7b7dff);
  animation-delay: -2.2s;
}

.preview-screen {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  padding: 20px 22px;
  border-radius: 24px;
  background: rgba(10, 20, 40, 0.6);
  backdrop-filter: blur(10px);
}

.preview-screen span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.74;
}

.preview-screen strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.mode-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 18px;
}

.mode-card {
  padding: 28px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.alt-card {
  background: rgba(126, 215, 255, 0.1);
}

.mode-card h2 {
  margin-top: 12px;
  font-size: 34px;
}

.mode-card p {
  margin-top: 14px;
  color: rgba(243, 247, 255, 0.82);
  line-height: 1.7;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.primary-button,
.secondary-button,
.topbar-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.primary-button,
.topbar-button,
.tool-button {
  background: linear-gradient(135deg, var(--orange), var(--coral));
  color: white;
  box-shadow: 0 18px 32px rgba(255, 107, 107, 0.24);
}

.secondary-button {
  background: linear-gradient(135deg, var(--mint), var(--teal));
  color: white;
  box-shadow: 0 18px 32px rgba(47, 143, 157, 0.24);
}

.mode-button {
  margin-top: 24px;
  min-width: 210px;
}

.primary-button:hover,
.secondary-button:hover,
.topbar-button:hover,
.tool-button:hover,
.ghost-link:hover {
  transform: translateY(-2px);
}

.tool-button.active {
  box-shadow:
    0 18px 32px rgba(255, 107, 107, 0.24),
    0 0 0 3px rgba(255, 255, 255, 0.56) inset;
}

.workspace-page {
  background:
    radial-gradient(circle at top left, rgba(255, 217, 61, 0.18), transparent 24%),
    radial-gradient(circle at right, rgba(126, 215, 255, 0.2), transparent 26%),
    linear-gradient(180deg, #fef9ef 0%, #eef8ff 48%, #f8f5ff 100%);
  color: var(--ink);
}

.workspace-shell {
  min-height: 100vh;
  padding: 20px;
}

.workspace-topbar {
  padding: 8px 6px 18px;
}

.brand-group,
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dark-mark {
  background: rgba(23, 48, 78, 0.08);
}

.dark-copy {
  color: var(--muted);
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(23, 48, 78, 0.08);
}

.danger-button,
.danger-tool {
  background: linear-gradient(135deg, #ff8c82, #ff5e78);
  box-shadow: 0 18px 32px rgba(255, 94, 120, 0.22);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  gap: 20px;
  min-height: calc(100vh - 112px);
}

.library-panel,
.inspector-panel {
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.panel,
.stage-panel {
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.panel-heading h2 {
  margin-top: 8px;
  font-size: 30px;
}

.panel-heading p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.library-tools {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.library-search {
  display: grid;
  gap: 8px;
}

.library-search span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.library-search input,
.tag-input-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(23, 48, 78, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.library-search input:focus,
.tag-input-row input:focus {
  border-color: rgba(255, 107, 107, 0.42);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.12);
}

.library-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.library-meta strong {
  font-size: 18px;
}

.library-meta span {
  color: var(--muted);
}

.library-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(23, 48, 78, 0.1);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.category-chip:hover,
.category-chip.active {
  transform: translateY(-1px);
  border-color: rgba(255, 107, 107, 0.28);
  box-shadow: 0 10px 22px rgba(23, 48, 78, 0.08);
}

.category-chip.active {
  background: linear-gradient(135deg, rgba(255, 157, 77, 0.16), rgba(255, 107, 107, 0.16));
}

.library-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.part-card {
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(23, 48, 78, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  cursor: grab;
  display: grid;
  gap: 12px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.part-card:hover,
.part-card.active {
  transform: translateY(-2px);
  border-color: rgba(255, 107, 107, 0.45);
  box-shadow: 0 18px 32px rgba(23, 48, 78, 0.1);
}

.part-card.active {
  background: linear-gradient(180deg, #fff7ef, #ffffff);
}

.part-preview {
  width: 100%;
  height: 94px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(23, 48, 78, 0.08)),
    var(--preview-accent, linear-gradient(135deg, #ff9d4d, #ff6b6b));
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.part-preview::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.preview-svg {
  position: relative;
  z-index: 1;
  width: calc(100% - 20px);
  height: calc(100% - 18px);
  filter: drop-shadow(0 12px 18px rgba(16, 24, 40, 0.18));
}

.preview-svg--large {
  width: calc(100% - 26px);
  height: calc(100% - 22px);
}

.part-card strong {
  display: block;
  font-size: 18px;
}

.part-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.part-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.part-tag,
.part-drag-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.part-tag {
  background: rgba(23, 48, 78, 0.08);
  color: var(--ink);
}

.part-drag-label {
  background: rgba(255, 107, 107, 0.12);
  color: #c7505d;
}

.panel-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  line-height: 1.6;
}

.soft-note {
  margin-top: 20px;
}

.stage-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 18px;
}

.stage-toolbar h1 {
  margin-top: 8px;
  font-size: clamp(30px, 3.2vw, 46px);
}

.stage-toolbar p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.stage-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 520px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.84), rgba(209, 234, 255, 0.82)),
    linear-gradient(180deg, #eaf5ff, #fdf7ef);
  border: 1px solid rgba(255, 255, 255, 0.95);
}

.stage-canvas-wrap.is-drop-target {
  box-shadow:
    inset 0 0 0 3px rgba(255, 157, 77, 0.42),
    0 18px 38px rgba(23, 48, 78, 0.12);
}

#scene {
  width: 100%;
  height: 100%;
}

.scene-overlay {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}

.overlay-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(23, 48, 78, 0.08);
}

.drop-indicator {
  position: absolute;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(23, 48, 78, 0.74);
  color: white;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: 0 18px 34px rgba(23, 48, 78, 0.18);
  opacity: 0.92;
  transform: translateY(0);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.drop-indicator.is-passive {
  opacity: 0.72;
}

.drop-indicator.is-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.stage-footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card,
.selection-card,
.fill-mode-card,
.tag-maker-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 48, 78, 0.08);
}

.stat-card span,
.selection-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card strong,
.selection-card strong {
  display: block;
  margin-top: 12px;
  font-size: 26px;
}

.selection-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.selected-preview-visual {
  width: 100%;
  height: 120px;
  margin-top: 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(23, 48, 78, 0.08)),
    var(--preview-accent, linear-gradient(135deg, #ff9d4d, #ff6b6b));
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.selected-preview-visual::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.color-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.color-swatch.active {
  border-color: rgba(23, 48, 78, 0.7);
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.86),
    0 14px 26px rgba(23, 48, 78, 0.14);
}

.color-swatch::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
}

.color-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
}

.color-input-row span {
  font-weight: 700;
}

.color-input-row input {
  width: 58px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.fill-mode-card {
  margin-top: 18px;
}

.fill-mode-card p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.tag-maker-card {
  margin-top: 18px;
}

.tag-maker-card p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.tag-input-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.tag-input-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag-create-button {
  width: 100%;
  margin-top: 14px;
}

.fill-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.fill-mode-button {
  min-height: 46px;
  border: 1px solid rgba(23, 48, 78, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.fill-mode-button:hover,
.fill-mode-button.active {
  transform: translateY(-2px);
  border-color: rgba(255, 107, 107, 0.34);
  box-shadow: 0 14px 24px rgba(23, 48, 78, 0.08);
}

.fill-mode-button.active {
  background: linear-gradient(135deg, rgba(255, 157, 77, 0.18), rgba(255, 107, 107, 0.18));
}

.fill-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.transform-grid {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.tool-button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.library-empty {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.fallback-message {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 32px;
  text-align: center;
  color: var(--muted);
  line-height: 1.8;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-14px) rotate(2deg);
  }
}

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .stage-panel {
    min-height: auto;
  }
}

@media (max-width: 960px) {
  .home-main,
  .mode-section,
  .hero-points,
  .stage-footer {
    grid-template-columns: 1fr;
  }

  .home-shell,
  .workspace-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .home-topbar,
  .workspace-topbar,
  .workspace-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .workspace-actions {
    width: 100%;
  }

  .topbar-button {
    width: 100%;
  }

  .preview-card {
    min-height: 360px;
  }

  .stage-canvas-wrap {
    min-height: 420px;
  }

  .part-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .library-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
