/**
 * 爬爬 App v1 — 共享样式 (iOS HIG 规范)
 * 包含 Design Tokens 的 CSS 变量实现 + 基础重置 + 工具类 + 组件基础样式
 * 设计基准：iPhone 14 Pro (393×852pt)
 * 设计语言：iOS Human Interface Guidelines
 */

/* ========================================
   1. CSS Variables (Design Tokens)
   ======================================== */

:root {
  /* 主色 */
  --color-primary-50: #E8F5E9;
  --color-primary-100: #C8E6C9;
  --color-primary-200: #A5D6A7;
  --color-primary-300: #81C784;
  --color-primary-400: #66BB6A;
  --color-primary-500: #43A047;
  --color-primary-600: #388E3C;
  --color-primary-700: #2E7D32;
  --color-primary-800: #1B5E20;
  --color-primary-900: #104A16;

  /* 语义色 */
  --color-success: #2E7D32;
  --color-warning: #F9A825;
  --color-error: #D32F2F;
  --color-info: #1976D2;

  /* iOS 系统色 — 亮色模式 */
  --ios-label: #000000;
  --ios-secondary-label: rgba(60, 60, 67, 0.6);
  --ios-tertiary-label: rgba(60, 60, 67, 0.3);
  --ios-placeholder: rgba(60, 60, 67, 0.3);
  --ios-separator: rgba(60, 60, 67, 0.29);
  --ios-opaque-separator: #C6C6C8;
  --ios-system-background: #FFFFFF;
  --ios-secondary-background: #F2F2F7;
  --ios-tertiary-background: #FFFFFF;
  --ios-grouped-background: #F2F2F7;
  --ios-secondary-grouped: #FFFFFF;
  --ios-tertiary-grouped: #F2F2F7;
  --ios-fill: rgba(120, 120, 128, 0.2);
  --ios-secondary-fill: rgba(120, 120, 128, 0.16);
  --ios-quaternary-fill: rgba(120, 120, 128, 0.08);

  /* 背景色 — 亮色模式 */
  --color-bg-page: #FFFFFF;
  --color-bg-surface: #F2F2F7;
  --color-bg-elevated: #FFFFFF;
  --color-bg-overlay: rgba(0, 0, 0, 0.4);
  --color-bg-glass: rgba(255, 255, 255, 0.72);

  /* 文字色 — 亮色模式 */
  --color-text-primary: #000000;
  --color-text-secondary: rgba(60, 60, 67, 0.72);
  --color-text-tertiary: rgba(60, 60, 67, 0.3);
  --color-text-inverse: #FFFFFF;
  --color-text-link: #1B5E20;

  /* 字体 */
  --font-sans: -apple-system, "SF Pro Display", "SF Pro Text", "PingFang SC", "Noto Sans SC", "HarmonyOS Sans", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", "Roboto Mono", "HarmonyOS Sans Mono", monospace;

  /* 字重 */
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* 别名（推荐使用数字命名 --space-N，命名方案仅保留兼容） */
  --space-xs: var(--space-1);
  --space-sm: var(--space-2);
  --space-md: var(--space-3);
  --space-lg: var(--space-4);
  --space-xl: var(--space-5);
  --space-2xl: var(--space-6);
  --space-3xl: var(--space-8);
  --space-4xl: var(--space-12);

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-full: 9999px;

  /* 阴影（iOS 极少使用） */
  --shadow-sm: none;
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.15);

  /* 毛玻璃 */
  --glass-bg-light: rgba(255, 255, 255, 0.72);
  --glass-bg-dark: rgba(28, 28, 30, 0.72);
  --glass-blur: 20px;
  --glass-saturation: 180%;

  /* 分隔线 */
  --divider-default: 0.5px solid var(--ios-separator);
  --divider-opaque: 0.5px solid var(--ios-opaque-separator);

  /* Z-Index */
  --z-base: 0;
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* 过渡 */
  --transition-micro: 100ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* 尺寸 */
  --app-width: 393px;
  --app-height: 852px;
  --navbar-height: 44px;
  --safe-top: 47px;
  --safe-bottom: 34px;
  --touch-target: 44px;
  --list-row-height: 44px;
  --button-height: 48px;
  --button-height-sm: 36px;
  --sheet-handle-width: 36px;
  --sheet-handle-height: 5px;
}

