:root {
  --bg: #0b1020;
  --bg-soft: #0f1630;
  --card: #121a39;
  --card-hover: #162048;
  --text: #e6ecff;
  --muted: #a8b2d1;
  --accent: #6aa9ff;
  --success: #7fd1b9;
  --border: #26335f;
  --shadow: rgba(0,0,0,0.25);
  --hero-gradient: radial-gradient(1200px 400px at 20% -10%, #153063 0%, #0b1636 50%, #081028 100%);
  --hero-image-gradient: linear-gradient(135deg, #0d1b3d 0%, #0a1530 50%, #081028 100%);
  --body-gradient: linear-gradient(180deg, var(--bg) 0%, #0c142c 100%);
  --button-gradient: linear-gradient(180deg, #102a63, #0d2354);
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-soft: #e8ecf1;
  --card: #ffffff;
  --card-hover: #f8f9fb;
  --text: #2c3e50;
  --muted: #5a6c7d;
  --accent: #4a90e2;
  --success: #52c41a;
  --border: #d9e1e8;
  --shadow: rgba(0,0,0,0.08);
  --hero-gradient: #e8ecf1;
  --hero-image-gradient: #e8ecf1;
  --body-gradient: linear-gradient(180deg, #f5f7fa 0%, #e8ecf1 100%);
  --button-gradient: linear-gradient(180deg, #5aa3f0, #4a90e2);
}

* { 
  box-sizing: border-box; 
}

/* iOS 安全区域适配 */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--body-gradient);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
  /* 移动端优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.site-header {
  position: relative;
  overflow: hidden;
  background: var(--hero-gradient);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease;
}

.hero-image {
  height: 40px;
  background: var(--hero-image-gradient);
  transition: background 0.3s ease;
}

[data-theme="light"] .hero-image {
  background: var(--hero-gradient);
  filter: none;
}

.header-content {
  max-width: 960px;
  padding: 12px 16px 16px;
  margin: 0 auto;
}

.title {
  margin: 4px 0 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.description {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
  font-size: 13px;
}

.container {
  max-width: 960px;
  margin: 16px auto 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 10px var(--shadow);
  /* 移动端触摸优化 */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.card:active { 
  background: var(--card-hover); 
  transform: scale(0.98);
}

.card-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
}

.card-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 12px;
}

.card button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--button-gradient);
  color: white;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  font-size: 16px;
  /* 移动端触摸优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ========== 响应式布局 ========== */

/* 平板及以上 */
@media (min-width: 600px) {
  .container {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 24px auto 64px;
  }
  
  .card-title {
    font-size: 32px;
  }
}

/* 桌面端 */
@media (min-width: 768px) {
  .title { 
    font-size: 48px;
    margin: 8px 0 16px;
  }
  
  .hero-image { 
    height: 160px; 
  }
  
  .header-content {
    padding: 20px 16px 24px;
  }
  
  .description {
    font-size: 16px;
    line-height: 1.8;
  }
  
  /* 桌面端恢复 hover 效果 */
  .card:hover { 
    background: var(--card-hover); 
    transform: translateY(-2px); 
  }
  
  .card:active {
    transform: translateY(-2px) scale(0.99);
  }
}

/* 大屏幕优化 */
@media (min-width: 1024px) {
  .container {
    gap: 20px;
  }
}

/* 设置按钮 */
.settings-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.2s ease;
  z-index: 1000;
  /* 移动端触摸优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.settings-btn:active {
  background: var(--card-hover);
  transform: scale(0.95) rotate(90deg);
}

.settings-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 设置下拉菜单 */
.settings-dropdown {
  position: fixed;
  top: 64px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 4px 20px var(--shadow);
  display: none;
  z-index: 1001;
  animation: dropdownSlideIn 0.2s ease;
}

.settings-dropdown.active {
  display: block;
}

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

.dropdown-section {
  padding: 8px 4px;
}

.dropdown-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 8px;
}

.theme-option {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  /* 移动端触摸优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.theme-option:active {
  background: var(--bg-soft);
  transform: scale(0.98);
}

.theme-option.active {
  background: var(--accent);
  color: white;
}

.theme-option svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

/* 桌面端设置按钮 hover 效果 */
@media (min-width: 768px) {
  .settings-btn {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
  
  .settings-btn:hover {
    background: var(--card-hover);
    transform: rotate(90deg);
  }
  
  .settings-btn:active {
    transform: scale(0.95) rotate(90deg);
  }
  
  .settings-btn svg {
    width: 22px;
    height: 22px;
  }
  
  .settings-dropdown {
    top: 72px;
    right: 20px;
    min-width: 200px;
  }
  
  .theme-option:hover {
    background: var(--bg-soft);
  }
  
  .theme-option:active {
    transform: scale(0.98);
  }
}
