/**
 * dopic.app - Dedicated Mobile Stylesheet for [steam-avatar]
 * Clean iOS Light Theme with High-Contrast Dark Neon Canvas Preview
 * Sticky Preview Dock on Scroll
 */

:root,
body,
body.m-light-theme {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --surface: #ffffff !important;
  --card-bg: #ffffff !important;
  --bg-page: #f4f7fc !important;
  --text: #0f172a !important;
  --text-muted: #64748b !important;
  --border: #e2e8f0 !important;
  --border-light: #f1f5f9 !important;
  --radius-lg: 18px;
  --radius-md: 12px;
}

html {
  background: #f4f7fc !important;
  color-scheme: light !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}

body,
body.m-light-theme,
.m-app-container {
  background-color: #f4f7fc !important;
  background-image: linear-gradient(180deg, #eef4ff 0%, #f6f9fd 240px, #f4f7fc 100%) !important;
  color: #0f172a !important;
  min-height: 100vh !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}

/* Header (Clean iOS Light Frosted Glass) */
.m-header {
  position: relative !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}
.m-header-title {
  color: #0f172a !important;
}
.m-brand-badge {
  background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
  color: #ffffff !important;
}
.m-lang-btn {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

/* Hero Section */
.m-hero {
  padding: 1.15rem 1rem 0.4rem !important;
  text-align: center;
}
.m-hero-text h1 {
  font-size: 1.4rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  letter-spacing: -0.025em;
  margin-bottom: 0.25rem;
}
.m-hero-text .highlight {
  color: #64748b !important;
  font-size: 0.85rem !important;
  font-weight: 500;
}

/* Studio Layout */
.m-steam-studio {
  display: flex !important;
  flex-direction: column !important;
  gap: 1.1rem !important;
  width: 100% !important;
  padding: 0 0.85rem 2rem 0.85rem !important;
  box-sizing: border-box !important;
}

/* 1. STICKY PREVIEW CARD (Guaranteed pinned at top on scroll) */
.m-workspace-wrap #stageCard,
.m-workspace-wrap .stage-card,
#stageCard.stage-card,
.stage-card {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0px !important;
  z-index: 1000 !important;
  width: 100% !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08) !important;
  padding: 0.85rem !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  margin: 0 0 1rem 0 !important;
  transition: all 0.25s ease !important;
}

/* When scrolling down, smoothly shrink to compact dock */
.m-workspace-wrap #stageCard.is-compact,
.m-workspace-wrap .stage-card.is-compact,
#stageCard.stage-card.is-compact,
.stage-card.is-compact {
  padding: 0.45rem 0.75rem !important;
  box-shadow: 0 8px 26px -2px rgba(15, 23, 42, 0.16) !important;
  border-color: #cbd5e1 !important;
  border-radius: 0 0 16px 16px !important;
}

.stage-header-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  gap: 8px;
}
.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-header-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}
.stage-actions-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bg-toggle-group {
  display: flex;
  gap: 3px;
  background: #f1f5f9;
  padding: 2.5px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.bg-toggle-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.bg-toggle-btn.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25);
}

.btn-quick-export {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: #0284c7;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-quick-export:active {
  background: #0284c7;
  color: #ffffff;
}

/* 2. THE DARK SHOWCASE CHAMBER (Remains deep dark for neon glow) */
.showcase-chamber {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 4px 16px rgba(0, 0, 0, 0.25);
  border: 1px solid #1e293d;
  margin-bottom: 0.5rem;
  transition: max-width 0.25s ease;
}

.stage-card.is-compact .showcase-chamber {
  max-width: 145px;
  margin-bottom: 0.2rem;
}

