/* 遊戲內的教學卡（index.html 也用同一份 learn.css；P0-07 第 6 項）。
   learn.css 的主色是教學頁的淺色系（--site-*），這裡只覆蓋顏色與捲動，不改結構——
   覆蓋的用意是「同一份內容、兩種介面」，不是兩套樣板。 */
.modal.learn-layer { z-index: 30; }
.learn-card { max-height: min(86vh, 900px); display: flex; flex-direction: column; }
.learn-card > h2 { margin: 0 0 12px; }
.learn-card .modal-actions { margin-top: 14px; }
.learn-scroll { overflow: auto; padding-right: 4px; }
.learn-in-app { color: var(--text, #efe9df); }
.learn-in-app .learn-entry { background: var(--panel, #16181d); border-color: var(--line, #2c3038); }
.learn-in-app .learn-entry:target { outline: none; }
.learn-in-app .learn-tai, .learn-in-app .learn-win small { color: var(--gold, #d9b56b); }
.learn-in-app .learn-example h4, .learn-in-app .learn-engine, .learn-in-app .learn-version { color: var(--muted, #9aa2ad); }
.learn-in-app .learn-counter { border-top-color: var(--line, #2c3038); }
.learn-in-app .learn-meld { background: rgba(255,255,255,.07); }
.learn-in-app .learn-tags span { background: rgba(255,255,255,.09); }
.learn-in-app .learn-anchor { color: var(--muted, #9aa2ad); }
.learn-in-app .learn-entries { margin-top: 0; }

/* 結算畫面與台數一覽裡的台數：可點開教學卡。做成按鈕而不是連結——它不離開這一頁，
   所以不該有連結的語意（也不該讓瀏覽器有開新視窗的機會）。 */
.res-learn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted rgba(217,181,107,.7); text-underline-offset: 3px; }
.res-learn:hover { color: var(--gold, #d9b56b); }

/* 台灣十六張基礎教學頁（learn.html，P0-07） */
html:has(body.learn-page), body.learn-page { height: auto; overflow: auto; }
.learn-page { background: var(--site-bg-color, #f6f1e6); color: var(--site-ink, #2a2622); font-family: var(--font, "Noto Sans TC", sans-serif); margin: 0; }
.learn-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--site-line, #d9cfbd); background: var(--site-dialog, #fbf8f1); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.learn-brand { font-family: var(--site-display, "Noto Serif TC", serif); font-weight: 900; font-size: 20px; color: inherit; text-decoration: none; letter-spacing: .06em; }
.learn-head nav { display: flex; gap: 18px; flex-wrap: wrap; }
.learn-head nav a { color: var(--site-accent, #8a5a2b); text-decoration: none; font-size: 14px; }
.learn-head nav a:hover { text-decoration: underline; }
.learn-main { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.8; }
.learn-main h1 { font-family: var(--site-display, "Noto Serif TC", serif); font-size: clamp(26px, 5vw, 38px); margin: 0 0 12px; letter-spacing: .06em; }
.learn-main h2 { font-family: var(--site-display, "Noto Serif TC", serif); margin: 48px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--site-line, #d9cfbd); }
.learn-main h3 { margin: 26px 0 6px; }
.learn-lead { color: var(--site-muted, #6f665c); }
.learn-entries { display: grid; gap: 22px; margin-top: 18px; }
.learn-entry { border: 1px solid var(--site-line, #d9cfbd); border-radius: 6px; padding: 18px 20px; background: var(--site-dialog, #fbf8f1); scroll-margin-top: 80px; }
.learn-entry:target { outline: 2px solid var(--site-accent, #8a5a2b); outline-offset: 2px; }
.learn-entry header { display: flex; align-items: baseline; gap: 12px; }
.learn-entry h3 { margin: 0; font-size: 20px; }
.learn-tai { color: var(--site-accent, #8a5a2b); }
.learn-anchor { margin-left: auto; color: var(--site-muted, #6f665c); text-decoration: none; }
.learn-entry.is-incomplete { border-color: #c0392b; }
.learn-warn { color: #c0392b; font-weight: 700; }
.learn-example { margin-top: 14px; }
.learn-example h4 { margin: 0 0 8px; font-size: 14px; color: var(--site-muted, #6f665c); letter-spacing: .1em; }
.learn-counter { border-top: 1px dashed var(--site-line, #d9cfbd); padding-top: 12px; }
.learn-hand { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding-bottom: 8px; }
.learn-tiles, .learn-meld, .learn-flowers, .learn-win { display: inline-flex; gap: 3px; align-items: flex-end; }
.learn-tiles { flex-wrap: wrap; row-gap: 8px; }
.learn-entries > * { min-width: 0; }
.learn-win { flex-direction: column; align-items: center; gap: 2px; }
.learn-win small { font-size: 12px; color: var(--site-accent, #8a5a2b); }
.learn-meld { padding: 3px; border-radius: 6px; background: rgba(0,0,0,.05); }
.learn-hand .tile { width: 30px; height: 41px; }
/* 沒有 JavaScript 時的文字牌（預先寫進 HTML 的版本） */
.tile-text { display: inline-block; padding: 2px 6px; border: 1px solid var(--site-line, #d9cfbd); border-radius: 4px; background: #fffdf7; font-size: 13px; line-height: 1.5; }
.tile-text.hi { border-color: var(--site-accent, #8a5a2b); font-weight: 700; }
.learn-hand .tile.sm { width: 24px; height: 33px; }
.learn-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.learn-tags span { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(0,0,0,.06); }
.learn-engine { margin: 8px 0 4px; font-size: 13px; color: var(--site-muted, #6f665c); }
.learn-items { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 0; }
.learn-items li { display: inline-flex; gap: 6px; font-size: 14px; }
.learn-version { margin-top: 24px; font-size: 13px; color: var(--site-muted, #6f665c); }
.learn-cta { margin-top: 40px; text-align: center; }

/* 切片 6：學習訓練場的家族導覽（六頁共用；見 js/learn/nav.js）。
   放在 </main> 之前，所以樣式上要與上面的內容分開一點，並在窄畫面自動換行。 */
.learn-family {
  margin: 40px 0 8px;
  padding: 16px 18px;
  border: 1px solid var(--site-line, #d9cfbd);
  border-radius: 6px;
  background: #fdf8ee;
}
.learn-family > h2 { margin: 0 0 10px; font-size: 1rem; }
.learn-family > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.learn-family a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.learn-family a:hover { border-bottom-color: currentColor; }
.learn-family a[aria-current="page"] { font-weight: 600; color: var(--site-accent, #b8860b); }
@media (max-width: 600px) {
  .learn-hand .tile { width: 20px; height: 28px; }
  .learn-tiles, .learn-meld { gap: 2px; }
  .learn-hand .tile.sm { width: 18px; height: 25px; }
  .learn-entry { padding: 14px; }
}

/* 牌型圖鑑（riichi.html／mcr.html／american.html） */
.learn-head nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.learn-items .learn-total { flex-basis: 100%; font-weight: 700; }
.card-cat { margin: 28px 0 8px; font-size: 18px; }
.card-line { font-family: "Orbitron", ui-monospace, monospace; font-size: 20px; font-weight: 700; letter-spacing: .06em; margin: 0 0 8px; }
.card-line span + span { margin-left: .5em; }
.learn-main .guide-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 14px; }
.learn-main .guide-links a { color: var(--site-accent, #8a5a2b); }

/* 玩法教學的象棋分頁（2026-10-04）：棋子／走法一句／落點數。 */
.learn-xq { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 6px; }
.learn-xq li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) 3em; align-items: baseline; gap: 10px; padding: 8px 12px; border: 1px solid var(--line, #2c3038); border-radius: 8px; background: rgba(255, 255, 255, .04); }
.learn-xq b { font: 900 calc(17px * var(--fs, 1)) var(--site-display, "Noto Serif TC", serif); color: var(--gold, #d9b56b); }
.learn-xq span { line-height: 1.6; }
.learn-xq em { font-style: normal; font-weight: 700; text-align: right; color: var(--gold, #d9b56b); }
.learn-page .learn-xq li { background: #fff; border-color: var(--site-line, #d9cfbd); }
.learn-page .learn-xq b, .learn-page .learn-xq em { color: var(--site-accent, #8a5a2b); }

/* 出題（學習訓練場，2026-10-06）：題目、出牌按鈕、回饋、解答與解說。
   牌面圖需要 --tile-surface，由 js/learn/lesson.js 依玩家的材質設定寫進 :root；
   停用 JavaScript 時同一個區塊顯示文字牌，所以兩邊的排版要長得一樣。 */
:root { --tile-surface: linear-gradient(160deg, #fffdf7, #e9e2d2); }
.pz-lesson { margin: 40px 0 8px; padding: 20px 22px; border: 1px solid var(--site-line, #d9cfbd); border-radius: 8px; background: var(--site-dialog, #fbf8f1); }
.pz-lesson h2 { margin-top: 0; }
.pz-lead { margin: 0 0 6px; font-weight: 700; }
.pz-prompt { margin: 0 0 14px; color: var(--site-muted, #6f665c); line-height: 1.7; }
.pz-hand { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pz-meta { margin: 6px 0 0; font-size: 13px; color: var(--site-muted, #6f665c); }
.pz-form { margin-top: 16px; }
.pz-ask { margin: 0 0 8px; font-weight: 700; }
.pz-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pz-pick { display: flex; align-items: flex-end; gap: 2px; padding: 4px 6px; border: 1px solid var(--site-line, #d9cfbd); border-radius: 6px; background: #fff; cursor: pointer; }
.pz-pick:hover { border-color: var(--site-accent, #8a5a2b); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.pz-pick small { color: var(--site-muted, #6f665c); font-size: 12px; }
.pz-pick[disabled] { cursor: default; opacity: .5; }
.pz-pick .tile, .pz-hand .tile { width: calc(34px * var(--fs, 1)); height: calc(48px * var(--fs, 1)); border-radius: 5px; background-size: cover; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.pz-btn { margin-right: 8px; }
.pz-hint { margin: 0 0 10px; padding: 10px 12px; border-left: 3px solid var(--site-accent, #8a5a2b); background: rgba(138, 90, 43, .07); }
.pz-hint b { margin-right: 8px; }
.pz-feedback { margin-top: 12px; padding: 12px 14px; border-radius: 6px; border: 1px solid currentColor; }
.pz-feedback.is-ok { color: #1d6b3a; background: rgba(29, 107, 58, .08); }
.pz-feedback.is-bad { color: #a4362b; background: rgba(164, 54, 43, .08); }
/* 對手回應（多步的題目）：不是「我」的對錯，所以用中性色 —— 綠／紅會被誤讀成答對／答錯 */
.pz-feedback.is-note { color: #4a4038; background: rgba(74, 64, 56, .07); }
.pz-plies { margin: 8px 0 0; color: var(--site-muted, #6b6259); }
.pz-line { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: rgba(138, 90, 43, .06); }
.pz-line b { margin-right: 8px; }
.pz-line span { font-family: var(--site-display, "Noto Serif TC", serif); }
.pz-title { margin: 0 0 6px; font-weight: 700; }
.pz-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.pz-arrow { color: var(--site-muted, #6f665c); }
.pz-message { margin: 0; line-height: 1.7; }
.pz-solution { margin-top: 12px; padding: 12px 14px; border-radius: 6px; border: 1px dashed var(--site-line, #d9cfbd); background: rgba(138, 90, 43, .05); }
.pz-explain { margin: 8px 0 0; line-height: 1.8; }
.pz-form.is-done .pz-picks { opacity: .45; }

/* 棋盤（學習訓練場切片 2：象棋一步殺）。
   交叉點就是一顆按鈕：棋子寫在裡面，紅方／黑方用顏色分。
   棋盤的線用格線畫（不是真的棋盤木紋）——這一版的重點是「棋子的位置讀得出來」與「落點點得到」。 */
.pz-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 460px);
  margin: 14px 0 4px;
  border: 2px solid var(--site-line, #d9cfbd);
  border-radius: 4px;
  background: #fdf8ee;
  padding: 2px;
}
.pz-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid rgba(138, 90, 43, .25);
  border-bottom: 1px solid rgba(138, 90, 43, .25);
  background: transparent;
  font-family: var(--site-display, "Noto Serif TC", serif);
  font-size: calc(15px * var(--fs, 1));
  font-weight: 900;
  line-height: 1;
  padding: 0;
  cursor: default;
  color: inherit;
}
.pz-cell:nth-child(9n) { border-right: 0; }
.pz-cell:nth-child(n+82) { border-bottom: 0; }
.pz-cell.is-red { color: #b3261e; }
.pz-cell.is-black { color: #22262c; }
.pz-cell:not(:disabled) { cursor: pointer; }
.pz-cell:not(:disabled):hover { background: rgba(138, 90, 43, .12); }
.pz-cell.is-picked { background: rgba(217, 181, 107, .55); outline: 2px solid #8a5a2b; outline-offset: -2px; }
.pz-cell.is-target { background: rgba(29, 107, 58, .18); }
.pz-cell.is-target::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #1d6b3a; }
.pz-cell.is-target:not(:empty)::after { content: none; }
.pz-cell:disabled { opacity: 1; }
.learn-page .pz-board { background: #fff; }

/* 西洋棋：8×8，而且格子要**黑白相間**（西洋棋的盤面慣例）。
   格子數由棋種決定——象棋 9×10、西洋棋 8×8、圍棋 9～19 路。 */
.pz-board-chess {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  background: #f0e6d2;
}
.pz-board-chess .pz-cell {
  border-right: 0;
  border-bottom: 0;
  background: #f7f0e0;
  font-size: 1.6rem;
  line-height: 1;
}
.pz-board-chess .pz-cell.is-dark { background: #d9c3a0; }
.pz-board-chess .pz-cell.is-white { color: #fff; text-shadow: 0 0 1px #333, 0 0 2px #333; }
.pz-board-chess .pz-cell.is-black { color: #1d1a17; }
.pz-board-chess .pz-cell.is-target { box-shadow: inset 0 0 0 3px var(--site-accent, #b8860b); }
.pz-board-chess .pz-cell.is-picked { background: #eadfbf; }

/* 圍棋：木色棋盤、格線是**線**（交叉點），棋子是圓的（●／○）。
   路數由 `data-go-size` 決定（5～19 路），所以欄數寫在行內樣式裡。 */
.pz-board-go {
  background: #e6c98f;
  border: 2px solid #8a5a2b;
  padding: 6px;
}
.pz-board-go .pz-cell {
  border: 0;
  border-right: 1px solid rgba(90, 60, 20, .45);
  border-bottom: 1px solid rgba(90, 60, 20, .45);
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  color: #1d1a17;
}
.pz-board-go .pz-cell.is-black { color: #0b0908; }
.pz-board-go .pz-cell.is-white { color: #fffdf8; text-shadow: 0 0 1px #4a3a24, 0 0 3px #4a3a24; }
.pz-board-go .pz-cell.is-target { box-shadow: inset 0 0 0 3px #b8860b; }
.pz-board-go .pz-cell.is-picked { background: rgba(184, 134, 11, .22); }

/* 學習進度的儀表板（P2-08 切片 7）：四頁共用，內容由 js/learn/dashboard.js 填。
   沒有 JavaScript 時容器是空的（漸進增強）——所以不要給它任何「先嚇人」的預設字。 */
.lp-dash {
  margin: 22px 0 8px;
  padding: 16px 18px;
  border: 1px solid var(--site-line, #d9cfbd);
  border-radius: 6px;
  background: #fdf8ee;
}
.lp-dash > h2 { margin: 0 0 10px; font-size: 1.05rem; }
.lp-note { margin: 0; color: var(--site-muted, #6b6257); font-size: .95rem; }
.lp-stats { display: flex; flex-wrap: wrap; gap: 22px; margin: 0 0 12px; }
.lp-stats > div { min-width: 120px; }
.lp-stats dt { font-size: .82rem; color: var(--site-muted, #6b6257); }
.lp-stats dd { margin: 2px 0 0; font-size: 1.1rem; font-weight: 600; }
.lp-stats dd small { font-size: .75rem; font-weight: 400; margin-left: 3px; color: var(--site-muted, #6b6257); }
.lp-sub { margin: 10px 0 6px; font-size: .95rem; }
.lp-plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lp-item a, .lp-item > span { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: inherit; }
.lp-item a:hover .lp-title { text-decoration: underline; }
.lp-game { flex: 0 0 auto; font-size: .78rem; padding: 1px 7px; border-radius: 999px; background: #efe6d3; color: #6b5a42; }
.lp-title { flex: 1 1 auto; }
.lp-tag { flex: 0 0 auto; font-size: .78rem; color: var(--site-accent, #b8860b); }
.lp-tag.is-review { color: var(--site-muted, #6b6257); }