/* ========================================
   2. Base Reset
   ======================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

/* 可滚动容器隐藏滚动条（模拟器内更整洁） */
.app-container::-webkit-scrollbar,
.page-content::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
  display: none;
}
.app-container,
.page-content,
.main-content,
.left-panel,
.right-panel {
  scrollbar-width: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

input, textarea {
  font-family: inherit;
  -webkit-appearance: none;
  font-size: 17px;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ========================================
   3. Typography Tokens
   ======================================== */

.text-large-title {
  font-size: 28px;
  font-weight: var(--font-bold);
  line-height: 1.2;
}

.text-h1 {
  font-size: 22px;
  font-weight: var(--font-bold);
  line-height: 1.3;
}

.text-h2 {
  font-size: 20px;
  font-weight: var(--font-semibold);
  line-height: 1.35;
}

.text-h3 {
  font-size: 17px;
  font-weight: var(--font-semibold);
  line-height: 1.4;
}

.text-body {
  font-size: 17px;
  font-weight: var(--font-regular);
  line-height: 1.5;
}

.text-body-medium {
  font-size: 17px;
  font-weight: var(--font-medium);
  line-height: 1.5;
}

.text-callout {
  font-size: 16px;
  font-weight: var(--font-medium);
  line-height: 1.4;
}

.text-subhead {
  font-size: 15px;
  font-weight: var(--font-regular);
  line-height: 1.4;
}

.text-caption {
  font-size: 13px;
  font-weight: var(--font-regular);
  line-height: 1.4;
}

.text-footnote {
  font-size: 12px;
  font-weight: var(--font-regular);
  line-height: 1.3;
}

/* ========================================
   4. Utility Classes
   ======================================== */

/* Colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-inverse { color: var(--color-text-inverse); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

.bg-page { background: var(--color-bg-page); }
.bg-surface { background: var(--color-bg-surface); }
.bg-elevated { background: var(--color-bg-elevated); }
.bg-primary { background: var(--color-primary-600); }
.bg-error { background: var(--color-error); }

/* Border radius */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-3xl { border-radius: var(--radius-3xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Flex */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Text align */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ========================================
   5. App Container
   ======================================== */

.app-container {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--color-bg-page);
  position: relative;
  overflow-x: hidden;
}

/* ========================================
   6. Navigation
   ======================================== */

/* ---- Standard Navbar（透明沉浸风格） ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--app-width);
  height: calc(var(--safe-top) + var(--navbar-height));
  padding-top: var(--safe-top);
  background: transparent;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.navbar-title {
  font-size: 17px;
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  text-align: center;
  flex: 1;
}

.navbar-back,
.navbar-action {
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 17px;
  transition: opacity var(--transition-micro);
}

.navbar-back {
  min-width: auto;
  padding: 0 4px;
}

.navbar-action {
  min-width: var(--touch-target);
}

.navbar-back:active,
.navbar-action:active {
  opacity: 0.5;
}

/* ---- Large Title Navbar (首页) ---- */
.navbar-large {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--app-width);
  height: calc(var(--safe-top) + 96px);
  padding-top: var(--safe-top);
  background: var(--color-bg-page);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  padding-bottom: var(--space-2);
}

.navbar-large .large-title {
  font-size: 28px;
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
}

/* ========================================
   7. Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-family: inherit;
  transition: transform var(--transition-micro), opacity var(--transition-micro);
  -webkit-user-select: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* 主按钮 */
.btn-primary {
  width: 100%;
  height: var(--button-height);
  border-radius: var(--radius-md);
  background: var(--color-primary-600);
  color: var(--color-text-inverse);
  font-size: 17px;
  font-weight: var(--font-medium);
  padding: 0 var(--space-4);
}

.btn-primary:disabled {
  background: var(--ios-fill);
  color: var(--ios-tertiary-label);
  cursor: not-allowed;
  transform: none;
  opacity: 1;
}

/* 次按钮 */
.btn-secondary {
  height: var(--button-height);
  border-radius: var(--radius-md);
  background: var(--ios-fill);
  color: var(--color-primary-600);
  font-size: 17px;
  font-weight: var(--font-medium);
  padding: 0 var(--space-4);
}

.btn-secondary:disabled {
  color: var(--ios-tertiary-label);
  cursor: not-allowed;
  transform: none;
  opacity: 1;
}

/* 文字按钮 */
.btn-text {
  height: var(--button-height-sm);
  background: transparent;
  color: var(--color-primary-600);
  font-size: 17px;
  font-weight: var(--font-regular);
  padding: 0 var(--space-2);
}

.btn-text:active {
  opacity: 0.5;
}

/* 危险按钮 */
.btn-danger {
  width: 100%;
  height: var(--button-height);
  border-radius: var(--radius-md);
  background: var(--color-error);
  color: var(--color-text-inverse);
  font-size: 17px;
  font-weight: var(--font-medium);
  padding: 0 var(--space-4);
}

/* Capsule 按钮（品系标签等） */
.btn-capsule {
  height: var(--button-height-sm);
  border-radius: var(--radius-full);
  background: var(--ios-secondary-grouped);
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: var(--font-regular);
  padding: 0 14px;
}

.btn-capsule:active {
  background: var(--ios-tertiary-grouped);
}

/* ========================================
   8. Inputs
   ======================================== */

/* ---- iOS 搜索框 ---- */
.search-input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--ios-fill);
  border: none;
  padding: 0 var(--space-3) 0 36px;
  font-size: 17px;
  color: var(--color-text-primary);
  outline: none;
  transition: background var(--transition-fast);
}

