/* =========================================================
   星语礼 / StarGift — Luxury Boutique Studio & Foil Envelope Cover
   ========================================================= */
body.studio-page {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #070616;
  color: #f6f0fc;
  font-family: var(--serif);
}

.studio-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  height: 100dvh;
  width: 100%;
  position: relative;
}

body.read-only .studio-layout,
body.immersive-mode .studio-layout {
  grid-template-columns: 1fr;
}

/* ---------- Stage Viewport ---------- */
.stage-wrap {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #070616;
}

#stage-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#stage-canvas:active {
  cursor: grabbing;
}

/* Preview Watermark */
.preview-watermark {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-watermark::before {
  content: "星语礼 StarGift 预览 · 解锁或导出后自动去除";
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.16);
  transform: rotate(-16deg);
  white-space: nowrap;
}

body.unlocked .preview-watermark,
body.read-only .preview-watermark {
  display: none;
}

/* Top Hero Title on Stage (preserved in immersive mode!) */
.stage-hero-header {
  position: absolute;
  top: max(68px, calc(env(safe-area-inset-top) + 56px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  text-align: center;
  pointer-events: none;
  width: min(90%, 560px);
  transition: top 0.3s ease;
}

body.read-only .stage-hero-header,
body.immersive-mode .stage-hero-header {
  top: max(22px, env(safe-area-inset-top));
}

.stage-hero-recipient {
  display: inline-block;
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: clamp(23px, 2.8vw, 36px);
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  background: linear-gradient(120deg, #fffef6 0%, #ffe08a 42%, #ff9ec8 82%, #fff3cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 196, 110, 0.65)) drop-shadow(0 4px 14px rgba(226, 70, 126, 0.5));
}

.stage-hero-title {
  margin: 0;
  font-size: clamp(18px, 2.1vw, 26px);
  background: linear-gradient(120deg, #fffaf0 10%, #ffe19c 55%, #ffd2e8 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 16px rgba(190, 120, 255, 0.42));
  letter-spacing: 0.06em;
}

.stage-hero-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: rgba(255, 240, 224, 0.78);
  letter-spacing: 0.1em;
}

/* Top Floating Bar */
.stage-top-bar {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.stage-top-bar > * {
  pointer-events: auto;
}

.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(18, 13, 34, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 226, 175, 0.2);
  color: #f8f2ff;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.glass-pill:hover {
  background: rgba(34, 24, 58, 0.88);
  border-color: rgba(255, 210, 150, 0.5);
  transform: translateY(-1px);
}

.glass-pill.active {
  background: rgba(226, 70, 126, 0.28);
  border-color: rgba(255, 140, 190, 0.72);
  color: #fff;
}

.glass-pill.primary {
  background: linear-gradient(120deg, #ff7aa8, #e2467e 52%, #a86bff);
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 600;
  box-shadow: 0 8px 22px -8px rgba(226, 70, 126, 0.72);
}

.glass-pill.primary:hover {
  box-shadow: 0 12px 28px -8px rgba(226, 70, 126, 0.88);
}

.glass-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 226, 175, 0.22);
  background: rgba(18, 13, 34, 0.68);
  backdrop-filter: blur(14px);
  color: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s var(--ease-bounce), background 0.2s, border-color 0.2s;
}

.glass-icon-btn:hover,
.glass-icon-btn.active {
  background: linear-gradient(135deg, #ff7aa8, #b46cff);
  border-color: transparent;
  transform: translateY(-1px);
}

/* =========================================================
   ACT 1: LUXURY FOIL-STAMPED SEALED ENVELOPE COVER
   ========================================================= */
.act-cover {
  position: absolute;
  inset: 0;
  z-index: 30;
  background:
    radial-gradient(ellipse 68% 58% at 50% 42%, rgba(112, 54, 152, 0.42), transparent 68%),
    radial-gradient(circle at 20% 80%, rgba(226, 70, 126, 0.16), transparent 45%),
    radial-gradient(circle at 82% 22%, rgba(255, 210, 125, 0.14), transparent 42%),
    #070512;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.act-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 14% 22%, rgba(255, 240, 200, 0.8), transparent),
    radial-gradient(1.2px 1.2px at 84% 18%, rgba(255, 210, 235, 0.75), transparent),
    radial-gradient(1.8px 1.8px at 76% 78%, rgba(255, 235, 180, 0.7), transparent),
    radial-gradient(1.4px 1.4px at 22% 76%, rgba(185, 225, 255, 0.7), transparent),
    radial-gradient(1px 1px at 50% 12%, rgba(255, 255, 255, 0.7), transparent);
  animation: coverStars 4.5s ease-in-out infinite alternate;
}

@keyframes coverStars {
  0% { opacity: 0.55; }
  100% { opacity: 1; }
}

.act-cover.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cover-envelope {
  width: min(440px, 92vw);
  padding: 40px 30px 30px;
  border-radius: 26px;
  text-align: center;
  background:
    linear-gradient(165deg, rgba(46, 26, 72, 0.94) 0%, rgba(22, 13, 40, 0.98) 58%, rgba(14, 9, 26, 0.99) 100%);
  border: 1px solid rgba(255, 220, 152, 0.45);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.78),
    0 0 60px -15px rgba(210, 120, 255, 0.3),
    inset 0 1px 0 rgba(255, 240, 200, 0.35),
    inset 0 0 0 8px rgba(255, 220, 150, 0.04);
  position: relative;
  overflow: hidden;
}

/* Inner delicate double gold hairline border */
.cover-envelope::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 18px;
  border: 1px solid rgba(255, 222, 160, 0.24);
  pointer-events: none;
}

/* Luxury V-Shaped Sealed Envelope Flap Crease */
.cover-flap-crease {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 155px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 225, 170, 0.09), rgba(255, 225, 170, 0.01));
  clip-path: polygon(0 0, 100% 0, 50% 96%);
  border-bottom: 1px solid rgba(255, 220, 150, 0.16);
}

