/* Shared adaptive layout. Keep long content reachable; do not hide page overflow. */
:root{--nav-height:72px}
html{font-size:clamp(16px, .15vw + 14px, 18px)}
body.app,body.landing{padding-top:var(--nav-height)}
body.app{min-height:100dvh}
.nav.nav-fixed,.nav.nav-landing{height:var(--nav-height);padding:0 clamp(12px,2vw,32px);gap:12px}
.nav .logo{min-width:0;flex-shrink:1}.nav .logo-mark{flex-shrink:0}.nav .logo-mark .owl-img{width:40px;height:40px}.nav .logo-mark svg{max-height:42px;width:44px}.nav .logo-mark b{font-size:.7rem}.nav .logo-text{font-size:clamp(.95rem,1.3vw,1.25rem);white-space:nowrap}
.nav-links{min-width:0;flex-shrink:0}.nav-links>a,.nav-links .dd-btn,.nav-back{font-size:.82rem;padding:.45rem .65rem}
.compact-nav-links{display:none}
.page-banner{padding:1rem clamp(1rem,3vw,2rem)}
.page-banner-inner{gap:.7rem;max-width:1500px}.page-banner .crumb{font-size:.75rem}.page-banner h1{font-size:clamp(1.1rem,1.6vw,1.5rem);white-space:normal;overflow:visible}.page-banner .lead{font-size:.85rem;line-height:1.6;overflow-wrap:anywhere}
.page{max-width:1500px;padding:1rem clamp(1rem,2vw,2rem) 1.25rem}.page-wide{max-width:1800px}
.page>*,.page [class$="-layout"]>*,.page [class$="-grid"]>*,.field{min-width:0}
.page h2{font-size:1.2rem}.page h3{font-size:1.05rem}.block{margin-top:1.25rem}.block-h{margin-bottom:.65rem}.topic-card{padding:1rem 1.15rem}.topic-card h3{font-size:1.15rem;line-height:1.45}.tc-class{margin:.55rem 0}.tc-meta{font-size:.8rem}.progress-card{padding:1rem}.fn-card{padding:1rem}.fb-layout{grid-template-columns:minmax(0,1fr) minmax(240px,300px);gap:1rem;margin-bottom:0}.fb-score{margin:.7rem 0}.fb-score b{font-size:3rem}.fb-teacher,.fb-status{padding:1rem 1.25rem}.fb-h{gap:.5rem;flex-wrap:wrap}.fb-comments p{white-space:pre-wrap;overflow-wrap:anywhere}
.page input:not([type=checkbox]):not([type=radio]),.page select,.page textarea{max-width:100%}.page pre{white-space:pre-wrap;overflow-wrap:anywhere}.page td,.page th{overflow-wrap:anywhere}
.chat-main{height:calc(100dvh - var(--nav-height) - 180px);min-height:320px}.toolkit{top:calc(var(--nav-height) + 12px);max-height:calc(100dvh - var(--nav-height) - 28px)}
.board-page .layout{height:calc(100dvh - var(--nav-height) - var(--board-bar-h, 3.375rem))!important}
@media(min-width:1101px) and (min-height:650px){.write-layout{grid-template-columns:minmax(250px,300px) minmax(0,1fr)}.write-layout #essay{height:clamp(240px,calc(100dvh - 400px),640px);min-height:220px}.gr-list{top:calc(var(--nav-height) + 12px)}.rd-list,.rd-notes{top:calc(var(--nav-height) + 12px)}}
@media(max-width:1250px){.nav .logo-text .lt-abbr{display:none}.nav .logo-text{max-width:230px;overflow:hidden;text-overflow:ellipsis}.nav .uname{max-width:7rem}.nav-staff .nav-links>a.keep-lg{display:none}.nav-staff .compact-nav-links{display:block;border-bottom:1px solid var(--line);padding-bottom:.4rem}}
@media(max-width:900px){:root{--nav-height:64px}.nav .logo-text{display:none}.nav .logo-mark{flex-direction:row;gap:6px}.nav .logo-mark b{font-size:.85rem}.nav.nav-fixed .nav-links{display:flex;position:static;background:none;box-shadow:none;gap:.35rem}.nav.nav-fixed .nav-links>a.keep-lg{display:none}.compact-nav-links{display:block;border-bottom:1px solid var(--line);padding-bottom:.4rem}.nav .dd-menu{max-width:calc(100vw - 24px);max-height:calc(100dvh - var(--nav-height) - 20px);overflow-y:auto}.nav .uname{max-width:8rem}.fb-layout{grid-template-columns:1fr}.fb-status .btn{width:auto}.write-layout,.chat-layout,.rd-layout{grid-template-columns:1fr}.toolkit{position:static;max-height:300px}.chat-main{height:65dvh;min-height:340px}.board-page .layout{height:calc(100dvh - var(--nav-height) - var(--board-bar-h, 3.375rem))!important}}
@media(max-width:600px){.nav .uname{display:none}.nav .logo-mark svg{width:34px}.nav-links .nav-back .nb-t{display:none}.nav-links .nav-back{padding:.4rem .55rem}.nav .user-btn{padding:.35rem}.page{padding:.75rem .75rem 1rem}.page-banner{padding:.75rem}.page-banner .crumb{font-size:.7rem}.page-banner h1{font-size:1.15rem}.page-banner .lead{font-size:.8rem}.page-banner .btn-lg{padding:.6rem .8rem;font-size:.85rem}.topic-grid,.fn-grid,.bot-cards,.about-grid,.features{grid-template-columns:minmax(0,1fr)}.page table{display:block;max-width:100%;overflow-x:auto}.page .field select,.page .field input,.page .field textarea{font-size:16px}.fb-teacher,.fb-status{padding:1rem}.fb-score b{font-size:2.5rem}.gr-intro{padding-top:1rem!important}.gr-head h2 small{overflow-wrap:anywhere}.gr-nav{flex-wrap:wrap}.gr-score-input select{font-size:16px}.ed-h{flex-wrap:wrap}#essay{height:45dvh;min-height:240px;padding:1rem}.help-fab{width:48px;height:48px}.modal{padding:.75rem}.modal-box{max-width:100%;max-height:90dvh;overflow-y:auto}}
@media(max-height:800px) and (min-width:901px){.page-banner{padding:.7rem 1.5rem}.page{padding-top:.75rem;padding-bottom:1rem}.page-banner .crumb{margin-bottom:.2rem}.page-banner h1{margin-bottom:.2rem}.block{margin-top:1rem}.gr-intro{padding-top:.75rem!important}.grading-page .gr-main{padding:1rem}.grading-page .gr-head{margin-bottom:.75rem;padding-bottom:.6rem}.grading-page .gr-essay{max-height:calc(100dvh - 285px)}}
.nav .dd-menu a.dd-item{display:flex}
.page section,.page article,.page aside{min-width:0}.mo-groups{grid-template-columns:repeat(auto-fit,minmax(min(100%,380px),1fr))}.in-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
.fn{padding:1rem}.fn .ic{width:2.5rem;height:2.5rem;margin-bottom:.5rem}.fn .ic svg{width:1.5rem;height:1.5rem}.fn .pz{margin-bottom:.65rem}.progress-card .stepper{margin-bottom:.25rem}
@media(max-width:600px){.mo-row{grid-template-columns:32px minmax(0,1fr) auto;gap:6px}.mo-row .mo-bar2{display:none}.mo-row .mo-nudge{grid-column:2 / -1;justify-self:start}.in-bar{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}}
@media(min-width:1251px) and (min-height:650px){.grading-page>main.page{height:calc(100dvh - var(--nav-height) - 130px);flex:none;display:flex;flex-direction:column}.grading-page .gr-bar{flex:none}.grading-page .gr-layout{flex:1;min-height:0}.grading-page .gr-main{height:100%;display:flex;flex-direction:column}.grading-page .gr-head{flex:none}.grading-page .gr-split{flex:1;min-height:0}.grading-page .gr-assessment{height:100%;overflow-y:auto;padding-right:.5rem}.grading-page .gr-essay{max-height:100%;min-height:0}.grading-page .gr-list{max-height:100%;top:0}.chat-layout{align-items:start}}
@media(min-width:1251px) and (min-height:650px){.grading-page .gr-layout{grid-template-rows:minmax(0,1fr)}.grading-page .gr-main,.grading-page .gr-assessment{min-height:0;max-height:100%}.grading-page .gr-split{grid-template-rows:minmax(0,1fr)}}

/* Progress-aware owl: grid columns match the five progress markers. */
.pc-progress-guide{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:auto 38px;gap:2px 0;margin-top:.4rem}.pc-guide-bubble{grid-row:1;display:flex;align-items:center;gap:.4rem;padding:.4rem .7rem;border-radius:10px;background:var(--amber-soft);color:#6b4a07;min-width:0;min-height:2.4rem}.pc-guide-bubble>span{flex:1;min-width:0;font-size:.8rem;line-height:1.5;overflow-wrap:anywhere}.pc-guide-bubble button{flex:none;width:28px;height:28px;border:0;border-radius:50%;background:#ffffffa6;color:#6b4a07;font-size:.75rem}.pc-stage-owl{grid-row:2;justify-self:center;display:flex;align-items:end}.pc-stage-owl .owl-live{width:38px;height:38px}.progress-card .stepper{margin-top:0}.progress-card .stepper .current-stage .b{box-shadow:0 0 0 4px #2f5fe025}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(max-width:600px){.pc-guide-bubble{grid-column:1 / -1!important;padding:.5rem .6rem;min-height:3.5rem}.pc-guide-bubble>span{font-size:.8rem}.pc-progress-guide{grid-template-rows:auto 34px}.pc-stage-owl .owl-live{width:34px;height:34px}}

/* Topic cards use readable type and natural height rather than viewport stretching. */
.topic-page .fn-grid{align-items:stretch}.topic-page .fn{grid-template-rows:auto auto auto auto auto;align-content:start;padding:clamp(1rem,1.4vw,1.5rem);column-gap:.8rem}.topic-page .fn h3{font-size:clamp(1.2rem,1.45vw,1.65rem);line-height:1.3;overflow-wrap:normal}.topic-page .fn .zh{font-size:clamp(1rem,1.05vw,1.2rem);margin:.2rem 0 .8rem;line-height:1.5}.topic-page .fn>p:not(.zh){font-size:clamp(1rem,1.12vw,1.3rem);line-height:1.65;margin-bottom:.45rem}.topic-page .fn .pz{font-size:clamp(.95rem,1vw,1.15rem);line-height:1.7;margin-bottom:0}.topic-page .fn .fn-actions{align-self:start;margin-top:1rem}.topic-page .fn-actions .btn{font-size:clamp(.95rem,1vw,1.15rem);white-space:normal;overflow:visible;text-overflow:clip;line-height:1.5;min-height:44px;padding:.65rem .8rem}.topic-page .fn-actions .note{font-size:.85rem}.topic-page .fn-n{width:2rem;height:2rem;font-size:1rem}.topic-page .fn .ic{width:3rem;height:3rem}.topic-page .fn .ic svg{width:1.7rem;height:1.7rem}.topic-page .fn-grid{min-height:0}.topic-page .pc-guide-bubble>span{font-size:clamp(.9rem,1vw,1.05rem)}
body:has(main.topic-page) .page-banner h1{font-size:clamp(1.25rem,1.7vw,2rem);line-height:1.35}
@media(max-width:600px){.topic-page .fn h3{font-size:1.3rem}.topic-page .fn>p:not(.zh){font-size:1rem}.topic-page .fn .pz{font-size:.95rem}.topic-page .fn .fn-actions{margin-top:.8rem}}
/* Prominent CAWS brand without increasing the fixed navigation height. */
.nav .logo-mark .owl-img{width:54px;height:50px;object-fit:contain}.nav .logo-mark svg{max-height:50px;width:54px}.nav .logo-mark b{font-size:.85rem;line-height:1;letter-spacing:.16em}.nav .logo-text{font-size:clamp(1.25rem,1.5vw,1.85rem);font-weight:850;letter-spacing:-.025em}.nav .logo-text .lt-abbr{font-weight:900;color:#6b4a3a}
@media(min-width:901px) and (max-width:1500px){.nav .logo-text{font-size:1.25rem}.nav-staff .nav-links>a.keep-lg{display:none}.nav-staff .compact-nav-links{display:block;border-bottom:1px solid var(--line)}.nav .logo-text .lt-abbr{display:inline}}
@media(max-width:900px){.nav .logo-mark .owl-img{width:44px;height:44px}.nav .logo-mark svg{width:44px;max-height:44px}.nav .logo-mark b{font-size:1.2rem;letter-spacing:.08em}.nav .logo-mark{gap:8px}}
@media(min-width:901px) and (max-width:1250px){.nav .logo-text{font-size:0;max-width:none;overflow:visible}.nav .logo-text::after{content:"CAWS";font-size:1.7rem;font-weight:900;color:var(--ink);letter-spacing:.02em}}

/* Restore action placement; retain the requested larger card typography. */
.topic-page .fn{grid-template-rows:auto auto auto auto 1fr;align-content:stretch}.topic-page .fn .fn-actions{align-self:end;margin-top:1rem}
/* Shared stepper sizing applies wherever the progress component is rendered. */
.stepper,.progress-card .stepper,.topic-page .progress-card .stepper{--step-size:clamp(2rem,2.3vw,2.75rem);--step-line:4px}
.stepper .b,.stepper.compact .b,.progress-card .stepper .b,.topic-page .progress-card .stepper .b{width:var(--step-size);height:var(--step-size);font-size:clamp(1rem,1.1vw,1.3rem);border-width:3px}
.stepper li::before,.progress-card .stepper li::before,.topic-page .progress-card .stepper li::before,.stepper.compact li::before{top:calc(var(--step-size)/2 - var(--step-line)/2);height:var(--step-line)}
.stepper .l,.stepper.compact .l,.progress-card .stepper .l,.topic-page .progress-card .stepper .l{font-size:clamp(.95rem,1.1vw,1.25rem);line-height:1.4;margin-top:.35rem}
.stepper .l small,.progress-card .stepper .l small,.topic-page .progress-card .stepper .l small{font-size:clamp(.8rem,.9vw,1rem)}
.pc-h>b,.topic-page .pc-h>b{font-size:clamp(1.1rem,1.3vw,1.5rem)}.pc-h>b span{font-size:1.1em}.pc-guide-bubble>span,.topic-page .pc-guide-bubble>span{font-size:clamp(1rem,1.1vw,1.25rem)}
@media(max-width:600px){.stepper,.progress-card .stepper,.topic-page .progress-card .stepper{--step-size:1.9rem}.stepper .l,.stepper.compact .l,.progress-card .stepper .l,.topic-page .progress-card .stepper .l{font-size:.78rem}.stepper .l small,.progress-card .stepper .l small{font-size:.72rem}.topic-page .pc-h>b{font-size:1.1rem}}
.stepper{grid-template-columns:repeat(var(--steps,5),minmax(0,1fr))}.stepper li{min-width:0}.stepper .l{overflow-wrap:anywhere;max-width:100%}
/* Keep progress compact when type is enlarged; do not allocate separate tall rows. */
.topic-page .progress-card{position:relative;padding:.5rem 1rem .6rem}
.pc-progress-guide{grid-template-rows:auto 26px;row-gap:0;margin-top:0}
.pc-guide-bubble{min-height:32px;padding:.2rem .6rem}
.pc-guide-bubble>span,.topic-page .pc-guide-bubble>span{line-height:1.3}
.pc-stage-owl .owl-live{width:28px;height:26px}
.topic-page .progress-card .stepper .l{margin-top:.2rem;line-height:1.25}
@media(min-width:1100px){.topic-page .pc-h{position:absolute;top:.5rem;left:1rem;margin:0}.pc-progress-guide .pc-guide-bubble{grid-column:3 / -1!important}.pc-progress-guide{grid-template-rows:36px 26px}.topic-page .progress-card .stepper{--step-size:clamp(2rem,2.1vw,2.5rem)}}
@media(min-width:601px) and (max-width:1099px){.topic-page .pc-h{margin-bottom:.25rem}.pc-progress-guide .pc-guide-bubble{grid-column:1 / -1!important}.pc-guide-bubble{min-height:32px}.pc-progress-guide{grid-template-rows:auto 24px}.pc-stage-owl .owl-live{height:24px;width:26px}}
@media(max-width:600px){.topic-page .progress-card{padding:.5rem .6rem}.topic-page .pc-h{margin-bottom:.25rem}.pc-guide-bubble{min-height:32px;padding:.25rem .4rem}.pc-progress-guide{grid-template-rows:auto 24px}.pc-stage-owl .owl-live{width:26px;height:24px}.pc-guide-bubble button{width:24px;height:24px}}
.topic-page .pc-h>b{line-height:1.2}
@media(min-width:1100px){.pc-guide-bubble{height:36px}.topic-page .progress-card .stepper .l small{vertical-align:baseline}}
@media(max-width:1099px){.pc-guide-bubble{height:48px;min-height:48px}.topic-page .pc-h{min-height:26px}.topic-page .pc-guide-bubble>span{font-size:1rem}}

/* Native viewport sizing; keep the owl in front of its message on every device. */
html{zoom:1}
.topic-page .progress-card{display:grid;grid-template-columns:auto minmax(0,1fr);gap:.35rem 1.2rem;align-items:center;padding:.65rem 1rem}
.topic-page .pc-h{position:static;margin:0;min-height:0;grid-column:1;grid-row:1}
.pc-progress-guide{display:block;grid-column:2;grid-row:1;margin:0;min-width:0}
.pc-progress-guide .pc-guide-bubble{height:auto;min-height:38px;padding:.25rem .55rem;display:flex;align-items:center;gap:.5rem}
.pc-inline-owl{display:flex;flex:none;align-items:center}.pc-inline-owl .owl-live{width:34px;height:34px;flex:none}
.topic-page .progress-card>.stepper{grid-column:1 / -1;grid-row:2;margin:0}
@media(max-width:600px){
  .topic-page .progress-card .stepper{--step-size:2.25rem}
}
@media(max-width:900px){.topic-page .progress-card{grid-template-columns:minmax(0,1fr);gap:.25rem}.topic-page .pc-h{grid-column:1;grid-row:1}.pc-progress-guide{grid-column:1;grid-row:2}.topic-page .progress-card>.stepper{grid-column:1;grid-row:3}.pc-progress-guide .pc-guide-bubble{min-height:36px}.pc-inline-owl .owl-live{width:30px;height:30px}}

.mobile-card-nav{display:none;align-items:center;justify-content:space-between;gap:.5rem;margin:.35rem 0 .5rem;font-size:.85rem}
@media(max-width:600px),(min-width:601px) and (max-width:1099px) and (max-height:800px){.mobile-card-nav:not([hidden]){display:flex}.topic-page .fn-grid{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;align-items:stretch;gap:.75rem;padding:0 0 .4rem;scrollbar-width:none}.topic-page .fn-grid::-webkit-scrollbar{display:none}.topic-page .fn{flex:0 0 100%;min-width:0;scroll-snap-align:start}.topic-page .block{margin-top:.6rem}.topic-page .fn h3{font-size:1.25rem}.topic-page .fn>p:not(.zh){line-height:1.5}.topic-page .fn .pz{line-height:1.5}.topic-page .fn .zh{margin-bottom:.5rem}.topic-page .fn{padding:.8rem 1rem}.topic-page .fn .fn-actions{margin-top:.6rem}}
@media(min-width:601px) and (max-width:1099px) and (max-height:800px){.topic-page .fn{flex-basis:calc(50% - .375rem)}}
.pc-guide-bubble>.pc-inline-owl{flex:0 0 auto;min-width:0}.pc-guide-bubble>#owlMsg{text-align:left}

.pc-card-link{font-size:.85rem;font-weight:700;white-space:nowrap;padding:.2rem .5rem;border:1px solid var(--line);border-radius:16px;text-decoration:none;background:#fffaf0}

/* Fit the available screen using real layout space, never shrink the whole site. */
main.topic-page{max-width:none;width:100%;padding:12px clamp(12px,2.5vw,48px) 12px}
.topic-page>.block{margin-top:0;margin-bottom:12px}.topic-page>.block:last-child{margin-bottom:0}
.topic-page .progress-card{padding:.4rem .8rem}.topic-page .pc-h>b{line-height:1.2}
@media(min-width:1100px){body:has(main.topic-page) .page-banner{padding:.6rem clamp(12px,2.5vw,48px)}body:has(main.topic-page) .page-banner-inner{max-width:none}.topic-page .fn{padding:1rem}.topic-page .fn .zh{margin-bottom:.5rem}.topic-page .fn>p:not(.zh),.topic-page .fn .pz{line-height:1.5}.topic-page .fn .fn-actions{margin-top:.7rem}}

@media(max-width:600px){.topic-page .pc-h{gap:.2rem .5rem}.topic-page .progress-card{row-gap:.15rem}.topic-page .pc-h>b{font-size:1.05rem}.topic-page .pc-card-link{padding:.15rem .4rem}.topic-page .progress-card .stepper .l small{display:block;margin-left:0}}
main.topic-page{padding-bottom:8px}
/* Compact topic-card steps must keep each English word intact. */
.stepper.compact{container-type:inline-size}.stepper.compact .l{white-space:normal;overflow-wrap:normal;word-break:normal;font-size:.75rem;font-size:clamp(.7rem,3cqi,1rem)}
.nav .nav-home{flex:none;white-space:nowrap;font-size:.8rem;padding:.4rem .65rem;border:1px solid var(--line);border-radius:18px;color:var(--ink);text-decoration:none;background:white}.nav .nav-home:hover{background:var(--primary-soft);color:var(--primary)}@media(max-width:600px){.nav .nav-home{font-size:.72rem;padding:.35rem .5rem}}
.nav .nav-links>a.nav-home{display:inline-flex;align-items:center}

/* 很窄的手機（約 380px 以下）：頁首只留貓頭鷹圖示，CAWS 字樣不會被返回／回首頁按鈕切掉 */
@media(max-width:380px){.nav .logo-mark b{display:none}}
/* 超寬螢幕（2K、4K、教室大螢幕）：字級和版面再等比例放大，最大 22px */
@media(min-width:2200px){html{font-size:clamp(18px, .55vw + 5.8px, 22px)}}
/* 手機和平板：說明小字至少 12px（麵包屑、圖說、頁尾） */
@media(max-width:600px),(pointer:coarse){.crumb,p.crumb,figcaption,.footer-slim,.footer-slim span,.manual-example button span,#manualHint{font-size:12px!important}}
/* 觸控裝置（手機、平板）：勾選框、下拉選單、小按鈕放大，手指比較好點；不影響滑鼠操作的電腦 */
@media(pointer:coarse){
  main input[type=checkbox],main input[type=radio],.board-page input[type=checkbox]{width:1.25rem;height:1.25rem}
  main select,.board-page select{min-height:2.5rem}
  main .link-btn,main .pill,.board-bar .pill,.board-page .seg button,#viewCanvas,#viewThread,main .btn-sm,main .mini-btn,main a.btn,main button.btn{min-height:2.25rem}
  main .pill,.board-bar .pill{display:inline-flex;align-items:center;justify-content:center}
  .ai-key-guide-link{padding:.35rem 0}
}
/* 大螢幕：長段落一行不超過約 90 個字元，比較好讀（版面本身仍然會撐開） */
@media(min-width:1600px){.teacher-workspace main p,.ov-question,.ex-page p,main.page > .card > p{max-width:90ch}}
/* 任務頁四個方框：標題與編號放大 */
.topic-page .fn h3{font-size:clamp(1.45rem,1.9vw,2.15rem);line-height:1.2;padding-right:3.4rem}
.topic-page .fn .zh{font-size:clamp(1.2rem,1.45vw,1.6rem);font-weight:800}
.topic-page .fn-n{width:clamp(2.6rem,3vw,3.2rem);height:clamp(2.6rem,3vw,3.2rem);font-size:clamp(1.35rem,1.6vw,1.75rem);top:.8rem;right:.9rem;box-shadow:0 3px 8px rgba(0,0,0,.18)}
@media(max-width:600px){.topic-page .fn h3{font-size:1.5rem}.topic-page .fn .zh{font-size:1.2rem}}
