/* base.css — 设计系统：变量 + 重置 + 通用组件 */
/* 韩系简约ins风，白色+哑光玫瑰色调 */

/* ===== CSS变量 ===== */
:root {
  --c-bg: #ffffff;
  --c-surface: #faf4f6;
  --c-surface-2: #efe3e9;
  --c-border: rgba(180, 140, 160, 0.10);
  --c-border-m: rgba(180, 140, 160, 0.16);
  --c-accent: #d4a0b0;
  --c-accent-light: #f2d5de;
  --c-accent-dark: #c08898;
  --c-text: #3a2f35;
  --c-sub: #9a8a92;
  --c-hint: #c4b5bc;
  --c-rose: #e8b4be;
  --c-green: #7cb99a;
  --c-red: #e08080;
  --c-warn: #e8c580;
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 100px;
  --font: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-custom: '';
  --font-size-body: 14px;
  --letter-spacing-body: 0em;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --dur: 0.2s;
}

/* ===== 全局重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font-family: var(--font);
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
  font-size: var(--font-size-body);
  letter-spacing: var(--letter-spacing-body);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, textarea { user-select: text; }
img { display: block; max-width: 100%; }
button { border: none; background: none; cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); outline: none; font-size: 16px; }

/* ===== 手机容器 ===== */
#app {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  background: var(--c-bg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===== 开屏页 ===== */
#loading {
  position: fixed; inset: 0;
  background: var(--c-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.6s var(--ease);
}
#loading.hidden { opacity: 0; pointer-events: none; }

/* 背景装饰 */
.splash-bg { position: absolute; inset: 0; pointer-events: none; }

.splash-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
}
.splash-blob.b1 {
  width: 320px; height: 320px;
  background: var(--c-accent-light);
  opacity: 0.55;
  top: -80px; left: -80px;
  animation: blobFloat1 11s ease-in-out infinite;
}
.splash-blob.b2 {
  width: 220px; height: 220px;
  background: var(--c-rose);
  opacity: 0.35;
  bottom: 60px; right: -50px;
  animation: blobFloat2 13s ease-in-out infinite;
}
.splash-blob.b3 {
  width: 160px; height: 160px;
  background: var(--c-surface-2);
  opacity: 0.6;
  top: 55%; left: 60%;
  animation: blobFloat3 9s ease-in-out infinite;
}

@keyframes blobFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, 32px) scale(1.06); }
}
@keyframes blobFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-18px, -24px) scale(1.09); }
}
@keyframes blobFloat3 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--c-accent-light);
  top: 50%; left: 50%;
  opacity: 0;
  animation: ringPulse 3.6s ease-out infinite;
}
.splash-ring.r1 { width: 160px; height: 160px; animation-delay: 0s; }
.splash-ring.r2 { width: 250px; height: 250px; animation-delay: 1.2s; }
.splash-ring.r3 { width: 340px; height: 340px; animation-delay: 2.4s; }

