/* Institution learning: shared tokens and explicit layout roles. */
:root{--green:#245c4a;--deep:#213d35;--muted:#4a5f56;--red:#a4333c;--line:#d5e0d9}
body{font-size:16px;line-height:1.6;color:var(--deep)}
button,input,select,textarea{font:inherit}button,input,select,summary{min-height:44px}button{white-space:normal}select{max-width:100%}
small,.sub,.muted,.learning-muted,.student-kicker,.stat-top,.footer-note{font-size:15px;color:var(--muted);line-height:1.65}
:where(button,a,input,select,textarea,summary):focus-visible{outline:3px solid #245c4a;outline-offset:3px;box-shadow:0 0 0 5px white}
h1,h2,h3{overflow-wrap:anywhere;line-height:1.5}p{overflow-wrap:anywhere}label{line-height:1.6}button:disabled{cursor:wait}
.public-header,.learning-header{display:flex;flex-wrap:nowrap;justify-content:space-between;align-items:center;gap:16px}
.public-brand{font-size:21px;line-height:1.3;min-width:0}.public-brand img{width:44px;height:44px;flex:none}.public-brand span{overflow-wrap:normal}
/* Navigation header - consistent across pages */
.header-tools{display:flex;align-items:center;gap:12px;min-width:0}.header-tools .account-identity{max-width:220px}.identity-name{font-size:16px}.identity-button{padding:5px;background:transparent;border:0;min-width:0}
.app-menu{position:relative;flex:none}.app-menu summary{display:flex;align-items:center;padding:10px 16px;border:1px solid var(--line);border-radius:10px;cursor:pointer;font-size:16px;list-style:none;min-height:44px}.app-menu summary::-webkit-details-marker{display:none}.app-menu nav{position:absolute;right:0;top:calc(100% + 8px);z-index:20;display:grid;gap:10px;background:white;border:1px solid var(--line);box-shadow:0 12px 30px #213d3520;border-radius:12px;padding:16px;width:min(270px,calc(100vw - 32px));max-height:70vh;overflow:auto}.app-menu nav>*{width:100%;min-height:44px;margin:0;font-size:16px}.app-menu nav a{display:flex;align-items:center}
.topbar-right{min-width:0;gap:12px}.topbar .brand{font-size:18px}.topbar .brand small{display:none}.sidebar .account-tools{display:grid;gap:12px;margin:18px 0}.sidebar .account-tools a{padding:8px 12px;min-height:44px}
.management-list{border-top:1px solid var(--line)}.management-row,.candidate-row{display:flex;align-items:center;gap:16px;padding:18px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}.management-row>strong,.management-row>div:first-child{flex:1;min-width:0}.management-row .actions{margin:0}.taxonomy-dialog{width:min(640px,calc(100% - 24px));max-height:85vh;padding:0;border:1px solid var(--line);border-radius:16px}.taxonomy-body{padding:24px}.taxonomy-body label{display:grid;gap:6px}.taxonomy-body [data-tax-error]{color:var(--red)}
.student-grid{display:block;border-top:1px solid var(--line)}.student-grid .student-card{display:grid;grid-template-columns:minmax(180px,2fr) minmax(140px,1fr) minmax(140px,1fr) minmax(130px,1fr);gap:18px;align-items:center;padding:20px 0;border:0;border-bottom:1px solid var(--line);background:transparent;border-radius:0;box-shadow:none}.student-grid .student-card .identity{flex-direction:row}.student-card select{width:100%}.student-card .card-meta{border:0;padding:0;margin:0}.student-card>.danger{grid-column:4}
.category-filter{display:flex;align-items:center;gap:12px;margin:18px 0 24px}.category-filter select{width:auto;max-width:350px}
.learning-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr));align-items:stretch}.learning-card{display:flex;flex-direction:column;gap:10px}.learning-card h2{margin:0;font-size:22px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.learning-card>p{margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.learning-card>.actions{margin-top:auto}.learning-card .learning-cover,.student-shell .learning-placeholder,.learning-placeholder{width:100%;height:auto;aspect-ratio:16/9;object-fit:cover;border-radius:12px;overflow:hidden}.learning-placeholder img{width:100%;height:100%;max-height:180px;object-fit:contain}.learning-card label{display:grid;gap:6px;margin-top:8px}.learning-card progress{width:100%}
/* Student-focused UI: encouragement, progress, mascot */
.student-shell{background:#f8faf7;min-height:100vh;padding-bottom:80px}
.student-shell .learning-header{background:white;margin:-20px -20px 20px;padding:16px 20px;border-bottom:1px solid var(--line)}
/* Only the duplicated top tab row is hidden (the bottom navigation replaces it); course, video and quiz actions must stay visible. */
.student-shell>.actions{display:none}
.student-welcome{background:linear-gradient(135deg,#e8f4ed 0%,#f0f7f3 100%);border:0;box-shadow:0 2px 12px rgba(34,87,70,0.08);grid-template-columns:1fr 140px;padding:22px 26px;gap:12px;margin-bottom:24px}
.student-continue{background:white;border:2px solid var(--green);box-shadow:0 4px 16px rgba(34,87,70,0.12);margin-bottom:20px;padding:24px;border-radius:16px}
.student-continue h2{color:var(--green);font-size:22px;margin:0 0 8px}
.student-card{background:white;border-radius:16px;box-shadow:0 2px 10px rgba(34,87,70,0.06);transition:transform 0.2s,box-shadow 0.2s}
.student-card:hover{transform:translateY(-2px);box-shadow:0 6px 20px rgba(34,87,70,0.12)}
.student-balance{background:white;padding:16px 20px;border-radius:12px;text-align:center;margin:20px 0;box-shadow:0 2px 8px rgba(34,87,70,0.06)}
.student-bottom-nav{background:white;border-top:2px solid var(--line);box-shadow:0 -4px 12px rgba(34,87,70,0.08)}

/* Management-focused UI: efficiency, data density, filtering */
.learning-shell:not(.student-shell){background:white}
.learning-shell:not(.student-shell) .learning-header{border-bottom:2px solid var(--line);padding-bottom:20px;margin-bottom:24px}
.learning-shell:not(.student-shell) .panel{border:1px solid var(--line);box-shadow:none;padding:20px}
.learning-shell:not(.student-shell) .learning-grid{gap:16px}
.learning-shell:not(.student-shell) .learning-card{border:1px solid var(--line);box-shadow:none;transition:border-color 0.2s}
.learning-shell:not(.student-shell) .learning-card:hover{border-color:var(--green)}
.buddy-character,.buddy-eyes,.buddy-spark,.buddy-art{animation:none!important}.student-result .buddy-art{animation:completion-nod .6s ease-out 1!important}@keyframes completion-nod{50%{transform:translateY(-6px) rotate(3deg)}}
.membership-row{padding:24px 0;border-bottom:1px solid var(--line)}.membership-status{margin:16px 0}.membership-status .status-explain{color:var(--muted);margin-top:8px}.membership-actions{margin:16px 0;display:flex;gap:12px;flex-wrap:wrap}.membership-actions button{min-height:48px}.enrollment-steps{display:flex;flex-wrap:wrap;gap:12px 24px;padding-left:24px;margin:16px 0}.enrollment-steps li{padding:8px;color:var(--muted);position:relative}.enrollment-steps [aria-current=step]{color:var(--deep);font-weight:700;border-bottom:3px solid var(--green)}.enrollment-steps [data-complete=true]{color:var(--green)}.enrollment-steps [data-complete=true]::before{content:'✓';position:absolute;left:-16px;font-weight:700}.secondary-actions{margin:16px 0}.secondary-actions summary{display:flex;align-items:center;cursor:pointer}.secondary-actions[open]>button{margin-top:10px}
.candidate-row>img,.candidate-avatar{width:64px;height:64px;object-fit:cover;border-radius:50%;background:#e4eee7;flex:none}.candidate-row>div{flex:1;min-width:120px}.candidate-row strong{overflow-wrap:anywhere}.candidate-row p{margin:0;color:var(--muted)}
.review-history-controls{display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin:20px 0}.review-history-controls label{display:grid;gap:6px;flex:1;min-width:160px}.review-pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:20px 0}.member-review{box-shadow:none;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:20px 0}.review-history .member-review{margin:0}
html:lang(th) :is(button,label,summary,h1,h2,h3){line-height:1.75}html:lang(zh-Hans) :is(h1,h2,h3){word-break:normal}
@media(max-width:760px){.public-shell,.learning-shell{padding:16px 16px 36px}.public-header,.learning-header{gap:12px;margin-bottom:20px}.public-brand{font-size:19px;gap:10px}.public-brand img{width:40px;height:40px}.header-tools{gap:10px;flex-wrap:nowrap;justify-content:flex-end}.header-tools .account-identity{max-width:160px}.identity-avatar{width:36px;height:36px}.identity-name{font-size:15px}.public-header .public-brand{flex:1;min-width:0}.public-header .header-tools{flex:none}.topbar{flex-wrap:wrap;gap:8px}.topbar .brand{font-size:16px;max-width:45%;min-width:0}.topbar .brand-logo{width:36px;height:36px}.topbar-right{flex:1;justify-content:flex-end}.topbar-right .account-identity{max-width:130px}.heading{flex-wrap:wrap}.heading .actions{max-width:100%;justify-content:flex-start}.heading .primary,.choices button,.behavior-btn,.hero p,.stat-top,.lang{font-size:14px}.toolbar select{max-width:100%;min-width:0;flex:1}.student-grid .student-card{grid-template-columns:1fr 1fr;gap:14px}.student-card>.identity{grid-column:1/-1}.student-card>.danger{grid-column:auto}.student-card>.card-actions{grid-column:1/-1;flex-direction:row}.student-card>.card-actions button{flex:1}.student-card .card-meta{flex-direction:column}.student-welcome{padding:20px;grid-template-columns:1fr 90px}.student-welcome .buddy-stage{width:90px;height:100px;margin:0;transform:scale(.65);transform-origin:left center}.student-welcome h2{font-size:23px}.student-metrics{gap:10px 20px}.category-filter{flex-wrap:wrap}.category-filter select{flex:1;max-width:100%}.student-shell{padding-bottom:110px}.student-continue{padding:20px}.candidate-row button{width:100%}.taxonomy-body{padding:18px}.learning-card h2{font-size:21px}.app-menu summary{padding:10px 14px;font-size:15px}}
@media(prefers-reduced-motion:reduce){.student-result .buddy-art{animation:none!important}html{scroll-behavior:auto}*{transition:none!important}}
[data-motion=off] .student-result .buddy-art{animation:none!important}

.public-brand{text-decoration:none!important}.student-welcome{margin:18px 0;min-height:160px}.student-welcome h2{font-size:23px;margin:0}.student-welcome p{margin:8px 0}.student-welcome .buddy-stage{height:120px}.student-welcome .buddy-art{height:120px;width:120px}.student-bottom-nav svg{display:block;margin:0 auto 4px}.learning-card progress{accent-color:var(--green)}
@media(max-width:760px){.student-welcome{grid-template-columns:minmax(0,1fr) 80px;min-height:160px}.student-welcome .buddy-stage{transform:scale(.65);transform-origin:left center;height:120px}.learning-header .header-tools .account-identity{max-width:140px}.learning-header .public-brand{font-size:19px;gap:8px;flex:1;min-width:0}.learning-header .public-brand img{width:40px;height:40px}.learning-header .header-tools{gap:10px;flex:none}.app-menu summary{padding:10px 14px;font-size:15px}}

.dashboard-actions{display:flex;flex-wrap:wrap;gap:12px;margin:0 0 24px}.dashboard-actions button,[data-enrollment-notice]{display:inline-flex;align-items:center;justify-content:center;gap:8px}
/* 2026-10-25 audit fixes: no horizontal scroll on the student header, readable contrast (>=4.5:1), one-row staff header on phones */
@media(max-width:760px){.student-shell .learning-header{margin:-16px -16px 16px;padding:12px 16px}}
.student-bottom-nav button,.student-bottom-nav a{color:#4b5a52}
.student-welcome p{color:#33473f}
.rank .place{color:#5b6b63}.avatar:not(img){color:#5e5233}.avatar.c1{color:#2f5a4f}.avatar.c2{color:#5b4870}.avatar.c3{color:#7a4f2e}
@media(max-width:600px){
 .topbar{flex-wrap:nowrap;gap:8px}
 .topbar .brand{flex:1 1 auto;max-width:none;min-width:0}
 .topbar .brand>div{min-width:0}
 .topbar .brand [data-institution-name]{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .topbar-right{flex:0 0 auto;flex-wrap:nowrap;gap:6px}
 .topbar-right .account-identity{max-width:96px}
 .topbar-right [data-enrollment-notice]{min-width:44px;min-height:44px;padding:4px 8px}
}
.membership-actions{display:grid;gap:12px;justify-items:start;align-items:start}
@media(max-width:600px){.public-header .public-brand span,.learning-header .public-brand span{white-space:nowrap}}

/* Entry card to the pet house game. */
.student-pet-entry{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:center;text-decoration:none;color:var(--deep);border-left:5px solid #e2a400}
.student-pet-entry>span:first-child{font-size:36px}.student-pet-entry strong{display:block;font-size:19px}.student-pet-entry small{display:block}.student-pet-entry b{color:var(--green);white-space:nowrap}