.search-input::placeholder {
  color: var(--ios-placeholder);
}

.search-input:focus {
  background: var(--ios-secondary-fill);
}

/* 标准文本输入 */
.text-input {
  width: 100%;
  height: var(--list-row-height);
  background: transparent;
  border: none;
  padding: 0 var(--space-4);
  font-size: 17px;
  color: var(--color-text-primary);
  outline: none;
}

.text-input::placeholder {
  color: var(--ios-placeholder);
}

/* ========================================
   9. iOS Segmented Control
   ======================================== */

.segmented-control {
  display: flex;
  height: 44px;
  background: var(--ios-tertiary-grouped);
  border-radius: var(--radius-lg);
  padding: 2px;
  gap: 2px;
}

.segmented-control .segment {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  padding: 0 10px;
}

.segmented-control .segment.active {
  background: #FFFFFF;
  color: var(--color-text-primary);
  font-weight: var(--font-semibold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ========================================
   10. iOS Toggle (开关)
   ======================================== */

.toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 51px;
  height: 31px;
  background: var(--ios-fill);
  border-radius: 15.5px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-fast);
}

.toggle:checked {
  background: var(--color-primary-600);
}

.toggle:checked::after {
  transform: translateX(20px);
}

/* ========================================
   10.5 Gene Selection Views
   ======================================== */

/* ---- Gene Entry Row ---- */
.gene-entry-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 56px;
  padding: 12px var(--space-4) 10px;
  background: var(--ios-secondary-grouped);
  transition: background var(--transition-micro);
  -webkit-user-select: none;
  user-select: none;
}

.gene-entry-row:active {
  background: var(--ios-tertiary-grouped);
}

.gene-entry-row + .gene-entry-row {
  border-top: var(--divider-default);
}

.gene-entry-row .entry-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding-right: var(--space-3);
  padding-top: 2px;
}

.gene-entry-row .locus-name {
  font-size: 16px;
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  line-height: 1.3;
}

