/* ============================================================
 * 证件照助手 - 2026 Modern H5 Style System
 * Mobile-first, dark mode, glassmorphism, spring animations
 * ============================================================ */

/* ============================================================
 * 1. CSS Custom Properties (Design Tokens)
 * ============================================================ */
:root {
  /* --- Brand Colors --- */
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  --color-primary-rgb: 99, 102, 241;

  --color-accent: #f472b6;
  --color-accent-light: #f9a8d4;
  --color-accent-rgb: 244, 114, 182;

  /* --- Semantic Colors --- */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-success-dark: #059669;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-warning-dark: #d97706;
  --color-error: #f43f5e;
  --color-error-light: #ffe4e6;
  --color-error-dark: #e11d48;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;

  /* --- Surfaces --- */
  --surface-primary: #ffffff;
  --surface-secondary: #f8fafc;
  --surface-tertiary: #f1f5f9;
  --surface-elevated: #ffffff;

  /* --- Background --- */
  --bg-primary: #f0f2f5;
  --bg-secondary: #e8eaf0;
  --bg-gradient-start: #eef2ff;
  --bg-gradient-end: #fdf2f8;

  /* --- Text --- */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --text-link: #6366f1;

  /* --- Borders --- */
  --border-light: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.15);

  /* --- Shadows --- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.10), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.05);

  /* --- Border Radius --- */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* --- Spacing Scale (4px base) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* --- Typography --- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;

  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-base: 0.925rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.6rem;
  --text-3xl: 2rem;

  /* --- Layout --- */
  --tab-bar-height: 64px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --container-max: 480px;

  /* --- Glass Effect --- */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-blur: 20px;
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ============================================================
 * 2. Dark Mode
 * ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --surface-primary: #1e1e2e;
    --surface-secondary: #252536;
    --surface-tertiary: #2a2a3c;
    --surface-elevated: #303048;

    --bg-primary: #16161e;
    --bg-secondary: #1a1a28;
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #1e1e2e;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #ffffff;
    --text-link: #818cf8;

    --border-light: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.15);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.15);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);

    --glass-bg: rgba(30, 30, 46, 0.75);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    --color-success-light: rgba(16, 185, 129, 0.15);
    --color-warning-light: rgba(245, 158, 11, 0.15);
    --color-error-light: rgba(244, 63, 94, 0.15);
    --color-info-light: rgba(59, 130, 246, 0.15);
  }
}

/* ============================================================
 * 3. Reset & Base
 * ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

button {
  font-family: inherit;
}

input {
  font-family: inherit;
}

/* Selection */
::selection {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

/* ============================================================
 * 4. Glass Utility
 * ============================================================ */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass {
    background: var(--surface-primary);
    border: 1px solid var(--border-light);
  }
}

.glass-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-smooth);
}

.glass-card:active {
  transform: scale(0.985);
}

/* ============================================================
 * 5. Typography
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* ============================================================
 * 6. Buttons
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 11px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--text-inverse);
  border: none;
  box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.3);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.btn-outline:hover {
  background: rgba(var(--color-primary-rgb), 0.06);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 16px;
}

.btn-ghost:hover {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 15px 28px;
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* ============================================================
 * 7. Option Buttons (Pill Style)
 * ============================================================ */
.btn-option {
  background: var(--surface-tertiary);
  color: var(--text-secondary);
  border: 2px solid transparent;
  flex: 1;
  padding: 11px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-spring);
}

.btn-option.active {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
  border-color: var(--color-primary-light);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.12);
  transform: scale(1.02);
}

/* ============================================================
 * 8. Form Elements
 * ============================================================ */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

.form-input,
.form-group input[type="tel"],
.form-group input[type="text"] {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-smooth);
  outline: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-group input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus,
.form-group input:focus {
  border-color: var(--color-primary-light);
  background: var(--surface-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.08);
}

.form-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

/* Floating Label */
.floating-label {
  position: relative;
}

.floating-label input {
  padding-top: 20px;
  padding-bottom: 10px;
}

.floating-label .label-text {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  font-size: var(--text-base);
  color: var(--text-tertiary);
  pointer-events: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.floating-label input:focus ~ .label-text,
.floating-label input:not(:placeholder-shown) ~ .label-text {
  top: 10px;
  transform: translateY(0);
  font-size: var(--text-xs);
  color: var(--color-primary);
}

/* ============================================================
 * 9. Login Page
 * ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, #667eea 0%, #764ba2 40%, #f472b6 100%);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  position: relative;
  overflow: hidden;
}

/* Animated background blobs */
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}

