/**
 * 加拿大28开奖网 - 全新现代化样式
 * 设计风格: 渐变、毛玻璃效果、流畅动画
 * 版本: 2.0
 */

/* ============================================
   1. CSS 变量定义 (全新配色方案)
   ============================================ */
:root {
  /* 主题色 - 现代紫蓝渐变 */
  --primary-start: #6366f1;
  --primary-end: #8b5cf6;
  --secondary-start: #ec4899;
  --secondary-end: #f43f5e;
  
  /* 品牌渐变 */
  --brand-gradient: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
  --brand-gradient-vibrant: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --brand-gradient-warm: linear-gradient(135deg, var(--secondary-start) 0%, var(--secondary-end) 100%);
  
  /* 语义色 - 更柔和的配色 */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* 中性色系 - 更现代的灰度 */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* 文本色 */
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --text-white: #ffffff;
  
  /* 背景色 */
  --page-bg: #f8fafc;
  --page-bg-gradient: linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-bg-glass: rgba(255, 255, 255, 0.8);
  
  /* 边框色 */
  --border-color: var(--gray-200);
  --border-color-light: rgba(255, 255, 255, 0.18);
  
  /* 间距系统 */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* 圆角系统 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* 阴影系统 - 更柔和的阴影 */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
  
  /* 过渡动画 */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* 层级 */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   2. 全局重置和基础样式
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
               'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--page-bg-gradient);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all var(--transition-fast);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  outline: 0;
  background: none;
  transition: all var(--transition-fast);
  user-select: none;
}

input,
textarea,
select {
  font-family: inherit;
  outline: 0;
  border: 0;
}

/* ============================================
   3. 布局系统
   ============================================ */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

/* ============================================
   4. 顶部导航 (全新设计)
   ============================================ */
.site-header {
  background: var(--card-bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  border-bottom: 1px solid var(--border-color-light);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 70px;
  gap: var(--spacing-lg);
}

.brand {
  font-size: 24px;
  font-weight: 800;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand:before {
  content: '🎲';
  font-size: 28px;
}

.top-tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-left: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px;
}

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

.tab {
  height: 42px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.tab:before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}

.tab:hover {
  color: var(--primary-start);
  transform: translateY(-1px);
}

.tab:hover:before {
  opacity: 0.1;
}

.tab.active {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* ============================================
   5. Hero 卡片区 (毛玻璃效果)
   ============================================ */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-md);
  margin: var(--spacing-lg) 0;
}

.card {
  background: var(--card-bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.3);
}

.card:hover:before {
  opacity: 0.05;
}

.card-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
}

/* CTA 按钮 */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.cta:before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.2) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.cta:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl), 0 0 40px rgba(99, 102, 241, 0.5);
}

.cta:hover:before {
  opacity: 1;
}

/* ============================================
   6. 子导航
   ============================================ */
.sub-tabs {
  display: flex;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border-color);
}

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

.sub-tab {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
}

.sub-tab:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.sub-tab.active {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ============================================
   7. 表格容器
   ============================================ */
.table-wrap {
  background: var(--card-bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.table-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.table-actions {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
}

#tableContainer {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 14px;
  table-layout: fixed;
}

.table thead {
  background: linear-gradient(to bottom, var(--gray-50), var(--gray-100));
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
  vertical-align: middle;
}

/* 主页表格列宽优化 */
#resultTable th:nth-child(1),
#resultTable td:nth-child(1) {
  width: 25%;
}

#resultTable th:nth-child(2),
#resultTable td:nth-child(2) {
  width: 45%;
}

#resultTable th:nth-child(3),
#resultTable td:nth-child(3) {
  width: 30%;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.k-right {
  text-align: right !important;
}

.table td.digit {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ============================================
   8. 徽章组件 (全新设计)
   ============================================ */
.badge,
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: var(--shadow-xs);
}