.gene-entry-row .gene-name {
  font-size: 12px;
  font-weight: var(--font-regular);
  color: var(--color-text-tertiary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gene-entry-row .selector-wrap {
  flex-shrink: 0;
  min-width: 150px;
  max-width: 200px;
  margin-top: 1px;
}

/* 选中态 */
.gene-entry-row.selected {
  background: var(--ios-tertiary-grouped);
}

/* 互斥禁用态（同一位点其他基因） */
.gene-entry-row.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.gene-entry-row.disabled .segmented-control .segment {
  cursor: not-allowed;
}

/* 等位基因互斥减弱态：视觉提示但不阻止点击（允许切换） */
.gene-entry-row.muted {
  opacity: 0.45;
}

/* ---- Gene Category List ---- */
.gene-category-group {
  background: var(--ios-secondary-grouped);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.gene-category-header {
  font-size: 13px;
  font-weight: var(--font-regular);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  margin-top: var(--space-5);
  padding-left: var(--space-4);
}

/* ---- Search Empty State ---- */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.search-empty-state .icon {
  width: 48px;
  height: 48px;
  color: var(--ios-fill);
  margin-bottom: var(--space-3);
}

.search-empty-state .title {
  font-size: 17px;
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.search-empty-state .desc {
  font-size: 15px;
  color: var(--color-text-secondary);
}

/* ========================================
   11. Lists (iOS Grouped Style)
   ======================================== */

/* 列表分组容器 */
.list-group {
  background: var(--ios-secondary-grouped);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

/* 列表行 */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--list-row-height);
  padding: 0 var(--space-4);
  background: var(--ios-secondary-grouped);
  transition: background var(--transition-micro);
}

.list-row:active {
  background: var(--ios-tertiary-grouped);
}

.list-row + .list-row {
  border-top: var(--divider-default);
}

/* 列表行内容 */
.list-row-label {
  font-size: 17px;
  font-weight: var(--font-regular);
  color: var(--color-text-primary);
}

.list-row-value {
  font-size: 17px;
  font-weight: var(--font-regular);
  color: var(--color-text-secondary);
  text-align: right;
}

.list-row-chevron {
  color: var(--ios-tertiary-label);
  font-size: 14px;
  margin-left: var(--space-1);
}

/* ========================================
   12. Cards
   ======================================== */

.card {
  background: var(--ios-secondary-grouped);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-content {
  padding: var(--space-4);
}

/* ========================================
   13. Gene Tag
   ======================================== */

.gene-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--color-primary-100);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
}

.gene-tag .remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.5;
  font-size: 13px;
  transition: opacity var(--transition-micro);
}

.gene-tag .remove:active {
  opacity: 1;
}

/* ========================================
   14. Badge
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: var(--font-medium);
}

.badge-hot {
  background: var(--color-warning);
  color: var(--color-text-inverse);
}

/* ========================================
   15. Spinner
   ======================================== */

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-primary-600);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   16. Page Layout
   ======================================== */

