/* ───────────────────────────────────────────────────────────────
   learn.css — 撲克學院(/learn)
   跟 /intro 同一套視覺:深藍黑底、電光金只給「行動」(上桌按鈕、正解)、
   玻璃面板 + 1px 白 10% 細邊。手機 375px 直式是設計基準。
   閱讀頁的重點是「好讀」:內文 17px、行高 1.8、一行不超過 34 個中文字。
   ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #0a0e1c;
  --gold: #EDB40B;
  --glass: rgba(20,20,30,.8);
  --panel: rgba(255,255,255,.04);
  --hair: rgba(255,255,255,.1);
  --text: #e9ebf2;
  --dim: rgba(233,235,242,.62);
  --green: #1f6b4a;
  --ok: #3ccf8e;
  --bad: #ff6b6b;
  --card-red: #c8102e;
  --font: "Albert Sans", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --w: 680px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(80% 40% at 50% 0%, rgba(31,107,74,.28), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font-family: var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
main { width: 100%; max-width: var(--w); margin: 0 auto; padding: 0 16px 48px; }

/* ───────── 頂列 ───────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: rgba(10,14,28,.86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hair);
}
.brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .back { font-size: 24px; line-height: 1; margin-top: -2px; color: var(--dim); }
.play-btn {
  flex: none; text-decoration: none; font-weight: 700; font-size: 14px;
  color: #111; background: var(--gold); padding: 8px 16px; border-radius: 8px;
}

/* ───────── 索引頁 ───────── */
.hero { padding: 36px 0 20px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.hero h1 { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.hero-lead { margin: 12px 0 0; font-size: 16px; line-height: 1.7; color: var(--dim); }

.featured {
  display: flex; flex-direction: column; gap: 8px;
  margin: 8px 0 24px; padding: 20px; border-radius: 16px; text-decoration: none;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(237,180,11,.16), transparent 60%),
    linear-gradient(160deg, rgba(31,107,74,.55), rgba(20,20,30,.9));
  border: 1px solid rgba(237,180,11,.35);
}
.featured-tag { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .04em; }
.featured-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }

/* 分類捷徑:手機上橫向滑動,不換行(換行會吃掉半個螢幕) */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 600; background: var(--panel); border: 1px solid var(--hair);
}
.level-filter { display: flex; gap: 6px; margin: 14px 0 4px; }
.lf {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--dim);
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--hair); background: none; cursor: pointer;
}
.lf.on { color: var(--text); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }

.cat { padding-top: 28px; }
.cat-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.cat-head p { margin: 4px 0 12px; font-size: 14px; color: var(--dim); }
.cat.empty { display: none; }

