/* ============================================
   电梯安心锦囊 — 共享样式表
   主题：治愈系柔软卡通 + 安全警示感
   配色：安心蓝 #4A90D9 / 希望橙 #FF8C42
         呼吸白 #FFF8F0
   ============================================ */

/* --- CSS 自定义属性（主题色） --- */
:root {
  --color-bg: #FFF8F0;
  --color-primary: #4A90D9;
  --color-primary-hover: #5FA0E6;
  --color-accent: #FF8C42;
  --color-accent-hover: #FFA05E;
  --color-success: #2DD4A0;
  --color-success-dim: rgba(45, 212, 160, 0.18);
  --color-text: #2D2D3A;
  --color-text-muted: #8A8A9E;
  --color-card-bg: #FFFFFF;
  --color-card-border: rgba(74, 144, 217, 0.12);
  --color-danger: #FF6B6B;
  --radius: 28px;
  --radius-sm: 18px;
  --shadow: 0 6px 24px rgba(74, 144, 217, 0.10);
  --shadow-lg: 0 12px 40px rgba(74, 144, 217, 0.16);
  --transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- 全局重置 --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  padding: 16px;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(74, 144, 217, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 140, 66, 0.05) 0%, transparent 60%);
}

/* --- 标题 --- */
.app-title {
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 6px;
  letter-spacing: 2px;
  text-shadow: none;
}

.app-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
  letter-spacing: 1px;
}

/* --- 卡片（通用） — 小枕头风格 --- */
.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  margin-bottom: 14px;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(74, 144, 217, 0.2);
}

/* --- 三步自救卡片 — 小枕头 --- */
.step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  position: relative;
  border-radius: 28px;
  padding: 20px 22px;
  border: 2px solid transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease,
              background 0.3s ease;
}

.step-card:active {
  transform: scale(0.97);
}

.step-card .step-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.step-card .step-text {
  flex: 1;
}

.step-card .step-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--color-text);
}

.step-card .step-text p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* 毛绒质感大数字 */
.step-card .step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #6DB3F2);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(74, 144, 217, 0.3);
  font-family: "Arial Rounded MT Bold", "PingFang SC", sans-serif;
}

.step-card.done .step-number {
  background: linear-gradient(135deg, var(--color-success), #5EE0B8);
  box-shadow: 0 3px 10px rgba(45, 212, 160, 0.3);
}

.step-card .step-check {
  display: none;
  color: var(--color-success);
  font-size: 1.3rem;
  flex-shrink: 0;
}

.step-card.done .step-check {
  display: block;
}

.step-card.done .step-number {
  display: none;
}

/* 当前步骤 — 呼吸灯边框动画 */
.step-card.active {
  border-color: var(--color-primary);
  background: rgba(74, 144, 217, 0.04);
  transform: translateY(-2px);
  animation: breathe-border 2s ease-in-out infinite;
}

@keyframes breathe-border {
  0%, 100% { box-shadow: 0 0 8px rgba(74, 144, 217, 0.15), 0 6px 24px rgba(74, 144, 217, 0.10); }
  50% { box-shadow: 0 0 24px rgba(74, 144, 217, 0.25), 0 6px 24px rgba(74, 144, 217, 0.10); }
}

/* 已完成步骤 */
.step-card.done {
  opacity: 0.7;
}

/* --- 提示气泡 --- */
.tip-bubble {
  display: none;
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(74, 144, 217, 0.06);
  border-left: 3px solid var(--color-primary);
  border-radius: 16px;
  font-size: 0.88rem;
  color: var(--color-text);
  line-height: 1.6;
}

.tip-bubble.show {
  display: block;
}

/* --- 一键求救按钮 — 橙色大圆钮 --- */
.sos-wrapper {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.sos-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--color-accent), #FFA55C);
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 6px 24px rgba(255, 140, 66, 0.35);
  animation: sos-pulse 2s ease-out infinite;
}

.sos-btn::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.25), transparent 60%);
  pointer-events: none;
}

.sos-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(255, 140, 66, 0.45);
}

.sos-btn:active {
  transform: scale(0.95);
}

.sos-btn.sent {
  background: linear-gradient(145deg, var(--color-success), #5EE0B8);
  animation: none;
  box-shadow: 0 0 20px rgba(45, 212, 160, 0.5);
}

@keyframes sos-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 140, 66, 0.5), 0 6px 24px rgba(255, 140, 66, 0.35); }
  70% { box-shadow: 0 0 0 28px rgba(255, 140, 66, 0), 0 6px 24px rgba(255, 140, 66, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(255, 140, 66, 0), 0 6px 24px rgba(255, 140, 66, 0.35); }
}

.sos-status {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 8px;
  min-height: 24px;
  color: var(--color-text-muted);
}

/* --- 一键求救双发按钮 --- */
.sos-dual-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.sos-dual-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  position: relative;
  color: #fff;
}

.sos-dual-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.3), transparent 60%);
  pointer-events: none;
}

.sos-dual-btn.blue {
  background: linear-gradient(145deg, var(--color-primary), #6DB3F2);
  box-shadow: 0 4px 16px rgba(74, 144, 217, 0.35);
}

.sos-dual-btn.orange {
  background: linear-gradient(145deg, var(--color-accent), #FFA55C);
  box-shadow: 0 4px 16px rgba(255, 140, 66, 0.35);
}

.sos-dual-btn:hover {
  transform: scale(1.1);
}

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

.sos-dual-btn.sent {
  background: linear-gradient(145deg, var(--color-success), #5EE0B8);
  box-shadow: 0 4px 16px rgba(45, 212, 160, 0.35);
  animation: none;
}

.sos-dual-heart {
  font-size: 1.4rem;
  color: var(--color-danger);
  animation: heart-beat 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 小星星动画 */
.star-burst {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  font-size: 1.5rem;
  animation: star-fly 0.8s ease-out forwards;
}

@keyframes star-fly {
  0% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(180deg); }
}

/* --- 深呼吸引导 — 会呼吸的光晕 --- */
.breath-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
  min-height: 200px;
}

.breath-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6DB3F2, var(--color-primary));
  opacity: 0.9;
  transition: transform 4s ease-in-out, background 4s ease-in-out, box-shadow 4s ease-in-out;
  will-change: transform;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 20px rgba(74, 144, 217, 0.3);
}