.login-page::before {
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.25);
  top: -80px;
  right: -60px;
  animation: floatBlob 8s ease-in-out infinite;
}

.login-page::after {
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.2);
  bottom: -60px;
  left: -50px;
  animation: floatBlob 10s ease-in-out infinite reverse;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

.login-container {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.7s var(--ease-out-expo);
}

/* Logo Section */
.login-logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: softPulse 2.5s var(--ease-in-out) infinite;
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.2); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(255,255,255,0); }
}

.login-logo h1 {
  font-size: var(--text-2xl);
  color: #fff;
  margin-bottom: var(--space-1);
  letter-spacing: -0.02em;
}

.login-logo p {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-sm);
}

/* Login Form Card */
.login-form {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
}

.login-form .form-group {
  margin-bottom: var(--space-6);
}

.login-form .form-group label {
  color: var(--text-primary);
  font-weight: 600;
}

.login-form input[type="tel"] {
  background: var(--surface-primary);
  border-color: var(--border-medium);
  text-align: center;
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: 0.15em;
  padding: 14px 16px;
}

.login-form .btn-primary {
  padding: 14px;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(var(--color-primary-rgb), 0.4);
}

/* Feature List */
.login-tips {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
}

.login-tips p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 2.2;
  opacity: 0;
  animation: fadeInUp 0.5s var(--ease-out-expo) forwards;
}

.login-tips p:nth-child(1) { animation-delay: 0.3s; }
.login-tips p:nth-child(2) { animation-delay: 0.4s; }
.login-tips p:nth-child(3) { animation-delay: 0.5s; }
.login-tips p:nth-child(4) { animation-delay: 0.6s; }

.login-tips p::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  margin-right: var(--space-2);
  vertical-align: middle;
}

/* Login Footer */
.login-footer {
  text-align: center;
  margin-top: var(--space-6);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-xs);
}

/* ============================================================
 * 10. App Shell
 * ============================================================ */
.app-page {
  background: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-bar-height) + var(--safe-area-bottom) + var(--space-4));
}

.app-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-4);
}

/* Page Header */
.page-header {
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
}

.page-header h2 {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.user-info {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.user-info span {
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
 * 11. Step Progress Indicator
 * ============================================================ */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: var(--space-4) var(--space-2);
  margin-bottom: var(--space-3);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--surface-tertiary);
  color: var(--text-tertiary);
  transition: all var(--duration-normal) var(--ease-spring);
  position: relative;
}

.step-dot.completed {
  background: var(--color-success);
  color: #fff;
}

.step-dot.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(var(--color-primary-rgb), 0.15);
  animation: softPulse 2s var(--ease-in-out) infinite;
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border-medium);
  margin: 0 var(--space-1);
  transition: background var(--duration-slow) var(--ease-smooth);
}

.step-line.completed {
  background: var(--color-success);
}

.step-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
  margin-top: var(--space-1);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-smooth);
}

.step-label.active {
  color: var(--color-primary);
  font-weight: 600;
}

.step-label.completed {
  color: var(--color-success);
}

/* ============================================================
 * 12. Cards
 * ============================================================ */
.card {
  background: var(--surface-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration-normal) var(--ease-smooth);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-title .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
 * 13. Upload Area
 * ============================================================ */
.upload-area {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  background: var(--surface-secondary);
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--color-primary-light);
  background: rgba(var(--color-primary-rgb), 0.03);
}

.upload-area.has-file {
  border-style: solid;
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.upload-placeholder {
  pointer-events: none;
}

.upload-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-3);
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.upload-area:hover .upload-icon {
  transform: translateY(-3px) scale(1.05);
}

.upload-placeholder p {
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
}

.upload-hint {
  font-size: var(--text-xs) !important;
  color: var(--text-tertiary) !important;
  font-weight: 400 !important;
  margin-top: var(--space-1);
}

/* Upload Preview */
.upload-preview {
  text-align: center;
}