.cover-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  color: rgba(255, 222, 152, 0.62);
}
.cover-corner.tl { top: 16px; left: 16px; }
.cover-corner.tr { top: 16px; right: 16px; transform: scaleX(-1); }
.cover-corner.bl { bottom: 16px; left: 16px; transform: scaleY(-1); }
.cover-corner.br { bottom: 16px; right: 16px; transform: scale(-1); }

.cover-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--latin);
  font-style: italic;
  font-size: 12.5px;
  letter-spacing: 0.22em;
  color: #f7d996;
  margin-bottom: 12px;
}

.cover-badge::before,
.cover-badge::after {
  content: "";
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 217, 150, 0.7));
}
.cover-badge::after {
  background: linear-gradient(270deg, transparent, rgba(247, 217, 150, 0.7));
}

.cover-title {
  position: relative;
  margin: 0 0 18px;
  font-size: clamp(23px, 3vw, 29px);
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, #fffdf7 10%, #ffe2a4 52%, #ffd4e8 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 12px rgba(255, 200, 120, 0.25));
}

.cover-recipient-row {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 7px 18px 8px;
  border-radius: 999px;
  background: rgba(255, 232, 188, 0.08);
  border: 1px solid rgba(255, 222, 158, 0.28);
  margin-bottom: 26px;
  font-size: 16.5px;
  color: #f9dfaa;
}

.cover-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 220, 150, 0.55);
  color: #fff2cf;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  outline: none;
  padding: 1px 4px;
  min-width: 5.5rem;
  max-width: 14rem;
}

body.read-only .cover-name-input {
  border-bottom: none;
  pointer-events: none;
}

/* Sculpted Embossed Golden Wax Seal Medallion */
.cover-seal-wrap {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
}

.cover-seal-halo {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 220, 148, 0.36);
  animation: sealHaloSpin 18s linear infinite;
  pointer-events: none;
}