.badge.success,
.chip.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.badge.warning,
.chip.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.badge.danger,
.chip.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.badge.info,
.chip.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.badge.special,
.chip.special {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.badge.extreme,
.chip.extreme {
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: white;
}

.chips {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================
   9. 按钮组件
   ============================================ */
.btn-primary {
  background: var(--brand-gradient);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  border: 0;
  cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-base);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

.btn-secondary.active {
  background: var(--brand-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.button-group {
  display: inline-flex;
  gap: var(--spacing-xs);
}

/* ============================================
   10. 表单组件
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
input[type="date"],
input[type="search"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: white;
  transition: all var(--transition-base);
}

.form-input:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-start);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* 工具栏 */
.toolbar {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.toolbar input,
.toolbar select {
  flex: 0 1 auto;
  min-width: 140px;
}

.toolbar .info {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: auto;
  font-weight: 500;
}

/* ============================================
   11. 模态框 (全新动画)
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

.modal.show {
  display: flex;
  animation: fadeIn 300ms ease;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 300ms ease;
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-color-light);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--gray-100);
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

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

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-body h3 {
  font-size: 16px;
  font-weight: 700;
  margin: var(--spacing-lg) 0 var(--spacing-sm);
  color: var(--text-primary);
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  margin: var(--spacing-xs) 0;
  line-height: 1.7;
  color: var(--text-secondary);
}

.modal-body ul {
  margin: var(--spacing-xs) 0;
  padding-left: var(--spacing-lg);
}

.modal-body li {
  margin: 6px 0;
  line-height: 1.7;
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

/* ============================================
   12. Toast 通知
   ============================================ */
.toast {
  position: fixed;
  top: 80px;
  right: var(--spacing-lg);
  z-index: var(--z-tooltip);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 300ms ease, fadeOut 300ms ease 2700ms;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
}

.toast.error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
}

.toast.info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
}

/* ============================================
   13. 分页器
   ============================================ */
#pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#pager button {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-base);
}

#pager button:not(:disabled):hover {
  background: var(--brand-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

#pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#pageInfo {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   14. 页脚
   ============================================ */
.site-footer {
  background: var(--gray-900);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--spacing-2xl) 0;
  margin-top: var(--spacing-2xl);
  text-align: center;
  font-size: 13px;
}

.site-footer p {
  margin: var(--spacing-xs) 0;
  line-height: 1.8;
}

.site-footer a {
  color: var(--primary-start);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.site-footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.credits {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

/* ============================================
   15. 工具类
   ============================================ */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

.ghost {
  opacity: 0.3;
}

.gtext {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ============================================
   16. 动画
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================
   17. 响应式设计
   ============================================ */

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
  .hero-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
  }
  
  /* CTA按钮占满一行 */
  .hero-cards > .cta {
    grid-column: 1 / -1;
  }
}

/* 手机横屏 (481px - 768px) */
@media (max-width: 768px) {
  html {
    font-size: 13px;
  }
  
  /* 安全区域适配 */
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .container {
    padding-left: max(var(--spacing-sm), env(safe-area-inset-left));
    padding-right: max(var(--spacing-sm), env(safe-area-inset-right));
  }
  
  .site-header {
    height: auto;
    padding-top: env(safe-area-inset-top);
  }
  
  .header-inner {
    height: 60px;
    gap: var(--spacing-sm);
  }
  
  .brand {
    font-size: 18px;
    flex-shrink: 0;
  }
  
  .brand:before {
    font-size: 20px;
  }
  
  .top-tabs {
    flex: 1;
    justify-content: flex-end;
  }
  
  .tab {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    min-width: 64px;
  }
  
  /* Hero Cards 移动端优化 */
  .hero-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: var(--spacing-md) 0;
  }
  
  /* CTA按钮占满整行 */
  .cta {
    grid-column: 1 / -1;
    padding: 14px var(--spacing-md);
    font-size: 14px;
  }
  
  .card {
    padding: 14px 12px;
  }
  
  .card-title {
    font-size: 11px;
    margin-bottom: 6px;
  }
  
  .card-value {
    font-size: 18px;
    word-break: break-all;
  }
  
  /* 形态徽章缩小 */
  .chips {
    gap: 4px;
  }
  
  .chip {
    padding: 2px 8px;
    font-size: 11px;
  }
  
  /* 子导航优化 */
  .sub-tabs {
    gap: 6px;
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-md);
    position: relative;
  }
  
  /* 添加滚动渐变提示 */
  .sub-tabs::before {
    content: '';
    position: sticky;
    left: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to right, var(--page-bg), transparent);
    pointer-events: none;
    z-index: 1;
  }
  
  .sub-tabs::after {
    content: '';
    position: sticky;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, var(--page-bg), transparent);
    pointer-events: none;
    z-index: 1;
  }
  
  .sub-tab {
    padding: 8px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }
  
  /* 表格容器优化 */
  .table-wrap {
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
  }
  
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
  }
  
  .table-title {
    font-size: 16px;
  }
  
  .table-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .button-group {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .button-group .btn-secondary {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  /* 表格优化 - 添加横向滚动 */
  #tableContainer {
    margin: 0 -12px;
    padding: 0 12px;
  }
  
  .table {
    font-size: 12px;
    min-width: 600px;
    table-layout: auto;
  }
  
  .table th,
  .table td {
    padding: 12px 8px;
    font-size: 12px;
  }
  
  .table th {
    font-size: 11px;
    background: var(--gray-100);
  }
  
  /* 移动端期号列固定宽度 */
  #resultTable th:nth-child(1),
  #resultTable td:nth-child(1) {
    width: 100px;
    min-width: 100px;
  }
  
  /* 时间列固定宽度 */
  #resultTable th:nth-child(3),
  #resultTable td:nth-child(3) {
    width: 140px;
    min-width: 140px;
  }
  
  /* 优化表格数字显示 */
  .table .digit {
    font-size: 13px;
  }
  
  .badge {
    padding: 2px 6px;
    font-size: 10px;
  }
  
  /* 工具栏优化 */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
  }
  
  .toolbar label {
    width: 100%;
  }
  
  .toolbar label select {
    flex: 1;
  }
  
  .toolbar input,
  .toolbar select {
    width: 100%;
    min-width: auto;
    font-size: 16px; /* 防止iOS自动缩放 */
  }
  
  .toolbar button {
    width: 100%;
    padding: 10px 16px;
  }
  
  .toolbar .info {
    margin-left: 0;
    text-align: center;
    order: -1; /* 移到最上方 */
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
  }
  
  /* 分页器优化 */
  #pager {
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
  }
  
  #pager button {
    width: 100%;
    padding: 10px 16px;
  }
  
  #pageInfo {
    order: -1;
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
  }
  
  /* 模态框移动端优化 */
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .modal-content {
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  
  .modal-header {
    padding: var(--spacing-md);
  }
  
  .modal-title {
    font-size: 18px;
  }
  
  .modal-body {
    padding: var(--spacing-md);
  }
  
  .modal-footer {
    flex-direction: column-reverse;
    padding: var(--spacing-md);
  }
  
  .modal-footer button {
    width: 100%;
  }
  
  /* Toast通知优化 */
  .toast {
    left: var(--spacing-sm);
    right: var(--spacing-sm);
    width: auto;
    top: calc(60px + env(safe-area-inset-top) + 12px);
    font-size: 13px;
    padding: 12px 16px;
  }
  
  /* 表单优化 */
  .form-input,
  input[type="date"],
  input[type="search"],
  input[type="text"],
  select {
    font-size: 16px; /* 防止iOS自动缩放 */
    padding: 12px 14px;
  }
}

