/* ============================================================
   渐变壁纸工坊 · 样式表
   ============================================================ */

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

:root {
  --bg-1: #0a0a14;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8e8f2;
  --text-dim: #8b8ba3;
  --text-faint: #5c5c72;
  --accent: #00d4aa;
  --accent-2: #7b2ff7;
  --accent-grad: linear-gradient(135deg, #00d4aa 0%, #7b2ff7 100%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-1);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app { height: 100vh; display: flex; flex-direction: column; }

/* ===================== 顶栏 ===================== */
.topbar {
  flex-shrink: 0;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 20, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--accent-grad);
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.28),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}
.logo::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 25%,
              rgba(255,255,255,0.55) 0%, transparent 55%);
}

.brand-text h1 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.brand-text p  { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ===================== 按钮 ===================== */
.btn-primary, .btn-secondary, .btn-ghost {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, color 0.18s;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 212, 170, 0.26);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 22px rgba(0, 212, 170, 0.42);
}
.btn-primary:disabled { opacity: 0.6; cursor: progress; transform: none; }

.btn-secondary {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ===================== 主体布局 ===================== */
.main {
  flex: 1;
  display: flex;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
  min-height: 0;
}

/* ===================== 侧边栏 ===================== */
.sidebar {
  width: 318px;
  flex-shrink: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.14);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }

.section {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.section-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* ===================== 预设缩略图 ===================== */
.presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.preset {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  background: #111;
}
.preset:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(255,255,255,0.35);
}
.preset.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 5px 16px rgba(0,212,170,0.3);
}
.preset canvas { width: 100%; height: 100%; display: block; }

/* ===================== 模式选择 ===================== */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 8px;
  border-radius: 9px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s;
}
.mode:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.mode.active {
  background: rgba(0, 212, 170, 0.1);
  border-color: rgba(0, 212, 170, 0.55);
  color: var(--accent);
}
.mode-icon { font-size: 17px; line-height: 1; }

/* ===================== 颜色选择 ===================== */
.colors { display: flex; flex-direction: column; gap: 8px; }

.color-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.color-picker:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--border-strong);
}

.color-picker input[type="color"] {
  width: 38px; height: 38px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.color-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 9px;
}
.color-picker input[type="color"]::-moz-color-swatch {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 9px;
}

.color-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.color-name { font-size: 12px; font-weight: 500; color: var(--text); }
.color-hex {
  font-size: 11px;
  color: var(--text-dim);
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  letter-spacing: 0.03em;
}

/* ===================== 提示文字 ===================== */
.hint {
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-faint);
  margin-top: 9px;
}

/* ===================== 玻璃质感选项 ===================== */
.glass-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.glass-chip {
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.18s;
}
.glass-chip:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.glass-chip.active {
  background: rgba(0, 212, 170, 0.12);
  border-color: rgba(0, 212, 170, 0.55);
  color: var(--accent);
}

/* ===================== 滑块 ===================== */
.sliders { display: flex; flex-direction: column; gap: 15px; }

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 7px;
  color: var(--text);
}
.slider-label > span:first-child { flex-shrink: 0; }

/* 数值输入框：外观做成一个小胶囊，与滑块联动 */
.num-input {
  width: 58px;
  flex-shrink: 0;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  text-align: right;
  transition: border-color 0.18s, background 0.18s;
  /* 隐藏数字框的上下箭头，避免占宽又容易误点 */
  -moz-appearance: textfield;
  appearance: textfield;
}
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.num-input:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.08); }
.num-input:focus {
  outline: none;
  border-color: rgba(0, 212, 170, 0.7);
  background: rgba(0, 212, 170, 0.08);
  color: var(--text);
}

.slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.09);
  outline: none;
  cursor: pointer;
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.18);
  transition: box-shadow 0.18s;
}
.slider input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(0, 212, 170, 0.28);
}
.slider input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.18);
}

/* ===================== 下拉选择 ===================== */
.select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  border-radius: 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%238b8ba3' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.18s, background-color 0.18s;
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: rgba(0,212,170,0.6); }
.select option { background: #14142a; color: var(--text); }

/* ===================== 预览舞台 ===================== */
.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #07070f;
}

.stage-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 28% 18%, rgba(123, 47, 247, 0.18) 0%, transparent 62%),
    radial-gradient(ellipse 50% 40% at 74% 82%, rgba(0, 212, 170, 0.14) 0%, transparent 62%),
    radial-gradient(ellipse 40% 30% at 52% 52%, rgba(255, 107, 107, 0.05) 0%, transparent 70%);
}

.phone-wrap { position: relative; z-index: 2; }

.phone-frame {
  position: relative;
  height: min(71vh, 690px);
  aspect-ratio: 9 / 20;   /* 由 JS 覆盖为所选分辨率的真实比例 */
  padding: 8px;
  border-radius: 40px;
  background: linear-gradient(140deg, #23232e 0%, #0b0b12 55%, #1a1a24 100%);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow:
    0 34px 80px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 70px rgba(123, 47, 247, 0.18);
  animation: float 7s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 33px;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.phone-screen canvas { display: block; width: 100%; height: 100%; }

/* 打孔摄像头 */
.phone-notch {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #000;
  z-index: 6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07),
              0 0 0 2px rgba(0,0,0,0.55);
}

/* 状态栏 */
.statusbar {
  position: absolute;
  top: 12px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  z-index: 5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.status-icons { display: flex; align-items: center; gap: 5px; }
.battery {
  font-size: 11px;
  font-weight: 600;
  padding-left: 1px;
}

/* 底部手势条 */
.home-indicator {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.72);
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
}

/* ===================== 底部信息条 ===================== */
.stage-info {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px 20px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  white-space: nowrap;
}

.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label {
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.info-item > span:last-child {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.info-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
}

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  padding: 11px 22px;
  border-radius: 12px;
  background: rgba(20, 20, 34, 0.94);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== 响应式 ===================== */
@media (max-width: 980px) {
  html, body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .main {
    flex-direction: column-reverse;
    overflow: visible;
    padding: 14px;
  }
  .sidebar { width: 100%; overflow: visible; }
  .stage {
    min-height: 78vh;
    padding: 26px 0 74px;
  }
  .phone-frame { height: min(58vh, 560px); }
  .topbar { padding: 0 14px; height: 60px; }
  .brand-text p { display: none; }
  .btn-ghost { display: none; }
}

@media (max-width: 560px) {
  .presets { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .stage-info { gap: 11px; padding: 8px 14px; }
  .info-item:nth-child(4) { display: none; }
}
