/* ========================
   SnapWeb - 全局样式
   ======================== */

:root {
  --primary: #FF6B6B;
  --primary-dark: #ee5a5a;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --bg-dark: #1a1a2e;
  --bg-darker: #16162a;
  --bg-card: #242442;
  --bg-panel: #1e1e3a;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.5);
  --border-color: rgba(255,255,255,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --transition: all 0.25s ease;
  --toolbar-height: 64px;
  --bottom-controls-height: 88px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 页面容器 */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  overflow: hidden;
}

/* ========================
   启动页
   ======================== */
.splash-screen {
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

.splash-content {
  text-align: center;
  animation: fadeInUp 0.8s ease;
}

.splash-logo .camera-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(255,107,107,0.3);
}

.splash-logo .camera-icon svg {
  width: 48px;
  height: 48px;
  color: white;
}

.splash-logo h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.splash-logo p {
  font-size: 14px;
  color: var(--text-muted);
}

.splash-loading {
  margin-top: 40px;
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  margin: 0 auto 12px;
  overflow: hidden;
}

.loading-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  animation: loadingProgress 2s ease forwards;
}

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
}

@keyframes loadingProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================
   权限页
   ======================== */
.permission-screen {
  z-index: 900;
  align-items: center;
  justify-content: center;
}

.permission-content {
  text-align: center;
  padding: 40px;
  animation: fadeInUp 0.5s ease;
}

.permission-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.permission-icon svg {
  width: 56px;
  height: 56px;
  color: var(--primary);
}

.permission-content h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.permission-content p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.permission-content .sub-text {
  font-size: 13px;
  color: var(--text-muted);
}

