/* 學習區與主題教室入口；僅作用於模組容器。 */
.learning-shell { --learn-ink:#3d3028; --learn-accent:#854719; --learn-line:#e5d4bd; --learn-soft:#f8efdf; box-sizing:border-box; color:var(--learn-ink); font-family:inherit; }
.learning-shell *, .learning-shell *::before, .learning-shell *::after { box-sizing:border-box; }
.learning-shell [hidden], .learning-page[hidden], #app[hidden] { display:none !important; }
#app .classroom-header { display:flex; justify-content:space-between; align-items:center; gap:24px; }
#app .classroom-intro { min-width:0; }
#app .classroom-learning { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; width:min(100%,430px); }
#app .classroom-learning a { display:flex; align-items:center; gap:12px; min-width:0; min-height:72px; padding:12px 16px; border:1px solid #e5cfad; border-radius:15px; background:#fffaf0; box-shadow:0 5px 18px #71452114; color:#603815; text-decoration:none; font-size:17px; font-weight:800; line-height:1.4; }
#app .classroom-learning a:last-child { background:#eef7f6; border-color:#bfdbd6; color:#205954; }
#app .classroom-learning a:hover { transform:translateY(-2px); box-shadow:0 8px 22px #71452126; }
#app .classroom-learning a:focus-visible { outline:3px solid #266781; outline-offset:3px; }
#app .classroom-learning-icon { flex:none; display:grid; place-items:center; width:38px; height:38px; border-radius:11px; background:#f3e1bf; font-size:21px; }
#app .classroom-learning a:last-child .classroom-learning-icon { background:#d8ece8; }
#app .classroom-learning small { display:block; margin-top:3px; font-size:12px; font-weight:600; white-space:nowrap; }
.learning-page .learning-home-link { display:inline-flex; align-items:center; min-height:44px; margin:0 12px 10px 0; font-size:15px; font-weight:700; }
#learning-notice { max-width:1088px; margin:12px auto; padding:12px 16px; background:#f4e6c9; border-radius:10px; font-size:16px; }
.learning-page { max-width:1120px; margin:0 auto; padding:28px 24px max(48px,env(safe-area-inset-bottom)); font-size:17px; line-height:1.9; background:#fffcf7; min-height:65vh; overflow-wrap:anywhere; }
.learning-page h1 { font-size:clamp(26px,4vw,36px); line-height:1.4; font-weight:800; color:#563821; margin:12px 0 8px; letter-spacing:.02em; }
.learning-page h2 { font-size:23px; line-height:1.5; font-weight:700; margin:28px 0 12px; }
.learning-page h3 { font-size:19px; font-weight:700; line-height:1.6; margin:0 0 8px; }
.learning-page p { margin:8px 0 14px; }
.learning-page a { color:var(--learn-accent); text-underline-offset:4px; }
.learning-page a:hover { color:#5c2c0e; }
.learning-shell :is(a,button,input,textarea,summary):focus-visible { outline:3px solid #276980; outline-offset:3px; }
.learning-page h1:focus { outline:none; }
.learning-page :is(button,a.learning-primary,.learning-actions a,.learning-back,.learning-exercise-nav a) { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 16px; border-radius:10px; border:1px solid #c9ae8c; background:#fff; color:#70401c; font:inherit; font-size:16px; line-height:1.5; font-weight:600; text-decoration:none; cursor:pointer; }
.learning-page button:hover { background:#f8efdf; }
.learning-page :is(a,button).learning-primary { background:#854719; border-color:#854719; color:#fff; }
.learning-page :is(a,button).learning-primary:hover { background:#663512; color:#fff; }
.learning-page .learning-lead { color:#6c594a; font-size:18px; margin-bottom:24px; }
.learning-page .learning-muted { color:#6f6054; font-size:14px; line-height:1.7; }
.learning-eyebrow { color:#805025; font-size:14px; font-weight:600; letter-spacing:.03em; }
.learning-breadcrumb { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:14px; }
.learning-breadcrumb a { min-height:44px; display:inline-flex; align-items:center; }
.learning-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.learning-card { padding:22px; margin:0 0 16px; background:white; border:1px solid var(--learn-line); border-radius:16px; box-shadow:0 4px 14px #71452106; min-width:0; }
.learning-card h2 { margin-top:0; }
.learning-page .learning-card-title { font-size:21px; font-weight:700; line-height:1.5; text-decoration:none; display:block; padding:4px 0; min-height:44px; }
.learning-card-title:hover { text-decoration:underline; }
.learning-excerpt { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.learning-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin:16px 0; }
.learning-search { margin:20px 0; padding:20px; background:var(--learn-soft); border-radius:16px; }
.learning-search label, .learning-reading > label { display:block; font-weight:700; margin-bottom:8px; }
.learning-page :is(input[type=search],textarea) { width:100%; max-width:100%; min-width:0; padding:12px 14px; background:#fff; color:#3d3028; border:1px solid #ad9273; border-radius:10px; font:inherit; font-size:17px; line-height:1.9; }
.learning-page textarea { resize:vertical; min-height:160px; }
.learning-search .learning-check { display:flex; gap:10px; align-items:center; margin:8px 0 0; min-height:44px; font-size:16px; font-weight:500; }
.learning-check input { width:20px; height:20px; accent-color:#854719; }
.learning-reading { max-width:720px; margin:24px auto; }
.learning-content { white-space:pre-line; line-height:1.95; }
.learning-prompts, .learning-comparison, .learning-sample { padding:22px; margin:24px 0; background:var(--learn-soft); border-radius:16px; border:1px solid var(--learn-line); }
.learning-prompts h2 { margin-top:0; }
.learning-page ol:not(.learning-steps):not(.learning-map) { list-style:decimal; padding-left:28px; }
.learning-page ul { list-style:disc; padding-left:24px; }
.learning-page li { margin-bottom:10px; }
.learning-page summary { min-height:44px; cursor:pointer; padding:8px 0; font-weight:600; }
.learning-related a { display:inline-flex; align-items:center; min-height:44px; }
.learning-detail-actions { position:sticky; bottom:max(10px,env(safe-area-inset-bottom)); display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:12px; background:#fffaf2f5; border:1px solid var(--learn-line); border-radius:16px; box-shadow:0 4px 20px #68401b18; margin-top:24px; }
.learning-detail-actions > * { min-width:0; text-align:center; }
.learning-steps, .learning-map { list-style:none; padding:0; margin:16px 0; counter-reset:step; }
.learning-steps li { counter-increment:step; }
.learning-steps li::before { content:counter(step); display:flex; align-items:center; justify-content:center; width:36px; height:36px; background:#854719; color:white; border-radius:50%; font-weight:700; margin-bottom:12px; }
.learning-map { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.learning-map .learning-card { margin:0; }
.learning-exercise-nav { display:flex; gap:8px; flex-wrap:wrap; margin:20px 0; }
.learning-exercise-nav a { width:44px; padding:8px !important; }
.learning-exercise-nav a[aria-current] { background:#854719; color:white; }
.learning-error { color:#972f20; }
.learning-dialog { width:calc(100% - 24px); max-width:620px; max-height:calc(100dvh - 24px); overflow:auto; padding:24px; background:#fffaf2; border:1px solid #c9ae8c; border-radius:16px; font-size:17px; }
.learning-dialog::backdrop { background:#30261c88; }
.learning-dialog h2 { margin:0 0 16px; font-size:21px; }
.learning-dialog textarea { width:100%; min-height:160px; padding:12px; font:inherit; border:1px solid #ad9273; border-radius:8px; }
.learning-dialog button { min-height:44px; margin:12px 8px 0 0; padding:10px 16px; background:#fff; border:1px solid #ad9273; border-radius:8px; cursor:pointer; }
@media (max-width:850px) { .learning-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } #app .classroom-header { align-items:stretch; flex-direction:column; gap:16px; } }
@media (max-width:600px) {
  #app .classroom-learning { width:100%; gap:8px; }
  #app .classroom-learning a { min-height:72px; gap:7px; padding:10px 8px; font-size:15px; }
  #app .classroom-learning-icon { width:30px; height:30px; font-size:18px; }
  #app .classroom-learning small { font-size:11px; white-space:normal; }
  .learning-page { padding:18px 14px max(36px,env(safe-area-inset-bottom)); }
  .learning-grid,.learning-map { grid-template-columns:1fr; }
  .learning-card,.learning-prompts,.learning-comparison,.learning-search,.learning-sample { padding:18px; }
  .learning-detail-actions { grid-template-columns:repeat(2,minmax(0,1fr)); padding:10px; }
  .learning-detail-actions > * { padding:9px 6px !important; }
}
@media (max-height:480px) { .learning-detail-actions { position:static; } }
@media (prefers-reduced-motion:reduce) { .learning-shell * { scroll-behavior:auto !important; transition:none !important; animation:none !important; } }

/* 素材寶庫：好詞 / 好句 / 好段分頁與成語標籤介面 */
.materials-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-width:520px; margin:8px auto 18px; padding:5px; background:#fdf1ec; border-radius:999px; border:1px solid #f4d9cf; }
.learning-page a.materials-tab { display:flex; align-items:center; justify-content:center; gap:6px; min-height:42px; padding:6px 14px; border-radius:999px; text-decoration:none; color:#6d5448; font-weight:700; font-size:16px; transition:background-color .15s,color .15s; }
.learning-page a.materials-tab:hover { background:#fae2da; color:#5a3222; }
.learning-page a.materials-tab.is-active { background:#ee745d; color:#fff; box-shadow:0 3px 10px #ee745d44; }
.materials-tab-badge { display:none; }

.idiom-search { margin:12px 0 16px; padding:14px 16px; }
.idiom-anchor-bar { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 18px; }
.learning-page a.idiom-anchor-pill { display:inline-flex; align-items:center; min-height:36px; padding:5px 14px; border-radius:999px; border:1px solid #f3d2c8; background:#fff6f3; color:#774636; font-size:14px; font-weight:600; text-decoration:none; }
.learning-page a.idiom-anchor-pill:hover { background:#ffe8e0; }
.learning-page a.idiom-anchor-pill.is-focused { background:#fce6df; border-color:#e99a89; color:#b8432d; }

.idiom-categories-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.idiom-category-card { display:flex; flex-direction:column; padding:18px 20px 14px; background:#fff; border:1.5px solid #f3c4b8; border-radius:18px; box-shadow:0 4px 16px #9e523a0d; }
.idiom-category-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.learning-page a.idiom-category-title { font-size:19px; font-weight:800; color:#3b2c25; text-decoration:none; }
.learning-page a.idiom-category-title:hover { color:#c94d35; }
.idiom-category-count { font-size:14px; color:#88776e; font-weight:600; white-space:nowrap; }
.idiom-category-mobile-sub { display:none; margin:0 0 10px; font-size:13px; color:#88776e; }

.idiom-tags-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.learning-page a.idiom-tag-pill { display:flex; align-items:center; justify-content:space-between; gap:6px; min-height:36px; padding:5px 12px; border-radius:999px; border:1px solid #f2dcd4; background:#fff7f4; color:#4f3e35; font-size:14px; font-weight:600; text-decoration:none; }
.learning-page a.idiom-tag-pill:hover { border-color:#ee745d; background:#ffece6; }
.idiom-tag-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.idiom-tag-num { color:#d45d46; font-size:13px; font-weight:700; flex-shrink:0; }

.idiom-category-footer { margin-top:14px; padding-top:10px; border-top:1px solid #f5e5de; text-align:right; }
.learning-page a.idiom-category-all { font-size:14px; font-weight:700; color:#c8523b; text-decoration:none; }
.learning-page a.idiom-category-all:hover { text-decoration:underline; }

.idiom-list-topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:4px 0 12px; }
.learning-page a.idiom-back-link { font-size:15px; font-weight:700; color:#c8523b; text-decoration:none; min-height:36px; display:inline-flex; align-items:center; }
.idiom-list-title { font-size:18px; font-weight:800; color:#3d3028; }
.idiom-sr-heading { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.idiom-filter-chips { display:flex; gap:8px; overflow-x:auto; padding:4px 2px 10px; margin-bottom:8px; scrollbar-width:thin; }
.learning-page a.idiom-chip { flex:0 0 auto; display:inline-flex; align-items:center; min-height:36px; padding:5px 14px; border-radius:999px; border:1px solid #ecd9d1; background:#fff7f4; color:#5a463d; font-size:14px; font-weight:600; text-decoration:none; }
.learning-page a.idiom-chip:hover { background:#ffece6; }
.learning-page a.idiom-chip.is-active { background:#18b6a0; border-color:#18b6a0; color:#fff; }

.idiom-count-status { margin:4px 0 12px; }
.idiom-cards-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.learning-page a.idiom-card { display:flex; flex-direction:column; gap:6px; padding:16px 18px; background:#fff; border:1px solid #ecd9ce; border-radius:16px; box-shadow:0 4px 14px #6b432b0d; text-decoration:none; color:#3d3028; transition:border-color .15s,transform .12s,box-shadow .15s; }
.learning-page a.idiom-card:hover { border-color:#ee745d; transform:translateY(-2px); box-shadow:0 8px 20px #9e523a1a; }
.idiom-card-head { display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.idiom-card-word { margin:0; font-size:20px; font-weight:800; color:#3b2a22; }
.idiom-card-ext { font-size:12px; font-weight:700; color:#c8523b; white-space:nowrap; }
.idiom-card-zhuyin { margin:0; font-size:14px; color:#856657; letter-spacing:.03em; line-height:1.5; }
.idiom-card-meaning, .idiom-card-example, .idiom-card-fallback { margin:2px 0 0; font-size:14px; line-height:1.65; color:#4b3c34; }
.idiom-card-label { font-weight:700; color:#9b4936; }
.idiom-card-example { color:#5d4f47; }
.idiom-card-fallback { color:#88776e; }
.idiom-load-more { margin:18px auto 0; display:flex !important; }

@media (max-width:850px) {
  .idiom-categories-grid { grid-template-columns:1fr; }
}
@media (max-width:640px) {
  .materials-tabs { max-width:none; border-radius:16px; background:#fff; border:1px solid #f4d9cf; padding:8px; gap:8px; }
  .learning-page a.materials-tab { flex-direction:column; gap:4px; padding:8px 4px; border-radius:12px; font-size:14px; }
  .learning-page a.materials-tab.is-active { background:#fff3ef; color:#e25b45; box-shadow:none; }
  .materials-tab-badge { display:grid; place-items:center; width:36px; height:36px; border-radius:10px; font-size:17px; font-weight:800; color:#fff; background:#f28876; }
  .learning-page a.materials-tab[href*="sentence"] .materials-tab-badge { background:#54d0c4; }
  .learning-page a.materials-tab[href*="paragraph"] .materials-tab-badge { background:#f5b74b; }

  .idiom-anchor-bar { display:none; }
  .idiom-categories-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .idiom-category-card { padding:12px 12px 14px; border-radius:16px; border-color:#f3e1da; }
  .idiom-category-head { margin-bottom:2px; }
  .learning-page a.idiom-category-title { font-size:16px; }
  .idiom-category-count, .idiom-category-footer { display:none; }
  .idiom-category-mobile-sub { display:block; }
  .idiom-tags-grid { display:flex; flex-wrap:wrap; gap:6px; }
  .learning-page a.idiom-tag-pill { min-height:28px; padding:3px 9px; font-size:12px; }
  .idiom-tag-num { display:none; }
  .idiom-tags-grid .idiom-tag-pill:nth-of-type(n+4) { display:none; }
  .idiom-cards-grid { grid-template-columns:1fr; }
}