.upload-preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  margin: 0 auto var(--space-3);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* Upload Status */
.upload-status {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.upload-status.success {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.upload-status.error {
  background: var(--color-error-light);
  color: var(--color-error-dark);
}

/* ============================================================
 * 14. Option Selectors
 * ============================================================ */
.option-group {
  margin-bottom: var(--space-4);
}

.option-group:last-child {
  margin-bottom: 0;
}

.option-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

.option-buttons {
  display: flex;
  gap: var(--space-2);
}

/* Color Dot */
.color-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  vertical-align: middle;
  margin-right: var(--space-1);
  flex-shrink: 0;
  transition: border-color var(--duration-fast) var(--ease-smooth);
}

.color-white {
  background: #FFFFFF;
  border-color: #d4d4d8;
}

.color-blue {
  background: #3b82f6;
  border-color: #2563eb;
}

.btn-option.active .color-dot {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

/* ============================================================
 * 15. Price Display
 * ============================================================ */
.price-info {
  text-align: center;
  padding: var(--space-3) 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-1);
}

.price-label {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.price-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-error), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.price-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ============================================================
 * 16. Order Cards
 * ============================================================ */
.order-list {
  min-height: 120px;
}

.order-card {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-2);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

.order-card:active {
  transform: scale(0.98);
  background: var(--surface-secondary);
}

.order-card:last-child {
  margin-bottom: 0;
}

/* Status left-border accent */
.order-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--border-medium);
  transition: background var(--duration-fast) var(--ease-smooth);
}

.order-card:hover::before {
  background: var(--color-primary-light);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.order-no {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Status Badges */
.order-status {
  font-size: var(--text-xs);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-unpaid {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.status-paid {
  background: var(--color-info-light);
  color: var(--color-info);
}

.status-notfound {
  background: var(--color-error-light);
  color: var(--color-error-dark);
}

.status-waiting {
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
}

.status-generated {
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.status-failed {
  background: var(--color-error-light);
  color: var(--color-error-dark);
}

.status-expired {
  background: var(--surface-tertiary);
  color: var(--text-tertiary);
}

/* Order card tags */
.order-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.order-card-body span {
  background: var(--surface-secondary);
  color: var(--text-secondary);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Expired badge */
.expired-badge {
  display: inline-block;
  background: var(--color-warning);
  color: #fff;
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-left: var(--space-1);
  font-weight: 600;
}

/* ============================================================
 * 17. Skeleton Loading
 * ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-tertiary) 25%,
    var(--surface-secondary) 50%,
    var(--surface-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-2);
  border: 1px solid var(--border-light);
}

.skeleton-line {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-30 { width: 30%; }

.skeleton-badge {
  height: 22px;
  width: 60px;
  display: inline-block;
}

/* ============================================================
 * 18. Pagination
 * ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) 0;
}

.pagination button {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.04);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-info {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============================================================
 * 19. Bottom Sheet Modal
 * ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s var(--ease-smooth);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: var(--container-max);
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--surface-primary);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  overflow-y: auto;
  animation: slideUpSpring 0.45s var(--ease-spring);
  box-shadow: var(--shadow-xl);
}

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

/* Drag Handle */
.sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-1);
  opacity: 0.5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--surface-primary);
  z-index: 2;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-secondary);
  border: none;
  font-size: 1.1rem;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.modal-close:hover {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
}

/* ============================================================
 * 20. Order Detail
 * ============================================================ */
.detail-section {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.detail-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-section h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.detail-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: var(--text-base);
}

.detail-info-label {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.detail-info-row span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-photo {
  text-align: center;
  margin: var(--space-3) 0;
}

.detail-photo img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin: 0 auto;
}

.detail-photo .photo-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

/* ============================================================
 * 21. Payment Modal
 * ============================================================ */
.qrcode-img {
  display: block;
  max-width: 180px;
  margin: var(--space-4) auto;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  background: #fff;
  padding: var(--space-2);
}

/* ============================================================
 * 22. Tab Bar (Floating Pill)
 * ============================================================ */
.tab-bar {
  position: fixed;
  bottom: calc(var(--safe-area-bottom) + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-8));
  max-width: calc(var(--container-max) - var(--space-8));
  height: var(--tab-bar-height);
  display: flex;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  z-index: 100;
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
}

/* Floating indicator pill */
.tab-bar::before {
  content: '';
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  width: calc((100% - var(--space-2)) / 3);
  height: calc(100% - var(--space-2));
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  z-index: 0;
  transition: transform var(--duration-slow) var(--ease-spring);
}

.tab-bar[data-active="home"]::before  { transform: translateX(0); }
.tab-bar[data-active="apps"]::before  { transform: translateX(100%); }
.tab-bar[data-active="mine"]::before  { transform: translateX(200%); }

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all var(--duration-normal) var(--ease-smooth);
  -webkit-tap-highlight-color: transparent;
  gap: 2px;
}

.tab-icon {
  font-size: 1.25rem;
  transition: transform var(--duration-normal) var(--ease-spring);
  line-height: 1;
}

.tab-label {
  font-size: 0.65rem;
  font-weight: 600;
  transition: all var(--duration-normal) var(--ease-smooth);
  letter-spacing: 0.02em;
}

/* Inactive tab */
.tab-item {
  color: var(--text-tertiary);
}

/* Active tab */
.tab-item.active {
  color: #fff;
}

.tab-item.active .tab-icon {
  transform: scale(1.1);
}

/* ============================================================
 * 23. Toast Notifications
 * ============================================================ */
.toast {
  position: fixed;
  top: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 90vw;
  animation: toastIn 0.4s var(--ease-spring);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.toast {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.toast.success {
  background: var(--color-success);
  color: #fff;
  border: none;
}

.toast.error {
  background: var(--color-error);
  color: #fff;
  border: none;
}

.toast.warning {
  background: var(--color-warning);
  color: #fff;
  border: none;
}

.toast .toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Toast progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
  animation: toastProgress 2.5s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ============================================================
 * 24. Loading Overlay
 * ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-medium);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

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

.loading {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ============================================================
 * 25. Empty States
 * ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-5);
  color: var(--text-tertiary);
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
  background: var(--surface-secondary);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.empty-state p {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}

.empty-state p:last-child {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ============================================================
 * 26. Pull to Refresh
 * ============================================================ */
.ptr-container {
  position: relative;
}

.ptr-indicator {
  text-align: center;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-fast) var(--ease-smooth),
              padding var(--duration-fast) var(--ease-smooth);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.ptr-indicator.active {
  max-height: 48px;
  padding: var(--space-3);
}

.ptr-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  margin-right: var(--space-2);
  vertical-align: middle;
}

/* ============================================================
 * 27. Tab Content
 * ============================================================ */
.tab-content {
  display: none;
  animation: fadeSlideIn 0.35s var(--ease-out-expo);
}

.tab-content.active {
  display: block;
}

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

/* ============================================================
 * 28. Utilities
 * ============================================================ */
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-tertiary); }
.text-danger  { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }
.fw-500       { font-weight: 500; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }

