:root { --ink: #1a1a2e; --muted: #666; --accent: #0f6fde; --bg: #fafaf7; --line: #e5e2da; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang HK", "Microsoft JhengHei", "Noto Sans TC", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.8; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 14px 20px; }
.site-title { font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.site-header nav a { margin-left: 18px; color: var(--muted); }
.site-header nav a:hover { color: var(--accent); }

main.wrap { padding-top: 28px; padding-bottom: 48px; }
.site-desc { color: var(--muted); }

.post h1 { font-size: 1.7rem; line-height: 1.4; }
.post-meta { color: var(--muted); font-size: .9rem; }
.post img { max-width: 100%; height: auto; }
.post h2 { border-bottom: 2px solid var(--line); padding-bottom: 6px; margin-top: 2.2em; }
.post table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.post th, .post td { border: 1px solid var(--line); padding: 8px 12px; }
.post th { background: #f0eee8; }

.disclaimer-box { background: #fff8e1; border: 1px solid #f0d878; border-radius: 8px; padding: 12px 16px; font-size: .92rem; margin: 18px 0; }
.toc { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 18px; margin: 18px 0; font-size: .95rem; }
.toc summary { font-weight: 600; cursor: pointer; }

.video-embed { position: relative; padding-bottom: 56.25%; height: 0; margin: 20px 0; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

.post-list { list-style: none; padding: 0; }
.post-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.post-list .date { color: var(--muted); font-size: .85rem; margin-left: 10px; }
.post-list .summary { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }
.section-label { font-size: .78rem; background: #eef4fd; color: var(--accent); border-radius: 4px; padding: 2px 8px; margin-left: 8px; }
.tag { font-size: .85rem; }

.site-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .88rem; margin-top: 40px; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 20px; }
.footer-disclaimer { color: #9a7b00; }

/* 卡片網格 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin: 20px 0 32px; }
.card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--ink); transition: box-shadow .15s ease; }
.card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #eee; }
.card-body { padding: 14px 16px 16px; }
.card-body h3 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.5; }
.card-body p { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
.card-meta { font-size: .82rem; color: var(--accent); }
.lesson-badge { display: inline-block; font-size: .78rem; background: #eef4fd; color: var(--accent); border-radius: 4px; padding: 2px 8px; margin-bottom: 8px; }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

/* 文章內文左右對齊 */
.post p, .post li { text-align: justify; text-justify: inter-ideograph; }

/* 麵包屑 */
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--ink); }

/* 課程進度徽章 */
.lesson-progress { display: inline-block; font-size: .82rem; background: #eef4fd; color: var(--accent); border-radius: 4px; padding: 2px 10px; margin: 0 0 8px; }

/* 上一課/下一課導航 */
.lesson-nav { display: flex; gap: 12px; align-items: stretch; margin: 36px 0 24px; }
.lesson-nav a { flex: 1; display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); }
.lesson-nav a:hover { text-decoration: none; border-color: var(--accent); }
.lesson-nav .nav-label { display: block; font-size: .82rem; color: var(--accent); margin-bottom: 6px; }
.lesson-nav .nav-title { display: block; font-size: .92rem; line-height: 1.5; }
.lesson-next { text-align: right; }
.lesson-toc { flex: 0 0 auto; display: flex !important; align-items: center; font-size: .9rem; color: var(--muted) !important; }
@media (max-width: 640px) { .lesson-nav { flex-direction: column; } .lesson-next { text-align: left; } }

/* 相關筆記 */
.related-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; margin-top: 24px; }
.related-box h2 { border: 0; margin: 0 0 10px; font-size: 1.15rem; }
.related-box ul { margin: 0; padding-left: 20px; }
.related-box li { margin: 6px 0; }
