* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --nav-h: 70px;
  --primary-green: #b81212;
  --primary-blue: #4dabf7;
  --primary-purple: #845ef7;
  --danger-red: #fa5252;
  --text-light: #f8f9fa;
}

body {
  font-family: 'Noto Sans TC', sans-serif;
  background: #0a1016;
  color: var(--text-light);
  overflow-x: hidden;
  position: relative;
}

/* 背景動畫層 */
.custom-photo-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #aa0404 0%, #1b415f 50%, #1a1a2e 100%);
  z-index: -5;
}

.ocean-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(18, 184, 134, 0.15) 0%, transparent 70%);
  z-index: -4;
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.wave-layer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(to top, rgba(18, 184, 134, 0.2), transparent);
  z-index: -3;
  animation: wave 6s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-10px) scaleY(1.1); }
}

.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(18, 184, 134, 0.6);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(18, 184, 134, 0.8);
}

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh) translateX(50px); opacity: 0; }
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 1.5s; }
.particle:nth-child(8) { left: 80%; animation-delay: 2.5s; }
.particle:nth-child(9) { left: 90%; animation-delay: 3.5s; }

/* 導覽列 */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  background: rgba(10, 16, 22, 0.5);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: all 0.3s ease;
}

#navbar.scrolled {
  background: rgba(10, 16, 22, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.nav-left img {
  height: 45px;
  filter: drop-shadow(0 0 10px rgba(18, 184, 134, 0.5));
  transition: transform 0.3s ease;
}

.nav-left img:hover {
  transform: scale(1.1) rotate(5deg);
}

.nav-right {
  display: flex;
  gap: 30px;
}

.nav-right a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  transition: color 0.3s ease;
}

.nav-right a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-green);
  transition: width 0.3s ease;
}

.nav-right a:hover {
  color: var(--primary-green);
}

.nav-right a:hover::after {
  width: 100%;
}

/* 🎯 主內容 */
.main-content {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.hero-section {
  max-width: 1800px;
  margin: 0 auto;
  padding: 50px 20px 30px;
  text-align: center;
}

.hero-section h1 {
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(18, 184, 134, 0.6), 0 4px 15px rgba(0, 0, 0, 0.5);
  margin-bottom: 15px;
  animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subtitle {
  font-size: 1.2rem;
  color: #e9ecef;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  margin-bottom: 10px;
  animation: fadeIn 1s ease 0.3s both;
}

.emergency-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--danger-red), #ff6b6b);
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(250, 82, 82, 0.5);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(250, 82, 82, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 6px 25px rgba(250, 82, 82, 0.8);
    transform: scale(1.05);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 🌍 地圖容器 */
.map-container {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
  animation: fadeInUp 1s ease 0.5s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.map-wrapper {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(18, 184, 134, 0.3);
  background: rgba(10, 16, 22, 0.8);
  backdrop-filter: blur(10px);
}

#map {
  width: 100%;
  height: 600px;
  position: relative;
  z-index: 1;
}

/* 📌 AED 列表區 */
.aed-list-section {
  max-width: 1400px;
  margin: 50px auto;
  padding: 0 20px;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 0 15px rgba(18, 184, 134, 0.5);
  animation: fadeIn 1s ease;
}

.aed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 50px;
}

.aed-card {
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  animation: cardSlideIn 0.6s ease forwards;
  opacity: 0;
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aed-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(18, 184, 134, 0.2), transparent);
  transition: left 0.5s ease;
}

.aed-card:hover::before {
  left: 100%;
}

.aed-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(18, 184, 134, 0.4);
  border-color: var(--primary-green);
}

.aed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.aed-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--danger-red), #ff6b6b);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(250, 82, 82, 0.5);
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10%, 30% { transform: scale(1.1); }
  20%, 40% { transform: scale(0.95); }
}

.aed-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.aed-info {
  margin-top: 12px;
}