@keyframes sealHaloSpin {
  to { transform: rotate(360deg); }
}

.cover-pendant-btn {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 2px solid rgba(255, 240, 195, 0.65);
  background:
    radial-gradient(circle at 32% 28%, #fff3c4 0%, #e4ae48 48%, #a66c1a 85%, #6e4209 100%);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.58),
    0 0 36px rgba(255, 206, 110, 0.45),
    inset 0 3px 6px rgba(255, 255, 255, 0.72),
    inset 0 -4px 10px rgba(90, 46, 5, 0.65);
  color: #532c04;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  animation: coverBreath 2.6s ease-in-out infinite;
  transition: transform 0.25s var(--ease-bounce);
}

.cover-pendant-btn::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(92, 48, 6, 0.36);
  box-shadow: inset 0 1px 2px rgba(255, 245, 210, 0.55);
  pointer-events: none;
}

/* Animated Metallic Sheen Sweep */
.cover-pendant-btn::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -90%;
  width: 60%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.52), transparent);
  transform: rotate(25deg);
  animation: sealSheen 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sealSheen {
  0%, 60% { left: -90%; }
  100% { left: 150%; }
}

.cover-pendant-btn:hover {
  transform: scale(1.07);
}

.cover-pendant-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-pendant-btn svg {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 1px 1px rgba(255, 248, 220, 0.6));
}

@keyframes coverBreath {
  0%, 100% { box-shadow: 0 12px 34px rgba(0, 0, 0, 0.58), 0 0 28px rgba(255, 206, 110, 0.38), inset 0 3px 6px rgba(255, 255, 255, 0.72); }
  50% { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.62), 0 0 48px rgba(255, 214, 128, 0.72), inset 0 3px 6px rgba(255, 255, 255, 0.82); }
}

.cover-hint {
  font-size: 13px;
  color: rgba(255, 236, 208, 0.78);
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.cover-countdown {
  font-family: var(--latin);
  font-size: 46px;
  font-weight: 700;
  color: #ffe28a;
  height: 54px;
  display: none;
  align-items: center;
  justify-content: center;
}

.cover-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Floating Photos Wall ---------- */
.floating-photos {
  position: absolute;
  top: 84px;
  right: 18px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.photo-frame {
  width: 82px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  animation: photoFloat 4s ease-in-out infinite;
}

.photo-frame.glass {
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.14);
  padding: 3px;
}

.photo-frame.polaroid {
  background: #fff;
  padding: 5px 5px 14px;
  border-radius: 4px;
  transform: rotate(3deg);
}

.photo-frame img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

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

/* ---------- Act 5: Final Keepsake Card Overlay (4 Styles) ---------- */
.act-finalcard {
  position: absolute;
  inset: 0;
  z-index: 28;
  background: rgba(8, 6, 20, 0.72);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.act-finalcard.active {
  display: flex;
}

.final-card-shell {
  width: min(410px, 90vw);
  max-height: 82dvh;
  overflow-y: auto;
  position: relative;
  padding: 28px 24px 24px;
  transition: all 0.25s;
}

.final-card-shell.style-galaxy {
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(42, 28, 76, 0.94), rgba(16, 12, 34, 0.96));
  border: 1px solid rgba(255, 215, 140, 0.45);
  color: #fff5e6;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.68), inset 0 0 0 6px rgba(255, 224, 150, 0.06);
}

.galaxy-wax-seal {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffeba8, #d69c38 64%, #8d5c14);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.72);
  color: #542d05;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.final-card-shell.style-letter {
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(130, 82, 34, 0.03) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 50% 45%, #fcf3de 0%, #eed7ad 82%, #cba168 100%);
  color: #442812;
  border: 1.5px solid #8c5927;
  box-shadow: inset 0 0 32px rgba(96, 48, 12, 0.36), 0 0 0 3px rgba(84, 42, 12, 0.25), 0 24px 60px rgba(0, 0, 0, 0.55);
}

.letter-postmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border: 1.5px dashed rgba(136, 72, 28, 0.55);
  border-radius: 999px;
  font-family: var(--latin);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7c4720;
  transform: rotate(-4deg);
}

