/* ====== 1. 變數與基礎設定 (強化色系與陳建，升級現代感) ====== */
:root {
  /* 基礎色彩：微調為純淨輕盈背景，凸顯卡片內容 */
  --color-bg-start: #f4f6f9; 
  --color-bg-end: #e5edf5;   
  --color-card: #ffffff;
  
  /* 文字色彩 */
  --color-text-main: #1f2937; /* 提升質感的深灰色 */
  --color-text-muted: #64748b;
  
  /* 品牌與點綴色 */
  --color-accent: #ff6b00;
  --color-accent-orange: #f97316;
  --color-trust-blue: #2563eb; /* 現代藍色系 */
  --color-trust-blue-bg: #eff6ff;
  
  /* 狀態標籤色彩 */
  --color-red: #e11d48;
  --color-red-bg: #fff1f2;
  --color-green: #059669;
  --color-green-bg: #ecfdf5;
  --color-view: #d97706;
  --color-view-bg: #fffbeb;
  
  /* 字體大小與圓角設定 */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-h1: 24px;
  --radius-lg: 16px;
  --radius-btn: 16px;
  
  /* 動畫與層次陰影 (更柔和的高級感陰影) */
  --motion-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --motion-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
  --shadow-base: 0 8px 20px rgba(0,0,0,0.04);
  --shadow-lg: 0 15px 35px rgba(0,0,0,0.08);
}

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

html, body {
  min-height: 100vh;
  width: 100vw;
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth; 
}

/* ====== 2. 佈局與排版 ====== */
.dashboard {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 12px calc(110px + env(safe-area-inset-bottom)) 12px; 
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ratio-16-9 { aspect-ratio: 16 / 9; height: auto !important; min-height: auto !important; }
.ratio-1-1 { aspect-ratio: 1 / 1; height: auto !important; min-height: auto !important; }
.ratio-9-16 { aspect-ratio: 9 / 16; height: auto !important; min-height: auto !important; }

/* ====== 3. 頂部 Header ====== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: opacity var(--motion-fast);
}

.brand-group:hover { opacity: 0.8; }

.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--color-trust-blue);
  stroke-width: 2.5;
}

header h1 {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--color-text-main) 0%, #4b5563 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pulse-blue { animation: pulse-blue 2s infinite; }
@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.status-badge {
  font-size: 13px;
  color: var(--color-trust-blue);
  background-color: var(--color-trust-blue-bg);
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid rgba(37, 99, 235, 0.1);
}

.oba-orange-pill {
  font-size: 13px; color: white !important;
  background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ff8c00 100%);
  padding: 8px 16px; border-radius: 100px; font-weight: 700;
  text-decoration: none; letter-spacing: 0.05em;
  box-shadow: 0 4px 10px rgba(255, 107, 0, 0.3);
  transition: var(--motion-fast);
}
.oba-orange-pill:active { transform: scale(0.9); box-shadow: 0 2px 5px rgba(255, 107, 0, 0.3); }

/* ====== 4. 通用卡片元件 (Widget) ====== */
.widget {
  background-color: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-base);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: transform var(--motion-base), box-shadow var(--motion-base);
}

.widget:hover {
  transform: translateY(-4px); 
  box-shadow: var(--shadow-lg);
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.widget-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
}

.widget-icon { width: 22px; height: 22px; color: var(--color-trust-blue); }
.color-red { color: var(--color-red); }
.color-view { color: var(--color-view); }
.color-orange { color: var(--color-accent-orange); }

.widget-details {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ====== 5. 圖片卡片與 Bento 網格 ====== */
.img-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  box-shadow: var(--shadow-base);
  transition: var(--motion-base);
  transform: translateZ(0);
}

.img-card:active { transform: scale(0.96); box-shadow: var(--shadow-sm); }

.img-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
  transition: transform 0.5s var(--motion-base);
}

.img-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.1) 100%);
  z-index: 2;
}

.img-card:hover::before { transform: scale(1.05); }