.aed-info p {
  margin: 8px 0;
  color: #e9ecef;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.aed-info i {
  color: var(--primary-green);
  width: 20px;
}

.aed-tag {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(18, 184, 134, 0.2);
  border: 1px solid var(--primary-green);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 10px;
  color: var(--primary-green);
}

/* 訪問計數 */
#visitor-count {
  text-align: center;
  padding: 30px 20px 50px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-light);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 📱 手機版 */
@media (max-width: 768px) {
  :root {
    --nav-h: 60px;
  }

  #navbar {
    padding: 0 20px;
  }

  .nav-left img {
    height: 35px;
  }

  .nav-right {
    gap: 15px;
  }

  .nav-right a {
    font-size: 0.85rem;
  }

  .hero-section h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .emergency-badge {
    font-size: 0.95rem;
    padding: 10px 18px;
  }

  #map {
    height: 400px;
  }

  .section-title {
    font-size: 1.7rem;
  }

  .aed-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .aed-card {
    padding: 18px;
  }

  .aed-name {
    font-size: 1.1rem;
  }

  .aed-info p {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .hero-section {
    padding: 30px 15px 20px;
  }

  .hero-section h1 {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .emergency-badge {
    font-size: 0.85rem;
    padding: 8px 16px;
  }

  #map {
    height: 350px;
  }

  .map-wrapper {
    border-radius: 16px;
  }

  .aed-card {
    border-radius: 14px;
    padding: 16px;
  }
}
/* 讓 AED 列表內的小圖示更亮、清楚 */
.aed-info i {
  color: #ff6b6b !important;
  filter: drop-shadow(0 0 6px rgba(255, 107, 107, 0.5));
}

/* Leaflet popup */
.leaflet-popup-content-wrapper {
  background: rgba(8, 12, 18, 0.95);
  color: var(--text-light);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(18, 184, 134, 0.3);
}

.leaflet-popup-content {
  margin: 15px;
  font-family: 'Noto Sans TC', sans-serif;
}

.leaflet-popup-content h3 {
  color: var(--primary-green);
  margin-bottom: 10px;
  font-weight: 800;
}

.leaflet-popup-tip {
  background: rgba(8, 12, 18, 0.95);
}

.aed-usage-section {
  max-width: 1400px;
  margin: 40px auto 80px;
  padding: 0 20px;
}

.usage-steps {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.usage-card {
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  transition: 0.3s ease;
}

.usage-card:hover {
  transform: translateY(-6px);
  border-color: #ff6b6b;
  box-shadow: 0 8px 28px rgba(255, 107, 107, 0.4);
}

.step-icon {
  font-size: 2rem;
  width: 70px;
  height: 70px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fa5252, #ff8787);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.cpr-section {
  text-align: center;
  margin: 60px auto;
}

.cpr-box {
  background: rgba(8,12,18,0.85);
  padding: 30px;
  border-radius: 18px;
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,0.12);
}

.beat-light {
  width: 25px;
  height: 25px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fa5252;
  box-shadow: 0 0 20px rgba(250,82,82,0.6);
  opacity: 0.3;
  transition: opacity 0.1s ease;
}

.cpr-btn {
  background: linear-gradient(135deg, #fa5252, #ff8787);
  padding: 12px 24px;
  border: none;
  color: white;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 700;
  transition: 0.3s;
}

.cpr-btn:hover {
  transform: scale(1.05);
}

/* 讓緊急電話按鈕更像「可點擊」 */
.emergency-badge {
  cursor: pointer;
  transition: 0.25s ease;
}

.emergency-badge:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 25px rgba(255, 107, 107, 0.8);
}

.emergency-badge:active {
  transform: scale(0.95);
  box-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
}
.emergency-badge-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* 📍 我的定位按鈕 */
.locate-me-btn {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: rgba(10, 16, 22, 0.85);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  transition: 0.25s ease;
  z-index: 9999;
}

.locate-me-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(77, 171, 247, 0.7);
}

.locate-me-btn:active {
  transform: scale(0.92);
}