.page-content {
  padding-top: calc(var(--safe-top) + var(--navbar-height));
  padding-bottom: var(--safe-bottom);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.page-content-large-title {
  padding-top: calc(var(--safe-top) + 96px);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.section-title {
  font-size: 13px;
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  margin-top: var(--space-6);
  padding-left: var(--space-4);
}

/* ========================================
   17. Empty State
   ======================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  color: var(--ios-fill);
  margin-bottom: var(--space-3);
}

.empty-state-title {
  font-size: 20px;
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.empty-state-desc {
  font-size: 15px;
  color: var(--color-text-secondary);
}

/* ========================================
   18. Feedback Components
   ======================================== */

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  background: rgba(0, 0, 0, 0.85);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: var(--font-medium);
  text-align: center;
  min-width: 120px;
  max-width: 280px;
  animation: toastIn 300ms ease-out;
  box-shadow: var(--shadow-lg);
}

.toast.hiding {
  animation: toastOut 200ms ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- Alert ---- */
.alert-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 200ms ease-out;
}

.alert-box {
  background: var(--color-bg-elevated);
  border-radius: 12px;
  width: 100%;
  max-width: 280px;
  padding: var(--space-5);
  text-align: center;
  animation: scaleIn 250ms ease-out;
}

.alert-box .alert-title {
  font-size: 17px;
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.alert-box .alert-message {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  line-height: 21px;
}

.alert-box .alert-actions {
  display: flex;
  gap: var(--space-3);
}

.alert-box .alert-actions button {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: var(--font-medium);
}

.alert-box .alert-actions .btn-cancel {
  background: var(--ios-fill);
  color: var(--color-text-primary);
}

.alert-box .alert-actions .btn-confirm {
  background: var(--color-error);
  color: var(--color-text-inverse);
}

/* ---- Action Sheet ---- */
.action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fadeIn 200ms ease-out;
}

.action-sheet {
  background: var(--color-bg-surface);
  border-radius: 16px 16px 0 0;
  animation: sheetUp 400ms cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.action-sheet-handle {
  width: var(--sheet-handle-width);
  height: var(--sheet-handle-height);
  background: var(--ios-opaque-separator);
  border-radius: 3px;
  margin: 8px auto 12px;
}

.action-sheet-actions {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  margin: 0 var(--space-2) var(--space-2);
  overflow: hidden;
}

.action-sheet-btn {
  width: 100%;
  height: 56px;
  background: var(--color-bg-elevated);
  border: none;
  border-top: var(--divider-default);
  font-size: 17px;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-sheet-btn:first-child {
  border-top: none;
}

.action-sheet-btn.destructive {
  color: var(--color-error);
  font-weight: var(--font-medium);
}

.action-sheet-btn.selected {
  color: var(--color-primary-600);
  font-weight: var(--font-medium);
}

.action-sheet-btn.cancel {
  margin: 0 var(--space-2) var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--color-bg-elevated);
  font-weight: var(--font-medium);
}

/* ---- Inline Message ---- */
.inline-message {
  font-size: 13px;
  margin-top: var(--space-1);
}

.inline-message.error {
  color: var(--color-error);
}

.inline-message.warning {
  color: var(--color-warning);
}

.inline-message.success {
  color: var(--color-success);
}

/* ========================================
   19. Animations
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* iOS Push 页面进入动画（子页面共享） */
@keyframes iosPushIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.app-container.page-enter {
  transform: translateX(100%);
}

.page-enter {
  animation: iosPushIn 350ms cubic-bezier(0.32, 0.72, 0.3, 1) forwards;
}

/* ========================================
   21. External SVG Icon Images
   ========================================
   iconfont SVG 用 <img> 加载，filter 统一着色 */

.icon-img {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* 强制纯黑（作为遮罩底色） */
.icon-img {
  filter: brightness(0) saturate(100%);
}

/* 导航栏/按钮图标：secondary 透明度 */
.navbar .icon-img,
.navbar-action .icon-img,
.hero-more-btn .icon-img {
  opacity: 0.6;
}

/* 搜索框内图标：tertiary 透明度 */
.search-icon.icon-img {
  opacity: 0.3;
}

/* 展开箭头：tertiary 透明度 */
.chevron.icon-img {
  opacity: 0.3;
}

/* 空状态图标：近似 ios-fill */
.search-empty-state .icon-img {
  opacity: 0.2;
}

/* ========================================
   22. Settings List Extensions (跨页通用)
   ======================================== */

/* 设置列表行:支持左侧 icon + 文字、右侧副标题/箭头的两栏布局 */
.list-row-with-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-row-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.list-row-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* 左侧图标统一容器尺寸 */
.list-row-icon {
  width: 22px;
  height: 22px;
}

/* 列表行右侧 SVG chevron */
.list-row-chevron-img {
  width: 12px;
  height: 12px;
  opacity: 0.3;
}

/* ========================================
   23. Site Footer
   ======================================== */

.site-footer {
  width: 100%;
  max-width: var(--app-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) calc(var(--safe-bottom) + 88px);
  text-align: center;
  font-size: var(--text-footnote);
  color: var(--color-text-secondary);
  background: var(--color-bg-page);
}

.site-footer a {
  color: var(--color-text-secondary);
}
