html, body {
  height: auto;
  width: 100%;
  overflow-x: hidden !important;
  overflow-y: auto;
  max-width: 100%;
  font-family: "TaipeiSansTCBeta", sans-serif;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  background: image-set(
    url('../images/Pathways_走路.webp') type("image/webp"),
    url('../images/Pathways_走路.jpg') type("image/jpeg")
  ) no-repeat center center fixed;
  background-size: cover;
  background-attachment: fixed;
  position: relative;
  animation: bgMove 60s linear infinite; /* 背景緩慢漂移 */
}

@keyframes bgMove {
  0% { background-position: center 0; }
  50% { background-position: center 10px; }
  100% { background-position: center 0; }
}

/* 背景半透明遮罩 */
main {
  position: relative;
  z-index: 1;
}
main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 0;
  pointer-events: none;
}

/* Header */
header {
  background-color: rgba(0, 65, 101, 0.75);
  color: white;
  text-align: center;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  border-bottom: 3px solid #F2DF74;
}

/* Header 底部動態雙向流動線 */
header::after {
  content: "";
  display: block;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #004165, #F2DF74, #772432, #004165);
  background-size: 200% 100%;
  animation: moveLine 8s ease-in-out infinite;
}
@keyframes moveLine {
  0%, 100% { background-position: 0 0; }
  50% { background-position: 200% 0; }
}

/* Navbar */
.navbar a {
  margin: 0 10px;
  color: white;
  text-decoration: none;
  font-weight: bold;
  line-height: 1.4;
  letter-spacing: 0.03em;
  position: relative;
  overflow: hidden;
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.navbar a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #F2DF74;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.navbar a:hover,
.navbar a:active {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.navbar a:hover::after,
.navbar a.active::after {
  transform: scaleX(1);
}

.navbar a:hover,
.navbar a.active {
  background-color: #FFD700;
  color: #004165;
  border-radius: 6px;
  font-weight: bold;
  padding: 0.3em 0.6em;
  border-bottom: 3px solid #F2DF74;
}

/* LOGO 與標題區塊 */
.logo-title-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 5px 10px;
  max-width: 100%;
  position: relative;
  animation: fadeInLogo 1.4s ease forwards;
}
@keyframes fadeInLogo {
  0% { opacity: 0; transform: translateY(-12px) scale(0.96); }
  70% { opacity: 1; transform: translateY(3px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* LOGO 金光掃描 */
.logo {
  max-height: 50px;
  height: auto;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  position: relative;
  transition: all 0.3s ease;
}
.logo::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-25deg);
  animation: shine 6s ease-in-out infinite;
}
@keyframes shine {
  0% { left: -75%; }
  60% { left: 125%; }
  100% { left: 125%; }
}

/* 標題光澤律動 */
.site-title {
  font-size: clamp(1.2rem, 4.5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.3;
  background: linear-gradient(180deg, #fff8c6 0%, #F2DF74 40%, #cdaa30 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  animation: textGlow 4s ease-in-out infinite alternate;
}
@keyframes textGlow {
  0% { text-shadow: 0 2px 3px rgba(0,0,0,0.25); }
  100% { text-shadow: 0 0 12px rgba(255, 215, 0, 0.6); }
}

/* Hover 效果 */
.logo-title-wrapper:hover .logo {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
  transform: scale(1.05);
}
.logo-title-wrapper:hover .site-title {
  text-shadow: 0 0 8px rgba(242, 223, 116, 0.8);
  transform: scale(1.03);
}

/* Icon grid */
.icon-section {
  padding: 4px 5%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  position: relative;
  z-index: 1;
}
.icon-section.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* 分隔線 */
.section-divider {
  height: 6px;
  width: 80%;
  margin: 8px auto;
  border-radius: 3px;
  background: linear-gradient(90deg, #004165, #772432, #F2DF74, #004165, #772432);
  background-size: 300% 100%;
  box-shadow: 0 0 6px rgba(242, 223, 116, 0.3);
  animation: dividerHybrid 10s linear infinite;
}
@keyframes dividerHybrid {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: center;
  align-items: center;
  gap: 16px 10px;
  width: calc(100% - 8px);
  margin: 0 auto;
  padding: 0 4px;
  box-sizing: border-box;
}
.icon-wrapper {
  width: 100%;
  max-width: 110px;
  position: relative;
  text-align: center;
  margin: 8px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.icon-wrapper.fade-in {
  opacity: 1;
  transform: translateY(0);
}
.icon {
  width: 100%;
  max-width: 100px;
  height: auto;
  border-radius: 50%;
  display: block;
  margin: 0 auto;
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.3s ease;
}
.icon-wrapper:hover .icon {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.3));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.icon-wrapper:hover .icon-label {
  transform: translateY(-2px);
  transition: all 0.25s ease;
  background-color: rgba(0,0,0,0.9);
}
.icon-label {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(0.8rem, 3vw, 1rem);
  line-height: 1.2;
  padding: 5px 4px;
  background-color: rgba(0,0,0,0.8);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  backdrop-filter: blur(2px);
  border-radius: 6px;
  z-index: 2;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 105%;
  max-width: 115px;
  word-break: keep-all;
  text-align: center;
}
.icon-label span.shortcode {
  font-weight: 800;
  font-size: 1.1em;
  letter-spacing: 0.03em;
}
@media (min-width: 1024px) {
  .icon-label {
    max-width: 130px;
    width: 120%;
  }
  .icon-label:has(.shortcode) {
    font-size: 0.95em;
    letter-spacing: 0.02em;
  }
}
@media (min-width: 768px) {
  .icon-label {
    width: 110%;
    max-width: 125px;
    padding: 5px 4px;
  }
}

/* Footer */
footer {
  border-top: 3px solid #F2DF74;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(245,245,245,0.98));
  text-align: center;
  padding: 16px 10px 30px 10px;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  line-height: 1.4;
  color: #222;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 5;
  width: 100%;
  box-sizing: border-box;
}

/* 禁止選取靜態文字但保留互動 */
body, header, footer, main, nav, div, section, article, p, span, h1, h2, h3, h4, h5, h6, img {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-touch-callout: none;
}

/* 保留互動元件 */
a, button, input, textarea, select, label {
  user-select: auto !important;
  -webkit-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  -webkit-touch-callout: default !important;
}


/* === 原始 RWD === */
@media (max-width: 600px) {
  body { padding-bottom: 30px; }
}
@media (max-width: 1024px) {
  body { background-attachment: scroll !important; }
}

html { background-color: #ffffff; }
* { box-sizing: border-box; }
img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 🔧 修正段落開始：安全移除手機多餘底部空白，無影響桌機 */
@media (max-width: 600px) {
  body {
    padding-bottom: 0 !important; /* 移除多餘空白 */
    background-attachment: scroll !important; /* Android 背景修正 */
  }
}

/* 保持背景位置一致 */
body {
  background-position: center bottom;
}

/* 桌機保留固定背景 */
@media (min-width: 1025px) {
  body {
    background-attachment: fixed !important;
  }
}
/* 🔧 修正段落結束 */
