:root {
  --studio-bg: #f4efe6;
  --studio-bg-soft: rgba(255, 251, 245, 0.7);
  --studio-card: rgba(255, 251, 244, 0.82);
  --studio-card-strong: rgba(255, 248, 239, 0.92);
  --studio-line: rgba(74, 91, 79, 0.14);
  --studio-line-strong: rgba(34, 68, 44, 0.24);
  --studio-shadow: 0 24px 60px rgba(88, 74, 53, 0.14);
  --studio-shadow-soft: 0 10px 24px rgba(88, 74, 53, 0.09);
  --studio-text: #243126;
  --studio-text-soft: #5c675c;
  --studio-green: #2e5b37;
  --studio-green-strong: #21452a;
  --studio-green-soft: rgba(46, 91, 55, 0.12);
  --studio-accent: #d7b693;
  --studio-danger: #a55247;
  --studio-danger-soft: rgba(165, 82, 71, 0.12);
  --studio-success: #3d7b51;
  --studio-warning: #c08a44;
  --checker-a: #ffffff;
  --checker-b: #e8e8e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 245, 225, 0.92), transparent 34%),
    radial-gradient(circle at right 20%, rgba(198, 221, 203, 0.55), transparent 26%),
    linear-gradient(180deg, #faf5ec 0%, #f1eadf 100%);
  color: var(--studio-text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  position: relative;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.studio-page {
  position: relative;
  overflow: hidden;
}

.studio-ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.studio-ambient-a {
  top: 64px;
  right: 8%;
  width: 260px;
  height: 260px;
  background: rgba(127, 175, 138, 0.18);
}

.studio-ambient-b {
  bottom: 12%;
  left: 5%;
  width: 320px;
  height: 320px;
  background: rgba(233, 189, 144, 0.18);
}

.studio-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto 40px;
}

.studio-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 0 24px;
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--studio-green);
  font-size: 0.88rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.studio-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.studio-hero p {
  margin: 0;
  max-width: 760px;
  color: var(--studio-text-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.glass-card {
  background: var(--studio-card);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--studio-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar-card,
.panel-card {
  border-radius: 28px;
}

.sidebar-card {
  position: sticky;
  top: 20px;
  padding: 22px;
}

.section-stack {
  display: grid;
  gap: 18px;
}

.section-card {
  background: var(--studio-card-strong);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  padding: 18px;
  box-shadow:
    inset 7px 7px 18px rgba(212, 201, 184, 0.2),
    inset -7px -7px 18px rgba(255, 255, 255, 0.55);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.section-head p {
  margin: 0;
  color: var(--studio-text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(78, 90, 79, 0.1);
  color: var(--studio-text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.dropzone {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px 20px;
  border-radius: 24px;
  border: 1.5px dashed rgba(46, 91, 55, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(246, 241, 231, 0.72));
  box-shadow:
    inset 8px 8px 18px rgba(221, 209, 189, 0.22),
    inset -8px -8px 18px rgba(255, 255, 255, 0.62);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-active {
  transform: translateY(-1px);
  border-color: rgba(46, 91, 55, 0.46);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(236, 246, 238, 0.86));
  box-shadow:
    0 12px 28px rgba(76, 104, 82, 0.12),
    inset 8px 8px 18px rgba(221, 209, 189, 0.15),
    inset -8px -8px 18px rgba(255, 255, 255, 0.72);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-kicker {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--studio-green);
  font-weight: 700;
}

.dropzone-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.5;
}

.dropzone-copy {
  margin: 0;
  color: var(--studio-text-soft);
  line-height: 1.65;
  font-size: 0.92rem;
}

.file-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(78, 90, 79, 0.08);
  color: var(--studio-text-soft);
  font-size: 0.84rem;
  line-height: 1.4;
}

.field-stack {
  display: grid;
  gap: 14px;
}

.field-row {
  display: grid;
  gap: 8px;
}

.field-row label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field-row small {
  color: var(--studio-text-soft);
  line-height: 1.55;
}

.toolbar-grid {
  display: grid;
  gap: 12px;
}

.tool-row {
  display: grid;
  gap: 10px;
}

.tool-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.tool-value {
  color: var(--studio-green);
}

.range-control {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(46, 91, 55, 0.14), rgba(46, 91, 55, 0.4));
  outline: none;
}

.range-control::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3c7047, #21452a);
  box-shadow: 0 8px 18px rgba(33, 69, 42, 0.26);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.range-control::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3c7047, #21452a);
  box-shadow: 0 8px 18px rgba(33, 69, 42, 0.26);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.button-row,
.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-stack {
  flex-direction: column;
}

.primary-button,
.secondary-button,
.ghost-button,
.tool-button,
.color-button {
  border: none;
  border-radius: 16px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease,
    opacity 140ms ease;
  text-decoration: none;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.tool-button:disabled,
.color-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #356440, #23492c);
  box-shadow: 0 14px 24px rgba(35, 73, 44, 0.24);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.tool-button:hover:not(:disabled),
.color-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--studio-green-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(240, 235, 226, 0.95));
  box-shadow: var(--studio-shadow-soft);
}

.ghost-button {
  color: var(--studio-text);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(78, 90, 79, 0.12);
}

.tool-button {
  color: var(--studio-text);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(78, 90, 79, 0.12);
  min-height: 42px;
}

.tool-button.is-active {
  color: #fff;
  background: linear-gradient(180deg, #3b6c46, #254b2d);
  box-shadow: 0 12px 24px rgba(37, 75, 45, 0.22);
}

.color-button {
  min-width: 58px;
  background: #fff;
  border: 1px solid rgba(78, 90, 79, 0.14);
}

.status-card {
  display: grid;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
}

.status-pill.is-idle {
  color: var(--studio-text);
  background: rgba(255, 255, 255, 0.72);
}

.status-pill.is-busy {
  color: #7a5308;
  background: rgba(245, 215, 155, 0.5);
}

.status-pill.is-success {
  color: #255334;
  background: rgba(166, 222, 188, 0.46);
}

.status-pill.is-error {
  color: #7a2f27;
  background: rgba(237, 184, 175, 0.56);
}

.status-detail {
  margin: 0;
  color: var(--studio-text-soft);
  line-height: 1.7;
  font-size: 0.92rem;
}

.tips-list {
  margin: 0;
  padding-left: 18px;
  color: var(--studio-text-soft);
  display: grid;
  gap: 6px;
  line-height: 1.65;
  font-size: 0.92rem;
}

.preview-column {
  display: grid;
  gap: 24px;
}

.panel-card {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0 0 6px;
}

.panel-head p {
  margin: 0;
  color: var(--studio-text-soft);
  line-height: 1.65;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.preview-stage {
  display: grid;
  gap: 12px;
}

.board-frame {
  position: relative;
  min-height: 260px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(78, 90, 79, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 14px 26px rgba(88, 74, 53, 0.08);
}

.board-frame.is-checker {
  background:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%, var(--checker-b)),
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%, var(--checker-b)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 242, 236, 0.88));
  background-position: 0 0, 12px 12px, 0 0;
  background-size: 24px 24px, 24px 24px, auto;
}

.board-scroll {
  position: relative;
  min-height: 260px;
  max-height: min(72vh, 900px);
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 20px;
}

.board-scroll canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  background: transparent;
}

.board-scroll.is-painting {
  cursor: crosshair;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--studio-text-soft);
  line-height: 1.7;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(246, 242, 236, 0.6));
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(78, 90, 79, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

.mini-note {
  margin: 0;
  color: var(--studio-text-soft);
  font-size: 0.86rem;
  line-height: 1.65;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(78, 90, 79, 0.08);
}

.meta-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: var(--studio-text-soft);
}

.meta-card span {
  font-weight: 700;
}

.busy-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 14px;
  background: rgba(246, 241, 232, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.busy-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(46, 91, 55, 0.16);
  border-top-color: var(--studio-green);
  animation: studio-spin 0.8s linear infinite;
}

.busy-overlay p {
  margin: 0;
  color: var(--studio-text-soft);
  font-weight: 600;
}

.footer-note {
  margin: 0;
  padding: 14px 0 6px;
  color: var(--studio-text-soft);
  text-align: center;
  line-height: 1.7;
}

@keyframes studio-spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .sidebar-card {
    position: static;
  }
}

@media (max-width: 820px) {
  .studio-shell {
    width: min(100vw - 24px, 1440px);
  }

  .studio-hero {
    flex-direction: column;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .board-scroll {
    max-height: none;
    min-height: 220px;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .sidebar-card,
  .panel-card {
    border-radius: 22px;
  }

  .sidebar-card,
  .panel-card,
  .section-card {
    padding: 16px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row > * {
    width: 100%;
  }

  .hero-links {
    width: 100%;
  }

  .hero-links > * {
    flex: 1 1 auto;
    justify-content: center;
  }
}
