:root,
body,
body.dark-theme {
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-light: rgba(6, 182, 212, 0.15);
  --surface: #0f172a !important;
  --card-bg: #0b1120 !important;
  --bg: #050811 !important;
  --text: #f8fafc !important;
  --text-muted: #94a3b8 !important;
  --border: #1e293d !important;
  --border-light: #25334d !important;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(6, 182, 212, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html,
body,
body.dark-theme {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #050811 !important;
  color: #f8fafc !important;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(6, 182, 212, 0.18), transparent),
    radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.1), transparent),
    radial-gradient(circle at 0% 50%, rgba(14, 165, 233, 0.08), transparent) !important;
  background-attachment: fixed !important;
}

/* Header */
header,
body.dark-theme header {
  background: rgba(11, 17, 32, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}
.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.nav-btn {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-btn:hover {
  color: var(--text);
  background: #1e293b;
}
.nav-btn.primary,
header .btn-nav-primary,
.site-header .btn-nav-primary,
.btn-nav-primary {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  padding: 0.45rem 1rem !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.15) !important;
  transition: all 0.15s ease !important;
}
header .btn-nav-primary:hover,
.site-header .btn-nav-primary:hover,
.btn-nav-primary:hover {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.25) !important;
}

/* Hero Section */
.hero-sec {
  text-align: center;
  padding: 2.25rem 1rem 1.25rem;
  max-width: 1120px;
  margin: 0 auto;
  box-sizing: border-box;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.95rem;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #38bdf8;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 0.45rem;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 680px;
  margin: 0 auto;
}
.btn-demo-chip {
  background: #111a2e;
  border: 1px solid #233352;
  color: #38bdf8;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.btn-demo-chip:hover {
  background: #18253f;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

/* Studio Main Layout */
.studio-grid {
  max-width: 1120px;
  margin: 0 auto 3rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
  flex: 1;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .studio-grid { grid-template-columns: 1fr; }
}

/* Left Panel */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
}
.sec-box {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.sec-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.form-input {
  background: #141d30;
  border: 1.5px solid #233352;
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.demo-avatar-chip {
  flex: 1;
  background: #141d30;
  border: 1.5px solid #233352;
  color: #cbd5e1;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.demo-avatar-chip:hover {
  border-color: var(--primary);
  color: #38bdf8;
  background: #19253d;
}
.demo-avatar-chip.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--primary);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

/* Shapes Row */
.shape-selector-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.shape-btn {
  background: #141d30;
  border: 1.5px solid #233352;
  color: #cbd5e1;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}
.shape-btn:hover {
  border-color: var(--primary);
  color: #38bdf8;
  background: #19253d;
}
.shape-btn.active {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

/* Presets Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.preset-chip {
  background: #141d30;
  border: 1.5px solid #233352;
  color: #f8fafc;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}
.preset-chip:hover {
  border-color: var(--primary);
  background: #19253d;
  transform: translateY(-1px);
}
.preset-chip.active {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.25);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
}

/* Range Sliders */
.slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.slider-badge {
  color: #38bdf8;
  font-family: monospace;
  font-weight: 800;
}
input[type="range"] {
  width: 100%;
  accent-color: #06b6d4;
  cursor: pointer;
}

/* Tool Buttons Row */
.tool-buttons-row {
  display: flex;
  gap: 8px;
}
.btn-tool {
  flex: 1;
  background: #141d30;
  border: 1.5px solid #233352;
  color: #cbd5e1;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
}
.btn-tool:hover {
  border-color: var(--primary);
  color: #38bdf8;
  background: #19253d;
}

/* Usage Tips Box */
.steam-tip-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.78rem;
  color: #38bdf8;
  line-height: 1.6;
}

/* Right Stage */
.stage-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 90px;
  box-shadow: var(--shadow-card);
}

.stage-header-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.stage-header-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bg-toggle-group {
  display: flex;
  background: #141d30;
  border: 1px solid #233352;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}
.bg-toggle-btn {
  background: transparent;
  border: none;
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bg-toggle-btn:hover {
  color: var(--text);
}
.bg-toggle-btn.active {
  background: #0b1120;
  color: #38bdf8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Showcase Chamber: 黑色透明底 (Steam 展柜) */
.showcase-chamber {
  width: 100%;
  padding: 2.25rem 1rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.25s ease, border-color 0.25s ease;
  box-sizing: border-box;
}
.showcase-chamber.dark-trans {
  background: 
    radial-gradient(ellipse at center, rgba(30, 41, 59, 0.85) 0%, rgba(11, 17, 32, 0.98) 100%),
    repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0% 25%, rgba(0, 0, 0, 0.2) 0% 50%) 50% / 20px 20px;
  border: 1px solid rgba(30, 41, 59, 0.6);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
}
.showcase-chamber.grid {
  background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 16px 16px;
  border: 1px solid var(--border);
}
.showcase-chamber.light {
  background: #f8fafc;
  border: 1px solid var(--border);
}

.preview-wrapper {
  width: 280px;
  height: 280px;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-radius 0.25s ease;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.65));
}
#avatarCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  cursor: grab;
  transition: border-radius 0.25s ease;
}
#avatarCanvas:active {
  cursor: grabbing;
}
.stage-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.9rem;
  text-align: center;
}

/* Download Buttons */
.pc-export-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin-top: 1.25rem;
}

.btn-download-main {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  color: white;
  font-weight: 800;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  border: none;
  font-size: 0.92rem;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.btn-download-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-download-png {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.btn-download-png:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.btn-download-gif {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}
.btn-download-gif:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

.export-status-toast {
  margin-top: 10px;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #38bdf8;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
