/* /learn/ 內容頁的樣式（r42、r42d）。只放 learn 專屬的 class；首頁用的 site.css 一個字都沒動（頂列、容器 .wrap、按鈕、問答卡、文末紅色行動帶 .final、頁尾全部沿用 site.css）。
   r42d（Tomy 2026-11-02「為什麼學習專區這麼爛？這是電腦畫面，為什麼沒有像首頁那樣排版寬？」）：
   外框改成跟首頁同一套：頂列同一份 markup（多一個「學習專區」）、所有區塊都用 .wrap（左右邊界跟首頁量到的一樣）、標題帶用首頁 hero 的底色、
   文章區電腦版兩欄（文章＋側欄），文末接首頁的行動帶。閱讀欄寬度維持 760（中文一行 40 字上下），多出來的寬度給側欄，不把文章拉滿。
   換行規則（keep-all＋anywhere＋pretty）由 site.css 的 p,li,h1… 那一條提供；數字不斷行與詞界 <wbr> 在建置時由 apps/web/scripts/learn.mjs 放進 HTML。 */
.learn-body-page{background:var(--cream)}

/* 頂列：「學習專區」是目前頁（底色＋紅色底線；文章頁也維持） */
.top-nav a[aria-current=page]{background-color:var(--sand);color:var(--ink);background-image:linear-gradient(var(--primary),var(--primary));background-size:calc(100% - 28px) 3px;background-position:14px calc(100% - 7px);background-repeat:no-repeat}