.final-card-shell.style-receipt {
  border-radius: 0;
  background: #fbfbfb;
  color: #202020;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  padding: 32px 24px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  background-image:
    radial-gradient(circle at 8px 0, transparent 5px, #fbfbfb 5.5px),
    radial-gradient(circle at 8px 100%, transparent 5px, #fbfbfb 5.5px);
  background-size: 16px 50%;
  background-position: top left, bottom left;
  background-repeat: repeat-x;
}

.final-card-shell.style-scratch {
  border-radius: 22px;
  background: linear-gradient(145deg, #fff5fa, #ffe6f1);
  color: #3b1c2c;
  border: 2px solid #f7a6c8;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.scratch-canvas-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 10px;
}

#scratch-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.final-card-body {
  white-space: pre-wrap;
  line-height: 1.85;
  font-size: 15px;
  margin: 12px 0 18px;
}

.receipt-barcode {
  height: 36px;
  margin-top: 14px;
  background: repeating-linear-gradient(90deg, #222 0 2px, transparent 2px 4px, #222 4px 5px, transparent 5px 8px);
  opacity: 0.78;
}

/* ---------- Sleek Single-Row Bottom Dock (Desktop) ---------- */
.stage-bottom-dock {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(15, 11, 28, 0.76);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 226, 175, 0.18);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.52);
  max-width: 96%;
  overflow-x: auto;
  scrollbar-width: none;
}

.stage-bottom-dock::-webkit-scrollbar {
  display: none;
}

.stage-bottom-dock .glass-pill {
  padding: 6px 11px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.stage-bottom-dock .glass-pill:hover {
  background: rgba(255, 255, 255, 0.14);
}

.stage-bottom-dock .glass-icon-btn {
  width: 31px;
  height: 31px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
}

.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.38);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.theme-dot.active {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
}

.stage-hint-chip {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 15;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(16, 11, 30, 0.58);
  border: 1px solid rgba(255, 224, 165, 0.24);
  color: rgba(255, 236, 198, 0.88);
  font-family: var(--sans);
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Immersive Fullscreen Mode ---------- */
body.immersive-mode .stage-top-bar,
body.immersive-mode .stage-bottom-dock,
body.immersive-mode .editor-drawer,
body.immersive-mode .mobile-stage-corners,
body.immersive-mode .mobile-open-editor-btn,
body.immersive-mode .stage-hint-chip {
  opacity: 0 !important;
  pointer-events: none !important;
}

.exit-immersive-btn {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 80;
  display: none;
  transition: opacity 0.4s ease;
}

body.immersive-mode .exit-immersive-btn {
  display: inline-flex;
}

.exit-immersive-btn.faded {
  opacity: 0.22;
}

/* =========================================================
   LUXURY GLASSMORPHIC CREATOR STUDIO DRAWER (3-TAB DESIGN)
   ========================================================= */
.editor-drawer {
  background: linear-gradient(180deg, #171229 0%, #110c1f 100%);
  border-left: 1px solid rgba(255, 224, 175, 0.14);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  z-index: 35;
  font-family: var(--sans);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.45);
}

body.read-only .editor-drawer {
  display: none;
}

.drawer-top {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drawer-top h2 {
  margin: 0;
  font-size: 16px;
  font-family: var(--serif);
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, #fff6e5, #ffd699);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Segmented 3-Tab Studio Switcher */
.studio-tabs {
  margin: 0 16px 10px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.studio-tab-btn {
  padding: 8px 6px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(226, 216, 245, 0.72);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.studio-tab-btn.active {
  background: linear-gradient(135deg, rgba(226, 70, 126, 0.38), rgba(164, 110, 255, 0.36));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 235, 0.28);
}

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 200, 230, 0.22) transparent;
}

.studio-tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.studio-tab-pane.active {
  display: flex;
}

.ed-card {
  padding: 15px 15px 16px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 224, 180, 0.1);
  display: grid;
  gap: 11px;
}

.ed-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #fce2c4;
  letter-spacing: 0.04em;
}

.ed-input,
.ed-textarea,
.ed-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 7, 19, 0.72);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ed-input:focus,
.ed-textarea:focus,
.ed-select:focus {
  border-color: #e692c8;
  box-shadow: 0 0 0 3px rgba(226, 70, 126, 0.16);
}