.showcase-chamber.dark-trans {
  background: radial-gradient(circle at center, #111a2e 0%, #050811 100%) !important;
}
.showcase-chamber.grid {
  background-color: #0b1120 !important;
  background-image: 
    linear-gradient(45deg, #1e293b 25%, transparent 25%), 
    linear-gradient(-45deg, #1e293b 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #1e293b 75%), 
    linear-gradient(-45deg, transparent 75%, #1e293b 75%) !important;
  background-size: 16px 16px !important;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px !important;
}
.showcase-chamber.light {
  background: #ffffff !important;
}

#avatarCanvas {
  width: 100% !important;
  max-width: 190px !important;
  height: auto !important;
  display: block;
  touch-action: none !important;
  border-radius: 6px;
  transition: max-width 0.25s ease;
}

.stage-card.is-compact #avatarCanvas {
  max-width: 140px !important;
}

.stage-tip {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  transition: opacity 0.2s ease;
}
.stage-card.is-compact .stage-tip {
  display: none !important;
}

/* 3. CONTROLS PANEL (Clean White iOS Surface) */
.panel-card {
  width: 100% !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 18px !important;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06) !important;
  padding: 1.15rem 1rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  box-sizing: border-box !important;
}

.sec-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 0.95rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.7rem !important;
}
.sec-title {
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-badge {
  font-size: 0.72rem;
  color: #0284c7;
  font-weight: 700;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 6px;
}
.sec-badge.glow {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
}
.sec-sub {
  font-size: 0.74rem;
  color: #64748b;
}

/* Preset Avatar Chips */
.preset-avatar-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.demo-avatar-chip {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  padding: 0.55rem 0.35rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.demo-avatar-chip.active {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}

/* Upload Button Row (Album & Camera) */
.m-upload-action-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  margin-top: 0.6rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.m-workspace-wrap label.m-upload-btn,
.m-workspace-wrap label.m-cam-btn,
.m-upload-action-row label,
.m-upload-btn,
.m-cam-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  width: 100% !important;
  min-height: 44px !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 0.86rem !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  text-align: center !important;
  transition: all 0.15s ease !important;
}

.m-workspace-wrap label.m-upload-btn,
.m-upload-btn {
  background: #ffffff !important;
  border: 1.5px dashed #0284c7 !important;
  color: #0284c7 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08) !important;
}

.m-workspace-wrap label.m-cam-btn,
.m-cam-btn {
  background: #f0fdf4 !important;
  border: 1.5px solid #86efac !important;
  color: #166534 !important;
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.08) !important;
}

.m-workspace-wrap label.m-upload-btn:active,
.m-upload-btn:active {
  background: #f0f9ff !important;
  transform: scale(0.98);
}

.m-workspace-wrap label.m-cam-btn:active,
.m-cam-btn:active {
  background: #dcfce7 !important;
  transform: scale(0.98);
}

/* Shape Row */
.shape-selector-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.shape-btn {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  padding: 0.65rem 0.35rem !important;
  border-radius: 10px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.shape-btn.active {
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}

/* Presets Grid */
.preset-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
}
.preset-chip {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #1e293b !important;
  padding: 0.65rem 0.75rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.preset-chip.active {
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.18) !important;
}

/* Range Sliders */
.slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
}
.slider-badge {
  color: #0284c7;
  font-family: monospace;
  font-weight: 800;
}
input[type="range"] {
  width: 100%;
  accent-color: #0284c7;
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
}

/* Tool Buttons Row */
.tool-buttons-row {
  display: flex;
  gap: 8px;
}
.btn-tool {
  flex: 1;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  padding: 0.65rem 0.5rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.btn-tool:active {
  background: #f1f5f9 !important;
}

.steam-tip-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 4. BOTTOM DOWNLOAD ACTION WRAP */
.m-bottom-action-wrap {
  width: 100% !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
}

.m-export-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 100% !important;
}

.btn-download-main {
  width: 100% !important;
  min-height: 52px !important;
  padding: 0.75rem 1rem !important;
  border-radius: 14px !important;
  border: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.btn-download-main:active {
  transform: scale(0.98) !important;
}

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

.btn-download-gif {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35) !important;
}

.btn-export-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.btn-export-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.btn-export-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.9;
  line-height: 1.2;
}

.btn-quick-gif {
  background: #fdf2f8 !important;
  border-color: #fbcfe8 !important;
  color: #db2777 !important;
}
.btn-quick-gif:active {
  background: #db2777 !important;
  color: #ffffff !important;
}

.export-status-toast {
  width: 100%;
  box-sizing: border-box;
  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.3);
}

.stage-subtext {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.65rem;
  text-align: center;
}