.mt-4  { margin-top: var(--space-1); }
.mt-8  { margin-top: var(--space-2); }
.mt-12 { margin-top: var(--space-3); }
.mt-16 { margin-top: var(--space-4); }
.mt-20 { margin-top: var(--space-5); }
.mt-24 { margin-top: var(--space-6); }

.mb-4  { margin-bottom: var(--space-1); }
.mb-8  { margin-bottom: var(--space-2); }
.mb-12 { margin-bottom: var(--space-3); }
.mb-16 { margin-bottom: var(--space-4); }
.mb-20 { margin-bottom: var(--space-5); }
.mb-24 { margin-bottom: var(--space-6); }

.p-0  { padding: 0; }
.p-4  { padding: var(--space-1); }
.p-8  { padding: var(--space-2); }
.p-12 { padding: var(--space-3); }
.p-16 { padding: var(--space-4); }
.p-20 { padding: var(--space-5); }

.gap-4  { gap: var(--space-1); }
.gap-8  { gap: var(--space-2); }
.gap-12 { gap: var(--space-3); }
.gap-16 { gap: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.w-full { width: 100%; }
.rounded-full { border-radius: var(--radius-full); }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================
 * 29. Keyframe Animations
 * ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* ============================================================
 * 30. Responsive Adjustments
 * ============================================================ */
@media (min-width: 481px) {
  .app-container {
    padding: var(--space-6);
  }

  .tab-bar {
    width: 440px;
  }

  .login-form {
    padding: var(--space-10) var(--space-8);
  }
}

@media (min-width: 769px) {
  body {
    display: flex;
    justify-content: center;
  }

  .app-page {
    width: 100%;
    max-width: var(--container-max);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
  }

  .modal-content {
    border-radius: var(--radius-2xl);
    bottom: auto;
    margin: auto;
    max-width: 440px;
    max-height: 80vh;
    animation: scaleIn 0.3s var(--ease-spring);
  }

  .modal {
    align-items: center;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
