/*
 * 電腦概論 How Computers Work（/resources/classes/computers/）專屬樣式。
 * 共用的版面在 astro.css（.astro-lab、.al-*、.ph-card、.cc-card、.myth、.trick、.act）；這裡的 class 前綴一律 cp-。
 * 只載在本系列的頁面（build.py 的 _comp_head()）；晶片系列的 chips.css 也用 cp-，兩支不會同時載入。
 * 中文一律系統字（var(--zh)），不載中文網頁字型。
 */

/* ── 3D 模型：一排開關與燈泡 ─────────────────────────────────────────── */
.cp-lab .al-stage { grid-template-columns: minmax(0, 1fr) 350px; }
.cp-lab .al-space { min-height: 560px; background: radial-gradient(70% 60% at 50% 40%, rgba(255,201,74,.10), transparent 70%); }
.cp-lab .al-space-cv { touch-action: none; }
.cp-lab .al-hint { left: auto; right: 1rem; text-align: right; }
.al-lab.cp-lb { min-width: 1.7em; text-align: center; font-size: .86rem; font-weight: 800; line-height: 1.25; padding: .1rem .5rem; font-variant-numeric: tabular-nums; color: var(--al-mute); }
.al-lab.cp-lb.is-on { color: #1b1405; background: rgba(255,211,110,.95); border-color: #ffd36e; box-shadow: 0 6px 18px -8px rgba(0,0,0,.6); }
.al-lab.cp-lb small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; }
.al-lab.cp-lb-carry { color: #052421; background: rgba(126,240,227,.95); border-color: #7ef0e3; font-size: .7rem; }
.al-lab.cp-lb-carry small { color: #0d3a35; }
.al-lab.cp-lb-end { font-size: .7rem; color: #ffe3a3; border-color: rgba(201,161,74,.7); }
.al-lab.cp-lb[hidden] { display: none; }
.cp-narrow .al-lab.cp-lb { font-size: .7rem; padding: .05rem .34rem; min-width: 1.4em; }

.cp-aside { display: flex; flex-direction: column; gap: .6rem; }
.cp-aside > * { min-width: 0; }
.cp-aside .al-sky-k { margin-bottom: 0; }
.cp-num { margin: 0; font-family: var(--serif); font-size: 4rem; font-weight: 700; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.cp-carrying .cp-num { color: var(--al-mute); }
.cp-eq { margin: 0; min-height: 2.9em; font-size: .98rem; font-weight: 700; line-height: 1.45; color: var(--al-sun); font-variant-numeric: tabular-nums; }
.cp-binw { margin: 0; display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; padding-top: .55rem; border-top: 1px solid var(--al-line); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--al-mute); }
.cp-bin { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.12rem; letter-spacing: .08em; color: #fff; text-transform: none; }
.cp-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .22rem; }
.cp-strip button { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .34rem 0 .3rem; border-radius: 9px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-mute); font-family: var(--sans); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.cp-strip button small { font-size: .62rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cp-strip button b { font-size: 1.05rem; font-weight: 800; line-height: 1; }
.cp-strip button:hover { background: rgba(255,255,255,.08); }
.cp-strip button[aria-pressed="true"] { background: var(--al-sun); border-color: var(--al-sun); color: #1b1405; box-shadow: 0 0 16px -4px rgba(255,211,110,.8); }
.cp-novalues .cp-strip button small { visibility: hidden; }
.cp-btns { display: flex; flex-wrap: wrap; gap: .45rem; }
.cp-btn-d { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: 999px; border: 1px solid rgba(255,211,110,.45); background: transparent; color: var(--al-sun); font-family: var(--sans); font-weight: 800; font-size: .82rem; cursor: pointer; transition: background .2s; }
.cp-btn-d:hover { background: rgba(255,211,110,.12); }
.cp-add { background: rgba(255,211,110,.14); }
.cp-msg { margin: 0; min-height: 6.4em; font-size: .83rem; line-height: 1.6; color: var(--al-text); }
.cp-msg .zh { display: block; margin-top: .25rem; color: var(--al-mute); }
.cp-k2 { margin-top: .1rem !important; }
.cp-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.cp-seg button { padding: .42rem .2rem; border-radius: 11px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-text); font-family: var(--sans); font-weight: 800; font-size: .76rem; line-height: 1.2; cursor: pointer; }
.cp-seg button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-seg button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.14); box-shadow: 0 0 0 1px var(--al-sun) inset; }
.cp-credit { margin: 0; padding: 0 1.3rem 1.1rem; font-size: .74rem; line-height: 1.6; color: #7f90b0; }
.cp-credit a { color: var(--al-mute); text-decoration: underline; text-underline-offset: 2px; }
/* 沒有 WebGL：3D 不畫，右邊的數字、位元列和按鈕照樣能用 */
.cp-lab.al-nogl .al-sky { display: flex; }
.cp-lab.al-nogl .al-controls { display: block; }
.cp-lab.al-nogl .al-space { min-height: 150px; aspect-ratio: auto; border-right: 0; border-bottom: 1px solid var(--al-line); }
@media (max-width: 1000px) {
  .cp-lab .al-stage { grid-template-columns: minmax(0, 1fr); }
  .cp-lab .al-space { aspect-ratio: 16 / 9; min-height: 340px; max-height: 80vh; border-right: 0; border-bottom: 1px solid var(--al-line); }
  .cp-msg { min-height: 4.6em; }
}
@media (max-width: 620px) {
  .cp-lab .al-space { aspect-ratio: 16 / 10; min-height: 0; max-height: 70vh; }
  .cp-lab .al-hint { display: none; }
  .cp-num { font-size: 3.2rem; }
  .cp-msg { min-height: 7.6em; }
}

/* ── 課程卡、卡片小圖 ─────────────────────────────────────────────────── */
.cp-ico { background: radial-gradient(circle at 50% 40%, #1b2f5c, #070b17); }
.cp-ico canvas { width: 84px; height: 84px; }
.cp-lc-ico { background: radial-gradient(circle at 50% 38%, #1b2f5c, #070b17); }

/* ── 淺色區塊共用的小零件 ─────────────────────────────────────────────── */
.cp-k { margin: 0 0 .2rem; font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-dk); }
.cp-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--brand-dk); font-family: var(--sans); font-weight: 800; font-size: .88rem; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.cp-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.cp-btn-gold { background: var(--gold); border-color: var(--gold); color: #1b1405; }
.cp-btn-gold:hover { background: var(--gold-dk); color: #fff; }
.cp-btn[hidden] { display: none; }

/* ── 用五根手指數到 31 ────────────────────────────────────────────────── */
.cp-fingers { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.6rem 2.2rem; align-items: center; margin-top: 1.5rem; padding: 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.cp-hand-w { min-width: 0; }
.cp-hand { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 1.15fr; align-items: end; gap: 6px; height: 300px; max-width: 400px; margin: 0 auto; padding: 0 6px 96px; }
.cp-palm { position: absolute; left: 0; right: 15%; bottom: 0; height: 104px; border-radius: 26px 26px 42px 42px; background: #f0d2b4; border: 2px solid #c9a07c; z-index: 0; }
.cp-finger { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .2rem; height: 34%; padding: .45rem 0 0; border-radius: 22px 22px 6px 6px; border: 2px solid #c9a07c; border-bottom: 0; background: #f0d2b4; color: #7a5a3c; font-family: var(--sans); cursor: pointer; transition: height .22s cubic-bezier(.3,1.4,.5,1), background .2s, color .2s; overflow: hidden; }
.cp-finger b { font-size: 1.15rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cp-finger small { font-size: .62rem; font-weight: 700; line-height: 1.25; text-align: center; opacity: 0; transition: opacity .2s; }
.cp-finger:hover { background: #f6dfc7; }
.cp-finger:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cp-finger[aria-pressed="true"] { background: var(--gold); border-color: var(--gold-dk); color: #1b1405; }
.cp-finger[aria-pressed="true"] small { opacity: 1; }
.cp-f-pinky[aria-pressed="true"] { height: 68%; }
.cp-f-ring[aria-pressed="true"] { height: 90%; }
.cp-f-middle[aria-pressed="true"] { height: 100%; }
.cp-f-index[aria-pressed="true"] { height: 92%; }
.cp-f-thumb { align-self: end; margin-bottom: -58px; margin-left: 4px; transform: rotate(24deg); transform-origin: 20% 100%; border-bottom: 2px solid #c9a07c; border-radius: 22px 22px 14px 14px; height: 26%; }
.cp-f-thumb[aria-pressed="true"] { height: 52%; }
.cp-hand-c { margin: 1rem auto 0; max-width: 400px; font-size: .88rem; line-height: 1.6; color: var(--ink-soft); text-align: center; }
.cp-hand-c .zh { display: block; }
.cp-fg-side { min-width: 0; }
.cp-fg-num { margin: 0; font-family: var(--serif); font-size: 4.2rem; font-weight: 700; line-height: 1; color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.cp-fg-eq { margin: .3rem 0 0; min-height: 1.6em; font-size: 1.08rem; font-weight: 700; color: var(--gold-dk); font-variant-numeric: tabular-nums; }
.cp-fg-binw { margin: .3rem 0 0; font-size: .86rem; color: var(--ink-soft); }
.cp-fg-bin { margin-left: .4rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .12em; color: var(--ink); }
.cp-fg-task { margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: 16px; background: var(--cream); border: 1px solid var(--line); transition: border-color .2s, background .2s; }
.cp-fg-hit .cp-fg-task { border-color: #4caf7a; background: #eefaf2; }
.cp-fg-q { margin: 0; font-size: 1.05rem; font-weight: 700; }
.cp-fg-goal { font-family: var(--serif); font-size: 1.7rem; color: var(--brand-dk); margin: 0 .2rem; }
.cp-fg-msg { margin: .35rem 0 .8rem; min-height: 3.2em; font-size: .92rem; line-height: 1.55; }
.cp-fg-msg .zh { display: block; color: var(--ink-soft); }
.cp-tips { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem 1rem; }
.cp-tips li { padding: .9rem 1.1rem; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; font-size: .94rem; line-height: 1.6; }
.cp-tips li .zh { display: block; margin-top: .25rem; color: var(--ink-soft); font-size: .9rem; }

/* ── 猜猜這是多少 ─────────────────────────────────────────────────────── */
.cp-guess { margin-top: 1.5rem; padding: 1.5rem 1.6rem 1.4rem; background: #0c1428; color: #e8edf7; border-radius: 20px; box-shadow: var(--shadow); max-width: 860px; }
.cp-gs-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; align-items: baseline; }
.cp-gs-k { margin: 0; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #ffd36e; }
.cp-gs-k span { margin-left: .4rem; color: #9fb0cf; letter-spacing: .02em; text-transform: none; }
.cp-gs-sc { margin: 0; font-size: .82rem; color: #9fb0cf; }
.cp-gs-score { margin-left: .3rem; font-size: 1.05rem; color: #fff; font-variant-numeric: tabular-nums; }
.cp-gs-lights { display: flex; justify-content: center; gap: clamp(.3rem, 1.6vw, .9rem); min-height: 96px; margin: 1.3rem 0 1rem; align-items: flex-start; }
.cp-lamp { display: flex; flex-direction: column; align-items: center; gap: .45rem; width: clamp(28px, 9vw, 56px); }
.cp-lamp i { width: 100%; aspect-ratio: 1; border-radius: 50%; background: #2b3550; border: 2px solid #4a5878; }
.cp-lamp.is-on i { background: radial-gradient(circle at 40% 35%, #fff3c9, #ffd36e 55%, #f0a92a); border-color: #fff3c9; box-shadow: 0 0 22px 4px rgba(255,211,110,.55); }
.cp-lamp small { font-size: .74rem; font-weight: 700; color: #9fb0cf; font-variant-numeric: tabular-nums; visibility: hidden; }
.cp-gs-values .cp-lamp small { visibility: visible; }
.cp-gs-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.cp-gs-opt { padding: .8rem .2rem; border-radius: 14px; border: 1px solid rgba(160,180,230,.3); background: rgba(255,255,255,.05); color: #fff; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, transform .15s; }
.cp-gs-opt:hover:not(:disabled) { background: rgba(255,255,255,.12); transform: translateY(-2px); }
.cp-gs-opt:disabled { cursor: default; opacity: .55; }
.cp-gs-opt.is-right { background: #2f9e63; border-color: #7ee0aa; opacity: 1; }
.cp-gs-opt.is-wrong { background: rgba(214,69,69,.35); border-color: #e08a8a; text-decoration: line-through; }
.cp-gs-msg { margin: 1rem 0 .9rem; min-height: 3.4em; font-size: .95rem; line-height: 1.6; }
.cp-gs-msg .zh { display: block; color: #9fb0cf; }
.cp-gs-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .7rem 1rem; }
.cp-check { display: inline-flex; align-items: center; gap: .5rem; font-size: .84rem; color: #9fb0cf; cursor: pointer; }
.cp-check input { width: 18px; height: 18px; accent-color: #ffd36e; }

/* ── 為什麼不用十種亮度 ───────────────────────────────────────────────── */
.cp-levels { margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 900px; }
.cp-lv-ctl { display: grid; gap: .4rem; max-width: 420px; font-weight: 800; font-size: .92rem; }
.cp-lv-out { margin-left: .4rem; font-size: 1.15rem; color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.cp-lv-noise { width: 100%; accent-color: var(--brand); }
.cp-lv-track { margin-top: 1.5rem; }
.cp-lv-h { margin: 0 0 .5rem; font-weight: 800; font-size: .98rem; }
.cp-lv-h .zh { margin-left: .5rem; font-weight: 600; color: var(--ink-soft); }
.cp-lv-line { position: relative; height: 96px; margin: 0 26px 1.7rem; border-radius: 10px; background: linear-gradient(90deg, #10182e, #f6e7b0); border: 1px solid var(--line); }
.cp-lv-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.cp-lv-tick::after { content: attr(data-k); position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: .74rem; font-weight: 800; color: var(--ink); }
.cp-lv-cut { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed #d64545; margin-left: -1px; }
.cp-lv-dots { position: absolute; inset: 0; }
.cp-lv-dots b { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 1.5px solid #fff; }
.cp-lv-dots b.ok { background: #2f9e63; }
.cp-lv-dots b.bad { background: #d64545; }
.cp-lv-res { margin: 0; font-size: .95rem; }
.cp-lv-res b { font-size: 1.25rem; color: #2f9e63; font-variant-numeric: tabular-nums; }
.is-bad .cp-lv-res b { color: #d64545; }
.cp-lv-res .zh { margin-left: .7rem; color: var(--ink-soft); }
.cp-lv-key { list-style: none; margin: 1.3rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.3rem; font-size: .8rem; color: var(--ink-soft); }
.cp-lv-key li { display: inline-flex; align-items: center; gap: .4rem; }
.cp-lv-key i { display: inline-block; width: 12px; height: 12px; }
.cp-lv-key .k-tick { width: 2px; height: 14px; background: #10182e; }
.cp-lv-key .k-cut { width: 0; height: 14px; border-left: 2px dashed #d64545; }
.cp-lv-key .k-ok { border-radius: 50%; background: #2f9e63; }
.cp-lv-key .k-bad { border-radius: 50%; background: #d64545; }
.cp-lv-msg { margin: 1rem 0; min-height: 4.8em; padding: .9rem 1.1rem; border-radius: 14px; background: var(--cream); border: 1px solid var(--line); font-size: .96rem; line-height: 1.6; }
.cp-lv-msg .zh { display: block; margin-top: .25rem; color: var(--ink-soft); }
.cp-lv-note { margin: 1rem 0 0; font-size: .86rem; line-height: 1.6; color: var(--ink-soft); }
.cp-lv-note .zh { display: block; }

/* ── 動手之前、延伸閱讀、出處、系列首頁 ───────────────────────────────── */
.cp-safety { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.cp-safety li { position: relative; padding: 1rem 1.2rem 1rem 3.1rem; background: #fff; border: 1px solid #f0c9b8; border-radius: 14px; font-size: .98rem; line-height: 1.65; box-shadow: var(--shadow-sm); }
.cp-safety li::before { content: "\26A0"; position: absolute; left: 1.05rem; top: .95rem; font-size: 1.2rem; color: var(--sunset); }
.cp-safety li .zh { display: block; margin-top: .3rem; color: var(--ink-soft); font-size: .93rem; }
.cp-links { display: grid; gap: 1rem; margin-top: 1.4rem; max-width: 860px; }
.cp-link { display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.2rem 1.4rem; border-radius: 18px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink); transition: transform .25s, box-shadow .25s, border-color .25s; }
a.cp-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold); color: var(--ink); }
.cp-link-soon { border-style: dashed; background: linear-gradient(120deg, #fff, var(--cream)); }
.cp-link-ic { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: radial-gradient(circle at 50% 38%, #1b2f5c, #070b17); font-size: 2rem; }
.cp-link-b { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cp-link-k { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dk); }
.cp-link-b b { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; }
.cp-link-zh { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
.cp-link-n { margin-top: .4rem; font-size: .92rem; line-height: 1.6; }
.cp-link-n .zh { display: block; margin-top: .2rem; color: var(--ink-soft); }
.cp-link-go { align-self: flex-start; margin-top: .6rem; font-weight: 800; font-size: .82rem; color: var(--brand-dk); background: var(--brand-lt); border-radius: 999px; padding: .38rem .85rem; }
.cp-link-soon .cp-link-go { color: var(--ink-soft); background: var(--cream); border: 1px solid var(--line); }
.cp-sources { margin: 0 0 2.4rem; padding: 1.3rem 1.5rem; border: 1px solid var(--line); border-radius: 16px; background: var(--cream); }
.cp-sources .sub-head { margin-top: 0; }
.cp-sources > .muted { margin: .2rem 0 .8rem; font-size: .9rem; }
.cp-sources ol { margin: 0; padding-left: 1.3em; display: grid; gap: .55rem; }
.cp-sources li { font-size: .92rem; line-height: 1.55; }
.cp-sources li > span { display: block; }
.cp-sources li .zh { display: inline; margin-left: .4rem; color: var(--ink-soft); font-size: .88rem; }
.cp-sources a { font-weight: 700; font-size: .86rem; color: var(--brand-dk); overflow-wrap: anywhere; }
.cp-progress { font-weight: 700; color: var(--brand-dk); }
.cp-intro-ic { float: right; margin: 0 0 .8rem 1.2rem; display: grid; place-items: center; width: 104px; height: 104px; border-radius: 26px; background: radial-gradient(circle at 50% 38%, #1b2f5c, #070b17); box-shadow: 0 14px 30px -18px rgba(6,12,30,.9); }

@media (max-width: 860px) {
  .cp-fingers { grid-template-columns: 1fr; }
  .cp-tips { grid-template-columns: 1fr; }
}
@media (max-width: 760px) { .cp-safety { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .cp-link { flex-direction: column; }
  .cp-intro-ic { width: 80px; height: 80px; } .cp-intro-ic svg { width: 58px; height: 58px; }
  .cp-fingers, .cp-guess, .cp-levels { padding: 1.1rem; }
  .cp-hand { height: 250px; padding-bottom: 80px; } .cp-palm { height: 88px; } .cp-f-thumb { margin-bottom: -48px; }
  .cp-gs-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-lv-line { margin: 0 20px 1.7rem; height: 84px; }
  .cp-lv-tick::after { font-size: .64rem; }
  .cp-lv-res .zh { display: block; margin-left: 0; }
}

/* 模型下方的圖例 */
.al-lg-cpon i { border: 0; background: #ffd36e; box-shadow: 0 0 10px rgba(255,211,110,.8); }
.al-lg-cpoff i { border: 2px solid #5b6b90; background: #2b3550; }
.al-lg-cpsw i { border: 0; background: linear-gradient(90deg, #d4574a 0 50%, #38c778 50%); }
.al-lg-cpcarry i { border: 0; width: 14px; height: 14px; margin: .3rem 2px 0; background: #7ef0e3; box-shadow: 0 0 10px rgba(126,240,227,.8); }

/* ══ 第二課：像素牆（comp-pixels）══════════════════════════════════════ */
.cp-px-lab .al-space { min-height: 640px; }
.cp-cams { position: absolute; left: .8rem; top: .8rem; display: inline-flex; padding: 3px; border-radius: 14px; background: rgba(6,10,22,.72); border: 1px solid var(--al-line); z-index: 2; }
.cp-cams button { border: 0; background: transparent; color: var(--al-mute); font-family: var(--sans); font-weight: 800; font-size: .78rem; line-height: 1.15; padding: .38rem .75rem; border-radius: 11px; cursor: pointer; text-align: center; }
.cp-cams button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .7rem; }
.cp-cams button[aria-pressed="true"] { background: #22345f; color: #fff; }
.cp-cams button[aria-pressed="true"] small { color: var(--al-sun); }
.al-lab.cp-lb-ch { font-size: .76rem; color: #fff; }
.al-lab.cp-lb-r { border-color: #ff6b60; } .al-lab.cp-lb-g { border-color: #4fd97a; } .al-lab.cp-lb-b { border-color: #6ea2ff; }
.al-lab.cp-lb-ch.is-on { color: #1b1405; }
.cp-px-top { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: .8rem; align-items: center; }
.cp-px-map { width: 124px; height: 124px; border-radius: 8px; border: 1px solid var(--al-line); cursor: pointer; image-rendering: pixelated; touch-action: manipulation; }
.cp-px-map:focus-visible { outline: 2px solid var(--al-sun); outline-offset: 2px; }
.cp-px-info { min-width: 0; }
.cp-px-sw { display: block; width: 46px; height: 46px; border-radius: 10px; border: 2px solid #fff; box-shadow: 0 6px 18px -8px rgba(0,0,0,.8); }
.cp-px-pos { margin: .45rem 0 0; font-size: .84rem; font-weight: 800; color: #fff; line-height: 1.3; }
.cp-px-pos small { display: block; font-family: var(--zh); font-weight: 600; font-size: .74rem; color: var(--al-mute); }
.cp-px-hex { margin: .25rem 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .7rem; color: var(--al-mute); overflow-wrap: anywhere; }
.cp-chrows { display: grid; gap: .35rem; }
.cp-chrow { display: grid; grid-template-columns: 46px minmax(0, 1fr) 2.4em; gap: .55rem; align-items: center; }
.cp-chrow button { padding: .25rem 0; border-radius: 9px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-text); font-family: var(--sans); font-weight: 800; font-size: .8rem; line-height: 1.1; cursor: pointer; }
.cp-chrow button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .66rem; color: var(--al-mute); }
.cp-chrow button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.14); box-shadow: 0 0 0 1px var(--al-sun) inset; }
.cp-chrow input { width: 100%; min-width: 0; }
.cp-chrow-r input { accent-color: #ff3b30; } .cp-chrow-g input { accent-color: #34c759; } .cp-chrow-b input { accent-color: #3b82f6; }
.cp-ch-v { font-size: .92rem; font-weight: 800; color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.cp-px-lab .cp-binw { padding-top: 0; border-top: 0; }
.cp-binw span { min-width: 0; } .cp-bin { white-space: nowrap; }
.cp-three { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
.cp-three > div { padding: .5rem .5rem .55rem; border-radius: 11px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-three dt { font-size: .58rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--al-mute); line-height: 1.3; min-height: 2.6em; }
.cp-three dd { margin: .2rem 0 0; font-size: .86rem; font-weight: 800; color: #fff; line-height: 1.25; font-variant-numeric: tabular-nums; }
.cp-three dd small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-as-num, .cp-as-char b { font-family: var(--serif); font-size: 1.5rem !important; color: var(--al-sun) !important; }
.cp-px-lab .cp-msg { min-height: 7.4em; }
.cp-total { margin: 0; font-size: .86rem; font-weight: 700; color: var(--al-text); line-height: 1.5; }
.cp-total .zh { display: block; color: var(--al-mute); font-weight: 600; }
@media (max-width: 1000px) { .cp-px-lab .al-space { aspect-ratio: 4 / 3; min-height: 380px; } }
@media (max-width: 620px) {
  .cp-px-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; }
  .cp-cams button { font-size: .7rem; padding: .32rem .55rem; }
  .cp-px-lab .cp-msg { min-height: 9.6em; }
}

/* ── 打字看編號 ───────────────────────────────────────────────────────── */
.cp-chars, .cp-draw, .cp-sound { margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.cp-ch-in { display: grid; gap: .4rem; max-width: 460px; font-weight: 800; font-size: .92rem; }
.cp-ch-input { width: 100%; padding: .7rem .9rem; border-radius: 12px; border: 2px solid var(--line); background: var(--cream); font-family: var(--sans), var(--zh); font-size: 1.5rem; color: var(--ink); }
.cp-ch-input:focus { outline: none; border-color: var(--brand); background: #fff; }
.cp-ch-quick { margin-top: .8rem; align-items: center; }
.cp-ch-quick .cp-k { margin: 0 .2rem 0 0; }
.cp-ch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; margin-top: 1.1rem; }
.cp-ch-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: .8rem; align-items: center; padding: .8rem .9rem; border-radius: 14px; border: 1px solid var(--line); background: var(--cream); }
.cp-ch-g { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 12px; background: #10182e; color: #ffd36e; font-size: 2rem; font-weight: 700; line-height: 1; }
.cp-ch-g i { font-style: normal; font-size: .62rem; font-weight: 700; color: #9fb0cf; text-align: center; }
.cp-ch-card dl { margin: 0; display: grid; gap: .35rem; min-width: 0; }
.cp-ch-card dt { font-size: .66rem; font-weight: 700; color: var(--ink-soft); line-height: 1.3; }
.cp-ch-card dd { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.cp-ch-card dd small { margin-left: .4rem; font-size: .78rem; font-weight: 700; color: var(--gold-dk); }
.cp-ch-card dd.cp-ch-b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .74rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.cp-ch-msg, .cp-dr-msg { margin: 1rem 0 0; font-size: .96rem; line-height: 1.6; }
.cp-ch-msg .zh, .cp-dr-msg .zh { display: block; color: var(--ink-soft); }

/* ── 8 × 8 像素畫 ─────────────────────────────────────────────────────── */
.cp-draw { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.4rem 2rem; align-items: start; }
.cp-dr-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 6px; border-radius: 12px; background: #10182e; touch-action: none; user-select: none; -webkit-user-select: none; }
.cp-dr-c { aspect-ratio: 1; padding: 0; border: 0; border-radius: 4px; background: #f4ecd8; cursor: pointer; }
.cp-dr-c.is-on { background: #1b2440; box-shadow: inset 0 0 0 2px #ffd36e; }
.cp-dr-c:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cp-dr-left .cp-btns { margin-top: .8rem; }
.cp-dr-rows { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .2rem; max-width: 300px; }
.cp-dr-rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .2rem .7rem; border-radius: 8px; background: var(--cream); }
.cp-dr-rows code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: .14em; color: var(--ink); }
.cp-dr-rows b { font-size: 1.05rem; color: var(--brand-dk); font-variant-numeric: tabular-nums; }

/* ── 聲音取樣 ─────────────────────────────────────────────────────────── */
.cp-sound { max-width: 900px; }
.cp-sd-svg { display: block; width: 100%; height: auto; }
.cp-sd-bg { fill: #10182e; }
.cp-sd-lv { stroke: rgba(160,180,230,.22); stroke-width: 1; stroke-dasharray: 3 4; }
.cp-sd-bar { fill: rgba(255,211,110,.42); }
.cp-sd-wave { fill: none; stroke: #7ef0e3; stroke-width: 2.5; }
.cp-sd-dot { fill: #ffd36e; stroke: #10182e; stroke-width: 1; }
.cp-sound .cp-lv-key { margin-top: .7rem; }
.cp-lv-key .k-wave { width: 18px; height: 3px; background: #2bb5a6; }
.cp-lv-key .k-step { width: 14px; height: 12px; background: rgba(240,169,42,.6); }
.cp-sd-ctl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem 2rem; align-items: start; margin-top: 1.1rem; }
.cp-seg-l { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
.cp-seg-l button { padding: .45rem .1rem; border-radius: 11px; border: 1px solid var(--line); background: var(--cream); color: var(--ink); font-family: var(--sans); font-weight: 800; font-size: .8rem; line-height: 1.2; cursor: pointer; }
.cp-seg-l button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--ink-soft); }
.cp-seg-l button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.cp-seg-l button[aria-pressed="true"] small { color: rgba(255,255,255,.88); }
.cp-sd-list { margin: 1rem 0 0; font-size: .86rem; color: var(--ink-soft); }
.cp-sd-list span { display: block; font-weight: 700; }
.cp-sd-nums { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 860px) { .cp-draw { grid-template-columns: 1fr; } .cp-sd-ctl { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cp-chars, .cp-draw, .cp-sound { padding: 1.1rem; } .cp-three dt { min-height: 3.9em; } }
.al-lg-cppx i { border: 0; border-radius: 3px; background: #d62828; }
.al-lg-cprgb i { border: 0; border-radius: 3px; background: linear-gradient(90deg, #ff3b30 0 33%, #34c759 33% 66%, #3b82f6 66%); }
.al-lg-cpsel i { border: 2px solid #fff; border-radius: 3px; background: transparent; }

/* ══ 第三課：邏輯閘（comp-logic）═══════════════════════════════════════ */
.al-lab.cp-lb-in { font-size: .78rem; }
.cp-lg-gates button { font-size: .95rem; padding: .5rem .2rem; }
.cp-lg-gates button small { font-size: .74rem; }
.cp-lg-rule { margin: 0; min-height: 4.6em; font-size: .88rem; line-height: 1.55; color: #fff; }
.cp-lg-rule .zh { display: block; margin-top: .2rem; color: var(--al-mute); }
.cp-lg-io { display: flex; align-items: stretch; gap: .45rem; }
.cp-lg-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; width: 58px; padding: .4rem 0; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-mute); font-family: var(--sans); cursor: pointer; }
.cp-lg-in small { font-size: .78rem; font-weight: 800; color: #7ef0e3; }
.cp-lg-in b { font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.cp-lg-in[aria-pressed="true"] { background: #38c778; border-color: #7ee0aa; color: #062414; }
.cp-lg-in[aria-pressed="true"] small { color: #062414; }
.cp-lg-in[hidden] { display: none; }
.cp-lg-arrow { align-self: center; font-size: 1.3rem; color: var(--al-mute); }
.cp-lg-out { flex: 1; margin: 0; display: flex; align-items: center; gap: .6rem; padding: .4rem .8rem; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-mute); }
.cp-lg-out b { font-family: var(--serif); font-size: 1.9rem; line-height: 1; color: #fff; }
.cp-lg-out span { font-size: .78rem; font-weight: 700; line-height: 1.3; }
.cp-lg-out.is-on { background: var(--al-sun); border-color: var(--al-sun); color: #1b1405; box-shadow: 0 0 18px -4px rgba(255,211,110,.8); }
.cp-lg-out.is-on b { color: #1b1405; }
.cp-lg-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-variant-numeric: tabular-nums; }
.cp-lg-table th { padding: .15rem .4rem .3rem; font-size: .72rem; font-weight: 800; color: var(--al-mute); text-align: center; }
.cp-lg-table th small { margin-left: .3rem; font-family: var(--zh); font-weight: 600; }
.cp-lg-table td { padding: .28rem .4rem; text-align: center; font-size: .95rem; font-weight: 700; color: var(--al-text); background: rgba(255,255,255,.03); }
.cp-lg-table td:first-child { border-radius: 9px 0 0 9px; } .cp-lg-table td:last-child { border-radius: 0 9px 9px 0; }
.cp-lg-table tr.is-one td:last-child b { color: var(--al-sun); }
.cp-lg-table tr.is-cur td { background: rgba(255,211,110,.2); color: #fff; box-shadow: 0 1px 0 var(--al-sun) inset, 0 -1px 0 var(--al-sun) inset; }
.cp-lg-table tr.is-pad { visibility: hidden; }
.cp-lg-lab .cp-msg { min-height: 4.8em; }
@media (min-width: 1001px) { .cp-lg-lab .al-space { min-height: 620px; } }
.al-lg-cpflow i { border: 0; width: 12px; height: 12px; margin: .35rem 3px 0; background: #7ef0e3; box-shadow: 0 0 10px rgba(126,240,227,.8); }
.al-lg-cpknife i { border: 0; border-radius: 2px; height: 5px; margin-top: .55rem; background: #c98a4b; }
.al-lg-cpseesaw i { border: 0; border-radius: 2px; height: 5px; margin-top: .55rem; background: #7b5b3a; transform: rotate(-14deg); }
@media (max-width: 620px) { .cp-lg-lab .cp-msg { min-height: 6.4em; } .cp-lg-rule { min-height: 6.2em; } }

/* ── 把閘接起來 ───────────────────────────────────────────────────────── */
.cp-wire { margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 900px; }
.cp-wire .cp-gs-k { color: var(--gold-dk); } .cp-wire .cp-gs-sc { color: var(--ink-soft); } .cp-wire .cp-gs-score { color: var(--brand-dk); }
.cp-wr-q { margin: .8rem 0 1.1rem; font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; color: var(--ink); }
.cp-wr-q .zh { display: block; margin-top: .2rem; font-family: var(--zh); font-size: 1.02rem; font-weight: 600; color: var(--ink-soft); }
.cp-wr-build { display: grid; grid-template-columns: minmax(0, 1.5fr) auto minmax(0, 1fr); gap: 1rem; align-items: center; padding: 1rem; border-radius: 16px; background: #10182e; color: #e8edf7; }
.cp-wr-ins { display: grid; gap: .6rem; }
.cp-wr-in { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem .5rem .5rem .8rem; border-radius: 12px; background: rgba(255,255,255,.06); }
.cp-wr-lab { font-size: .9rem; line-height: 1.35; min-width: 0; }
.cp-wr-lab b { margin-right: .35rem; color: #7ef0e3; }
.cp-wr-lab small, .cp-wr-out small { display: block; font-family: var(--zh); font-size: .8rem; color: #9fb0cf; }
.cp-wr-not, .cp-wr-gate button { flex: none; padding: .4rem .7rem; border-radius: 10px; border: 1px dashed rgba(160,180,230,.5); background: transparent; color: #9fb0cf; font-family: var(--sans); font-weight: 800; font-size: .82rem; line-height: 1.15; cursor: pointer; }
.cp-wr-not small, .cp-wr-gate button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; }
.cp-wr-not[aria-pressed="true"] { border-style: solid; border-color: #ff9c8f; background: #d4574a; color: #fff; }
.cp-wr-gate { display: grid; gap: .4rem; }
.cp-wr-gate button { padding: .6rem 1rem; font-size: 1rem; border-style: solid; }
.cp-wr-gate button[aria-pressed="true"] { border-color: #ffd36e; background: #ffd36e; color: #1b1405; }
.cp-wr-outw { display: flex; align-items: center; gap: .7rem; font-size: .9rem; line-height: 1.35; }
.cp-wr-bulb { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #2b3550; border: 2px solid #4a5878; }
.is-solved .cp-wr-bulb { background: radial-gradient(circle at 40% 35%, #fff3c9, #ffd36e 55%, #f0a92a); border-color: #fff3c9; box-shadow: 0 0 22px 4px rgba(255,211,110,.55); }
.cp-wr-exprw { margin: 1rem 0 .5rem; font-size: .86rem; font-weight: 700; color: var(--ink-soft); }
.cp-wr-expr { margin-left: .5rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.05rem; color: var(--brand-dk); }
.cp-wr-table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cp-wr-table th, .cp-wr-table td { padding: .3rem .9rem; text-align: center; border-bottom: 1px solid var(--line); font-size: .95rem; }
.cp-wr-table th { font-size: .76rem; color: var(--ink-soft); } .cp-wr-table th small { display: block; font-family: var(--zh); font-weight: 600; }
.cp-wr-table tr.ok td:last-child { color: #2f9e63; font-weight: 800; } .cp-wr-table tr.bad td:last-child { color: #d64545; font-weight: 800; }
.cp-wr-table tr.bad td { background: #fdf0ee; }
.cp-wr-msg { margin: .9rem 0; min-height: 3.2em; font-size: .96rem; line-height: 1.6; }
.cp-wr-msg .zh { display: block; color: var(--ink-soft); }
.is-solved .cp-wr-msg { color: #1f7a4a; font-weight: 700; }

/* ── 真值表測驗 ───────────────────────────────────────────────────────── */
.cp-lq-q { margin: 1.4rem 0 1.1rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .4rem 1.6rem; min-height: 2.6em; }
.cp-lq-in { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; color: #7ef0e3; }
.cp-lq-ex { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; color: #fff; }
.cp-lq-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; margin: 0 auto; }
@media (max-width: 720px) {
  .cp-wr-build { grid-template-columns: 1fr; }
  .cp-wr-gate { grid-template-columns: 1fr 1fr; }
  .cp-wire { padding: 1.1rem; } .cp-wr-table th, .cp-wr-table td { padding: .3rem .55rem; }
}
@media (max-width: 620px) { .cp-lg-lab .al-space { aspect-ratio: 4 / 3; } }

/* ══ 第四課：加法器（comp-adder）═══════════════════════════════════════ */
@media (min-width: 1001px) { .cp-ad-lab .al-space { min-height: 720px; } }
.al-lab.cp-lb-col { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .76rem; color: #052421; background: rgba(126,240,227,.95); border-color: #7ef0e3; }
.cp-ad-sumt { border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 0 0 .2rem; }
.cp-ad-sumt th { padding: .05rem .8rem .05rem 0; font-size: .82rem; font-weight: 800; color: var(--al-mute); text-align: right; white-space: nowrap; }
.cp-ad-sumt td { padding: .05rem 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.35rem; letter-spacing: .16em; color: #fff; text-align: right; }
.cp-ad-sumt td:last-child { padding-left: 1.1rem; font-family: var(--serif); font-size: 1.35rem; letter-spacing: 0; color: var(--al-sun); }
.cp-ad-line th, .cp-ad-line td { border-top: 2px solid var(--al-line); padding-top: .25rem; }
.cp-ad-line td:first-of-type { color: var(--al-sun); }
.cp-strip4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 230px; }
.cp-ad-lab .cp-k2 { margin-bottom: -.25rem !important; }
.cp-ad-col { margin: .2rem 0 0; min-height: 3.6em; padding: .5rem .7rem; border-radius: 11px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; color: #7ef0e3; }
.cp-ad-col b { display: block; font-family: var(--sans); font-size: .72rem; font-weight: 800; letter-spacing: .04em; color: var(--al-mute); }
.cp-ad-col small { display: block; font-family: var(--sans), var(--zh); font-size: .74rem; color: var(--al-mute); }
.cp-ad-lab .cp-msg { min-height: 6.4em; }
.al-lg-cpbox i { border: 0; border-radius: 4px; background: #22345f; box-shadow: 0 0 0 2px #7ef0e3 inset; }
@media (max-width: 1000px) { .cp-ad-lab .al-space { aspect-ratio: 4 / 3; min-height: 420px; } }
@media (max-width: 620px) { .cp-ad-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-ad-lab .cp-msg { min-height: 8em; } }

/* ── 半加器／全加器 ───────────────────────────────────────────────────── */
.cp-half { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem 2.2rem; align-items: start; margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 940px; }
.cp-hf-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-hf-ins { display: flex; gap: .6rem; margin: 1rem 0 .9rem; }
.cp-hf-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-width: 74px; padding: .55rem .6rem; border-radius: 14px; border: 2px solid var(--line); background: var(--cream); color: var(--ink-soft); font-family: var(--sans); cursor: pointer; }
.cp-hf-in small { font-size: .74rem; font-weight: 800; line-height: 1.2; text-align: center; }
.cp-hf-in b { font-family: var(--serif); font-size: 2rem; line-height: 1; color: var(--ink); }
.cp-hf-in[aria-pressed="true"] { background: #38c778; border-color: #2f9e63; color: #062414; }
.cp-hf-in[hidden] { display: none; }
.cp-hf-eq { margin: 0 0 .9rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.5rem; color: var(--ink); }
.cp-hf-eq b { color: var(--brand-dk); }
.cp-hf-eq small { margin-left: .8rem; font-family: var(--sans), var(--zh); font-size: .9rem; color: var(--ink-soft); }
.cp-hf-outs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.cp-hf-outs p { margin: 0; padding: .6rem .8rem; border-radius: 14px; border: 1px solid var(--line); background: var(--cream); display: grid; gap: .1rem; }
.cp-hf-outs span { font-size: .74rem; font-weight: 800; color: var(--ink-soft); }
.cp-hf-outs b { font-family: var(--serif); font-size: 2rem; line-height: 1.1; color: var(--ink); }
.cp-hf-outs code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .72rem; color: var(--brand-dk); }
.cp-hf-outs p.is-on { background: var(--gold); border-color: var(--gold-dk); }
.cp-hf-outs p.is-on span, .cp-hf-outs p.is-on code { color: #1b1405; }
.cp-hf-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cp-hf-table th, .cp-hf-table td { padding: .32rem .5rem; text-align: center; border-bottom: 1px solid var(--line); font-size: .98rem; }
.cp-hf-table th { font-size: .78rem; color: var(--ink-soft); } .cp-hf-table th small { display: block; font-family: var(--zh); font-weight: 600; }
.cp-hf-table tr.is-cur td { background: #fff3cf; box-shadow: 0 1px 0 var(--gold) inset, 0 -1px 0 var(--gold) inset; }
.cp-hf-note { margin: 1rem 0 0; font-size: .92rem; line-height: 1.6; }
.cp-hf-note .zh { display: block; margin-top: .2rem; color: var(--ink-soft); }

/* ── 自己當加法器 ─────────────────────────────────────────────────────── */
.cp-aq-grid { display: grid; gap: .25rem; justify-content: center; margin: 1.3rem 0 1rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.cp-aq-row { display: grid; grid-template-columns: 4.6rem repeat(5, 2.6rem); gap: .25rem; align-items: center; }
.cp-aq-row i { font-style: normal; font-family: var(--sans); font-size: .76rem; font-weight: 800; color: #9fb0cf; text-align: right; padding-right: .5rem; line-height: 1.15; }
.cp-aq-row i small { display: block; font-family: var(--zh); font-weight: 600; }
.cp-aq-row span { display: grid; place-items: center; height: 2.6rem; border-radius: 8px; font-size: 1.5rem; color: #fff; }
.cp-aq-row .cp-aq-c { height: 1.7rem; font-size: 1rem; color: #7ef0e3; }
.cp-aq-row .cp-aq-plus { color: #9fb0cf; }
.cp-aq-row .cp-aq-s { background: rgba(255,255,255,.06); color: #ffd36e; }
.cp-aq-row:last-child { padding-top: .35rem; border-top: 2px solid rgba(160,180,230,.4); }
.cp-aq-row span.is-cur { background: rgba(255,211,110,.22); box-shadow: 0 0 0 1px #ffd36e inset; }
.cp-aq-q { margin: 0 0 1rem; text-align: center; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: #fff; min-height: 2.8em; }
.cp-aq-q small { display: block; font-family: var(--zh); font-size: .95rem; font-weight: 600; color: #9fb0cf; }
.cp-aq-opt small { display: block; margin-top: .2rem; font-family: var(--sans), var(--zh); font-size: .68rem; font-weight: 600; line-height: 1.3; color: #9fb0cf; }
@media (max-width: 860px) { .cp-half { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cp-half { padding: 1.1rem; } .cp-aq-row { grid-template-columns: 3.6rem repeat(5, 2.1rem); } .cp-aq-row span { height: 2.2rem; font-size: 1.25rem; } .cp-hf-eq { font-size: 1.25rem; } }

/* ══ 第五課：可以拆開的主機（comp-pc）═════════════════════════════════ */
@media (min-width: 1001px) { .cp-pc-lab .al-space { min-height: 700px; } }
.al-lab.cp-lb-part { font-size: .72rem; line-height: 1.2; text-align: center; padding: .14rem .55rem; color: #dfe7f7; }
.al-lab.cp-lb-part.is-on { color: #1b1405; background: rgba(255,211,110,.95); border-color: #ffd36e; }
.al-lab.cp-lb-part.is-on small { color: #4a3608; }
.cp-pc-parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.cp-pc-parts button { padding: .36rem .15rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-text); font-family: var(--sans); font-weight: 800; font-size: .68rem; line-height: 1.2; cursor: pointer; }
.cp-pc-parts button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .66rem; color: var(--al-mute); }
.cp-pc-parts button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.16); box-shadow: 0 0 0 1px var(--al-sun) inset; }
.cp-pc-card { padding: .7rem .8rem; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); min-height: 19em; }
.cp-pc-name { margin: 0 0 .3rem; font-family: var(--serif); font-size: 1.12rem; line-height: 1.25; color: #fff; }
.cp-pc-name .zh { display: block; font-size: .9rem; font-weight: 600; color: var(--al-sun); }
.cp-pc-job, .cp-pc-note { margin: 0; font-size: .82rem; line-height: 1.55; color: var(--al-text); }
.cp-pc-job .zh, .cp-pc-note .zh { display: block; margin-top: .2rem; color: var(--al-mute); }
.cp-pc-note { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--al-line); font-size: .78rem; }
.cp-pc-note[hidden] { display: none; }
.cp-pc-sl { display: grid; gap: .3rem; font-size: .76rem; font-weight: 800; color: var(--al-mute); }
.cp-pc-sl input { width: 100%; accent-color: #ffd36e; }
.cp-pc-steps { list-style: none; counter-reset: st; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; }
.cp-pc-steps li { counter-increment: st; padding: .4rem .5rem .4rem 1.9rem; position: relative; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); font-size: .72rem; font-weight: 800; line-height: 1.25; color: var(--al-text); cursor: pointer; }
.cp-pc-steps li::before { content: counter(st); position: absolute; left: .5rem; top: .45rem; width: 1.1rem; height: 1.1rem; display: grid; place-items: center; border-radius: 50%; background: #22345f; color: #fff; font-size: .68rem; }
.cp-pc-steps li small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-pc-steps li.is-cur { border-color: #7ef0e3; background: rgba(126,240,227,.14); }
.cp-pc-steps li.is-cur::before { background: #7ef0e3; color: #052421; }
.cp-pc-lab .cp-msg { min-height: 6.4em; }
.al-lg-cppart i { border: 0; border-radius: 4px; background: #ffd36e; }
.al-lg-cpboard i { border: 0; border-radius: 3px; background: #14503f; box-shadow: 0 0 0 1px #2f8f73 inset; }
.al-lg-cpscreen i { border: 2px solid #1b2130; border-radius: 3px; background: #9fe3ff; }
@media (max-width: 1000px) { .cp-pc-lab .al-space { aspect-ratio: 4 / 3; min-height: 400px; } .cp-pc-card { min-height: 10em; } }
@media (max-width: 620px) { .cp-pc-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-pc-lab .cp-msg { min-height: 8em; } .cp-pc-card { min-height: 14em; } }

/* ── 這個工作是誰做的 ─────────────────────────────────────────────────── */
.cp-jb-q { margin: 1.3rem 0 1.1rem; min-height: 3.6em; text-align: center; font-family: var(--serif); font-size: 1.35rem; line-height: 1.35; color: #fff; }
.cp-jb-q small { display: block; margin-top: .2rem; font-family: var(--zh); font-size: 1rem; font-weight: 600; color: #9fb0cf; }
.cp-jb-opts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cp-jb-opt { font-family: var(--sans) !important; font-size: .86rem !important; line-height: 1.25; padding: .7rem .3rem !important; }
.cp-jb-opt small { display: block; margin-top: .15rem; font-family: var(--zh); font-size: .78rem; font-weight: 600; color: #9fb0cf; }

/* ── 裝得下多少 ───────────────────────────────────────────────────────── */
.cp-fits { margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 900px; }
.cp-ft-ctl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1rem 2rem; }
.cp-ft-drives { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cp-ft-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cp-ft-nums { margin: 1.2rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem 1.4rem; }
.cp-ft-nums dt { font-size: .74rem; font-weight: 800; color: var(--ink-soft); }
.cp-ft-nums dd { margin: .1rem 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; color: var(--ink); overflow-wrap: anywhere; }
.cp-ft-big { margin: 1.2rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .9rem; padding: 1rem 1.2rem; border-radius: 16px; background: #10182e; color: #e8edf7; }
.cp-ft-big > span:first-child { font-size: .8rem; font-weight: 800; color: #9fb0cf; }
.cp-ft-count { font-family: var(--serif); font-size: 2.4rem; line-height: 1; color: #ffd36e; font-variant-numeric: tabular-nums; }
.cp-ft-what { font-size: .98rem; font-weight: 700; } .cp-ft-what small { display: block; font-family: var(--zh); font-weight: 600; font-size: .86rem; color: #9fb0cf; }
.cp-ft-gib { color: var(--brand-dk); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .cp-ft-ctl { grid-template-columns: 1fr; } .cp-jb-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cp-fits { padding: 1.1rem; } .cp-ft-nums { grid-template-columns: 1fr; } .cp-ft-count { font-size: 1.9rem; } .cp-jb-q { font-size: 1.15rem; } }

/* ══ 第六課：小處理器（comp-cpu）═══════════════════════════════════════ */
@media (min-width: 1001px) { .cp-cpu-lab .al-space { min-height: 660px; } }
.al-lab.cp-lb-cell { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; font-weight: 700; color: #fff; background: transparent; border-color: transparent; padding: 0 .3rem; }
.al-lab.cp-lb-cell.is-on { color: #ffd36e; background: transparent; border-color: transparent; box-shadow: none; }
.al-lab.cp-lb-addr { font-size: .64rem; color: var(--al-mute); background: transparent; border-color: transparent; padding: 0 .2rem; }
.al-lab.cp-lb-reg { text-align: center; font-size: .62rem; line-height: 1.2; color: #c9d3e8; background: transparent; border-color: transparent; padding: 0; }
.al-lab.cp-lb-reg small { margin-left: .3rem; font-family: var(--zh); font-weight: 600; }
.al-lab.cp-lb-reg b { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92rem; color: #fff; }
.cp-narrow .al-lab.cp-lb-cell { font-size: .58rem; } .cp-narrow .al-lab.cp-lb-reg { font-size: .5rem; } .cp-narrow .al-lab.cp-lb-reg b { font-size: .68rem; }
.cp-seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-cpu-phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.cp-cpu-phases span { padding: .34rem .2rem; border-radius: 10px; border: 1px solid var(--al-line); text-align: center; font-size: .74rem; font-weight: 800; color: var(--al-mute); line-height: 1.2; }
.cp-cpu-phases small { display: block; font-family: var(--zh); font-weight: 600; font-size: .68rem; }
.cp-cpu-phases span.is-cur { background: #7ef0e3; border-color: #7ef0e3; color: #052421; }
.cp-cpu-regs { margin: 0; display: grid; grid-template-columns: .8fr 1.3fr .8fr; gap: .3rem; }
.cp-cpu-regs > div { padding: .4rem .5rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-cpu-regs dt { font-size: .58rem; font-weight: 700; color: var(--al-mute); line-height: 1.25; }
.cp-cpu-regs dd { margin: .1rem 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1rem; font-weight: 700; color: #fff; white-space: nowrap; }
.cp-cpu-mem { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(4, auto); gap: .22rem .3rem; }
.cp-cpu-mem li { display: grid; grid-template-columns: 1.3rem minmax(0, 1fr); align-items: center; padding: .22rem .45rem; border-radius: 8px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-cpu-mem i { font-style: normal; font-size: .66rem; font-weight: 700; color: var(--al-mute); }
.cp-cpu-mem b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; color: var(--al-text); }
.cp-cpu-mem li.is-ins b { color: #9fd0ff; }
.cp-cpu-mem li.is-pc { border-color: var(--al-sun); box-shadow: 0 0 0 1px var(--al-sun) inset; }
.cp-cpu-mem li.is-arg { background: rgba(126,240,227,.16); border-color: #7ef0e3; }
.cp-cpu-lab .cp-msg { min-height: 7.6em; }
.cp-cpu-dn { margin: 0; font-size: .74rem; color: var(--al-mute); } .cp-cpu-dn b { font-size: 1rem; color: #fff; margin: 0 .2rem; }
.al-lg-cpins i { border: 0; border-radius: 3px; background: #2f5d86; }
.al-lg-cpnum i { border: 0; border-radius: 3px; background: #2c3a5c; box-shadow: 0 0 0 1px #5b6b90 inset; }
.al-lg-cpreg i { border: 0; border-radius: 3px; background: #16382f; box-shadow: 0 0 0 2px #2f8f73 inset; }
@media (max-width: 1000px) { .cp-cpu-lab .al-space { aspect-ratio: 4 / 3; min-height: 420px; } }
@media (max-width: 620px) { .cp-cpu-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-cpu-lab .cp-msg { min-height: 9.6em; } }

/* ── 自己排程式 ───────────────────────────────────────────────────────── */
.cp-prog { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 1.4rem 2.2rem; align-items: start; margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 960px; }
.cp-pg-slots, .cp-pg-data { list-style: none; margin: .3rem 0 1rem; padding: 0; display: grid; gap: .3rem; }
.cp-pg-slot, .cp-pg-data li { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); align-items: center; gap: .4rem; }
.cp-pg-slot i, .cp-pg-data i { font-style: normal; font-size: .8rem; font-weight: 800; color: var(--ink-soft); text-align: center; }
.cp-pg-slot select { width: 100%; padding: .5rem .6rem; border-radius: 10px; border: 2px solid var(--line); background: var(--cream); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1rem; color: var(--ink); }
.cp-pg-slot select:focus { outline: none; border-color: var(--brand); }
.cp-pg-data { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cp-pg-data b { display: block; padding: .4rem .6rem; border-radius: 10px; background: #10182e; color: #fff; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.05rem; text-align: center; }
.cp-pg-data b.is-new { background: var(--gold); color: #1b1405; }
.cp-pg-msg { margin: 0 0 .8rem; min-height: 3.2em; padding: .8rem 1rem; border-radius: 14px; background: var(--cream); border: 1px solid var(--line); font-size: .96rem; line-height: 1.6; }
.cp-pg-msg .zh { display: block; color: var(--ink-soft); }
.is-solved .cp-pg-msg { background: #eefaf2; border-color: #4caf7a; } .is-failed .cp-pg-msg { background: #fdf0ee; border-color: #e7a79b; }
.cp-pg-trace { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cp-pg-trace li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: start; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--line); font-size: .88rem; line-height: 1.5; }
.cp-pg-trace li b { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: .76rem; }
.cp-pg-trace li small { display: block; color: var(--ink-soft); }
.cp-pg-trace li i { font-style: normal; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; font-weight: 700; color: var(--brand-dk); white-space: nowrap; }
.cp-pg-trace li.bad { background: #fdf0ee; border-color: #e7a79b; } .cp-pg-trace li.bad b { background: #d64545; }

/* ── 猜下一步 ─────────────────────────────────────────────────────────── */
.cp-pd-q { margin: 1.3rem 0 1.1rem; display: grid; gap: .5rem; justify-items: center; text-align: center; min-height: 8.4em; }
.cp-pd-st { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92rem; color: #9fb0cf; }
.cp-pd-in { padding: .3rem 1.1rem; border-radius: 12px; background: #2f5d86; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 700; color: #fff; }
.cp-pd-ask { font-size: 1.05rem; font-weight: 700; color: #fff; } .cp-pd-ask small { display: block; font-family: var(--zh); font-weight: 600; font-size: .92rem; color: #9fb0cf; }
@media (max-width: 860px) { .cp-prog { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cp-prog { padding: 1.1rem; } .cp-pd-in { font-size: 1.35rem; } .cp-pd-st { font-size: .76rem; } }

/* ══ 第七課：書桌與書櫃（comp-desk）═══════════════════════════════════ */
@media (min-width: 1001px) { .cp-dk-lab .al-space { min-height: 640px; } }
.al-lab.cp-lb-book { font-size: .95rem; line-height: 1.1; text-align: center; background: transparent; border-color: transparent; padding: 0; }
.al-lab.cp-lb-book small { display: block; font-family: var(--zh); font-size: .6rem; font-weight: 600; color: #c9d3e8; }
.al-lab.cp-lb-copy { font-size: .7rem; line-height: 1.2; text-align: center; padding: .12rem .5rem; }
.al-lab.cp-lb-copy small { display: block; font-family: var(--zh); font-weight: 600; font-size: .64rem; }
.al-lab.cp-lb-copy b { display: block; font-size: .6rem; color: #ff9c8f; }
.al-lab.cp-lb-copy.is-on b { color: #a02a1c; }
.al-lab.cp-lb-copy.is-on small { color: #3a2c05; }
.cp-narrow .al-lab.cp-lb-book small, .cp-narrow .al-lab.cp-lb-copy small { display: none; }
.cp-dk-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; }
.cp-dk-items button { position: relative; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); column-gap: .35rem; align-items: center; text-align: left; padding: .36rem .5rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-text); font-family: var(--sans); font-weight: 800; font-size: .74rem; line-height: 1.2; cursor: pointer; }
.cp-dk-items button span { grid-row: span 2; font-size: 1.1rem; }
.cp-dk-items button small { font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-dk-items button.is-desk { border-color: var(--al-sun); background: rgba(255,211,110,.16); }
.cp-dk-items button.is-dirty::after { content: ""; position: absolute; right: .45rem; top: .45rem; width: 8px; height: 8px; border-radius: 50%; background: #ff6b5c; }
.cp-dk-items button[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--al-sun) inset; }
.cp-dk-items button:disabled, .cp-dk-lab .cp-btn-d:disabled { opacity: .4; cursor: default; }
.cp-dk-key { margin: 0; font-size: .68rem; color: var(--al-mute); }
.cp-dk-key i { display: inline-block; width: 10px; height: 10px; margin-right: .3rem; vertical-align: -1px; border-radius: 3px; }
.cp-dk-key .k-desk { background: rgba(255,211,110,.5); border: 1px solid var(--al-sun); } .cp-dk-key .k-dirty { border-radius: 50%; background: #ff6b5c; }
.cp-dk-nums { margin: 0; display: grid; grid-template-columns: .8fr 1fr 1.2fr; gap: .3rem; }
.cp-dk-nums > div { padding: .4rem .5rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-dk-nums dt { font-size: .58rem; font-weight: 700; color: var(--al-mute); line-height: 1.25; min-height: 2.5em; }
.cp-dk-nums dd { margin: .1rem 0 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: #fff; }
.cp-dk-lab .cp-msg { min-height: 8.4em; }
.cp-dk-pi { font-size: 1.05rem; line-height: 1; }
.cp-off .cp-dk-power { background: #38c778; color: #062414; box-shadow: none; }
.al-lg-cpshelf i { border: 0; border-radius: 2px; background: linear-gradient(90deg, #4f9dff 0 33%, #d4574a 33% 66%, #ffb04a 66%); }
.al-lg-cpdesk i { border: 0; border-radius: 2px; height: 6px; margin-top: .5rem; background: #8a6a48; }
.al-lg-cplamp i { border: 0; background: #ffd36e; box-shadow: 0 0 10px rgba(255,211,110,.8); }
@media (max-width: 1000px) { .cp-dk-lab .al-space { aspect-ratio: 16 / 10; min-height: 360px; } }
@media (max-width: 620px) { .cp-dk-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-dk-lab .cp-msg { min-height: 10.4em; } }

/* ── 放桌上還是放書櫃／記憶體滿了會怎樣 ─────────────────────────────── */
.cp-wh-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; margin: 0 auto; }
.cp-full { margin-top: 1.5rem; padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); max-width: 900px; }
.cp-fl-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .4rem 0 1.3rem; }
.cp-fl-apps button { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; column-gap: .5rem; align-items: center; text-align: left; padding: .6rem .8rem; border-radius: 14px; border: 2px solid var(--line); background: var(--cream); color: var(--ink); font-family: var(--sans); font-weight: 800; font-size: .92rem; line-height: 1.2; cursor: pointer; }
.cp-fl-apps button span { grid-row: span 2; font-size: 1.5rem; }
.cp-fl-apps button small { grid-column: 2; font-family: var(--zh); font-weight: 600; font-size: .82rem; color: var(--ink-soft); }
.cp-fl-apps button i { grid-column: 3; grid-row: 1 / span 2; font-style: normal; font-size: .82rem; font-weight: 800; color: var(--ink-soft); }
.cp-fl-apps button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.cp-fl-apps button[aria-pressed="true"] small, .cp-fl-apps button[aria-pressed="true"] i { color: rgba(255,255,255,.88); }
.cp-fl-top { margin: 0 0 .3rem; display: flex; justify-content: space-between; align-items: baseline; font-size: .86rem; font-weight: 800; color: var(--ink-soft); }
.cp-fl-num { font-family: var(--serif); font-size: 1.4rem; color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.is-over .cp-fl-num { color: #d64545; }
.cp-fl-track { position: relative; height: 26px; border-radius: 8px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; }
.cp-fl-bar { display: block; height: 100%; width: 0; background: #2f9e63; transition: width .3s, background .3s; }
.is-full .cp-fl-bar { background: var(--gold); } .is-over .cp-fl-bar { background: #d64545; }
.cp-fl-track2 { margin-top: .35rem; height: 20px; border-style: dashed; }
.cp-fl-over { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, #d64545 0 8px, #e98a8a 8px 16px); transition: width .3s; }
.cp-fl-track2 em { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); font-style: normal; font-size: .68rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.is-over .cp-fl-track2 em { color: #6b1e1e; }
@media (max-width: 720px) { .cp-fl-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-full { padding: 1.1rem; } .cp-fl-track2 em { font-size: .56rem; } }
@media (max-width: 420px) { .cp-fl-apps { grid-template-columns: 1fr; } }

/* ── 第八課：按下一個鍵（cp-ky-）───────────────────────────────── */
@media (min-width: 1001px) { .cp-ky-lab .al-space { min-height: 600px; } }
.al-lab.cp-lb-end i { display: inline-block; min-width: 1.3em; margin-right: .2em; border-radius: 50%; background: rgba(255,211,110,.22); font-style: normal; text-align: center; }
.al-lab.cp-lb-end.is-on i { background: rgba(27,20,5,.18); }
.al-lab.cp-lb-val { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; color: #eaf6ff; border-color: rgba(126,240,227,.55); white-space: nowrap; }
.al-lab.cp-lb-cap { font-size: .66rem; min-width: 0; padding: 0 .2rem; color: #1d2a44; background: transparent; border-color: transparent; }
.cp-ky-lab.cp-narrow .al-lab.cp-lb-end small, .cp-ky-lab.cp-narrow .al-lab.cp-lb-end span, .cp-narrow .al-lab.cp-lb-cap { display: none; }
.cp-ky-lab.cp-narrow .al-lab.cp-lb-end i { margin: 0; background: transparent; }
.cp-ky-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; }
.cp-ky-keys button { padding: .4rem .2rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.04); color: var(--al-text); font-family: var(--sans); cursor: pointer; text-align: center; line-height: 1.2; }
.cp-ky-keys button b { display: block; font-size: .95rem; }
.cp-ky-keys button small { font-family: var(--zh); font-weight: 600; font-size: .66rem; color: var(--al-mute); }
.cp-ky-keys button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.16); }
.cp-ky-keys .cp-ky-shift { border-style: dashed; }
.cp-ky-keys .cp-ky-shift[aria-pressed="true"] { border-style: solid; background: var(--al-sun); color: #1b1405; }
.cp-ky-keys .cp-ky-shift[aria-pressed="true"] small { color: #3a2c05; }
.cp-ky-stops { list-style: none; margin: 0; padding: 0; display: grid; gap: .24rem; }
.cp-ky-stops button { width: 100%; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; column-gap: .45rem; align-items: center; text-align: left; padding: .34rem .55rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); color: var(--al-mute); font-family: var(--sans); font-size: .78rem; font-weight: 700; cursor: pointer; }
.cp-ky-stops button i { font-style: normal; width: 1.4rem; height: 1.4rem; line-height: 1.4rem; text-align: center; border-radius: 50%; background: rgba(255,255,255,.08); font-size: .7rem; }
.cp-ky-stops button small { display: block; font-family: var(--zh); font-weight: 600; font-size: .66rem; }
.cp-ky-stops .cp-ky-v { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .74rem; font-weight: 700; text-align: right; }
.cp-ky-stops button.is-done { color: var(--al-text); } .cp-ky-stops button.is-done .cp-ky-v { color: #7ef0e3; }
.cp-ky-stops button.is-on { border-color: var(--al-sun); background: rgba(255,211,110,.14); } .cp-ky-stops button.is-on i { background: var(--al-sun); color: #1b1405; }
.cp-ky-lab .cp-msg { min-height: 9.6em; }
.al-lg-cpkeycap i { border: 0; border-radius: 3px; background: #e9edf5; box-shadow: 0 2px 0 #aab4c8; }
.al-lg-cpcarry2 i { border: 0; width: 14px; height: 14px; margin: .3rem 2px 0; background: #ffd36e; box-shadow: 0 0 10px rgba(255,211,110,.9); }
.al-lg-cpchip i { border: 0; border-radius: 2px; background: #2b2f3a; box-shadow: 0 0 0 2px #4f9dff inset; }
.al-lg-cpbitcell i { border: 0; border-radius: 2px; background: linear-gradient(90deg, #25304a 0 50%, #ffd36e 50%); }
.al-lg-cppix i { border: 0; border-radius: 1px; background: linear-gradient(90deg, #eaf6ff 0 50%, #101a30 50%); box-shadow: 0 0 0 1px #56627e; }
@media (max-width: 1000px) { .cp-ky-lab .al-space { aspect-ratio: 16 / 9; min-height: 340px; } }
@media (max-width: 620px) { .cp-ky-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-ky-lab .cp-msg { min-height: 12em; } }
/* 選項題與「問問自己的鍵盤」 */
.cp-ch-opts { max-width: 760px; margin: 0 auto; } .cp-ch-opts.cp-ch-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cp-ch-opts.cp-ch-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-lv2-pad { display: block; width: 100%; padding: 1.4rem 1rem; border-radius: 16px; border: 2px dashed var(--brand); background: var(--cream); color: var(--brand-dk); font-family: var(--sans); font-size: 1.05rem; cursor: pointer; text-align: center; }
.cp-lv2-pad small { display: block; margin-top: .2rem; font-family: var(--zh); font-weight: 600; font-size: .92rem; color: var(--ink-soft); }
.cp-lv2-pad:focus { outline: none; border-style: solid; background: #fff; box-shadow: 0 0 0 4px rgba(15,110,95,.16); }
.cp-lv2-out { margin: 1.1rem 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.cp-lv2-out > div { padding: .7rem .8rem; border-radius: 14px; border: 1px solid var(--line); background: var(--cream); }
.cp-lv2-out dt { font-size: .74rem; font-weight: 800; color: var(--ink-soft); line-height: 1.3; min-height: 3.6em; }
.cp-lv2-out dt small { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; font-size: .66rem; opacity: .8; }
.cp-lv2-out dd { margin: .2rem 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.25rem; font-weight: 700; color: var(--brand-dk); overflow-wrap: anywhere; }
@media (max-width: 720px) { .cp-lv2-out { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-ch-opts.cp-ch-3 { grid-template-columns: 1fr; } }

/* ── 第九課：走格子的小機器人（cp-rb-、小遊戲 cp-mz-）───────────── */
@media (min-width: 1001px) { .cp-rb-lab .al-space { min-height: 640px; } }
.cp-rb-progs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; }
.cp-rb-progs button { padding: .4rem .5rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.04); color: var(--al-text); font-family: var(--sans); cursor: pointer; text-align: left; line-height: 1.25; }
.cp-rb-progs button b { display: block; font-size: .8rem; }
.cp-rb-progs button small { font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-rb-progs button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.16); }
.cp-rb-room { justify-content: center; font-size: .76rem; }
.cp-rb-room[hidden] { display: none; }
.cp-rb-code { list-style: none; margin: 0; padding: .35rem; max-height: 15.5rem; overflow-y: auto; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(0,0,0,.25); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .76rem; counter-reset: ln; }
.cp-rb-code li { position: relative; counter-increment: ln; padding: .16rem .5rem .16rem calc(2rem + var(--d) * 1.1rem); border-radius: 6px; color: var(--al-mute); line-height: 1.35; }
.cp-rb-code li::before { content: counter(ln); position: absolute; left: .4rem; width: 1.2rem; text-align: right; font-size: .62rem; opacity: .55; }
.cp-rb-code li small { margin-left: .5rem; font-family: var(--zh); font-weight: 600; font-size: .68rem; opacity: .85; }
.cp-rb-code li.is-in { color: #ffe3a3; }
.cp-rb-code li.is-on { color: #1b1405; background: var(--al-sun); }
.cp-rb-round { float: right; font-family: var(--sans); font-size: .64rem; font-weight: 800; color: #7ef0e3; }
.cp-rb-nums { grid-template-columns: 1fr 1fr; } .cp-rb-nums dt { min-height: 0; }
.cp-rb-lab .cp-msg { min-height: 8.4em; }
.al-lg-cprobot i { border: 0; border-radius: 3px; background: #ffd36e; }
.al-lg-cpnose i { border: 0; width: 0; height: 0; margin: .3rem 3px 0; background: transparent; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 13px solid #7ef0e3; border-radius: 0; }
.al-lg-cpwall i { border: 0; border-radius: 2px; background: #8a93a6; }
.al-lg-cpflag i { border: 0; border-radius: 1px; background: #d4574a; }
.al-lg-cpseen i { border: 0; border-radius: 2px; background: #2f8f86; }
@media (max-width: 1000px) { .cp-rb-lab .al-space { aspect-ratio: 4 / 3; min-height: 360px; } }
@media (max-width: 620px) { .cp-rb-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-rb-lab .cp-msg { min-height: 10.4em; } }
.cp-maze { max-width: 980px; }
.cp-mz-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.cp-mz-tabs button { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); column-gap: .5rem; align-items: center; text-align: left; padding: .55rem .8rem; border-radius: 14px; border: 2px solid var(--line); background: var(--cream); color: var(--ink); font-family: var(--sans); font-weight: 800; font-size: .92rem; cursor: pointer; }
.cp-mz-tabs button i { grid-row: span 2; width: 1.7rem; height: 1.7rem; line-height: 1.7rem; text-align: center; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-style: normal; font-size: .82rem; }
.cp-mz-tabs button small { font-family: var(--zh); font-weight: 600; font-size: .82rem; color: var(--ink-soft); }
.cp-mz-tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; } .cp-mz-tabs button[aria-pressed="true"] small { color: rgba(255,255,255,.88); } .cp-mz-tabs button[aria-pressed="true"] i { color: var(--brand-dk); }
.cp-mz-tabs button.is-done i { background: #2f9e63; border-color: #2f9e63; color: #fff; font-size: 0; } .cp-mz-tabs button.is-done i::after { content: "✓"; font-size: .9rem; }
.cp-mz-hint { margin: 1rem 0; font-size: .98rem; line-height: 1.6; } .cp-mz-hint .zh { display: block; color: var(--ink-soft); }
.cp-mz-main { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.cp-mz-grid { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 0; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; border: 2px solid #1d2a44; background: #24324f; }
.cp-mz-grid > i { display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset; font-style: normal; font-size: 1.6rem; color: #ff7a66; transition: background .25s; }
.cp-mz-grid > i.is-wall { background: #8a93a6; } .cp-mz-grid > i.is-seen { background: #2f8f86; }
.cp-mz-bot { position: absolute; left: 0; top: 0; width: calc(100% / var(--n)); height: calc(100% / var(--n)); display: flex; align-items: center; justify-content: center; transition: transform .28s ease; pointer-events: none; }
.cp-mz-bot b { display: block; width: 62%; height: 62%; border-radius: 22%; background: #ffd36e; color: #1d2a44; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; line-height: 1; transition: transform .28s ease; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.cp-mz-bot.is-bump b { background: #ff7a66; }
.cp-mz-c { font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.cp-mz-rep { display: flex; align-items: center; gap: .4rem; margin: .3rem 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92rem; font-weight: 700; color: var(--brand-dk); }
.cp-mz-rep[hidden] { display: none; }
.cp-mz-rep button { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 1.05rem; font-weight: 800; color: var(--brand-dk); cursor: pointer; }
.cp-mz-rep b { min-width: 1.6em; text-align: center; font-size: 1.15rem; }
.cp-mz-prog { list-style: none; margin: 0 0 1rem; padding: .5rem; min-height: 3.4rem; display: flex; flex-wrap: wrap; gap: .35rem; border-radius: 14px; border: 2px dashed var(--line); background: var(--cream); }
.cp-mz-rep:not([hidden]) + .cp-mz-prog { margin-left: 1.2rem; border-left: 4px solid var(--brand); border-style: solid; border-width: 0 0 0 4px; border-radius: 0 14px 14px 0; }
.cp-mz-prog li.is-empty { font-size: .86rem; color: var(--ink-soft); line-height: 1.5; padding: .2rem .4rem; } .cp-mz-prog li.is-empty .zh { display: block; }
.cp-mz-prog button, .cp-mz-tokens button { display: inline-grid; grid-template-columns: auto auto; column-gap: .4rem; align-items: center; padding: .35rem .65rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-family: var(--sans); font-size: .82rem; font-weight: 700; cursor: pointer; text-align: left; line-height: 1.2; }
.cp-mz-prog button i, .cp-mz-tokens button i { grid-row: span 2; font-style: normal; font-size: 1.05rem; color: var(--brand); }
.cp-mz-prog button small, .cp-mz-tokens button small { font-family: var(--zh); font-weight: 600; font-size: .74rem; color: var(--ink-soft); }
.cp-mz-prog button.is-on { background: var(--gold); border-color: var(--gold-dk); }
.cp-mz-tokens { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.cp-mz-tokens button { border-color: var(--brand); } .cp-mz-tokens button:disabled { opacity: .4; cursor: default; }
.cp-mz-btns { display: flex; gap: .6rem; flex-wrap: wrap; }
.cp-mz-run:disabled { opacity: .5; }
@media (max-width: 760px) { .cp-mz-main { grid-template-columns: 1fr; } .cp-mz-grid { max-width: 340px; margin: 0 auto; width: 100%; } .cp-mz-tabs button { grid-template-columns: 1fr; padding: .5rem; font-size: .8rem; } .cp-mz-tabs button i { display: none; } }

/* ── 第十課：兩種找法（cp-sr-、小遊戲 cp-gn-／cp-gw-）────────────── */
@media (min-width: 1001px) { .cp-sr-lab .al-space { min-height: 620px; } }
.cp-sr-ns, .cp-sr-wh { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cp-sr-mix { justify-content: center; font-size: .78rem; }
.cp-sr-mix[aria-pressed="true"] { background: #ff7a66; border-color: #ff7a66; color: #2a0b06; }
.cp-sr-look { margin: 0; font-size: .78rem; font-weight: 700; color: var(--al-mute); }
.cp-sr-look b { margin-left: .4rem; font-family: var(--serif); font-size: 1.5rem; color: #7ef0e3; }
.cp-sr-nums { grid-template-columns: 1fr 1fr; } .cp-sr-nums dt { min-height: 2.5em; } .cp-sr-nums dd { font-size: 1.9rem; }
.cp-sr-nums p { margin: 0; min-height: 1.2em; font-size: .64rem; font-weight: 800; color: var(--al-mute); }
.cp-sr-nums p.is-done { color: #6fe0a1; } .cp-sr-nums p.is-fail { color: #ff9c8f; }
.cp-sr-lab .cp-msg { min-height: 10.8em; }
.al-lab.cp-lb-num { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; min-width: 0; padding: .02rem .3rem; color: #1b1405; background: rgba(255,227,163,.95); border-color: #ffe3a3; }
.al-lab.cp-lb-num.is-on { background: #38c778; border-color: #38c778; color: #062414; }
.al-lab.cp-lb-num.is-small { font-size: .64rem; padding: 0 .2rem; }
.al-lg-cpbox i { border: 0; border-radius: 2px; background: #c9a47a; box-shadow: 0 -3px 0 #8a6a48 inset; }
.al-lg-cpboxopen i { border: 0; border-radius: 2px; background: #ffe3a3; }
.al-lg-cpboxdrop i { border: 0; border-radius: 2px; background: #46527a; }
.al-lg-cpboxhit i { border: 0; border-radius: 2px; background: #38c778; }
@media (max-width: 1000px) { .cp-sr-lab .al-space { aspect-ratio: 16 / 10; min-height: 340px; } }
@media (max-width: 620px) { .cp-sr-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-sr-lab .cp-msg { min-height: 14em; } }
.cp-gn-form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1.1rem; }
.cp-gn-form label { font-weight: 800; font-size: .92rem; }
.cp-gn-in { width: 7.5rem; padding: .55rem .8rem; border-radius: 12px; border: 2px solid var(--brand); font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--brand-dk); background: #fff; }
.cp-gn-count { margin: 0 0 0 auto; font-size: .86rem; font-weight: 800; color: var(--ink-soft); } .cp-gn-count b { font-family: var(--serif); font-size: 1.5rem; color: var(--brand-dk); margin-left: .2rem; }
.cp-gn-track { position: relative; height: 22px; border-radius: 8px; background: var(--cream); border: 1px solid var(--line); overflow: hidden; }
.cp-gn-bar { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; background: #2f9e63; transition: left .3s, width .3s; }
.cp-gn-log { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; min-height: 2rem; }
.cp-gn-log li { padding: .2rem .6rem; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; font-weight: 700; }
.cp-gn-log li.is-hit { background: #2f9e63; border-color: #2f9e63; color: #fff; }
.cp-gw-sizes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin: .4rem 0 1.3rem; }
.cp-gw-sizes button { padding: .55rem .2rem; border-radius: 12px; border: 2px solid var(--line); background: var(--cream); font-family: var(--serif); font-size: 1rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.cp-gw-sizes button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.cp-gw-rows { display: grid; gap: 1rem; }
.cp-gw-rows > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 1rem; }
.cp-gw-rows p { margin: 0; font-size: .9rem; font-weight: 800; color: var(--ink-soft); }
.cp-gw-rows b { font-family: var(--serif); font-size: 1.7rem; color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.cp-gw-rows .cp-fl-track { grid-column: 1 / -1; margin-top: .3rem; height: 22px; }
.cp-gw-bar-l, .cp-gw-bar-b { display: block; height: 100%; transition: width .35s; } .cp-gw-bar-l { background: #d98a2b; } .cp-gw-bar-b { background: #2f9e63; min-width: 3px; }
@media (max-width: 720px) { .cp-gw-sizes { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cp-gn-count { margin-left: 0; width: 100%; } }

/* ── 第十一課：輪流（cp-sc-、小工具 cp-sl-）──────────────────────── */
@media (min-width: 1001px) { .cp-sc-lab .al-space { min-height: 640px; } }
.cp-sc-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .28rem; }
.cp-sc-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: .5rem; padding: .3rem .55rem .4rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); font-size: .78rem; font-weight: 700; color: var(--al-text); }
.cp-sc-bars li[hidden] { display: none; }
.cp-sc-bars li small { font-family: var(--zh); font-weight: 600; font-size: .68rem; color: var(--al-mute); }
.cp-sc-bars li b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .72rem; color: var(--al-mute); }
.cp-sc-bars li em { grid-column: 1 / -1; display: block; height: 6px; margin-top: .25rem; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.cp-sc-bars li em i { display: block; height: 100%; width: 0; background: var(--al-sun); }
.cp-sc-bars li.is-on { border-color: var(--al-sun); background: rgba(255,211,110,.14); }
.cp-sc-bars li.is-done em i { background: #38c778; } .cp-sc-bars li.is-done b { color: #6fe0a1; }
.cp-sc-nums { grid-template-columns: 1.2fr 1fr 1fr; } .cp-sc-nums dd { font-size: 1.25rem; }
.cp-sc-lab .cp-msg { min-height: 8.4em; }
.al-lg-cpchef i { border: 0; border-radius: 50% 50% 3px 3px; background: #fff; }
.al-lg-cpplate i { border: 0; border-radius: 50%; height: 8px; margin-top: .45rem; background: #e9edf5; }
.al-lg-cpprog i { border: 0; border-radius: 2px; background: linear-gradient(0deg, #c7a6ff 0 60%, #1c2947 60%); }
.al-lg-cpmark i { border: 0; width: 0; height: 0; margin: .35rem 3px 0; background: transparent; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 12px solid #ffd36e; border-radius: 0; }
@media (max-width: 1000px) { .cp-sc-lab .al-space { aspect-ratio: 16 / 10; min-height: 340px; } }
@media (max-width: 620px) { .cp-sc-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-sc-lab .cp-msg { min-height: 11em; } }
.cp-sl-lab { display: block; font-weight: 800; font-size: 1rem; margin-bottom: .5rem; }
.cp-sl-lab b { font-family: var(--serif); font-size: 1.6rem; color: var(--brand-dk); margin: 0 .2rem; }
.cp-sl-range { width: 100%; accent-color: var(--brand); }
.cp-sl-ends { display: flex; justify-content: space-between; margin: .1rem 0 1rem; font-size: .76rem; font-weight: 700; color: var(--ink-soft); }
.cp-sl-strip { display: flex; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--cream); }
.cp-sl-strip i { display: block; min-width: 1px; }
.cp-sl-strip .is-download, .cp-sl-key .is-download { background: #3ac7b0; } .cp-sl-strip .is-essay, .cp-sl-key .is-essay { background: #e0b75a; }
.cp-sl-strip .is-music, .cp-sl-key .is-music { background: #9a6ee8; } .cp-sl-strip .is-sw, .cp-sl-key .is-sw { background: #2a3550; }
.cp-sl-key { margin: .5rem 0 0; font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.cp-sl-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.cp-sl-out { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cp-sl[data-zone="stutter"] .cp-sl-gap, .cp-sl[data-zone="waste"] .cp-sl-sw { color: #d64545; }
.cp-sl[data-zone="ok"] .cp-sl-gap, .cp-sl[data-zone="ok"] .cp-sl-sw { color: #2f9e63; }
@media (max-width: 720px) { .cp-sl-out { grid-template-columns: 1fr; } .cp-sl-out dt { min-height: 0; } }
.cp-sc-lab .al-lab.cp-lb-copy b { color: #7ef0e3; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.cp-sc-lab .al-lab.cp-lb-copy.is-on b { color: #3a2c05; }

/* ── 第十二課：壓縮（cp-rl-、小工具 cp-rd-／cp-ls-）─────────────── */
@media (min-width: 1001px) { .cp-rl-lab .al-space { min-height: 660px; } }
.cp-rl-pics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-rl-count { padding: .5rem .65rem .4rem; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-rl-count p { margin: 0; display: flex; justify-content: space-between; align-items: baseline; font-size: .7rem; font-weight: 700; color: var(--al-mute); }
.cp-rl-count p b { font-family: var(--serif); font-size: 1.5rem; color: #fff; font-variant-numeric: tabular-nums; }
.cp-rl-count .cp-rl-unit { justify-content: flex-end; font-size: .62rem; margin-top: .2rem; }
.cp-rl-track { height: 10px; margin: .15rem 0 .45rem; border-radius: 5px; background: rgba(255,255,255,.08); overflow: hidden; }
.cp-rl-bar-o, .cp-rl-bar-n { display: block; height: 100%; } .cp-rl-bar-o { width: 50%; background: #8a93a6; }
.cp-rl-bar-n { width: 50%; background: #38c778; transition: width .3s, background .3s; } .cp-rl-bar-n.is-big { background: #ff7a66; }
.cp-rl-line { margin: 0; min-height: 2.6em; display: flex; flex-wrap: wrap; align-items: center; gap: .18rem .3rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .76rem; color: var(--al-text); }
.cp-rl-line b { flex-basis: 100%; font-family: var(--sans); font-size: .64rem; color: var(--al-mute); }
.cp-rl-line span, .cp-rd-rows span { display: inline-flex; align-items: center; gap: .15rem; }
.cp-rl-line i, .cp-rd-rows i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(128,128,128,.5); }
.cp-rl-lab .cp-msg { min-height: 8.4em; }
.cp-rl-lab .cp-step:disabled { opacity: .4; cursor: default; }
.al-lab.cp-lb-run { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .72rem; min-width: 0; padding: 0 .28rem; color: #fff; background: rgba(11,19,38,.72); border-color: rgba(255,255,255,.35); }
.al-lg-cppx i { border: 0; border-radius: 2px; background: #d62828; }
.al-lg-cpbar i { border: 0; border-radius: 2px; width: 26px; background: #d62828; }
.al-lg-cpnum i { border: 0; border-radius: 6px; background: rgba(11,19,38,.72); box-shadow: 0 0 0 1px rgba(255,255,255,.5) inset; }
@media (max-width: 1000px) { .cp-rl-lab .al-space { aspect-ratio: 1 / 1; min-height: 360px; max-height: 560px; } }
@media (max-width: 620px) { .cp-rl-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-rl-lab .cp-msg { min-height: 11em; } }
.cp-rd { max-width: 980px; }
.cp-rd-main { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.cp-rd-grid { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 2px solid #1d2a44; touch-action: none; }
.cp-rd-grid button { border: 0; padding: 0; box-shadow: 0 0 0 1px rgba(29,42,68,.18) inset; cursor: crosshair; }
.cp-rd-pal { display: flex; gap: .5rem; margin: .8rem 0; }
.cp-rd-pal button { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.cp-rd-pal button[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--brand); }
.cp-rd-rows { list-style: none; margin: 0 0 1rem; padding: .6rem .8rem; display: grid; gap: .22rem; border-radius: 14px; background: var(--cream); border: 1px solid var(--line); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92rem; font-weight: 700; counter-reset: rr; }
.cp-rd-rows li { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: center; min-height: 1.5em; counter-increment: rr; }
.cp-rd-rows li::before { content: counter(rr); width: 1.2rem; font-size: .7rem; color: var(--ink-soft); font-weight: 600; }
.cp-rd .cp-fl-track { position: relative; overflow: visible; }
.cp-rd-bar { display: block; height: 100%; border-radius: 7px; background: #2f9e63; transition: width .25s, background .25s; }
.cp-rd[data-zone="big"] .cp-rd-bar { background: #d64545; } .cp-rd[data-zone="same"] .cp-rd-bar { background: var(--gold); }
.cp-rd[data-zone="big"] .cp-rd-now { color: #d64545; }
.cp-rd-mark { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.cp-rd-mark::after { content: "64"; position: absolute; top: -1.3em; left: -0.6em; font-style: normal; font-size: .7rem; font-weight: 800; color: var(--ink-soft); }
.cp-rd-now { font-family: var(--serif); font-size: 1.5rem; color: var(--brand-dk); }
.cp-ls { max-width: 900px; }
.cp-ls-ks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .4rem 0 1.2rem; }
.cp-ls-ks button { padding: .5rem .3rem; border-radius: 12px; border: 2px solid var(--line); background: var(--cream); font-family: var(--sans); color: var(--ink); cursor: pointer; line-height: 1.25; }
.cp-ls-ks button b { display: block; font-family: var(--serif); font-size: 1.05rem; } .cp-ls-ks button small { font-family: var(--zh); font-weight: 600; font-size: .76rem; color: var(--ink-soft); }
.cp-ls-ks button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; } .cp-ls-ks button[aria-pressed="true"] small { color: rgba(255,255,255,.88); }
.cp-ls-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; margin-bottom: 1rem; }
.cp-ls-pair figure { margin: 0; }
.cp-ls-pic { display: grid; grid-template-columns: repeat(16, 1fr); aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 2px solid #1d2a44; max-width: 320px; }
.cp-ls-pic i { display: block; }
.cp-ls-pair figcaption { margin-top: .5rem; font-size: .9rem; font-weight: 800; }
.cp-ls-pair figcaption small { display: block; font-weight: 700; font-size: .8rem; color: var(--ink-soft); } .cp-ls-pair figcaption small b { font-family: var(--serif); font-size: 1.15rem; color: var(--brand-dk); }
.cp-ls-back:disabled { opacity: .45; cursor: default; }
@media (max-width: 760px) { .cp-rd-main { grid-template-columns: 1fr; } .cp-rd-grid { max-width: 320px; } .cp-ls-ks { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-ls-pair { gap: .8rem; } }

/* ── 第十三課：打開一個網頁（cp-wb-、小工具 cp-hm-／cp-up-）─────── */
@media (min-width: 1001px) { .cp-wb-lab .al-space { min-height: 640px; } }
.cp-wb-urls { display: grid; gap: .28rem; }
.cp-wb-urls button { padding: .34rem .55rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.04); color: var(--al-text); font-family: var(--sans); cursor: pointer; text-align: left; line-height: 1.3; }
.cp-wb-urls button b { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .72rem; overflow-wrap: anywhere; }
.cp-wb-urls button small { font-family: var(--zh); font-weight: 600; font-size: .66rem; color: var(--al-mute); }
.cp-wb-urls button[aria-pressed="true"] { border-color: var(--al-sun); background: rgba(255,211,110,.16); }
.cp-wb-bar { margin: 0; padding: .3rem .7rem; border-radius: 999px; background: #eef1f6; color: #1d2a44; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .7rem; overflow-wrap: anywhere; }
.cp-wb-bar::before { content: "🔎 "; }
.cp-wb-lab .cp-ky-stops button.is-off { opacity: .35; }
.cp-wb-lab .cp-ky-stops .cp-ky-v { max-width: 10.5rem; overflow-wrap: anywhere; font-size: .68rem; }
.cp-wb-lab .cp-msg { min-height: 9.6em; }
.al-lab.cp-lb-page { min-width: 5.4rem; max-width: 8.6rem; padding: .3rem .5rem; text-align: left; background: #fff; color: #1d2a44; border-color: #cfd6e4; border-radius: 6px; box-shadow: 0 8px 22px -10px rgba(0,0,0,.7); }
.cp-pg-h1 { margin: 0 0 .15rem; font-family: var(--serif); font-size: .92rem; line-height: 1.2; }
.cp-pg-p, .cp-pg-text { margin: 0; display: block; font-family: var(--sans); font-size: .66rem; font-weight: 500; line-height: 1.35; }
.cp-narrow .al-lab.cp-lb-page { max-width: 6.2rem; padding: .2rem .35rem; } .cp-narrow .cp-pg-h1 { font-size: .72rem; } .cp-narrow .cp-pg-p { font-size: .56rem; }
.al-lg-cplaptop i { border: 0; border-radius: 2px; background: #10192e; box-shadow: 0 0 0 2px #aab4c8 inset; }
.al-lg-cpdns i { border: 0; border-radius: 2px; background: #f4ecd8; box-shadow: -4px 0 0 #8a5a2a inset; }
.al-lg-cpserver i { border: 0; border-radius: 2px; background: #2a3550; box-shadow: 0 5px 0 -3px #38c778 inset, 0 0 0 1px #8a93a6 inset; }
.al-lg-cpnode i { border: 0; width: 12px; height: 12px; margin: .35rem 4px 0; background: #7ef0e3; }
@media (max-width: 1000px) { .cp-wb-lab .al-space { aspect-ratio: 16 / 10; min-height: 340px; } }
@media (max-width: 620px) { .cp-wb-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-wb-lab .cp-msg { min-height: 12em; } }
.cp-hm { max-width: 980px; }
.cp-hm-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; align-items: start; }
.cp-hm-src { width: 100%; box-sizing: border-box; margin: .3rem 0 .8rem; padding: .8rem .9rem; border-radius: 14px; border: 2px solid var(--brand); background: #0f1a2e; color: #eaf6ff; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; line-height: 1.6; resize: vertical; }
.cp-hm-win { margin-top: .3rem; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
.cp-hm-chrome { display: flex; gap: .35rem; padding: .5rem .7rem; background: #e9edf5; }
.cp-hm-chrome i { width: 10px; height: 10px; border-radius: 50%; background: #c2c9d8; }
.cp-hm-out { min-height: 9rem; padding: 1rem 1.2rem; }
.cp-hm-out .cp-pg-h1 { font-size: 1.7rem; margin: 0 0 .5rem; } .cp-hm-out .cp-pg-p, .cp-hm-out .cp-pg-text { font-size: 1rem; line-height: 1.6; margin: 0 0 .5rem; }
.cp-hm-out .cp-pg-text { color: #8a5a2a; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; }
.cp-up-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 1.2rem; }
.cp-up-pick button { padding: .4rem .8rem; border-radius: 999px; border: 2px solid var(--line); background: var(--cream); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78rem; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.cp-up-pick button[aria-pressed="true"] { border-color: var(--brand); background: #fff; }
.cp-up-line { margin: 0 0 .6rem; padding: 1rem; border-radius: 14px; background: #0f1a2e; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; line-height: 2; overflow-wrap: anywhere; }
.cp-up-sep { color: #8a93a6; }
.cp-up-seg { padding: .15rem .4rem; border-radius: 8px; border: 2px solid transparent; font: inherit; color: #0f1a2e; cursor: pointer; }
.cp-up-seg.is-scheme, .cp-up-key .is-scheme { background: #ffd36e; } .cp-up-seg.is-host, .cp-up-key .is-host { background: #7ef0e3; } .cp-up-seg.is-path, .cp-up-key .is-path { background: #ffb3a8; }
.cp-up-seg[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.cp-up-key { margin: 0 0 1rem; font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.cp-up-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.cp-up-msg b { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9rem; margin-bottom: .2rem; overflow-wrap: anywhere; }
@media (max-width: 760px) { .cp-hm-main { grid-template-columns: 1fr; } .cp-up-line { font-size: .92rem; } }

/* ── 第十四課：保守祕密（cp-cf-、小工具 cp-ci-／cp-sp-／cp-kb-）──── */
@media (min-width: 1001px) { .cp-cf-lab .al-space { min-height: 620px; } }
.cp-cf-msgs button b { font-size: .76rem; letter-spacing: .04em; }
.cp-cf-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cp-cf-key { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 800; color: var(--al-text); }
.cp-cf-key.is-off { opacity: .35; }
.cp-cf-key button { width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 1px solid rgba(255,211,110,.5); background: transparent; color: var(--al-sun); font-size: 1rem; font-weight: 800; cursor: pointer; }
.cp-cf-key b { min-width: 1.6em; text-align: center; font-family: var(--serif); font-size: 1.4rem; color: var(--al-sun); }
.cp-cf-key small { font-family: var(--zh); font-weight: 600; font-size: .66rem; color: var(--al-mute); }
.cp-cf-who { margin: 0; display: grid; gap: .28rem; }
.cp-cf-who > div { padding: .34rem .6rem .42rem; border-radius: 10px; border: 1px solid var(--al-line); background: rgba(255,255,255,.03); }
.cp-cf-who dt { font-size: .64rem; font-weight: 700; color: var(--al-mute); }
.cp-cf-who dd { margin: .1rem 0 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700; letter-spacing: .03em; color: #7ef0e3; overflow-wrap: anywhere; min-height: 1.3em; }
.cp-cf-who > div.is-bad { border-color: #ff7a66; background: rgba(255,122,102,.12); } .cp-cf-who > div.is-bad dd { color: #ffb3a8; }
.cp-cf-lab .cp-msg { min-height: 9.6em; }
.al-lab.cp-lb-spy { border-color: rgba(255,122,102,.8); color: #ffc9c2; }
.al-lab.cp-lb-val.is-bad { border-color: #ff7a66; color: #ffb3a8; }
.al-lab.cp-lb-note { background: rgba(20,12,28,.9); }
.cp-narrow .cp-cf-lab .al-lab.cp-lb-val, .cp-cf-lab.cp-narrow .al-lab.cp-lb-val { font-size: .58rem; }
.al-lg-cpenv i { border: 0; border-radius: 2px; background: #f4ecd8; }
.al-lg-cplock i { border: 0; border-radius: 3px; background: #ffd36e; }
.al-lg-cpspy i { border: 0; border-radius: 50% 50% 3px 3px; background: #3a2a4a; box-shadow: 0 0 0 1px #ff7a66 inset; }
@media (max-width: 1000px) { .cp-cf-lab .al-space { aspect-ratio: 16 / 10; min-height: 340px; } }
@media (max-width: 620px) { .cp-cf-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-cf-lab .cp-msg { min-height: 12em; } }
.cp-ci { max-width: 860px; }
.cp-ci-dir { grid-template-columns: repeat(2, minmax(0, 12rem)); margin-bottom: 1.1rem; }
.cp-ci-dir button { border-color: var(--line); background: var(--cream); color: var(--ink); } .cp-ci-dir button small { color: var(--ink-soft); }
.cp-ci-dir button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; } .cp-ci-dir button[aria-pressed="true"] small { color: rgba(255,255,255,.88); }
.cp-ci-src { width: 100%; box-sizing: border-box; margin: .3rem 0 1.1rem; padding: .7rem .9rem; border-radius: 12px; border: 2px solid var(--brand); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.1rem; letter-spacing: .05em; color: var(--ink); background: #fff; }
.cp-ci-table { margin: .9rem 0 1.1rem; padding: .6rem .7rem; border-radius: 12px; background: #0f1a2e; overflow-x: auto; }
.cp-ci-table span { display: block; white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .98rem; letter-spacing: .34em; }
.cp-ci-top { color: #aab4c8; } .cp-ci-bot { color: #ffd36e; }
.cp-ci-out { margin: .3rem 0 0; min-height: 1.6em; padding: .7rem .9rem; border-radius: 12px; background: var(--cream); border: 1px solid var(--line); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: .05em; color: var(--brand-dk); overflow-wrap: anywhere; }
.cp-sp-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important; letter-spacing: .08em; }
.cp-sp-list { list-style: none; margin: 0 auto 1rem; padding: 0; max-width: 620px; max-height: 21rem; overflow-y: auto; display: grid; gap: .22rem; }
.cp-sp-list button { width: 100%; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .5rem; align-items: center; text-align: left; padding: .34rem .7rem; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #eaf0ff; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86rem; letter-spacing: .05em; cursor: pointer; }
.cp-sp-list button i { font-style: normal; font-size: .7rem; color: #9fb0cf; text-align: right; }
.cp-sp-list button:hover { background: rgba(255,255,255,.1); }
.cp-sp-list button.is-right { background: #2f9e63; border-color: #2f9e63; color: #fff; } .cp-sp-list button.is-wrong { opacity: .35; }
.cp-kb { max-width: 860px; }
.cp-kb-n { margin: .2rem 0 .3rem; padding: .8rem 1rem; border-radius: 14px; background: #0f1a2e; color: #7ef0e3; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.cp-kb[data-size="huge"] .cp-kb-n { font-size: .92rem; }
.cp-kb-d { margin: 0 0 .8rem; font-size: .88rem; font-weight: 700; color: var(--ink-soft); } .cp-kb-d b { font-family: var(--serif); font-size: 1.3rem; color: var(--brand-dk); margin: 0 .15rem; }
.cp-kb-msg, .cp-ci-out, .cp-sp-code { overflow-wrap: anywhere; }
/* 很長的數字（例如 2 的 128 次方）在窄螢幕要能換行，不然會把整頁撐寬 */
.cc-grid > * { min-width: 0; } .cc-grid p, .cp-tips li, .src-list li, .cp-lv-note, .lead { overflow-wrap: anywhere; }
.cp-sources li, .cp-sources p { overflow-wrap: anywhere; }

/* ── 第十五課：機器學習（cp-ln-、小工具 cp-tc-）─────────────────── */
@media (min-width: 1001px) { .cp-ln-lab .al-space { min-height: 640px; } }
.cp-ln-sets button b { font-family: var(--sans); font-size: .8rem; }
.cp-ln-nums { grid-template-columns: 1fr 1fr; } .cp-ln-nums dt { min-height: 2.5em; } .cp-ln-nums dd { font-size: 1.5rem; }
.cp-ln-lab .cp-msg { min-height: 12em; }
.al-lab.cp-lb-side { font-size: .7rem; } .al-lab.cp-lb-side.is-a { color: #ffb3a8; border-color: rgba(255,107,92,.7); } .al-lab.cp-lb-side.is-o { color: #ffd9a0; border-color: rgba(255,176,74,.7); }
.al-lab.cp-lb-flip { font-size: .6rem; padding: 0 .3rem; color: #fff; background: rgba(29,42,68,.92); border-color: #fff; }
.cp-narrow .al-lab.cp-lb-flip small, .cp-narrow .al-lab.cp-lb-side small { display: none; }
.al-lg-cpapple i { border: 0; background: #d62828; } .al-lg-cporange i { border: 0; background: #ff9a2e; }
.al-lg-cpwall i { border: 0; border-radius: 2px; width: 6px; margin: 0 9px; background: #7ef0e3; }
.al-lg-cpnewfruit i { border: 3px solid #fff; background: #d62828; width: 12px; height: 12px; margin: .3rem 3px 0; }
.al-lg-cpflip i { border: 3px solid #1d2a44; background: #ff9a2e; box-shadow: 0 0 0 1px #fff; }
@media (max-width: 1000px) { .cp-ln-lab .al-space { aspect-ratio: 4 / 3; min-height: 340px; } }
@media (max-width: 620px) { .cp-ln-lab .al-space { aspect-ratio: 1 / 1; min-height: 0; } .cp-ln-lab .cp-msg { min-height: 15em; } }
.cp-tc { max-width: 940px; }
.cp-tc-main { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.8rem; align-items: start; }
.cp-tc-wrap { position: relative; padding: 0 0 1.5rem 1.5rem; }
.cp-tc-svg { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; border: 2px solid #1d2a44; cursor: crosshair; touch-action: manipulation; }
.cp-tc-bg { fill: #f4ecd8; } .cp-tc-line { stroke: #0f6e5f; stroke-width: 4; stroke-linecap: round; }
.cp-tc-pt { stroke: #fff; stroke-width: 2; } .cp-tc-pt.is-a { fill: #d62828; } .cp-tc-pt.is-o { fill: #ff9a2e; } .cp-tc-pt.is-bad { stroke: #1d2a44; stroke-width: 4; }
.cp-tc-ax-x, .cp-tc-ax-y { position: absolute; font-size: .72rem; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.cp-tc-ax-x { right: 0; bottom: 0; } .cp-tc-ax-y { left: 0; top: 0; writing-mode: vertical-rl; transform: rotate(180deg); }
.cp-tc-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: .3rem 0 1rem; }
.cp-tc-out { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; } .cp-tc-out dt { min-height: 2.8em; }
@media (max-width: 760px) { .cp-tc-main { grid-template-columns: 1fr; } .cp-tc-wrap { max-width: 340px; } .cp-tc-out { grid-template-columns: 1fr; } .cp-tc-out dt { min-height: 0; } }

/* ── 第十六課：越變越小（cp-sh-、小工具 cp-cm-、回顧 cp-rc-）────── */
@media (min-width: 1001px) { .cp-sh-lab .al-space { min-height: 600px; } }
.cp-sh-gens { grid-template-columns: repeat(5, minmax(0, 1fr)); } .cp-sh-gens button { padding: .4rem .1rem; } .cp-sh-gens button b { font-size: .86rem; } .cp-sh-gens button small { font-size: .6rem; }
.cp-sh-card { padding: .6rem .8rem .7rem; border-radius: 12px; border: 1px solid var(--al-line); background: rgba(255,255,255,.04); }
.cp-sh-card p { margin: 0; }
.cp-sh-year { font-family: var(--serif); font-size: 1.9rem; line-height: 1; color: var(--al-sun); }
.cp-sh-name { margin-top: .2rem !important; font-size: .92rem; font-weight: 800; color: var(--al-text); } .cp-sh-name small { display: block; font-family: var(--zh); font-weight: 600; font-size: .8rem; color: var(--al-mute); }
.cp-sh-num { margin-top: .5rem !important; display: grid; gap: .1rem; }
.cp-sh-count { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.25rem; color: #7ef0e3; overflow-wrap: anywhere; }
.cp-sh-what { font-size: .72rem; font-weight: 700; color: var(--al-mute); } .cp-sh-what small { display: block; font-family: var(--zh); font-weight: 600; }
.cp-sh-lab .cp-msg { min-height: 13em; }
.cp-narrow .cp-sh-lab .al-lab.cp-lb-end small, .cp-sh-lab.cp-narrow .al-lab.cp-lb-end small, .cp-sh-lab.cp-narrow .al-lab.cp-lb-side { display: none; }
.cp-sh-lab.cp-narrow .al-lab.cp-lb-val { font-size: .54rem; padding: 0 .15rem; }
.al-lg-cpstand i { border: 0; border-radius: 50%; height: 9px; margin-top: .45rem; background: #2a3550; box-shadow: 0 0 0 1px #8a93a6 inset; }
.al-lg-cpcol i { border: 0; border-radius: 2px; width: 10px; margin: 0 7px; background: #4f9dff; }
.al-lg-cptick i { border: 0; border-radius: 0; height: 3px; margin-top: .6rem; background: repeating-linear-gradient(90deg, #4f9dff 0 6px, #0b1326 6px 8px); }
@media (max-width: 1000px) { .cp-sh-lab .al-space { aspect-ratio: 16 / 9; min-height: 320px; } }
@media (max-width: 620px) { .cp-sh-lab .al-space { aspect-ratio: 4 / 3; min-height: 0; } .cp-sh-lab .cp-msg { min-height: 17em; } }
.cp-cm { max-width: 900px; }
.cp-cm-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; margin: .3rem 0 1rem; }
.cp-cm-row button { padding: .5rem .2rem; border-radius: 12px; border: 2px solid var(--line); background: var(--cream); color: var(--ink); font-family: var(--sans); cursor: pointer; line-height: 1.25; }
.cp-cm-row button b { display: block; font-family: var(--serif); font-size: 1.05rem; } .cp-cm-row button small { font-family: var(--zh); font-weight: 600; font-size: .74rem; color: var(--ink-soft); }
.cp-cm-row button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; } .cp-cm-row button[aria-pressed="true"] small { color: rgba(255,255,255,.88); }
.cp-cm-out { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cp-cm-out dd { font-size: 1.05rem; }
.cp-rc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.cp-rc-card { position: relative; display: grid; gap: .35rem; align-content: start; padding: 1rem 1rem 1.1rem; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; min-width: 0; }
.cp-rc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 10px 24px -14px rgba(0,0,0,.4)); }
.cp-rc-n { position: absolute; right: .8rem; top: .7rem; font-family: var(--serif); font-size: 1.5rem; color: var(--gold-dk); opacity: .7; }
.cp-rc-ic { font-size: 1.6rem; line-height: 1; }
.cp-rc-card b { font-family: var(--serif); font-size: 1rem; line-height: 1.25; padding-right: 1.6rem; } .cp-rc-card b small { display: block; margin-top: .15rem; font-family: var(--zh); font-weight: 700; font-size: .86rem; color: var(--brand-dk); }
.cp-rc-t { font-size: .84rem; line-height: 1.5; color: var(--ink-soft); overflow-wrap: anywhere; } .cp-rc-t .zh { display: block; margin-top: .2rem; }
@media (max-width: 1000px) { .cp-rc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cp-cm-out { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cp-rc-grid { grid-template-columns: 1fr; } .cp-cm-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; } .cp-cm-row button small { font-size: .6rem; } }