.permission-buttons {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========================
   通用按钮样式
   ======================== */
.btn-primary {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-text {
  padding: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:active {
  background: rgba(255,255,255,0.2);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ========================
   拍摄页 - flex 布局
   ======================== */
.camera-screen {
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* 顶部工具栏 */
.top-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  z-index: 10;
  background: rgba(0,0,0,0.55);
}

.toolbar-btn {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.toolbar-btn:active {
  background: rgba(255,255,255,0.3);
}

.toolbar-btn svg {
  width: 20px;
  height: 20px;
}

/* 相机视图区域 — 充满顶部与底部之间的所有空间 */
.camera-view-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* 相机预览区域 */
.camera-preview-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.camera-video, .camera-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 网格辅助线 */
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.grid-line {
  position: absolute;
  background: rgba(255,255,255,0.3);
}

.grid-h1 { top: 33.33%; left: 0; width: 100%; height: 1px; }
.grid-h2 { top: 66.66%; left: 0; width: 100%; height: 1px; }
.grid-v1 { left: 33.33%; top: 0; width: 1px; height: 100%; }
.grid-v2 { left: 66.66%; top: 0; width: 1px; height: 100%; }

/* 对焦指示器 */
.focus-indicator {
  position: absolute;
  pointer-events: none;
}

.focus-square {
  width: 60px;
  height: 60px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  animation: focusIn 0.3s ease;
}

.focus-circle {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

@keyframes focusIn {
  from { transform: scale(1.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 倒计时 */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}

.countdown-number {
  font-size: 120px;
  font-weight: 700;
  color: white;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: countdownPulse 1s ease;
}

@keyframes countdownPulse {
  0% { transform: scale(1.5); opacity: 0; }
  50% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 快门闪光 */
.shutter-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
}

.shutter-flash.active {
  animation: flash 0.15s ease;
}

@keyframes flash {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}

/* 功能快捷入口（浮在相机视图底部） */
.quick-features {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.feature-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.feature-btn.active {
  background: var(--primary);
}

.feature-icon {
  font-size: 16px;
}

.feature-label {
  font-size: 10px;
}

/* 底部控制栏 */
.bottom-controls {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 12px 32px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
  min-height: 88px;
}

/* 相册缩略图 */
.album-thumb-btn {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.album-thumb-btn:active {
  transform: scale(0.92);
  border-color: white;
}

.album-thumb {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

/* 快门按钮 */
.shutter-btn {
  width: 72px;
  height: 72px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.shutter-ring {
  width: 100%;
  height: 100%;
  border: 4px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 4px 16px rgba(0,0,0,0.5);
}

.shutter-btn:active .shutter-ring {
  transform: scale(0.92);
}

.shutter-inner {
  width: 56px;
  height: 56px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.shutter-btn:active .shutter-inner {
  background: var(--primary);
}

/* 切换摄像头按钮 */
.switch-camera-btn {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.switch-camera-btn:active {
  transform: scale(0.92);
  background: rgba(255,255,255,0.3);
}

.switch-camera-btn svg {
  width: 24px;
  height: 24px;
}

/* ========================
   底部面板（美颜/滤镜/贴纸/模板）
   ======================== */
.bottom-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 16px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  max-height: 45vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

/* 面板折叠把手 */
.panel-handle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease;
  margin: 0 -16px;
}

.panel-handle:active {
  background: rgba(255,255,255,0.05);
}

.panel-handle-bar {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin-bottom: 4px;
}

.panel-handle-arrow {
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.4);
  transition: transform 0.3s ease, color 0.2s ease;
}

.panel-handle:active .panel-handle-arrow {
  color: rgba(255,255,255,0.7);
  transform: translateY(-2px);
}

.bottom-panel.hidden {
  transform: translateY(100%);
  pointer-events: none;
  opacity: 0;
}

.panel-header {
  margin-bottom: 12px;
}

/* Tab 样式 */
.beauty-tabs, .filter-categories, .sticker-tabs, .template-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.beauty-tabs::-webkit-scrollbar,
.filter-categories::-webkit-scrollbar,
.sticker-tabs::-webkit-scrollbar,
.template-tabs::-webkit-scrollbar {
  display: none;
}

.beauty-tab, .filter-category, .sticker-tab, .template-tab,
.sticker-category, .album-tab, .edit-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.beauty-tab.active, .filter-category.active,
.sticker-tab.active, .template-tab.active,
.sticker-category.active, .album-tab.active,
.edit-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 贴纸二级分类 */
.sticker-categories {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* 滑块 */
.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.slider-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 24px;
}

.slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-card);
  border-radius: 2px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 预设按钮 */
.preset-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.preset-btn {
  padding: 6px 16px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.preset-btn.active {
  background: var(--primary);
  color: white;
}

/* 滤镜列表 */
.filter-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}

.filter-list::-webkit-scrollbar {
  display: none;
}

.filter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 64px;
}

.filter-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
  border: 2px solid transparent;
  transition: var(--transition);
}

.filter-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filter-item.active .filter-thumb {
  border-color: var(--primary);
}

.filter-name {
  font-size: 11px;
  color: var(--text-secondary);
}

.filter-item.active .filter-name {
  color: var(--primary);
}

/* 贴纸网格 */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 8px 0;
  max-height: 200px;
  overflow-y: auto;
}

.sticker-item {
  aspect-ratio: 1;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: var(--transition);
}

.sticker-item:active {
  transform: scale(0.9);
}

/* 模板网格 */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0;
}

.template-item {
  aspect-ratio: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.template-item.active {
  border-color: var(--primary);
}

.template-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 面板操作按钮 */
.panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.panel-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.panel-btn.primary {
  background: var(--primary);
  color: white;
}

/* 弹窗 */
.popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
}

.popup-content {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow);
}

.ratio-option, .countdown-option {
  padding: 10px 16px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.ratio-option.active, .countdown-option.active {
  background: var(--primary);
  color: white;
}

/* ========================
   预览页
   ======================== */
.preview-screen {
  z-index: 200;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.preview-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.preview-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.preview-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.preview-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* 预览编辑 Tab */
.preview-edit-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  background: var(--bg-dark);
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-color);
}

.preview-edit-tabs::-webkit-scrollbar {
  display: none;
}

.preview-edit-content {
  padding: 12px 16px;
  background: var(--bg-dark);
  max-height: 140px;
  overflow-y: auto;
}

.edit-template-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.edit-template-tabs::-webkit-scrollbar {
  display: none;
}

.edit-template-tab {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.edit-template-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.preview-actions {
  display: flex;
  justify-content: space-around;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.action-btn svg {
  width: 24px;
  height: 24px;
}

.action-btn.primary {
  color: var(--primary);
}

.action-btn.primary svg {
  stroke: var(--primary);
}

/* ========================
   相册页
   ======================== */
.album-screen {
  z-index: 300;
}

.album-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.album-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.album-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  background: var(--bg-dark);
  scrollbar-width: none;
}

.album-tabs::-webkit-scrollbar {
  display: none;
}

.album-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-dark);
}

.album-empty {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.album-empty p {
  font-size: 16px;
  color: var(--text-secondary);
}

.album-empty .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.album-photo {
  aspect-ratio: 1;
  background: var(--bg-card);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.album-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.album-photo:active img {
  opacity: 0.8;
}

/* ========================
   分享页
   ======================== */
.share-screen {
  z-index: 400;
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.share-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.share-preview {
  padding: 16px;
  display: flex;
  justify-content: center;
  background: #000;
}

.share-image {
  max-width: 100%;
  max-height: 40vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.share-platforms {
  padding: 20px 16px;
  background: var(--bg-dark);
}

.share-platforms h4 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.platform-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-card);
}

.share-extra {
  padding: 16px;
  display: flex;
  gap: 12px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
}

.share-extra-btn {
  flex: 1;
  padding: 14px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.share-extra-btn.primary {
  background: var(--primary);
  color: white;
}

/* ========================
   设置页
   ======================== */
.settings-screen {
  z-index: 500;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-dark);
}

.settings-group {
  margin-bottom: 24px;
}

.settings-group h4 {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item span:first-child {
  font-size: 15px;
}

.setting-value {
  font-size: 14px;
  color: var(--text-muted);
}

.arrow {
  font-size: 18px;
  color: var(--text-muted);
}

/* 开关 */
.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-card);
  border-radius: 28px;
  transition: var(--transition);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.setting-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  width: 120px;
  text-align: right;
}

.setting-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
}

.setting-btn:active {
  background: var(--border-color);
}

/* ========================
   Toast 提示
   ======================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  z-index: 2000;
  transition: var(--transition);
}

.toast.hidden {
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
}

/* ========================
   确认弹窗
   ======================== */
.dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.dialog.hidden {
  display: none;
}

.dialog-content {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 80%;
  max-width: 300px;
  text-align: center;
}

.dialog-content h4 {
  font-size: 17px;
  margin-bottom: 8px;
}

.dialog-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.dialog-buttons {
  display: flex;
  gap: 12px;
}

.dialog-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
}

.dialog-btn.primary {
  background: var(--primary);
  color: white;
}

/* ========================
   照片上的贴纸层
   ======================== */
.sticker-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.sticker-on-photo {
  position: absolute;
  font-size: 60px;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
  transition: transform 0.1s;
}

.sticker-on-photo:active {
  cursor: grabbing;
}

.sticker-on-photo.selected {
  filter: drop-shadow(0 0 4px var(--primary));
  outline: 2px dashed rgba(255,107,107,0.5);
  outline-offset: 2px;
}

/* ========================
   文字叠加层
   ======================== */
.text-overlay {
  position: absolute;
  color: white;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  cursor: grab;
  user-select: none;
  pointer-events: auto;
}

/* ========================
   响应式适配
   ======================== */
@media (min-width: 768px) {
  .camera-preview-container {
    max-width: 500px;
    margin: 0 auto;
  }

  .album-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-height: 600px) {
  .bottom-panel {
    max-height: 35vh;
  }
}