:root {
  --maxw: 900px;
  --border: #e6e6e6;
  --text: #222;
  --muted: #666;
  --bg: #fff;
  --soft: #fafafa;

  --anchor-offset: 90px; /* 未來若又加 hash 可用 */
}

body {
  margin: 0;
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", "PingFang TC", sans-serif;
  line-height: 1.8;
  background: var(--bg);
  color: var(--text);
}

/* =========================
     頂部導覽列
     ========================= */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.top-nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.top-nav__back {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: var(--soft);
  font-weight: 700;
}

.top-nav__back::before {
  content: "";
  margin-right: 0;
}

.top-nav__link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.top-nav__sep {
  color: var(--muted);
  opacity: 0.9;
}

.top-nav__current {
  font-weight: 700;
  color: #555;
}

.top-nav a:hover {
  text-decoration: underline;
}

.top-nav a:focus-visible {
  outline: 2px solid #99c2ff;
  outline-offset: 2px;
  border-radius: 10px;
}

/* =========================
     頁面標題
     ========================= */
header.unit-header {
  max-width: var(--maxw);
  margin: 0 auto 18px;
  padding: 16px 20px 0;
}

header.unit-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

header.unit-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* =========================
     內容區
     ========================= */
main.catalog {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 20px 40px;
}

/* =========================
     ✅ 清單版唸得明白
     ========================= */
.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.course-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 12px 12px;
  border-top: 1px solid #e5e5e5;
}

.course-item:first-child {
  border-top: none;
}

.course-item:hover {
  background: #f9f9f9;
}

.course-unit {
  white-space: nowrap;
  font-weight: 700;
  color: #333;
}

.course-title a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  padding: 2px 0;
}

.course-title a:hover {
  text-decoration: underline;
}

/* ✅ 「點下去後」在此頁面就先顯示黃色（用 :active 做按下瞬間回饋） */
.course-title a:active {
  background: #fff7cc;
  outline: 2px solid #f3d36a;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: -8px;
}

/* 小螢幕微調 */
@media (max-width: 520px) {
  .top-nav__inner {
    padding: 8px 12px;
    gap: 6px;
    font-size: 13px;
    line-height: 1.35;
  }

  .top-nav__back,
  .top-nav__link {
    padding: 4px 8px;
    border-radius: 10px;
  }

  .course-item {
    grid-template-columns: 86px 1fr;
    padding: 10px 10px;
    gap: 10px;
  }

  .course-title a {
    font-weight: 700;
  }
  
  header.unit-header {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 6px 20px;
  }
  
  header.unit-header h1 {
    font-size: 1.3rem;
  }
  
  main.catalog {
    padding: 10px 20px 40px;
  }
}

/* 列印 */
@media print {
  @page {
    size: A4;
    margin: 20mm 18mm;
  }

  .top-nav {
    display: none;
  }

  body {
    font-size: 12pt;
  }

  .course-item {
    page-break-inside: avoid;
  }
}
