/* 生活中的科學｜共用版面 */
* { box-sizing: border-box; }

:root {
    --bg: #0a0e27;
    --bg-2: #10162f;
    --panel: rgba(21, 25, 50, 0.92);
    --panel-2: rgba(13, 18, 43, 0.92);
    --cyan: #00f0ff;
    --purple: #9d6cff;
    --pink: #ff4d94;
    --text: #f7f9ff;
    --muted: #b6bfdc;
    --border: rgba(0, 240, 255, 0.24);
    --shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
    --radius: 18px;
}

html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
    line-height: 1.75;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(0, 240, 255, 0.08), transparent 28rem),
        radial-gradient(circle at 90% 12%, rgba(157, 108, 255, 0.09), transparent 30rem),
        linear-gradient(180deg, var(--bg) 0%, #080b1d 100%);
}

a { color: var(--cyan); text-decoration: none; }
a:hover, a:focus-visible { color: #86f8ff; text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid rgba(0, 240, 255, 0.55); outline-offset: 3px; }

.container { width: min(1380px, calc(100% - 32px)); margin: 0 auto; }

.header { padding: 48px 0 28px; text-align: center; }
.header-content {
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(21, 25, 50, 0.78), rgba(10, 14, 39, 0.86));
    box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.06);
}
.title { margin: 0; line-height: 1.15; }
.title-main {
    display: block;
    font-size: clamp(2.1rem, 5vw, 3.65rem);
    font-weight: 800;
    letter-spacing: .08em;
    background: linear-gradient(90deg, var(--cyan), var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.title-sub {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-size: clamp(.96rem, 2vw, 1.2rem);
    font-weight: 400;
    letter-spacing: .12em;
}

.page-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 18px 0 0;
}
.nav-link, .external-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid rgba(0, 240, 255, .28);
    border-radius: 999px;
    background: rgba(0, 240, 255, .07);
    color: #d9fbff;
    line-height: 1.4;
}
.nav-link:hover, .external-link:hover { background: rgba(0, 240, 255, .13); text-decoration: none; }

.main-content { padding: 6px 0 54px; }
.panel, .table-wrapper, .content-card {
    margin-bottom: 22px;
    padding: clamp(20px, 3vw, 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
}
.panel > :first-child, .content-card > :first-child { margin-top: 0; }
.panel > :last-child, .content-card > :last-child { margin-bottom: 0; }

h2, h3 { color: #f8fbff; line-height: 1.35; }
h2 { margin: 0 0 18px; font-size: 1.55rem; }
h3 { margin: 26px 0 10px; font-size: 1.16rem; color: #d5c8ff; }
p { margin: 0 0 14px; }
ul, ol { margin-top: 8px; padding-left: 1.5em; }
li + li { margin-top: 6px; }
hr { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 24px 0; }

.lead { font-size: 1.08rem; color: #e8ecff; }
.muted, .note { color: var(--muted); }
.note-box {
    margin: 18px 0;
    padding: 14px 16px;
    border-left: 4px solid var(--purple);
    border-radius: 10px;
    background: rgba(157, 108, 255, .08);
    color: #e8e0ff;
}

/* 首頁課程表 */
.table-wrapper { overflow-x: auto; }
.course-table, .info-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}
.course-table th, .course-table td, .info-table th, .info-table td {
    padding: 15px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    vertical-align: top;
}
.course-table th, .info-table th {
    background: linear-gradient(135deg, rgba(102,126,234,.72), rgba(118,75,162,.72));
    text-align: center;
    font-weight: 700;
}
.course-table tbody tr:hover, .info-table tbody tr:hover { background: rgba(255,255,255,.025); }
.col-date { width: 110px; }
.col-note { width: 100px; }
.date, .note { text-align: center; }
.date { color: var(--cyan); font-weight: 700; }
.content-section { margin: 10px 0; }
.label { display: block; margin-bottom: 6px; color: #cbbcff; font-weight: 700; }
.link-list, .sub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* 內頁內容 */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}
.resource-card {
    padding: 16px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
}
.resource-card h3 { margin-top: 0; }
.lesson-table { width: 100%; border-collapse: separate; border-spacing: 0 14px; }
.lesson-table td {
    padding: 18px;
    background: rgba(255,255,255,.035);
    border-top: 1px solid rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.lesson-table td:first-child {
    width: 145px;
    color: var(--cyan);
    font-weight: 700;
    text-align: center;
    border-left: 1px solid rgba(255,255,255,.08);
    border-radius: 12px 0 0 12px;
}
.lesson-table td:last-child {
    border-right: 1px solid rgba(255,255,255,.08);
    border-radius: 0 12px 12px 0;
}

.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
figure { margin: 0; }
figure img, .responsive-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.12);
    background: #060817;
}
figcaption { margin-top: 8px; text-align: center; color: var(--muted); font-size: .94rem; }
.portrait { max-width: 340px; margin: 0 auto; }
video { display: block; width: min(100%, 760px); height: auto; margin: 12px auto 0; border-radius: 12px; background: #000; }
.inline-icon { width: 42px; height: 42px; object-fit: contain; vertical-align: middle; border: 0; border-radius: 8px; }

.footer {
    margin-top: 8px;
    padding: 26px 0 36px;
    border-top: 1px solid rgba(255,255,255,.1);
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
}

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 10;
    display: none;
    padding: 9px 12px;
    border: 1px solid rgba(0,240,255,.34);
    border-radius: 10px;
    color: var(--text);
    background: rgba(16,22,47,.94);
    cursor: pointer;
}
.back-to-top.show { display: block; }

@media (max-width: 760px) {
    .container { width: min(100% - 20px, 1380px); }
    .header { padding-top: 18px; }
    .header-content { padding: 22px 16px; }
    .table-wrapper, .panel, .content-card { padding: 15px; border-radius: 14px; }
    .media-grid { grid-template-columns: 1fr; }
    .lesson-table, .lesson-table tbody, .lesson-table tr, .lesson-table td { display: block; width: 100%; }
    .lesson-table { border-spacing: 0; }
    .lesson-table tr { margin-bottom: 14px; }
    .lesson-table td:first-child, .lesson-table td:last-child { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; }
    .lesson-table td:first-child { margin-bottom: 6px; }
    .course-table, .info-table { min-width: 620px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
