/* ============================================
   梦幻实验室 · 治愈系科学 — 全局样式 (V2)
   配色: 薄荷水晶 #7FE0D6 / 实验橙 #FF8C42 / 元素紫 #9B72CF / 纯净白 #F8F9FA
   ============================================ */

:root {
  --color-primary: #7FE0D6;
  --color-accent: #FF8C42;
  --color-purple: #9B72CF;
  --color-white: #F8F9FA;
  --color-bg-start: #d4f0f0;
  --color-bg-end: #e8dff5;
  --color-card-bg: rgba(248, 249, 250, 0.75);
  --color-text: #2d3748;
  --color-text-light: #718096;
  --color-danger: #ef4444;
  --color-success: #22c55e;
  --color-gold: #fbbf24;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-soft: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-glass: 0 8px 32px rgba(155,114,207,0.12);
  --shadow-elevated: 0 12px 48px rgba(155,114,207,0.18);
  --font-stack: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-size-base: 14px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 17px;
  --font-size-xl: 22px;
  --topbar-bg: rgba(255,255,255,0.7);
  --topbar-border: rgba(255,255,255,0.5);
  --card-border: rgba(255,255,255,0.6);
  --input-bg: rgba(255,255,255,0.6);
  --nav-bg: rgba(255,255,255,0.85);
}

/* ===== 护眼浅色模式（默认） ===== */
.theme-light {
  --color-bg-start: #d4f0f0;
  --color-bg-end: #e8dff5;
  --color-card-bg: rgba(248, 249, 250, 0.75);
  --color-text: #2d3748;
  --color-text-light: #718096;
  --topbar-bg: rgba(255,255,255,0.7);
  --topbar-border: rgba(255,255,255,0.5);
  --card-border: rgba(255,255,255,0.6);
  --input-bg: rgba(255,255,255,0.6);
  --nav-bg: rgba(255,255,255,0.85);
}

/* ===== 夜间深色模式 ===== */
.theme-dark {
  --color-bg-start: #1a1a2e;
  --color-bg-end: #16213e;
  --color-card-bg: rgba(30, 30, 60, 0.8);
  --color-text: #e2e8f0;
  --color-text-light: #a0aec0;
  --topbar-bg: rgba(20, 20, 40, 0.85);
  --topbar-border: rgba(255,255,255,0.08);
  --card-border: rgba(255,255,255,0.08);
  --input-bg: rgba(40, 40, 70, 0.6);
  --nav-bg: rgba(20, 20, 40, 0.9);
}

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

body {
  font-family: var(--font-stack);
  background: linear-gradient(160deg, var(--color-bg-start) 0%, var(--color-bg-start) 30%, var(--color-bg-end) 70%, var(--color-bg-end) 100%);
  min-height: 100vh;
  color: var(--color-text);
  overflow-x: hidden;
  padding-bottom: 80px;
  font-size: var(--font-size-base);
  transition: background 0.4s, color 0.3s;
}

/* 顶部导航条 — 更通透 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(155,114,207,0.06);
  transition: background 0.4s, border-color 0.3s;
}

/* ===== 信息卡片 ===== */
.info-card {
  background: linear-gradient(135deg, rgba(155,114,207,0.12), rgba(127,224,214,0.12));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-glass);
  padding: 18px;
  margin: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.4s, border-color 0.3s;
}
.info-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-purple);
}
.info-card-text {
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.5;
}
.info-card-btn {
  align-self: flex-start;
  padding: 8px 20px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.info-card-btn:active {
  transform: scale(0.96);
}

.top-bar h1 {
  font-size: 19px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.top-bar .back-link {
  font-size: 14px;
  color: var(--color-purple);
  text-decoration: none;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 50px;
  background: rgba(155,114,207,0.1);
  transition: all 0.2s;
}

.top-bar .back-link:hover {
  background: rgba(155,114,207,0.2);
  transform: translateX(-2px);
}

/* 磨砂玻璃卡片 — 更通透更有层次 */
.glass-card {
  background: var(--color-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: var(--shadow-glass);
  padding: 16px;
  transition: transform 0.25s, box-shadow 0.25s;
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elevated);
}

/* 主按钮 — 药丸形 + 实验橙 + Q弹反馈 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 30px;
  background: linear-gradient(135deg, var(--color-accent), #ff6b35);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-stack);
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12), 0 6px 20px rgba(255,140,66,0.35);
  transition: all 0.18s;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: 0.3px;
}

.btn-primary:active {
  transform: scale(0.94);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1), 0 2px 8px rgba(255,140,66,0.25);
}

.btn-primary:hover {
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12), 0 8px 28px rgba(255,140,66,0.45);
  transform: translateY(-2px);
}

/* 小药丸按钮 */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  border-radius: 50px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pill:active {
  transform: scale(0.92);
}

.btn-pill.primary {
  background: var(--color-primary);
  color: #1a5c55;
}

.btn-pill.purple {
  background: var(--color-purple);
  color: #fff;
}

.btn-pill.outline {
  background: transparent;
  border: 1.5px solid var(--color-purple);
  color: var(--color-purple);
}

/* 入口卡片网格 — 首页入口 */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  padding: 16px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 14px;
  background: var(--color-card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.5);
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  transition: all 0.25s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(127,224,214,0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}

.entry-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-elevated);
}

.entry-card:hover::before {
  opacity: 1;
}

.entry-card .icon {
  font-size: 40px;
  line-height: 1;
}

.entry-card .label {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* 页面标题区 */
.page-header {
  padding: 20px 16px 8px;
  text-align: center;
}

.page-header h2 {
  font-size: 22px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--color-text-light);
}

/* 底部导航 — 更大更舒适 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.6);
  z-index: 200;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--color-text-light);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  position: relative;
}

.nav-item .nav-icon {
  font-size: 26px;
  line-height: 1;
  transition: transform 0.2s;
}

.nav-item:hover .nav-icon {
  transform: scale(1.15);
}

.nav-item.active {
  color: var(--color-purple);
  font-weight: 700;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--color-purple);
  border-radius: 2px;
}

/* 通用动画 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(155,114,207,0.3); }
  50% { box-shadow: 0 0 20px rgba(155,114,207,0.6); }
}

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

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

.anim-fade-in {
  animation: fadeInUp 0.4s ease-out both;
}

.anim-pop {
  animation: popIn 0.35s ease-out both;
}

.anim-float {
  animation: float 3s ease-in-out infinite;
}

.anim-slide-in {
  animation: slideInLeft 0.3s ease-out both;
}

/* 响应式 */
@media (max-width: 480px) {
  .entry-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
  }
  .top-bar h1 {
    font-size: 16px;
  }
  .nav-item {
    padding: 4px 10px;
  }
  .nav-item .nav-icon {
    font-size: 22px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

/* Toast 消息 */
.toast-msg {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 50px;
  z-index: 9999;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: fadeInUp 0.3s ease-out;
  max-width: 80%;
  text-align: center;
}

/* 弹窗覆盖层 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  max-width: 320px;
  width: 85%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: popIn 0.3s ease-out;
}

/* ===== 主题 & 字体控制按钮 ===== */
.theme-toggle-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}
.theme-toggle-btn:active {
  background: rgba(155,114,207,0.12);
}

.font-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}
.font-controls button {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-text);
  transition: background 0.2s;
  line-height: 1;
}
.font-controls button:active {
  background: rgba(155,114,207,0.12);
}
.font-controls .font-size-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-light);
  min-width: 28px;
  text-align: center;
}