/* 📍 定位後的小藍點 ICON */
.my-location-marker i {
  text-shadow: 0 0 10px rgba(77,171,247,0.8);
}

/* 🌟 超醒目 AED 地圖圖示 */
.aed-marker-icon {
  width: 30px;
  height: 30px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  /* 立體＋發光 */
  box-shadow:
    0 0 8px rgba(255, 80, 80, 0.9),
    0 0 18px rgba(255, 80, 80, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.4);

  border: 3px solid #fa5252;
}

.aed-marker-icon i {
  font-size: 20px;
  color: #fa5252;
  text-shadow: 0 0 8px rgba(255, 80, 80, 0.7);
}

/* 🌟 緊急電話按鈕：改善太亮、去掉底線、加柔和陰影 */
.emergency-badge {
  text-decoration: none !important;        /* 取消底線 */
  color: #ffffff !important;               /* 文字改白色 */
  background: #ff6b6b;                     /* 主色維持醒目紅 */
  padding: 10px 22px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;

  /* 新版柔和陰影 —— 不刺眼、保留立體感 */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 0 12px rgba(255, 107, 107, 0.55);

  transition: 0.25s ease;
}

/* Icon 改白色＋淡光 */
.emergency-badge i {
  color: #ffffff !important;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}

/* Hover 效果（更精緻，不會發爆光） */
.emergency-badge:hover {
  transform: translateY(-3px);
  box-shadow:
    0 3px 12px rgba(0, 0, 0, 0.45),
    0 0 16px rgba(255, 107, 107, 0.7);
}

/* 點擊手感 */
.emergency-badge:active {
  transform: scale(0.94);
  box-shadow:
    0 1px 5px rgba(0, 0, 0, 0.4),
    0 0 6px rgba(255, 107, 107, 0.4);
}

/* 📌 地圖資料來源文字 */
.map-source {
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 10px;
  padding-bottom: 8px;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.45);
  letter-spacing: 0.5px;
  user-select: none;
}

/* =========================================
   CPR 卡片全新 UI（深色玻璃 + 高亮字體）
========================================= */

.cpr-box {
  background: rgba(20, 25, 35, 0.55);
  backdrop-filter: blur(14px);
  border-radius: 22px;
  padding: 34px 30px;
  margin-top: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.09);
}

/* 標題列（模式 + 計時器） */
.cpr-header {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #d6e4ff;
  opacity: 0.95;
  margin-bottom: 25px;
}

/* 數字區塊 */
.cpr-counter {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-bottom: 25px;
}

.count-number {
  font-size: 70px;
  font-weight: 900;
  color: #66e0ff;  /* 清晰亮青色 */
  text-shadow: 0 0 10px rgba(102,224,255,0.45);
}

.count-label {
  margin-top: -10px;
  font-size: 16px;
  text-align: center;
  color: #c8d5e6;
  opacity: 0.8;
}

/* 按壓按鈕 */
.press-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #1e66f5, #3a7bff);
  color: #fff;
  font-size: 22px;
  border-radius: 14px;
  border: none;
  box-shadow: 0 4px 12px rgba(30,102,245,0.4);
  transition: 0.2s;
}

.press-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30,102,245,0.45);
}

/* 節奏器脈衝點 */
.beat-light {
  width: 16px;
  height: 16px;
  background: #ff6b6b;
  border-radius: 50%;
  margin: 15px auto 12px auto;
  opacity: 0.3;
  transition: 0.12s;
  box-shadow: 0 0 12px rgba(255,107,107,0.6);
}

/* 開始節奏按鈕 */
.cpr-btn {
  padding: 12px 22px;
  font-size: 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  transition: 0.2s;
}

.cpr-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* 模式切換按鈕 */
.mode-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 10px 18px;
  border-radius: 14px;
  color: #dbe4ff;
}

.mode-btn.active {
  background: #1e66f5;
  border-color: transparent;
  color: #fff;
}
