/* 藍鴨6號課程助理｜行動裝置優先，系統字型，無網頁字型 */

:root {
  --ink: #14202b;
  --sub: #2f3e4c;
  --heading: #0b2e4f;
  --brand: #0b4f8a;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #c9d6e3;
  --focus: #f2b705;
  --err: #8a1c1c;
  --ok: #1d5e2a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  /* 留給底部導覽：導覽列 64px + 上框線 1px + 安全區（iPhone home indicator） */
  padding-bottom: calc(65px + env(safe-area-inset-bottom));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* 標題列 */
.app-header {
  background: var(--brand);
  color: #ffffff;
  padding: 16px 20px;
}
.app-header .brand { margin: 0; font-size: 22px; font-weight: 700; }
.app-header .course { margin: 4px 0 0; font-size: 15px; }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

h1 { font-size: 24px; line-height: 1.35; margin: 4px 0 8px; color: var(--heading); }
h2 { font-size: 22px; line-height: 1.35; margin: 24px 0 8px; color: var(--heading); }
p { margin: 0 0 12px; }
.sub { margin: 0 0 16px; color: var(--sub); }
.eyebrow { margin: 0; font-size: 15px; font-weight: 700; color: var(--brand); }
.small, .note { font-size: 15px; color: var(--sub); }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.preview-note {
  font-size: 15px;
  color: var(--sub);
  background: #fff8db;
  border: 1px solid #e6c95c;
  border-radius: 10px;
  padding: 8px 12px;
}

/* 按鈕：整行寬、至少 56px 高、只做一件事 */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin: 12px 0 0;
  padding: 12px 16px;
  border: 2px solid var(--brand);
  border-radius: 12px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--brand); color: #ffffff; }
.btn.secondary { background: #ffffff; color: var(--brand); }
.btn:disabled { opacity: 0.6; cursor: default; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 時間列、資訊列 */
.timeline, .checklist, .facts {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.timeline li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: none; }
.timeline span { flex: 0 0 64px; font-weight: 700; color: var(--heading); }

.facts > div, .facts > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.facts > div:last-child, .facts > li:last-child { border-bottom: none; }
.facts dt { font-weight: 700; color: var(--heading); }
.facts dd { margin: 0; }

.checklist li {
  position: relative;
  padding: 10px 0 10px 36px;
  border-bottom: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
  content: "☐";
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 22px;
  color: var(--brand);
}

/* 課表 */
.day {
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 16px;
  padding: 0 20px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.day summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 0;
  min-height: 56px;
}
.day summary::-webkit-details-marker { display: none; }
.day summary::after {
  content: "展開";
  float: right;
  font-size: 15px;
  color: var(--brand);
  font-weight: 700;
}
.day[open] summary::after { content: "收合"; }
.day-date { font-size: 18px; font-weight: 700; color: var(--brand); }
.day-title { display: block; font-size: 20px; font-weight: 700; color: var(--heading); }
.today-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}
.day.is-today { border: 2px solid var(--brand); }
.day ol { margin: 0 0 8px; padding-left: 1.6em; }
.day li { padding: 4px 0; }
.self-study {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 問老師 */
.field-label { display: block; font-weight: 700; color: var(--heading); margin-bottom: 8px; }
textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 12px;
  font: inherit;
  font-size: 18px;
  color: var(--ink);
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}
.status {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
}
.status.success { background: #e6f4e9; color: var(--ok); }
.status.error { background: #fbe9e9; color: var(--err); }

/* 證書條件 */
.cert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.cert-item:last-child { border-bottom: none; }
.cert-item input {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  margin: 0;
  accent-color: var(--brand);
}

/* 底部導覽 */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)); /* 5 等分，單列 */
  padding-bottom: env(safe-area-inset-bottom);
  background: #ffffff;
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 6px 2px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  color: var(--sub);
  text-decoration: none;
}
.bottom-nav a[aria-current="page"] {
  background: var(--brand);
  color: #ffffff;
}

footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  font-size: 15px;
  color: var(--sub);
  text-align: center;
}
footer a { color: var(--sub); }
