/* ===== 全域設定 ===== */
:root {
    --header-offset: 110px;
    --bg-main: #050814;
    --bg-panel: #0c1224;
    --bg-panel-soft: #10172f;
    --accent: #4fd1c5;
    --accent-soft: #38b2ac;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-soft: #1f2937;
    --code-bg: #020617;
    --danger: #f97373;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                    "Noto Sans TC", sans-serif;
    background: radial-gradient(circle at top, #111827 0, #020617 45%, #000 100%);
    color: var(--text-main);
    line-height: 1.6;
}

/* ===== 頁首 ===== */
header {
    border-bottom: 1px solid var(--border-soft);
    background: rgba(5, 8, 20, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);  /* 舊版 Safari 的前綴寫法 */
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 900px;
    margin: 0 20px;
    padding: 14px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
    box-shadow: 0 0 12px rgba(79, 209, 197, 0.55);
    font-size: 14px;
}

.brand-text-block {
    display: flex;
    flex-direction: column;
}

.brand-text-title {
    font-size: 18px;
    font-weight: 700;
}

.brand-text-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* 上方導覽：移到副標題下方 */
.top-nav {
    margin-top: 6px;
}

.top-nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 16px;
    font-size: 14px;
    position: relative;
}

.top-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
    transition: width 0.2s ease-out;
}

.top-nav a:hover {
    color: var(--accent);
}

.top-nav a:hover::after {
    width: 100%;
}

/* ===== 版面 ===== */
.layout {
    max-width: 900px;
    margin: 24px 20px 0px 0px;
    padding: 0 20px 40px;
    display: grid;
    /* 左窄（側欄），右寬（主內容） */
    grid-template-columns: minmax(230px, 1fr) minmax(0, 2.4fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ===== 左側 / 右側通用 ===== */
.card {
    background: linear-gradient(145deg, #020617 0%, #020617 40%, #020617 60%, #000 100%);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow:
        0 20px 40px rgba(15, 23, 42, 0.85),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    padding: 22px 24px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    width: auto;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12) 0, transparent 55%),
        radial-gradient(circle at 100% 0%, rgba(45, 212, 191, 0.12) 0, transparent 55%);
    opacity: 0.8;
}

.card > * {
    position: relative;
    z-index: 1;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.card-title-tag {
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-muted);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.chip {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    color: var(--accent);
    background: rgba(15, 23, 42, 0.9);
}

h3 {
    margin: 14px 0 6px;
    font-size: 16px;
    color: var(--accent);
    letter-spacing: 0.03em;
}

p {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 6px;
}

ul {
    padding-left: 18px;
    margin-bottom: 8px;
}

li {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 3px;
}

.hint {
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid var(--accent-soft);
    padding-left: 8px;
    margin-top: 4px;
}

/* ===== 表格 ===== */
.table-wrap {
    margin: 8px 0 10px;
    overflow-x: auto;
    width: auto;
    height: auto;
}

table {
    width: auto;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    border: 1px solid rgba(55, 65, 81, 0.7);
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}
th{text-align: center;}

th {
    background: rgba(15, 23, 42, 0.9);
    color: var(--accent);
    font-weight: 600;
}
tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.7);
}
tr:nth-child(odd) td {
    background: rgba(15, 23, 42, 0.4);
}

.tdT{
    vertical-align: top;
}
/* ===== 程式碼區塊 ===== */
pre, code {
    font-family: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
    font-size: 13px;
}
pre {
    background: var(--code-bg);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(30, 64, 175, 0.7);
    box-shadow: 0 0 18px rgba(30, 64, 175, 0.5);
    position: relative;
    margin: 8px 0 10px;
    color: #e5e7eb;
}
pre::before {
    content: "code";
    position: absolute;
    right: 10px;
    top: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}
.code-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
/* ===== 左側導覽／重點 ===== */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel {
    background: rgba(10, 16, 32, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 14px 14px 16px;
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
        radial-gradient(circle at 90% 100%, rgba(129, 140, 248, 0.12), transparent 55%);
    opacity: 0.8;
    pointer-events: none;
}

.panel > * {
    position: relative;
    z-index: 1;
}

.panel-title {
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
}

.toc {
    list-style: none;
    padding-left: 0;
    font-size: 13px;
}

.toc li {
    margin-bottom: 4px;
}

.toc a {
    color: var(--text-main);
    text-decoration: none;
}

.toc a span {
    color: var(--accent-soft);
    font-size: 12px;
    margin-right: 4px;
}

.toc a:hover {
    color: var(--accent);
}
/* 全站超連結顏色：亮黃色系，在深藍底上比較醒目 */
a {
    color: #facc15;              /* 亮黃 (可以改成你喜歡的色號) */
    text-decoration: none;
}

a:hover {
    color: #fde047;              /* 更亮一點的黃 */
    text-decoration: underline;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-muted);
}

.tip-box {
    font-size: 13px;
    border-left: 2px solid var(--accent);
    padding-left: 8px;
    color: var(--text-main);
}

.tip-strong {
    color: var(--accent-soft);
    font-weight: 600;
}
.ulM{
    margin-top:4px;
    padding-left:18px;
}

footer {
    max-width: 900px;
    margin: -40px 0px 50px 140px;
    padding: 0 20px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

#desc,
#qList,
#submit,
a[name^="hw"] {
    scroll-margin-top: var(--header-offset);
}

/* 左側「題目列表」的小項目樣式 */
.side-panel .toc li {
    list-style: none;            /* 拿掉預設小圓點 */
    margin: 4px 0;
}

/* 01 / 02 / 03... 編號膠囊 */
.side-panel .toc li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2em;
    height: 1.6em;
    margin-right: 0.5rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.16); /* 淺藍底 */
    color: #facc6b;                         /* 柔和黃色字 */
}

/* 題目連結文字顏色 */
.side-panel .toc li a {
    color: #e5f2ff;             /* 淺藍白 */
    text-decoration: none;
}

/* hover 時與編號色系呼應 */
.side-panel .toc li a:hover {
    color: #facc6b;
}
latex {
    display: block;
    text-align: left;
}
.td300{width:300px;}
.td300 ol, .td300 ul{
    margin-left: 0;
    padding-left: 8px;
    list-style-position: inside; /* 項目符號留在框線內 */
}
.td400{width:400px;}
.thw150{width:150px;}
.thw200{width:200px;}