/* === Base === */
:root {
  --green: #2d6a4f;
  --green-light: #95d5b2;
  --green-bg: #f0faf4;
  --blue: #1b4965;
  --text: #1b1b1b;
  --text-muted: #666;
  --border: #e0e0e0;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 8px;
  --max-w: 1100px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Noto Sans TC", sans-serif; color: var(--text); line-height: 1.7; background: #fafafa; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* === Header === */
.site-header { background: var(--green); color: #fff; padding: 0.8rem 0; }
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.site-title { color: #fff; font-weight: 700; font-size: 1.1rem; }
.site-title:hover { text-decoration: none; }
.site-header nav a { color: rgba(255,255,255,0.85); margin-left: 1.5rem; font-size: 0.9rem; }
.site-header nav a:hover { color: #fff; text-decoration: none; }

/* === Hero === */
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero h1 { font-size: 2.2rem; color: var(--green); margin-bottom: 0.5rem; }
.hero-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.progress-wrapper { max-width: 400px; margin: 0 auto; }
.progress-bar { background: var(--border); border-radius: 20px; height: 12px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--green), var(--green-light)); height: 100%; border-radius: 20px; transition: width 0.3s; }
.progress-text { display: block; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }

/* === Filter === */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 1.5rem 0; }
.filter-btn { border: 1px solid var(--border); background: #fff; padding: 0.35rem 0.9rem; border-radius: 20px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.filter-btn:hover, .filter-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

/* === Episode Grid === */
.episodes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; padding-bottom: 3rem; }
.episode-card { display: block; background: #fff; border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--card-shadow); border-left: 4px solid var(--green-light); transition: transform 0.15s, box-shadow 0.15s; }
.episode-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); text-decoration: none; }
.ep-badge { font-weight: 700; color: var(--green); font-size: 0.85rem; }
.series-tag { float: right; font-size: 0.75rem; background: var(--green-bg); color: var(--green); padding: 0.15rem 0.5rem; border-radius: 10px; }
.episode-card h3 { font-size: 1rem; margin: 0.5rem 0 0.3rem; color: var(--text); }
.episode-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.episode-card time { font-size: 0.75rem; color: #999; }

/* === Episode Detail === */
.episode-detail { padding: 2rem 0 3rem; }
.back-link { font-size: 0.85rem; color: var(--text-muted); display: inline-block; margin-bottom: 1rem; }
.episode-header { margin-bottom: 2rem; }
.series-badge { display: inline-block; background: var(--green-bg); color: var(--green); padding: 0.2rem 0.7rem; border-radius: 12px; font-size: 0.8rem; margin-bottom: 0.5rem; }
.episode-header h1 { font-size: 1.6rem; color: var(--green); margin-bottom: 0.5rem; }
.episode-header .outline { color: var(--text-muted); font-style: italic; }
.episode-header time { font-size: 0.8rem; color: #999; }

/* === Slides Gallery === */
.slides-section { margin: 2rem 0; }
.slides-section h2 { font-size: 1.2rem; color: var(--blue); margin-bottom: 1rem; border-bottom: 2px solid var(--green-light); padding-bottom: 0.3rem; }
.slides-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.slide-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.slide-card img { width: 100%; height: auto; display: block; }
.slide-card h3 { font-size: 0.95rem; padding: 0.6rem 0.8rem 0.2rem; color: var(--green); }
.slide-card ul { padding: 0 0.8rem 0.8rem 1.6rem; font-size: 0.85rem; color: var(--text-muted); }

/* === Research Content === */
.research-content { margin: 2rem 0; }
.research-content h2 { font-size: 1.2rem; color: var(--blue); margin-bottom: 1rem; border-bottom: 2px solid var(--green-light); padding-bottom: 0.3rem; }
.research-content h1, .research-content h2, .research-content h3 { margin-top: 1.5rem; }
.research-content ul, .research-content ol { padding-left: 1.5rem; }
.research-content li { margin-bottom: 0.3rem; }

/* === Podcast Player === */
.podcast-section { margin: 1.5rem 0; }
.podcast-section + .podcast-section { margin-top: 1rem; }
.podcast-section h2 { font-size: 1.2rem; color: var(--blue); margin-bottom: 0.8rem; border-bottom: 2px solid var(--green-light); padding-bottom: 0.3rem; }
.player-controls { display: flex; align-items: center; gap: 0.8rem; background: #fff; padding: 0.8rem 1rem; border-radius: var(--radius); box-shadow: var(--card-shadow); }
.play-btn { background: var(--green); color: #fff; border: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s; }
.play-btn:hover { background: var(--blue); }
.progress-container { flex: 1; }
.player-progress { background: var(--border); border-radius: 4px; height: 6px; cursor: pointer; position: relative; }
.player-progress-fill { background: linear-gradient(90deg, var(--green), var(--green-light)); height: 100%; border-radius: 4px; width: 0; transition: width 0.1s linear; }
.time-display { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.speed-select { border: 1px solid var(--border); border-radius: 4px; padding: 0.2rem 0.3rem; font-size: 0.8rem; background: #fff; color: var(--text); cursor: pointer; flex-shrink: 0; }

/* === Transcript Download === */
.transcript-download { margin-top: 0.6rem; }
.download-btn { display: inline-flex; align-items: center; gap: 0.4rem; background: #fff; border: 1px solid var(--green-light); color: var(--green); padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.85rem; text-decoration: none; transition: all 0.2s; }
.download-btn:hover { background: var(--green); color: #fff; text-decoration: none; }

/* === Video Section === */
.video-section { margin: 2rem 0; }
.video-section h2 { font-size: 1.2rem; color: var(--blue); margin-bottom: 0.8rem; border-bottom: 2px solid var(--green-light); padding-bottom: 0.3rem; }
.video-section video { width: 100%; border-radius: var(--radius); box-shadow: var(--card-shadow); background: #000; }

/* === Episode Nav === */
.episode-nav { display: flex; justify-content: space-between; padding: 2rem 0; border-top: 1px solid var(--border); margin-top: 2rem; }
.nav-prev, .nav-next { font-size: 0.9rem; }

/* === Footer === */
.site-footer { background: var(--green); color: rgba(255,255,255,0.8); padding: 1.5rem 0; text-align: center; margin-top: 3rem; }
.site-footer .subtitle { font-size: 0.75rem; opacity: 0.6; margin-top: 0.3rem; }

/* === Responsive === */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .episodes-grid { grid-template-columns: 1fr; }
  .slides-grid { grid-template-columns: 1fr 1fr; }
}

/* === Podcast Player === */
.podcast-section { margin: 2rem 0; }
.podcast-section + .podcast-section { margin-top: 1rem; }
.podcast-section h2 { font-size: 1.3rem; color: var(--green); margin-bottom: 0.8rem; }
.podcast-player {
  background: var(--green-bg);
  border: 1px solid var(--green-light);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.play-btn {
  width: 48px; height: 48px;
  min-width: 48px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.play-btn:hover { background: #245a42; }
.player-info { flex: 1; min-width: 0; }
.player-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.4rem;
}
.player-progress { width: 100%; }
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.progress-played {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}
.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.speed-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s;
}
.speed-btn:hover { border-color: var(--green); }

/* === Transcript Download === */
.transcript-download {
  margin-top: 0.6rem;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--green-light);
  color: var(--green);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}
.download-btn:hover {
  background: var(--green);
  color: #fff;
  text-decoration: none;
}
.download-btn svg {
  flex-shrink: 0;
}

/* === Video Section === */
.video-section {
  margin: 2rem 0;
}
.video-section h2 {
  font-size: 1.3rem;
  color: var(--blue);
  margin-bottom: 0.8rem;
  border-bottom: 2px solid var(--green-light);
  padding-bottom: 0.3rem;
}
.video-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #000;
}
.video-wrapper video {
  width: 100%;
  display: block;
}

@media (max-width: 600px) {
  .player-controls { flex-wrap: wrap; }
  .play-btn { width: 40px; height: 40px; min-width: 40px; }
}
/* === iPAS Supplement Section === */
.ipas-index { padding: 2rem 0 3rem; }
.ipas-index h1 { font-size: 1.8rem; color: var(--green); margin-bottom: 0.8rem; }
.ipas-index > p { color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.8; }

.ipas-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; margin: 2rem 0; }
.ipas-card { display: block; background: #fff; border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--card-shadow); border-left: 4px solid var(--green); transition: transform 0.15s, box-shadow 0.15s; position: relative; }
.ipas-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); text-decoration: none; }
.ipas-card-num { display: inline-block; background: var(--green); color: #fff; width: 28px; height: 28px; border-radius: 50%; text-align: center; line-height: 28px; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem; }
.ipas-card h3 { font-size: 1.05rem; color: var(--text); margin: 0.3rem 0; }
.ipas-card-unit { font-size: 0.75rem; color: var(--text-muted); }

/* iPAS Detail Page */
.ipas-detail { padding: 2rem 0 3rem; }
.ipas-header { margin-bottom: 1.5rem; }
.ipas-badge { display: inline-block; background: var(--green-bg); color: var(--green); padding: 0.2rem 0.7rem; border-radius: 12px; font-size: 0.8rem; margin-bottom: 0.5rem; }
.ipas-header h1 { font-size: 1.6rem; color: var(--green); margin-bottom: 0.5rem; }

/* iPAS Topic Nav Bar */
.ipas-topics-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.ipas-topic-link { border: 1px solid var(--border); background: #fff; padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; color: var(--text-muted); transition: all 0.2s; }
.ipas-topic-link:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.ipas-topic-link.active { background: var(--green); color: #fff; border-color: var(--green); }

/* iPAS Content Styling */
.ipas-content h2 { font-size: 1.3rem; color: var(--blue); margin: 2rem 0 0.8rem; border-bottom: 2px solid var(--green-light); padding-bottom: 0.3rem; }
.ipas-content h3 { font-size: 1.1rem; color: var(--green); margin: 1.5rem 0 0.5rem; }
.ipas-content h4 { font-size: 1rem; color: var(--text); margin: 1rem 0 0.5rem; }
.ipas-content p { margin-bottom: 0.8rem; }
.ipas-content ul, .ipas-content ol { padding-left: 1.5rem; margin-bottom: 0.8rem; }
.ipas-content li { margin-bottom: 0.3rem; }
.ipas-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.ipas-content th { background: var(--green); color: #fff; padding: 0.5rem 0.8rem; text-align: left; font-size: 0.85rem; }
.ipas-content td { padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border); }
.ipas-content tr:hover td { background: var(--green-bg); }
.ipas-content blockquote { background: var(--green-bg); border-left: 4px solid var(--green); padding: 0.8rem 1rem; margin: 1rem 0; border-radius: 0 var(--radius) var(--radius) 0; }
.ipas-content blockquote p { margin-bottom: 0; color: var(--green); font-weight: 500; }

/* Exam callout box */
.ipas-content .exam-tip { background: #fff8e1; border-left: 4px solid #f9a825; padding: 0.8rem 1rem; margin: 1rem 0; border-radius: 0 var(--radius) var(--radius) 0; }
.ipas-content .exam-tip p { margin-bottom: 0; }
.ipas-content .exam-questions { background: #e3f2fd; border-left: 4px solid #1565c0; padding: 0.8rem 1rem; margin: 1rem 0; border-radius: 0 var(--radius) var(--radius) 0; }

@media (max-width: 600px) {
  .ipas-cards { grid-template-columns: 1fr; }
  .ipas-topics-nav { gap: 0.3rem; }
  .ipas-topic-link { font-size: 0.75rem; padding: 0.25rem 0.6rem; }
}

/* ===== News Page ===== */
.news-page { max-width: 900px; margin: 0 auto; padding: 1rem; }
.news-hero { text-align: center; margin-bottom: 2rem; }
.news-hero h1 { font-size: 2rem; color: #2d6a4f; margin-bottom: .5rem; }
.news-hero-sub { color: #666; font-size: 1.1rem; }

.news-list { display: flex; flex-direction: column; gap: 1.2rem; }
.news-card {
  display: flex; gap: 1rem; padding: 1rem;
  border: 1px solid #e0e0e0; border-radius: 8px;
  text-decoration: none; color: inherit;
  transition: box-shadow .2s, border-color .2s;
}
.news-card:hover { box-shadow: 0 2px 12px rgba(45,106,79,.15); border-color: #2d6a4f; }
.news-card-image { flex-shrink: 0; width: 140px; height: 100px; border-radius: 6px; overflow: hidden; }
.news-card-image img { width: 100%; height: 100%; object-fit: cover; }
.news-card-body { flex: 1; min-width: 0; }
.news-card-meta { font-size: .8rem; color: #888; margin-bottom: .3rem; display: flex; gap: .6rem; }
.news-card-source { color: #2d6a4f; font-weight: 500; }
.news-card-body h3 { font-size: 1.05rem; margin: 0 0 .4rem; color: #333; line-height: 1.4; }
.news-card-body p { font-size: .9rem; color: #555; margin: 0; line-height: 1.5; }
.news-card-tags, .news-card-episodes { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.news-tag { background: #e8f5e9; color: #2d6a4f; padding: 2px 8px; border-radius: 4px; font-size: .75rem; }
.news-ep-tag { background: #e3f2fd; color: #1565c0; padding: 2px 8px; border-radius: 4px; font-size: .75rem; }
.news-empty { text-align: center; padding: 3rem; color: #999; }

/* ===== News Detail ===== */
.news-detail { max-width: 720px; margin: 0 auto; padding: 1rem; }
.back-link { color: #2d6a4f; text-decoration: none; font-size: .9rem; }
.back-link:hover { text-decoration: underline; }
.news-header { margin-bottom: 1.5rem; }
.news-date { color: #888; font-size: .85rem; margin-right: .5rem; }
.news-source { color: #2d6a4f; font-size: .85rem; font-weight: 500; }
.news-header h1 { font-size: 1.6rem; color: #1b4332; margin: .8rem 0 .5rem; line-height: 1.3; }
.news-summary { color: #555; font-size: 1rem; line-height: 1.6; margin-bottom: .8rem; }
.tag-list { display: flex; gap: .4rem; flex-wrap: wrap; }
.news-hero-image { margin: 1rem 0; border-radius: 8px; overflow: hidden; }
.news-hero-image img { width: 100%; height: auto; }
.news-content { line-height: 1.8; color: #333; font-size: 1rem; }
.news-content p { margin-bottom: 1rem; }

.related-episodes { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
.related-episodes h3 { color: #2d6a4f; margin-bottom: .8rem; }
.related-grid { display: flex; gap: .8rem; flex-wrap: wrap; }
.related-card {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .8rem; border: 1px solid #e0e0e0; border-radius: 6px;
  text-decoration: none; color: inherit; font-size: .9rem;
}
.related-card:hover { border-color: #2d6a4f; background: #f0f7f4; }
.related-badge { background: #2d6a4f; color: #fff; padding: 2px 6px; border-radius: 4px; font-size: .75rem; }
.related-title { color: #333; }
.news-source-link { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; }
.news-source-link a { color: #2d6a4f; text-decoration: none; }
.news-source-link a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .news-card { flex-direction: column; }
  .news-card-image { width: 100%; height: 180px; }
}