.breath-dot.inhale {
  transform: scale(3.5);
  background: radial-gradient(circle at 35% 30%, #FFF8F0, var(--color-primary));
  box-shadow: 0 0 80px rgba(74, 144, 217, 0.4);
}

.breath-dot.exhale {
  transform: scale(1);
  background: radial-gradient(circle at 35% 30%, #6DB3F2, var(--color-primary));
  box-shadow: 0 0 20px rgba(74, 144, 217, 0.3);
}

.breath-dot.calm {
  background: radial-gradient(circle at 35% 30%, #5EE0B8, var(--color-success));
  box-shadow: 0 0 40px rgba(45, 212, 160, 0.5);
  transform: scale(1);
}

.breath-label {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--color-text-muted);
  min-height: 28px;
  text-align: center;
}

.breath-count {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --- 自救记录卡片 --- */
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.record-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
}

.record-time {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.record-week {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

.record-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-text-muted);
  background: transparent;
  transition: all var(--transition);
}

.record-dot.done {
  background: var(--color-success);
  border-color: var(--color-success);
  box-shadow: 0 0 8px rgba(45, 212, 160, 0.5);
}

.record-trophy {
  font-size: 1.5rem;
  opacity: 0.3;
  transition: opacity var(--transition);
}

.record-trophy.lit {
  opacity: 1;
}

/* --- 按钮 --- */
.btn {
  display: inline-block;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), #6DB3F2);
  box-shadow: 0 4px 20px rgba(74, 144, 217, 0.3);
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(74, 144, 217, 0.45);
}

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

.btn-secondary {
  background: rgba(74, 144, 217, 0.08);
  color: var(--color-primary);
  border: 1px solid rgba(74, 144, 217, 0.2);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(74, 144, 217, 0.14);
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(74, 144, 217, 0.15);
}

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

.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

/* --- 底部导航栏 --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(74, 144, 217, 0.08);
  z-index: 100;
  padding: 8px 0 env(safe-area-inset-bottom, 10px) 0;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  transition: color var(--transition), transform var(--transition);
  position: relative;
}

.bottom-nav a .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform var(--transition);
}

.bottom-nav a.active .nav-icon {
  transform: scale(1.2);
}

.bottom-nav a.active {
  color: var(--color-primary);
}

.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
}

.bottom-nav a:hover {
  color: var(--color-primary);
}

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

/* 给所有页面底部留空间 */
.container {
  padding-bottom: 70px;
}

/* --- 响应式 --- */
@media (max-width: 600px) {
  body { padding: 12px; }
  .app-title { font-size: 1.5rem; }
  .card { padding: 16px 14px; }
  .sos-btn { width: 76px; height: 76px; font-size: 1.8rem; }
  .sos-dual-btn { width: 62px; height: 62px; font-size: 1.5rem; }
}

/* --- 知识卡片 --- */
.knowledge-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  min-height: 200px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.knowledge-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(74, 144, 217, 0.2);
}

.knowledge-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 12px;
}

.knowledge-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.knowledge-body {
  font-size: 0.92rem;
  color: var(--color-text);
  line-height: 1.7;
}

.knowledge-body .highlight {
  color: var(--color-accent);
  font-weight: 700;
}

.knowledge-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.knowledge-nav .nav-btn {
  background: rgba(74, 144, 217, 0.08);
  border: 1px solid rgba(74, 144, 217, 0.2);
  color: var(--color-primary);
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.knowledge-nav .nav-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.knowledge-nav .nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
  background: rgba(74, 144, 217, 0.08);
  color: var(--color-text-muted);
}

.knowledge-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.knowledge-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(74, 144, 217, 0.15);
  transition: all var(--transition);
}

.knowledge-dots .dot.active {
  background: var(--color-primary);
  transform: scale(1.3);
}

.knowledge-progress {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* --- 快捷入口卡片 --- */
.quick-links {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.quick-links a {
  flex: 1;
  text-decoration: none;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius);
  padding: 22px 10px;
  text-align: center;
  color: var(--color-text);
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.quick-links a:hover {
  border-color: var(--color-primary);
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(74, 144, 217, 0.12);
}

.quick-links a .ql-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 8px;
}

.quick-links a .ql-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--color-text-muted);
}

/* --- 分区标题 --- */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.section-title .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(74, 144, 217, 0.2), transparent);
}

/* --- 环境音开关 --- */
.sound-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.sound-toggle .switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: rgba(74, 144, 217, 0.15);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.sound-toggle .switch.on {
  background: var(--color-primary);
}

.sound-toggle .switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.sound-toggle .switch.on::after {
  transform: translateX(22px);
}

.sound-desc {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* --- 记录页统计 --- */
.record-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 14px;
}

.record-stats .stat {
  text-align: center;
}

.record-stats .stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}

.record-stats .stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.record-empty {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

.reset-link {
  display: block;
  text-align: center;
  margin-top: 24px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  opacity: 0.5;
}

.reset-link:hover {
  opacity: 1;
  color: var(--color-primary);
}

.week-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
