/* 強制重置所有背景設定 */
* {
  box-sizing: border-box;
}

html, body {
  background: #1d428a !important;
  background-image: linear-gradient(180deg, #1d428a 0%, #1d428a 30%, #6b8dd6 50%, #8faee6 100%) !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  min-height: 100vh !important;
}

body {
  color: #ffd700;
  font-family: 'Georgia', 'Times New Roman', serif;
  margin: 0;
  padding: 0;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1d428a 0%, #1d428a 30%, #6b8dd6 50%, #8faee6 100%) !important;
  z-index: -1;
}

/* 導航樣式 */
nav ul li strong a,
nav strong a,
.container-fluid nav ul li strong a {
  color: #ffd700 !important;
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-weight: 900 !important;
  letter-spacing: 1px !important;
  font-size: 1.8rem !important;
  text-decoration: none !important;
}

nav ul li a:not(strong a),
nav ul li a[href="mailto:MementunEmo@gmail.com"],
nav ul li a[onclick],
nav ul li a[target="_blank"] {
  color: #ffd700 !important;
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 1rem !important;
}

/* 按鈕樣式 */
button, [role="button"], a[role="button"] {
  background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
  color: #ffd700 !important;
  border: 2px solid #ffd700;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

button:hover, [role="button"]:hover, a[role="button"]:hover {
  background: linear-gradient(135deg, #d4af37 0%, #ffd700 50%, #ffed4e 100%);
  color: #1a237e !important;
  border-color: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* Modal 樣式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.modal-content {
  background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
  margin: 15% auto;
  padding: 20px;
  border: 2px solid #d4af37;
  border-radius: 12px;
  width: 80%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.close {
  color: #ffd700;
  float: right;
  font-size: 28px;
  font-weight: bold;
  position: absolute;
  right: 15px;
  top: 10px;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #ffd700;
}

.modal-content h2 {
  color: #ffd700;
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 900;
  text-align: left;
  font-family: 'Georgia', 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-content p {
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0.8rem 0;
  text-align: left;
}

/* SINGLE 文字樣式 */
.single-text {
  font-weight: 900;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.5rem;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(26, 35, 126, 0.8);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* 圖片放大功能樣式 */
.zoomable-image {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.zoomable-image:hover {
  transform: scale(1.02);
}

/* 圖片放大模態框 */
.image-zoom-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.image-zoom-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-zoom-content img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}



/* FBI Modal 樣式 */
.fbi-modal-content {
  background-color: #000000;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  border: none;
  border-radius: 0;
  width: 80vw;
  max-width: 800px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.5);
  z-index: 1001;
}

.fbi-modal-content .close {
  color: #ffffff;
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1002;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}



/* 青蛙嘴巴動畫效果 */
.frog-animation {
  animation: frogLaugh 2s ease-in-out infinite;
  transition: transform 0.3s ease;
}

@keyframes frogLaugh {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.frog-animation:hover {
  transform: scale(1.1);
}

/* Timeline 樣式 */
.timeline-container {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem auto;
  backdrop-filter: blur(10px);
  max-width: 1200px;
}

.timeline-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: bold;
  color: #000;
  margin-bottom: 2rem;
}

.timeline-iframe {
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* Research 樣式 */
.research-container {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem auto;
  backdrop-filter: blur(10px);
  max-width: 1800px;
}

.sop-title {
  text-align: center;
  font-size: 3.2rem;
  font-weight: bold;
  color: #000;
  margin-bottom: 2rem;
}

.process-steps-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
  max-width: 100%;
  overflow-x: hidden;
}

.process-step {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.step-number {
  padding: 0.8rem;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.8rem;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-1 { background-color: #5B9BD5; }
.step-2 { background-color: #70AD91; }
.step-3 { background-color: #8FBF47; }
.step-4 { background-color: #7BAA3C; }
.step-5 { background-color: #6B9739; }

.step-description {
  background-color: rgba(200, 220, 240, 0.7);
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.3;
  height: auto;
  min-height: 120px;
}

.step-description h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.step-description ul {
  margin: 0;
  padding-left: 1rem;
  list-style-type: disc;
}

.step-description li {
  margin: 0.3rem 0;
  font-size: 0.7rem;
  color: #555;
}

/* 響應式設計 */
/* LCS Merger 頁面五個方塊的自適應布局 */
.five-boxes-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr)); /* 改為4欄，讓文字框完全包含在白框內 */
  gap: 0.6rem;
  margin: 0.8rem 0;
  max-width: 100%; /* 移除固定最大寬度，讓容器適應父元素 */
  margin-left: auto;
  margin-right: auto;
  justify-content: center; /* 居中對齊 */
  padding: 0 1rem; /* 增加內邊距確保不會碰到邊界 */
}

.five-boxes-container > div {
  background: rgba(91, 155, 213, 0.1);
  border-radius: 8px;
  overflow: hidden;
  border-left: 4px solid;
  transition: all 0.3s ease;
  min-height: 200px; /* 設定最小高度 */
  width: 100%; /* 填滿grid分配的寬度 */
  display: flex;
  flex-direction: column;
  max-width: 100%; /* 確保不會超出容器 */
  box-sizing: border-box; /* 包含邊框和內邊距在寬度計算內 */
}

.five-boxes-container > div:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.five-boxes-container .box-header {
  color: white;
  padding: 0.8rem;
  font-weight: bold;
  text-align: center;
  font-size: 1.1rem;
}

.five-boxes-container .box-content {
  padding: 1rem;
  font-size: 1rem;
  line-height: 1.4;
  color: #555 !important;
  flex: 1; /* 讓內容區域填滿剩餘空間 */
  overflow-wrap: break-word; /* 強制長文字換行 */
  word-wrap: break-word;
}

.five-boxes-container .box-content strong {
  color: #444 !important;
}

.five-boxes-container .box-content span {
  color: #555 !important;
}

/* 各個方塊的顏色主題 */
.five-boxes-container > div:nth-child(1) {
  border-left-color: #5B9BD5;
}
.five-boxes-container > div:nth-child(1) .box-header {
  background: #5B9BD5;
}

.five-boxes-container > div:nth-child(2) {
  border-left-color: #70AD91;
  background: rgba(112, 173, 145, 0.1);
}
.five-boxes-container > div:nth-child(2) .box-header {
  background: #70AD91;
}

.five-boxes-container > div:nth-child(3) {
  border-left-color: #8FBF47;
  background: rgba(143, 191, 71, 0.1);
}
.five-boxes-container > div:nth-child(3) .box-header {
  background: #8FBF47;
}

.five-boxes-container > div:nth-child(4) {
  border-left-color: #F79646;
  background: rgba(247, 150, 70, 0.1);
}
.five-boxes-container > div:nth-child(4) .box-header {
  background: #F79646;
}

.five-boxes-container > div:nth-child(5) {
  border-left-color: #B85450;
  background: rgba(184, 84, 80, 0.1);
}
.five-boxes-container > div:nth-child(5) .box-header {
  background: #B85450;
}

/* 中等螢幕尺寸 (平板) */
@media (max-width: 1200px) and (min-width: 769px) {
  .five-boxes-container {
    grid-template-columns: repeat(3, minmax(220px, 1fr)); /* 保持最小寬度 */
    gap: 0.8rem;
  }
  
  .five-boxes-container > div:nth-child(4) {
    grid-column: 1 / 3; /* 第四個方塊佔兩列 */
  }
  
  .five-boxes-container > div:nth-child(5) {
    grid-column: 3 / 4; /* 第五個方塊佔一列 */
  }
}

@media (max-width: 768px) {
  /* 手機端布局：2-2-1 排列 */
  .five-boxes-container {
    grid-template-columns: repeat(2, minmax(150px, 1fr)); /* 手機版保持最小寬度 */
    gap: 0.5rem;
    max-width: none; /* 移除最大寬度限制 */
  }
  
  .five-boxes-container > div:nth-child(5) {
    grid-column: 1 / -1; /* 第五個方塊佔滿整行 */
  }
  
  .five-boxes-container .box-header {
    font-size: 0.95rem;
    padding: 0.6rem;
  }
  
  .five-boxes-container .box-content {
    padding: 0.8rem;
    font-size: 0.85rem;
  }

  .process-steps-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .frog-animation {
    max-width: 180px !important; /* 手機版圖片放大20%，從150px增加到180px */
  }

  .meme-text {
    font-size: 2.5rem;
  }

  .timeline-container, .research-container {
    margin: 0.5rem;
    padding: 1rem;
  }

  /* 手機版格子布局調整 */
  div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  /* 手機版按鈕布局調整 */
  div[style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    gap: 1.5rem !important;
    margin-top: 2rem !important;
    padding: 0 1rem !important;
  }

  /* 手機版按鈕樣式調整 */
  div[style*="display: flex"][style*="justify-content: space-between"] a {
    font-size: 0.75rem !important;
    padding: 1rem 0.8rem !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    line-height: 1.3 !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 手機版主要內容區域調整 */
  div[style*="border: 4px solid #d4af37"] {
    margin: -1rem 0.5rem 1rem 0.5rem !important;
    padding: 1.5rem !important;
  }

  /* 手機版標題文字調整 */
  h1[style*="font-size: 2.2rem"] {
    font-size: 1.4rem !important;
    line-height: 1.2 !important;
    word-wrap: break-word !important;
  }

  h2[style*="font-size: 1.4rem"] {
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
  }

  /* 手機版主要內容區塊調整 */
  div[style*="display: flex"][style*="align-items: center"][style*="gap: 2rem"] {
    flex-direction: column !important;
    gap: 1rem !important;
    text-align: center !important;
  }

  div[style*="display: flex"][style*="align-items: center"][style*="gap: 2rem"] > div[style*="flex: 1"] {
    flex: none !important;
    width: 100% !important;
  }
}