/* 手机竖屏 (< 480px) */
@media (max-width: 480px) {
  /* 单列布局 */
  .hero-cards {
    grid-template-columns: 1fr;
    gap: var(--spacing-xs);
  }
  
  .card {
    padding: 16px 14px;
  }
  
  .card-value {
    font-size: 22px;
  }
  
  /* 表格进一步优化 */
  .table {
    font-size: 11px;
  }
  
  .table th,
  .table td {
    padding: 8px 4px;
    font-size: 11px;
  }
  
  .table .digit {
    font-size: 12px;
  }
  
  .badge,
  .chip {
    padding: 1px 5px;
    font-size: 9px;
  }
  
  /* 按钮组优化 */
  .button-group {
    width: 100%;
  }
  
  .button-group .btn-secondary {
    flex: 1;
    min-width: 0;
    padding: 8px 8px;
    font-size: 11px;
  }
  
  /* 品牌Logo缩小 */
  .brand {
    font-size: 16px;
  }
  
  .brand:before {
    font-size: 18px;
  }
  
  .tab {
    padding: 0 12px;
    font-size: 12px;
    min-width: 56px;
  }
}

/* 极小屏幕 (< 360px) */
@media (max-width: 360px) {
  .container {
    padding-left: var(--spacing-xs);
    padding-right: var(--spacing-xs);
  }
  
  .hero-cards {
    gap: 8px;
  }
  
  .card {
    padding: 12px 10px;
  }
  
  .card-title {
    font-size: 10px;
  }
  
  .card-value {
    font-size: 18px;
  }
  
  .table {
    font-size: 10px;
  }
  
  .table th,
  .table td {
    padding: 6px 3px;
  }
  
  .brand:before {
    display: none; /* 隐藏emoji节省空间 */
  }
  
  .button-group .btn-secondary {
    font-size: 10px;
    padding: 6px 6px;
  }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-cards {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  
  .cta {
    grid-column: auto;
    grid-row: 2;
  }
  
  .card {
    padding: 10px;
  }
  
  .card-title {
    font-size: 10px;
  }
  
  .card-value {
    font-size: 16px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 增大可点击区域 */
  .btn-primary,
  .btn-secondary,
  .tab,
  .sub-tab,
  .mode-tab {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 优化触摸反馈 */
  .btn-primary:active,
  .btn-secondary:active,
  .tab:active,
  .sub-tab:active {
    transform: scale(0.96);
    opacity: 0.8;
  }
  
  /* 移除hover效果 */
  .card:hover,
  .tab:hover,
  .sub-tab:hover {
    transform: none;
  }
  
  /* 增强点击反馈 */
  .card:active,
  .sum-card:active,
  .flip-card:active {
    transform: scale(0.98);
  }
}