.art-grid { display: grid; gap: 10px; }
@media (min-width: 640px) { .art-grid { grid-template-columns: 1fr 1fr; } }
.art-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px;
  text-decoration: none; background: var(--glass); border: 1px solid var(--hair);
  transition: border-color .15s, transform .15s;
}
.art-card:hover { border-color: rgba(255,255,255,.28); }
.art-card:active { transform: scale(.99); }
.art-card[hidden] { display: none; }
.art-title { font-size: 17px; font-weight: 700; line-height: 1.4; letter-spacing: -.01em; }
.art-sum { font-size: 14px; line-height: 1.6; color: var(--dim); }
.art-meta { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--dim); }
.lv { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.lv1 { color: #8fe3b8; background: rgba(60,207,142,.12); }
.lv2 { color: #9cc4ff; background: rgba(90,150,255,.14); }
.lv3 { color: #ffb08a; background: rgba(255,120,70,.14); }

/* ───────── 文章頁 ───────── */
article { padding-top: 24px; }
.crumb { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.crumb a { color: var(--dim); text-decoration: none; }
article h1 { margin: 0 0 12px; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; }
.lead { margin: 16px 0 8px; font-size: 18px; line-height: 1.75; color: var(--dim); }

.prose { font-size: 17px; line-height: 1.85; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { margin: 2em 0 .6em; font-size: 23px; font-weight: 800; letter-spacing: -.02em; line-height: 1.35; }
.prose h3 { margin: 1.6em 0 .5em; font-size: 19px; font-weight: 700; line-height: 1.4; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose strong { color: #fff; font-weight: 700; }
.prose a { color: #fff; text-decoration-color: rgba(237,180,11,.7); text-underline-offset: 3px; }
.prose code { font-size: .88em; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.08); }
.prose blockquote {
  margin: 0 0 1.1em; padding: 4px 0 4px 16px;
  border-left: 3px solid rgba(255,255,255,.25); color: var(--dim);
}
.prose blockquote p { margin: 0; }

/* 表格在手機上橫向捲動,不要把整頁撐寬 */
.table-wrap { margin: 0 0 1.2em; overflow-x: auto; border: 1px solid var(--hair); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--hair); white-space: nowrap; }
td { white-space: normal; min-width: 4em; }
/* 第一欄通常是名稱(牌型、位置),被擠成直排很難讀 */
td:first-child { white-space: nowrap; min-width: 0; }
.cards { white-space: nowrap; }
th { font-size: 13px; color: var(--dim); font-weight: 600; background: rgba(255,255,255,.03); }
tr:last-child td { border-bottom: 0; }

.callout {
  margin: 0 0 1.2em; padding: 14px 16px; border-radius: 12px;
  background: rgba(31,107,74,.22); border: 1px solid rgba(60,207,142,.25);
}
.callout.warn { background: rgba(225,6,0,.1); border-color: rgba(255,107,107,.3); }
.callout-title { margin: 0 0 6px !important; font-weight: 700; font-size: 15px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul:last-child { margin-bottom: 0; }

/* 文章裡的小牌。跟牌桌同樣的白底、紅黑兩色,但用行內尺寸 */
.cards { display: inline-flex; gap: 3px; vertical-align: -0.35em; margin: 0 2px; }
.pc {
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 1.75em; height: 1.55em; padding: 0 .25em; border-radius: 4px;
  background: #fbfaf7; font-family: system-ui, -apple-system, sans-serif;
  font-size: .9em; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  box-shadow: 0 1px 0 rgba(0,0,0,.4), inset 0 0 0 1px rgba(0,0,0,.08);
}
.pc b { font-weight: 800; }
.pc i { font-style: normal; font-size: .95em; }
.pc.red { color: var(--card-red); }
.pc.black { color: #1c1a17; }
.pc.back {
  background: repeating-linear-gradient(45deg, #7a1f2b 0 3px, #5a1520 3px 6px);
  box-shadow: inset 0 0 0 2px #fbfaf7;
}

/* ───────── 小測驗 ───────── */
.quiz {
  margin: 2.2em 0 0; padding: 20px 16px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--hair);
}
.quiz h2 { margin: 0 0 4px; font-size: 21px; }
.quiz-lead { margin: 0 0 14px; font-size: 14px; color: var(--dim); }
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.quiz-q { margin: 0 0 10px !important; font-weight: 600; line-height: 1.6; }
.quiz-n {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px;
  border-radius: 50%; font-size: 12px; font-weight: 800; background: rgba(255,255,255,.12); vertical-align: 1px;
}
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt {
  font: inherit; font-size: 16px; line-height: 1.5; text-align: left; color: var(--text);
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--hair);
}
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border-color: var(--ok); background: rgba(60,207,142,.14); }
.quiz-opt.wrong { border-color: var(--bad); background: rgba(255,107,107,.12); }
.quiz-opt:disabled:not(.right):not(.wrong) { opacity: .55; }
.quiz-explain { margin: 10px 0 0 !important; font-size: 15px; line-height: 1.7; color: var(--dim); }
.quiz-explain::before { font-weight: 700; margin-right: 6px; }
.quiz-explain.ok::before { content: "答對了"; color: var(--ok); }
.quiz-explain.bad::before { content: "不對"; color: var(--bad); }

/* ───────── 文末 ───────── */
.cta {
  margin: 28px 0 0; padding: 20px; border-radius: 16px; text-align: center;
  background: linear-gradient(160deg, rgba(31,107,74,.6), rgba(20,20,30,.9));
  border: 1px solid var(--hair);
}
.cta p { margin: 0; color: var(--dim); font-size: 15px; }
.cta .cta-title { color: var(--text); font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.cta-btn {
  display: inline-block; margin-top: 14px; padding: 12px 32px; border-radius: 10px;
  text-decoration: none; font-weight: 800; font-size: 16px; color: #111; background: var(--gold);
}
.next {
  display: flex; flex-direction: column; gap: 4px; margin: 14px 0 0; padding: 16px;
  border-radius: 12px; text-decoration: none; background: var(--panel); border: 1px solid var(--hair);
}
.next-label { font-size: 12px; color: var(--dim); font-weight: 600; }
.next-title { font-size: 17px; font-weight: 700; }
.next-title::after { content: " ›"; color: var(--dim); }
.related { padding-top: 28px; }
.related h2 { margin: 0 0 12px; font-size: 18px; font-weight: 800; }

.foot {
  max-width: var(--w); margin: 0 auto; padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair); font-size: 13px; line-height: 1.7; color: var(--dim);
}
.foot p { margin: 0 0 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-links a { color: var(--dim); }

@media (min-width: 768px) {
  th, td { padding: 10px 12px; }
  .hero { padding-top: 56px; }
  .hero h1 { font-size: 60px; }
  article h1 { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .art-card { transition: none; }
}