/* 麵包屑 */
.crumbs ol{display:block;margin:0;padding:0;list-style:none;font-size:15px;line-height:1.7;color:var(--ink2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crumbs ol li{display:inline;text-wrap:nowrap}
.crumbs li+li::before{content:"／";margin-right:4px;color:var(--depth)}
@media (max-width:719.98px){.crumbs ol li:nth-child(3){display:none}}
.crumbs a{display:inline-flex;align-items:center;min-height:44px;color:var(--ink2);font-weight:700}

/* 標題帶：底色跟首頁 hero 一樣的暖黃。文章頁精簡（第一段內文在首屏就看得到），目錄頁大一點 */
.lh{background:radial-gradient(120% 90% at 85% 10%,#ffe3b3 0%,rgba(255,227,179,0) 60%),linear-gradient(180deg,#fff3dc 0%,var(--cream) 100%)}
.lh-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding-top:4px;padding-bottom:24px}
.lh-copy{min-width:0}
.lh h1{margin-top:2px;font-size:30px;line-height:1.3}
.lh-lead{margin-top:14px;max-width:34em;font-size:17px;line-height:1.75;font-weight:500}
.learn-updated{margin-top:10px;font-size:14px;line-height:1.5;font-weight:500;color:var(--ink2)}
.lh-actions{display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px;margin-top:16px}
.lh-actions .btn{flex:1 1 220px}
.lh-more{display:inline-flex;align-items:center;min-height:44px;font-size:16px;font-weight:800}
.lh-art{display:none;margin:0}
.lh-art .frame{aspect-ratio:16/9;overflow:hidden;border-radius:20px;border:5px solid #fff;background:var(--sand);box-shadow:0 3px 0 var(--depth),0 12px 24px rgba(70,45,20,.16)}
.lh-art img{width:100%;height:100%;object-fit:cover}
@media (min-width:720px){
  .lh h1{font-size:36px}
  .lh-lead{font-size:18px}
  .lh-actions .btn{flex:0 0 auto}
}
@media (min-width:900px){
  .lh-grid{grid-template-columns:minmax(0,1fr) minmax(0,400px);column-gap:48px;align-items:center;padding-top:8px;padding-bottom:28px}
  .lh-art{display:block}
}
@media (min-width:1024px){.lh h1{font-size:38px}}
@media (min-width:1280px){.lh h1{font-size:42px}}
/* 目錄頁：標題與圖都大一級，圖跟首頁一樣微微傾斜 */
.lh-index .lh-grid{padding-bottom:20px}
@media (min-width:900px){.lh-index .lh-grid{grid-template-columns:minmax(0,1fr) minmax(0,480px);padding-top:28px;padding-bottom:16px}}
@media (min-width:1024px){.lh-index h1{font-size:44px}.lh-index .lh-art{transform:rotate(1.2deg)}}
@media (min-width:1280px){.lh-index .lh-grid{grid-template-columns:minmax(0,1fr) minmax(0,560px)}.lh-index h1{font-size:46px}}

/* 文章區：電腦版（可用寬度夠）兩欄＝文章 760＋側欄 300～340；不夠寬就單欄，目錄收在導言後、其他文章放文末 */
.learn-layout{padding-top:32px;padding-bottom:56px}
.learn-main{max-width:760px}
.learn-toc,.side-card{display:none}
.learn-rest{display:grid;gap:24px;margin-top:40px}
@media (min-width:1024px){.learn-layout{padding-top:40px;padding-bottom:88px}}
@media (min-width:1180px){
  .learn-layout{display:grid;grid-template-columns:minmax(0,760px) minmax(300px,340px);grid-template-rows:1fr auto;grid-template-areas:"main toc" "main rest";justify-content:space-between;column-gap:48px}
  .learn-main{grid-area:main}
  /* 只有目錄黏著；開始玩卡片與其他文章在目錄那一格走完之後才出現（正常捲動），整條側欄不會比視窗高 */
  .learn-toc{grid-area:toc;display:block;align-self:start;position:sticky;top:calc(var(--top) + 24px)}
  .learn-rest{grid-area:rest;margin-top:32px}
  .toc-m{display:none}
  .side-card{display:block}
}
.toc,.side-card,.learn-more{padding:20px;border:2px solid var(--edge);border-radius:var(--r-panel);background:var(--paper);box-shadow:0 2px 0 var(--edge)}
.side-h{margin-bottom:6px;font-size:16px;font-weight:900;letter-spacing:.04em}
.toc ol{margin:0;padding:0;list-style:none}
.toc a{display:flex;align-items:center;min-height:40px;margin:0 -10px;padding:6px 10px;border-radius:10px;color:var(--ink);font-size:15px;font-weight:700;line-height:1.5;text-decoration:none}
.toc a:hover{background:var(--sand)}
.side-card img{width:100%;height:auto;margin-bottom:14px;border:3px solid #fff;border-radius:12px;box-shadow:0 2px 0 var(--depth)}
.side-card-t{font-size:18px;font-weight:900}
.side-card-p{margin:6px 0 16px;font-size:15px;line-height:1.7;font-weight:400;color:var(--ink2)}
.side-card .btn{width:100%}
.learn-more h2{font-size:16px;letter-spacing:.04em}
.learn-more ul{margin:8px 0 0;padding:0;list-style:none}
.learn-more li+li{margin-top:8px}
.learn-more a{display:inline-flex;align-items:center;min-height:44px;font-size:15px;font-weight:700;line-height:1.55}
/* 單欄時的本篇目錄：用首頁問答卡那個 <details>（site.css），展開後是連結清單 */
.toc-m{margin-bottom:28px}
.toc-m ol{margin:0;padding:0 16px 10px 40px}
.toc-m a{display:flex;align-items:center;min-height:44px;font-weight:700}

/* 正文：一般字重（以前整片偏粗）、桌機 18px、行高 1.8；粗體只標結論 */
.learn-text{font-size:17px;line-height:1.8;font-weight:400}
.learn-text>*+*{margin-top:18px}
.learn-text h2{margin-top:52px;font-size:24px;line-height:1.4;font-weight:800;scroll-margin-top:calc(var(--top) + 16px)}
.learn-text h3{margin-top:30px;font-size:19px;line-height:1.5;font-weight:800;scroll-margin-top:calc(var(--top) + 16px)}
.learn-text>:first-child{margin-top:0}
.learn-text h2+*,.learn-text h3+*{margin-top:12px}
.learn-text ul,.learn-text ol{padding-left:1.4em}
.learn-text li+li{margin-top:8px}
.learn-text blockquote{margin-left:0;padding:4px 16px;border-left:4px solid var(--sun);background:var(--sand);border-radius:0 var(--r-card) var(--r-card) 0}
.learn-text hr{border:0;border-top:2px solid var(--edge);margin:36px 0}
.learn-text a{font-weight:600}
.learn-text strong{font-weight:800}
/* 來源說明：次要註記 */
.learn-text .src-note{padding-top:12px;border-top:1px dashed var(--depth);font-size:14px;line-height:1.7;color:var(--ink2)}
@media (min-width:720px){.learn-text{font-size:18px}.learn-text h2{font-size:28px}.learn-text h3{font-size:21px}}
/* 文章最後的「接著讀」 */
.learn-next{margin-top:48px;padding:16px 20px;border-radius:var(--r-card);background:var(--sand)}
.learn-next p{font-size:16px;line-height:1.75;font-weight:500}
.learn-intro{max-width:760px;margin-top:40px}

/* 表格：保留表格，淡邊框、圓角、標頭底色、數字欄靠右；陰影極輕。窄螢幕可以左右捲（外框可聚焦，鍵盤也捲得動） */
.learn-table{overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--edge);border-radius:var(--r-card);background:var(--paper);box-shadow:0 1px 0 var(--edge)}
.learn-table:focus-visible{outline:3px solid var(--asset);outline-offset:3px}
.learn-table table{width:100%;min-width:0;border-collapse:collapse;font-size:16px;line-height:1.6;font-variant-numeric:tabular-nums}
.learn-table th,.learn-table td{padding:12px 16px;text-align:left;vertical-align:top;border-bottom:1px solid #f1e6d4}
/* 表格儲存格用 break-word 不用 anywhere：anywhere 會讓欄位的最小寬度變成一個字，整欄被壓到「36,983｜元」這種寬度 */
.learn-table th,.learn-table td{word-break:keep-all;overflow-wrap:break-word;text-wrap:pretty}
.learn-table thead th{background:var(--sand);font-weight:800;white-space:nowrap;border-bottom:1px solid var(--edge)}
.learn-table tbody th{font-weight:700}
.learn-table tbody tr:last-child>*{border-bottom:0}
.learn-table .num{text-align:right}
/* r42：表格最多 3 欄，手機要一眼看到全部欄位（min-width 480 會把第三欄藏到橫向捲動後面，比較表就看不出比較） */
@media (max-width:480px){.learn-table table{font-size:15px}.learn-table th,.learn-table td{padding:10px 10px}}

/* 目錄頁：文章卡片（桌機 3 欄、中寬 2 欄、手機 1 欄；五篇排成 3＋2）。整張可點（標題連結撐滿整張卡），鍵盤焦點畫在整張卡上 */
.lcards-sec{padding:20px 0 8px}
.lcards-h{margin-bottom:20px;font-size:26px}
.lcards{display:grid;grid-template-columns:1fr;gap:18px;margin:0;padding:0;list-style:none}
@media (min-width:720px){.lcards{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.lcards-h{font-size:30px}}
@media (min-width:1100px){.lcards{grid-template-columns:repeat(3,minmax(0,1fr));gap:24px}}
.lcard{position:relative;display:flex;flex-direction:column;overflow:hidden;border:2px solid var(--edge);border-radius:var(--r-panel);background:var(--paper);box-shadow:0 2px 0 var(--depth);transition:transform .2s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}
.lcard-art{aspect-ratio:16/9;overflow:hidden;background:var(--sand)}
.lcard-art img{width:100%;height:100%;object-fit:cover}
.lcard-body{display:flex;flex:1;flex-direction:column;align-items:flex-start;gap:10px;padding:18px 20px 20px}
.tag{display:inline-flex;align-items:center;min-height:28px;padding:1px 12px;border-radius:999px;background:var(--ink);color:#fff;font-size:14px;font-weight:800;letter-spacing:.04em}
.lcard h3{font-size:20px;line-height:1.4;font-weight:800}
.lcard h3 a{color:var(--ink);text-decoration:none}
.lcard h3 a::after{content:"";position:absolute;inset:0;border-radius:inherit}
.lcard h3 a:focus-visible{outline:none}
.lcard h3 a:focus-visible::after{outline:4px solid var(--asset);outline-offset:-4px}
.lcard-sum{flex:1;font-size:16px;line-height:1.7;font-weight:400;color:var(--ink2)}
.lcard-go{margin-top:4px;font-weight:800;color:var(--primary)}
.lcard-go::after{content:" →"}
@media (hover:hover){.lcard:hover{transform:translateY(-3px);border-color:var(--primary);box-shadow:0 5px 0 var(--depth)}}

/* 正文裡整段只有一個連到遊戲的連結＝行動按鈕（學習專區的連結顏色規則不要蓋掉按鈕的白字） */
.learn-text .learn-btn{margin-top:20px}
.learn-text .learn-btn .btn{color:#fff;text-decoration:none}
/* r42：Safari 的 text-wrap:pretty 會把整段平均拉短（「你不用｜去上班」右邊留一大塊白），只有 Safari（認得 -apple-system-body 的才是）改一般換行，Chrome 照用 pretty；最後一行孤字由 learn.mjs 的換行點規則（每塊至少 3 字、最後至少 2 字）擋 */
@supports (font:-apple-system-body){.learn-body-page :is(p,li,h1,h2,h3,td,th,dd,summary){text-wrap:wrap}}