@keyframes ringPulse {
  0%   { transform: translate(-50%, -50%) scale(0.75); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}

/* 中心内容 */
.splash-center {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  position: relative; z-index: 1;
  animation: splashIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.splash-icon {
  width: 76px; height: 76px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 8px 28px rgba(212, 160, 176, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 6px;
}
.splash-icon img { width: 100%; height: 100%; object-fit: cover; }

.splash-title {
  font-size: 38px;
  font-weight: 200;
  color: var(--c-text);
  letter-spacing: 0.18em;
}

.splash-tagline {
  font-size: 11px;
  color: var(--c-hint);
  letter-spacing: 0.32em;
  font-weight: 300;
}

/* Tap to Start */
.splash-tap {
  position: absolute;
  bottom: calc(56px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  z-index: 1;
  pointer-events: none;
}
.splash-tap.ready {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.splash-tap span {
  font-size: 11px;
  color: var(--c-hint);
  letter-spacing: 0.24em;
  font-weight: 300;
  animation: tapBreath 2.2s ease-in-out infinite;
}
.tap-line {
  width: 24px; height: 1px;
  background: var(--c-accent-light);
}

@keyframes tapBreath {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ===== 卡片 ===== */
.card {
  background: var(--c-bg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-surface {
  background: var(--c-surface);
  border-radius: var(--r-md);
}

/* ===== 胶囊主按钮 ===== */
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 400;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.btn-pill:active { transform: scale(0.96); opacity: 0.85; }

/* 幽灵按钮 */
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px;
  background: transparent;
  color: var(--c-accent);
  border: 1px solid var(--c-accent-light);
  border-radius: var(--r-pill);
  font-size: 14px;
  transition: all var(--dur) var(--ease);
}
.btn-ghost:active { background: var(--c-accent-light); }

/* 危险按钮 */
.btn-danger { background: var(--c-red); color: #fff; }
/* 图标按钮 */
.btn-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--c-sub);
  transition: background var(--dur);
}
.btn-icon:active { background: var(--c-surface); }

/* ===== 输入框 ===== */
.input-field {
  width: 100%;
  padding: 12px 16px;
  background: var(--c-surface);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 16px;
  color: var(--c-text);
  transition: border-color var(--dur);
}
.input-field:focus { border-color: var(--c-accent-light); }
.input-field::placeholder { color: var(--c-hint); }
textarea.input-field {
  resize: none; min-height: 80px; line-height: 1.6;
}

/* ===== 页面header ===== */
.page-header {
  display: flex; align-items: center;
  padding: 16px 16px 12px;
  padding-top: calc(16px + env(safe-area-inset-top));
  gap: 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
  flex-shrink: 0;
}
.page-header .header-back {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-sub); font-size: 18px;
  border-radius: 50%;
  transition: background var(--dur);
}
.page-header .header-back:active { background: var(--c-surface); }
.page-header .header-title {
  flex: 1; font-size: 17px; font-weight: 500; color: var(--c-text);
}

/* ===== 底部Sheet弹窗 ===== */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 100; opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.sheet-overlay.show { opacity: 1; }
.modal-sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 430px;
  background: var(--c-bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  z-index: 101;
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.3s var(--ease);
  max-height: 90vh; overflow-y: auto;
}
.modal-sheet.show { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--c-border-m);
  border-radius: 2px;
  margin: 12px auto 8px;
}

/* ===== 居中弹窗 ===== */
.center-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: calc(100% - 48px); max-width: 380px;
  max-height: 80vh; overflow-y: auto;
  background: var(--c-bg);
  border-radius: var(--r-lg);
  padding: 20px 0 16px;
  z-index: 201;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.2s var(--ease);
}
.center-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== Toggle开关 ===== */
.toggle-wrap {
  position: relative; width: 44px; height: 26px; cursor: pointer;
}
.toggle-wrap input[type="checkbox"] {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-track {
  position: absolute; inset: 0;
  background: var(--c-border-m);
  border-radius: var(--r-pill);
  transition: background 0.2s;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s var(--ease);
}
.toggle-wrap input:checked ~ .toggle-track { background: var(--c-accent); }
.toggle-wrap input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* ===== Toast提示 ===== */
#toast-container {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 16px);
  left: 50%; transform: translateX(-50%);
  z-index: 9998;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 20px;
  background: rgba(44, 44, 44, 0.88);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== 通用图片选择弹窗 ===== */
.img-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 800; opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.img-picker-overlay.show { opacity: 1; }
.img-picker-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 280px;
  background: var(--c-bg);
  border-radius: var(--r-lg);
  padding: 24px 20px 16px;
  z-index: 801;
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.2s var(--ease);
}
.img-picker-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.img-picker-title {
  font-size: 16px; font-weight: 500; color: var(--c-text);
}
.img-picker-options {
  display: flex; gap: 12px; width: 100%;
}
.img-picker-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  padding: 16px 8px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  color: var(--c-accent);
  font-size: 13px;
  transition: background var(--dur);
  cursor: pointer;
  border: none;
  font-family: var(--font);
}
.img-picker-btn i { font-size: 24px; }
.img-picker-btn:active { background: var(--c-surface-2); }
.img-picker-url-area {
  width: 100%;
  display: flex; flex-direction: column; gap: 8px;
}
.img-picker-confirm {
  width: 100%; font-family: var(--font);
}
.img-picker-cancel {
  width: 100%; padding: 10px 0;
  background: transparent;
  color: var(--c-sub);
  font-size: 14px;
  font-family: var(--font);
  border: none; cursor: pointer;
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
}
.img-picker-cancel:active { color: var(--c-accent); }

/* ===== 分割行样式 ===== */
.list-row {
  display: flex; align-items: center;
  padding: 14px 16px; gap: 12px;
  border-bottom: 1px solid var(--c-border);
}
.list-row:last-child { border-bottom: none; }
.list-row .row-label { flex: 1; font-size: 14px; color: var(--c-text); }
.list-row .row-sub { font-size: 12px; color: var(--c-sub); margin-top: 2px; }