.ed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ed-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.045);
  color: #e4daf4;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}

.ed-chip:hover {
  border-color: rgba(255, 196, 225, 0.45);
  background: rgba(255, 255, 255, 0.09);
}

.ed-chip.active {
  background: linear-gradient(125deg, #ff7aa8, #b67eff);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(226, 70, 126, 0.65);
}

.ed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: #d7cee8;
}

/* Custom Luxury Toggle Switch (Replaces raw browser checkboxes!) */
.ed-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.24s, border-color 0.24s;
}

.ed-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.24s var(--ease-bounce);
}

.ed-row input[type="checkbox"]:checked {
  background: linear-gradient(120deg, #ff7aa8, #b46cff);
  border-color: transparent;
}

.ed-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

/* Custom Luxury File Upload Button (Hides ugly native file input!) */
.upload-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 218, 165, 0.32);
  background: rgba(255, 232, 195, 0.04);
  color: #f3e6d6;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-pill:hover {
  border-color: rgba(255, 168, 210, 0.72);
  background: rgba(255, 168, 210, 0.08);
}

.upload-pill input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-pill-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: #ffe3b8;
  flex-shrink: 0;
}

.privacy-note {
  padding: 7px 11px;
  border-radius: 10px;
  background: rgba(255, 224, 175, 0.06);
  border: 1px solid rgba(255, 224, 175, 0.1);
  color: rgba(235, 222, 248, 0.72);
  font-size: 11.5px;
  text-align: center;
}

.drawer-footer {
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 224, 175, 0.12);
  background: rgba(14, 10, 26, 0.96);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Mobile Floating Corner Controls & More Popover */
.mobile-stage-corners,
.mobile-open-editor-btn,
.mobile-more-popover {
  display: none;
}

@media (max-width: 900px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .stage-top-bar {
    gap: 6px;
  }
  .stage-top-bar .glass-pill {
    padding: 6px 10px;
    font-size: 12px;
  }
  .stage-top-bar [data-act-music] {
    display: none;
  }
  .stage-hero-header {
    top: max(64px, calc(env(safe-area-inset-top) + 54px));
  }
  .stage-bottom-dock {
    display: none;
  }
  .mobile-stage-corners {
    display: flex;
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 20;
    justify-content: space-between;
    pointer-events: none;
  }
  .mobile-stage-corners > div {
    display: flex;
    gap: 10px;
    pointer-events: auto;
  }
  .mobile-more-popover {
    display: grid;
    gap: 10px;
    position: absolute;
    right: 14px;
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 52px);
    z-index: 24;
    padding: 12px;
    border-radius: 18px;
    background: rgba(18, 13, 34, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 224, 175, 0.18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .mobile-more-popover.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }
  body.immersive-mode .mobile-more-popover {
    opacity: 0 !important;
    pointer-events: none !important;
  }
  .mobile-open-editor-btn {
    display: inline-flex;
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 21;
  }
  body.read-only .mobile-open-editor-btn {
    display: none;
  }

  .editor-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60dvh;
    border-left: none;
    border-top: 1px solid rgba(255, 224, 175, 0.22);
    border-radius: 24px 24px 0 0;
    transform: translateY(104%);
    transition: transform 0.32s var(--ease-smooth);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.65);
  }
  .editor-drawer.mobile-open {
    transform: translateY(0);
  }
}