.img-card-content { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.img-card-title { font-size: 17px; font-weight: 900; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.img-card-subtitle { font-size: 13px; font-weight: 600; color: #ffeb3b; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }

.bg-quiz::before { background-image: url('quiz.jpg'); background-color:#8e8e93; }
.bg-timeline::before { background-image: url('timeline.jpg'); background-color:#8e8e93; }
.bg-youtube::before { background-image: url('youtube.jpg'); background-color:#8e8e93; }
.bg-strategy::before { background-image: url('strategy.jpg'); background-color:#8e8e93; }
.bg-10s::before { background-image: url('survival.jpg'); background-color:#8e8e93; }
.dynamic-bg::before { background-image: var(--dynamic-bg); background-color: #8e8e93; }

.bento-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
.bento-item { border-radius: var(--radius-lg); padding: 16px; font-size: 15px; overflow: hidden; }

/* ====== 6. 跑馬燈與專業化廣告 ====== */
.news-ticker {
  background-color: var(--color-card);
  border-radius: 100px; 
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-base);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.news-ticker:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }

.news-ticker-badge {
  font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 100px;
  white-space: nowrap; flex-shrink: 0; letter-spacing: 0.05em;
}

.news-ticker-content { flex: 1; overflow: hidden; }

#new-case-link, #rent-sale-link, #news-link {
  display: block; color: var(--color-text-main); text-decoration: none;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; 
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#new-case-link.fade-out, #rent-sale-link.fade-out, #news-link.fade-out {
  opacity: 0; transform: translateY(-8px);
}

.ad-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-base);
  border: 2px dashed #e2e8f0;
}
.ad-text { color: var(--color-text-muted); font-size: 14px; text-align: center; font-weight: 500;}
.ad-icon { width: 18px; height: 18px; color: var(--color-text-muted); animation: pulse-text 2s infinite; }
@keyframes pulse-text { 
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ====== 7. 新聞、觀點與骨架屏載入 ====== */
.skeleton-loader {
  background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  color: transparent !important;
  border-radius: 8px;
  padding: 15px; text-align: center; width: 100%;
}
@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.rich-news-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-height: 250px; overflow-y: auto; padding-right: 4px; scroll-behavior: auto; }
.rich-news-list::-webkit-scrollbar { width: 4px; }
.rich-news-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.news-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: var(--radius-btn); background-color: #f8fafc;
  text-decoration: none; transition: background-color var(--motion-fast), transform var(--motion-fast);
}
.news-item:hover, .news-item:active { background-color: var(--color-trust-blue-bg); transform: translateX(4px); }

.news-tag {
  font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.tag-news { background-color: var(--color-red-bg); color: var(--color-red); }       
.tag-rent { background-color: var(--color-green-bg); color: var(--color-green); }       
.tag-buy { background-color: var(--color-trust-blue-bg); color: var(--color-trust-blue); }       
.tag-view { background-color: var(--color-view-bg); color: var(--color-view); }       

.news-title { font-size: 14px; font-weight: 500; color: var(--color-text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.viewpoint-row { display: flex; overflow-x: auto; gap: 16px; padding-bottom: 12px; -webkit-overflow-scrolling: touch; scroll-behavior: auto; }
.viewpoint-row::-webkit-scrollbar { display: none; }
.viewpoint-card { flex: 0 0 140px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.viewpoint-img { width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius-btn); object-fit: cover; background-color: #f1f5f9; box-shadow: var(--shadow-sm); }
.viewpoint-title { font-size: 13px; font-weight: 600; color: var(--color-text-main); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ====== 8. Shorts 短影音區塊 ====== */
.shorts-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.shorts-tabs::-webkit-scrollbar { display: none; }
.tab-btn { flex: 0 0 auto; padding: 10px 18px; border-radius: 24px; background-color: var(--color-trust-blue-bg); color: var(--color-text-muted); border: 2px solid transparent; font-size: 14px; font-weight: 700; cursor: pointer; transition: var(--motion-fast); scroll-snap-align: start; }
.tab-btn.active { background-color: var(--color-trust-blue); color: white; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3); }
.shorts-tab-content { display: none; }
.shorts-tab-content.active { display: block; animation: fadeIn 0.4s ease; }

.shorts-row { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 12px; scroll-behavior: auto; -webkit-overflow-scrolling: touch; }
.shorts-row::-webkit-scrollbar { height: 4px; }
.shorts-row::-webkit-scrollbar-track { background: transparent; }
.shorts-row::-webkit-scrollbar-thumb { background: #e5e5ea; border-radius: 4px; }

.short-card { flex: 0 0 120px; aspect-ratio: 9 / 16; border-radius: 16px; display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; text-decoration: none; color: white; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); transition: transform var(--motion-fast); position: relative; overflow: hidden; background-size: cover; background-position: center; background-color: #333; }
.short-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.4) 100%); z-index: 1; }
.short-card:hover, .short-card:active { transform: translateY(-4px) scale(0.98); }
.short-card > * { z-index: 2; }
.short-play-icon { position: absolute; top: 12px; left: 12px; width: 24px; height: 24px; opacity: 0.9; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.short-title { font-size: 14px; font-weight: 800; line-height: 1.3; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }

/* ====== 9. 社群群組分類 ====== */
.group-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.group-tab-btn { padding: 8px 16px; border-radius: 20px; border: 1px solid #e5e5ea; background: white; color: var(--color-text-muted); font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--motion-fast); }
.group-content { display: none; }
.group-content.active { display: block; animation: fadeIn 0.4s ease; }
.grid-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-btn { padding: 10px 4px; border-radius: 8px; border: 1px solid #e5e5ea; background: white; color: var(--color-text-main); font-size: 13px; font-weight: 600; text-align: center; text-decoration: none; transition: var(--motion-fast); display: flex; align-items: center; justify-content: center; }

@media (max-width: 480px) {
  .grid-buttons { grid-template-columns: repeat(3, 1fr); }
  .grid-btn { font-size: 12px; padding: 8px 2px; }
}

.group-tab-btn.theme-ai { border-color: #e1bee7; color: #7b1fa2; }
.group-tab-btn.theme-ai.active { background-color: #f3e5f5; border-color: #7b1fa2; color: #7b1fa2; }
.group-tab-btn.theme-bad { border-color: #e0e0e0; color: #666666; }
.group-tab-btn.theme-bad.active { background-color: #666666; border-color: #666666; color: #ffeb3b; }
.group-tab-btn.theme-regional { border-color: #ffe0b2; color: #ef6c00; }
.group-tab-btn.theme-regional.active { background-color: #fff3e0; border-color: #ef6c00; color: #ef6c00; }

.grid-btn.theme-ai { background-color: #f3e5f5; border-color: #7b1fa2; color: #7b1fa2; }
.grid-btn.theme-ai:hover, .grid-btn.theme-ai:active { background-color: #7b1fa2; color: #ffffff; }
.grid-btn.theme-bad { background-color: #666666; border-color: #666666; color: #ffeb3b; }
.grid-btn.theme-bad:hover, .grid-btn.theme-bad:active { background-color: #000000; border-color: #000000; color: #ffeb3b; }
.grid-btn.theme-regional { background-color: #fff3e0; border-color: #ef6c00; color: #ef6c00; }
.grid-btn.theme-regional:hover, .grid-btn.theme-regional:active { background-color: #ef6c00; color: #ffffff; }

/* ====== 10. 搜尋膠囊與表單元素 ====== */
.select-wrapper { position: relative; }
.select-wrapper::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='3' stroke='%232563eb' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9'/%3E%3C/svg%3E");
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%); pointer-events: none;
}
select {
  width: 100%; appearance: none;
  background-color: var(--color-trust-blue-bg); border: 1px solid transparent;
  color: var(--color-trust-blue); padding: 18px 20px; border-radius: var(--radius-btn);
  font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: var(--motion-fast);
}
select:focus { background-color: #ffffff; border-color: var(--color-trust-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

.search-pill {
  display: flex;
  align-items: center;
  background-color: var(--color-trust-blue-bg);
  border-radius: 100px;
  padding: 4px 6px 4px 18px;
  border: 1px solid transparent;
  transition: all var(--motion-fast);
}

.search-pill:focus-within {
  background-color: #ffffff;
  border-color: var(--color-trust-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#nav-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-main);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 0;
  outline: none;
}

#nav-search-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

#nav-search-btn {
  background-color: var(--color-trust-blue);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform var(--motion-fast), background-color var(--motion-fast);
}

#nav-search-btn:active {
  transform: scale(0.9);
}

.nav-autocomplete-list {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: white; border: 1px solid #ebedf0; border-radius: 16px;
  box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto; display: none; z-index: 1000;
}
.nav-autocomplete-list .suggestion-item {
  padding: 12px 16px; border-bottom: 1px solid #f5f5f7; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--color-text-main); transition: background-color 0.2s;
}
.nav-autocomplete-list .suggestion-item:last-child { border-bottom: none; }
.nav-autocomplete-list .suggestion-item:hover { background-color: var(--color-trust-blue-bg); }
.match-highlight { color: var(--color-trust-blue); font-weight: 800; }

/* ====== 11. 頁尾與導覽列 ====== */
footer { margin-top: 32px; display: flex; flex-direction: column; align-items: center; }
.footer-nav { display: flex; justify-content: center; gap: 6px; width: 100%; padding-bottom: 20px; }
.footer-nav button {
  margin: 0; border: none; padding: 8px 4px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: bold; transition: opacity var(--motion-fast), transform var(--motion-fast);
  flex: 1; white-space: nowrap; display: flex; justify-content: center; align-items: center;
  background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ff8c00 100%);
  color: white; box-shadow: 0 4px 10px rgba(255, 107, 0, 0.2);
}
.footer-nav button:hover, .footer-nav button:active { opacity: 0.9; transform: translateY(-1px); }
.footer-copyright { font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; line-height: 1.6; }
.footer-copyright a { color: var(--color-accent-orange); text-decoration: none; font-weight: 700; transition: opacity var(--motion-fast); }
.footer-copyright a:hover, .footer-copyright a:active { opacity: 0.8; }

.bottom-bar {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background-color: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex; justify-content: space-around; align-items: center;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04); z-index: 1000;
}
.bottom-bar a {
  display: flex; flex-direction: column; align-items: center; text-decoration: none;
  color: var(--color-text-muted); font-size: 11px; font-weight: 600; gap: 6px; transition: color var(--motion-fast); flex: 1;
}
.bottom-bar a:hover, .bottom-bar a:active { color: var(--color-trust-blue); }
.bottom-bar .icon { font-size: 22px; }

/* ====== 12. 回到頁首按鈕 ====== */
.back-to-top {
  position: fixed;
  bottom: calc(95px + env(safe-area-inset-bottom)); 
  right: 20px;
  background: linear-gradient(135deg, var(--color-accent-orange) 0%, #ff8c00 100%);
  color: white;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  font-size: 11px; font-weight: 900; letter-spacing: -0.05em;
  border: none; cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
  z-index: 999; 
  opacity: 0; pointer-events: none;
  transition: transform var(--motion-base), opacity var(--motion-base);
  transform: translateY(20px);
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-5px); box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5); }
.back-to-top:active { transform: translateY(0); opacity: 0.8; }

/* ====== 13. 彈出視窗 (Modal) ====== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 2000;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
  background: var(--color-card); width: 90%; max-width: 480px; max-height: 85dvh;
  border-radius: 16px; padding: 0; transform: scale(0.95); opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
  display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-overlay.active .modal-content { transform: scale(1); opacity: 1; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #ebedf0; flex-shrink: 0;
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--color-accent-orange); }
.modal-close {
  background: transparent; border: none; width: 32px; height: 32px;
  font-size: 22px; font-weight: normal; color: var(--color-text-muted);
  cursor: pointer; transition: var(--motion-fast); display: flex; justify-content: center; align-items: center;
}
.modal-close:hover { color: var(--color-accent-orange); }
.modal-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 24px 20px; font-size: 15px; color: var(--color-text-main); line-height: 1.7;
}
.modal-body p { margin-bottom: 16px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body h3 { font-size: 16px; font-weight: bold; color: var(--color-text-main); margin-bottom: 8px; }

/* 輔助動畫 */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.bento-fade-out { opacity: 0; transform: scale(0.98); transition: opacity 0.4s ease, transform 0.4s ease; }
.no-overlay::after { display: none !important; }

/* ====== 14. 呼吸動畫與發光效果 (微調版) ====== */

/* 呼吸效果 - 按鈕 (縮小縮放比例，避免碰撞) */
@keyframes breathe-btn-anim {
  0% { transform: scale(1); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
  50% { transform: scale(1.04); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }
  100% { transform: scale(1); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
}
.breathe-btn {
  animation: breathe-btn-anim 2.5s ease-in-out infinite;
  display: inline-block;
}

/* 呼吸效果 - 文字標題區 */
@keyframes breathe-text-anim {
  0% { opacity: 0.3; }
  50% { opacity: 1; text-shadow: 0 0 8px rgba(0,0,0,0.1); }
  100% { opacity: 0.3; }
}
.breathe-text {
  animation: breathe-text-anim 2.5s ease-in-out infinite;
}

/* 發光效果 - 搜尋欄 (科技藍色光暈漸變) */
@keyframes glow-search-anim {
  0% { box-shadow: 0 0 5px rgba(37, 99, 235, 0.2); }
  50% { box-shadow: 0 0 15px rgba(37, 99, 235, 0.6), 0 0 25px rgba(37, 99, 235, 0.3); }
  100% { box-shadow: 0 0 5px rgba(37, 99, 235, 0.2); }
}
.glowing-search {
  animation: glow-search-anim 2.5s infinite ease-in-out;
}

/* ====== 15. 新增：遊戲區塊橫向卡片專屬樣式 ====== */
.game-card { 
  flex: 0 0 240px; 
  text-decoration: none; 
  display: flex; 
  flex-direction: column; 
  transition: transform var(--motion-fast); 
}
.game-card:hover, .game-card:active { 
  transform: translateY(-3px) scale(0.98); 
}
.game-img { 
  width: 100%; 
  aspect-ratio: 16 / 9; 
  border-radius: var(--radius-btn); 
  object-fit: cover; 
  box-shadow: var(--shadow-sm); 
  background-color: #f1f5f9;
}
/* ====== 16. 新增：深色/夜間模式 (Dark Mode) ====== */
body.dark-mode {
  /* 替換基礎色彩為深邃的板岩色 (Slate) */
  --color-bg-start: #0f172a; 
  --color-bg-end: #1e293b;   
  --color-card: #1e293b;
  
  /* 替換文字色彩為淺色 */
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  
  /* 調整標籤背景透明度，適應深色背景 */
  --color-trust-blue-bg: rgba(37, 99, 235, 0.15);
  --color-red-bg: rgba(225, 29, 72, 0.15);
  --color-green-bg: rgba(5, 150, 105, 0.15);
  --color-view-bg: rgba(217, 119, 6, 0.15);
  
  /* 讓陰影變得更深沉，提升立體感 */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-base: 0 8px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 15px 35px rgba(0,0,0,0.5);
}

/* 針對特定元件在深色模式下的細微調整 */
body.dark-mode .widget, body.dark-mode .news-ticker {
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode header h1 {
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
}

body.dark-mode .news-item {
  background-color: #334155; /* 深色新聞項目背景 */
}

body.dark-mode .news-item:hover, body.dark-mode .news-item:active {
  background-color: #475569;
}

body.dark-mode .viewpoint-img, body.dark-mode .game-img {
  background-color: #334155;
}

body.dark-mode select {
  background-color: #334155;
  color: #93c5fd;
}

body.dark-mode .search-pill, body.dark-mode .nav-autocomplete-list {
  background-color: #334155;
  border-color: #475569;
}

body.dark-mode .nav-autocomplete-list .suggestion-item {
  border-bottom-color: #475569;
}

body.dark-mode .nav-autocomplete-list .suggestion-item:hover {
  background-color: #475569;
}

body.dark-mode .bottom-bar {
  background-color: rgba(30, 41, 59, 0.95);
  border-top-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .modal-content {
  background: var(--color-card);
}

body.dark-mode .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .group-tab-btn {
  background-color: #334155;
}

body.dark-mode .ad-card {
  border-color: #475569;
}

body.dark-mode .skeleton-loader {
  background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
  background-size: 200% 100%;
}
