:root {
  --bg-lacquer: #0e1013;
  --bg-panel: #16191f;
  --bg-card: #1d2129;
  --gold-primary: #d4af37;
  --gold-soft: #f0d78c;
  --jade-taiwan: #1e6b52;
  --cinnabar-red: #b8292f;
  --text-main: #f3efe6;
  --text-muted: #a8a296;
  --border-gold: rgba(212, 175, 55, 0.26);
  --radius-md: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: radial-gradient(circle at top right, #1c2229 0%, var(--bg-lacquer) 65%);
  color: var(--text-main);
  line-height: 1.55;
}
.studio-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-gold);
  background: rgba(14, 16, 19, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand-title { margin: 0; font-size: 1.2rem; letter-spacing: 0.03em; color: var(--gold-soft); }
.brand-sub { margin: 3px 0 0; font-size: 0.83rem; color: var(--text-muted); }
.header-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-pill {
  background: rgba(30, 107, 82, 0.24);
  border: 1px solid rgba(46, 139, 87, 0.55);
  color: #8ef0c8;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 600;
}
.status-pill.warn {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.55);
  color: var(--gold-soft);
  cursor: pointer;
}
.studio-grid {
  max-width: 1420px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
}
@media (max-width: 980px) {
  .studio-grid { grid-template-columns: 1fr; padding: 14px; }
}
.panel-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.panel-title {
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(212, 175, 55, 0.14);
  padding-bottom: 8px;
}
.stem-badge {
  font-size: 0.71rem;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-soft);
  padding: 2px 8px;
  border-radius: 6px;
}
label { display: block; font-size: 0.84rem; color: var(--text-muted); margin: 10px 0 5px; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
textarea { resize: vertical; font-family: inherit; }
.code-area { font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 0.8rem; line-height: 1.46; }
input[type="range"] { width: 100%; accent-color: var(--gold-primary); cursor: pointer; }
.slider-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.84rem; margin-top: 10px; }
.slider-val { color: var(--gold-soft); font-weight: 700; }
.ar-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.ar-buttons button, .btn-primary, .btn-jade, .btn-outline {
  cursor: pointer;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.16s ease;
}
.ar-buttons button {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.ar-buttons button.active {
  background: linear-gradient(135deg, #d4af37, #a67c1e);
  color: #111;
  border-color: #f5df95;
}
.btn-primary { background: linear-gradient(135deg, #e0bd4c, #b58922); color: #121212; border: none; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled, .btn-jade:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-jade { background: linear-gradient(135deg, #248566, #175440); color: #f4fff9; border: 1px solid #5bd1a8; }
.btn-jade:hover { filter: brightness(1.09); }
.btn-outline { background: transparent; color: var(--gold-soft); border: 1px solid var(--border-gold); }
.btn-outline:hover { background: rgba(212, 175, 55, 0.12); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 16px; font-size: 0.94rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.info-banner {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(30, 107, 82, 0.16);
  border-left: 3px solid var(--jade-taiwan);
  font-size: 0.83rem;
  color: #d6f5e8;
}
.swatch-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.swatch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
}
.swatch-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.4); }
.lock-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(184, 41, 47, 0.14);
  border: 1px solid rgba(184, 41, 47, 0.45);
  border-radius: 8px;
  margin-top: 8px;
}
.lock-box.jade-lock {
  background: rgba(30, 107, 82, 0.16);
  border-color: rgba(46, 139, 87, 0.5);
}
.lock-box input { margin-top: 4px; transform: scale(1.2); accent-color: var(--gold-primary); }
.canvas-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #090a0d;
  padding: 14px;
  border-radius: 10px;
  border: 1px dashed rgba(212, 175, 55, 0.35);
  min-height: 360px;
}
#mockupCanvas { max-width: 100%; max-height: 540px; height: auto; display: block; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.72); }
.stage-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(14, 16, 19, 0.86);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--gold-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}
.render-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.render-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.stage-room-bar {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 10px;
}
.stage-room-bar.open { display: flex; }
.stage-room-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.stage-room-pills button.active {
  background: linear-gradient(135deg, #d4af37, #a67c1e);
  color: #111;
  border-color: #f5df95;
}
.render-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.22);
  font-size: 0.82rem;
  color: var(--gold-soft);
  display: none;
}
.render-status.visible { display: block; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.gallery-card {
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.gallery-card:hover, .gallery-card.active {
  transform: translateY(-2px);
  border-color: var(--gold-primary);
}
.gallery-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.gallery-card-meta {
  padding: 8px 10px;
}
.gallery-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.bundle-box {
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 0.84rem;
}
.bundle-box h4 {
  margin: 8px 0 4px;
  font-size: 0.83rem;
  color: var(--gold-soft);
}
.bundle-box h4:first-child { margin-top: 0; }
.bundle-box p { margin: 0 0 6px; color: var(--text-main); }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.meta-chip {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(30, 107, 82, 0.22);
  border: 1px solid rgba(46, 139, 87, 0.45);
  color: #a9f5d5;
}
.tech-drawer {
  background: var(--bg-panel);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.tech-drawer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
  list-style: none;
}
.tech-drawer summary:hover { color: var(--gold-soft); }
.tech-drawer-body { margin-top: 14px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ref-preview { display: none; align-items: center; gap: 10px; margin-top: 8px; background: var(--bg-card); padding: 8px; border-radius: 8px; }
.ref-preview img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; }
.saved-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}
.saved-card span { display: block; font-size: 0.74rem; color: var(--text-muted); }
.muted-hint { font-size: 0.8rem; color: var(--text-muted); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--gold-primary);
  border-radius: 14px;
  max-width: 500px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.65);
}
.toast-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #1e6b52, #144938);
  color: #fff;
  border: 1px solid #6be3b7;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all 0.22s ease;
  z-index: 100;
}
.toast-banner.visible { opacity: 1; transform: translateY(0); }
