/* The application frame reserves space for navigation and gives each view a bounded stage. */
html{height:100%;scroll-behavior:auto}
body,body.scope{height:100vh;height:100dvh;min-height:0;padding:0;display:flex;flex-direction:column;overflow:hidden}
.top,.foot,.bottomnav{flex:none}
.top{padding-top:env(safe-area-inset-top)}
.scope .bottomnav .nav-link{min-width:0}
body[data-route="quiz"]{
  background:radial-gradient(ellipse at 50% 0%,#30474d 0%,#1c3036 42%,#14262d 75%,#111e25 100%);
}
body[data-route="quiz"] .top,body[data-route="quiz"] .foot,body[data-route="quiz"] #bottomnav{display:none}
body[data-route="quiz"] #main{
  width:min(100%,622px);margin-inline:auto;padding:max(5px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));
}
body[data-route="quiz"] #quiz-view{display:flex;flex-direction:column}
.head-in{min-height:58px}
.main{flex:1 1 0;min-height:0;display:flex;flex-direction:column;padding-block:clamp(9px,1.8vh,20px);width:min(1200px,calc(100% - 64px))}
#page,#quiz-view,#reader-view{width:100%;flex:1 1 0;min-height:0}
#page{height:100%;overflow-y:auto;overscroll-behavior:contain}
.foot>div{padding-block:6px}
.immersive .head-in{min-height:45px;height:45px}
.immersive .brandmark{width:32px;height:32px;transform:scale(.8);transform-origin:left center;margin-right:-4px}
.immersive .brandmark i{left:3px;top:4px}
.immersive .brandmark b{left:2px;top:17px}
.immersive .main{padding-block:5px}
.immersive .me img{width:29px;height:29px}
body:is([data-route="lobby"],[data-route="subject"]) #page{display:flex;flex-direction:column;gap:clamp(10px,2.1vh,23px)}
body:is([data-route="lobby"],[data-route="subject"]) .hero{flex:none}
[data-route="lobby"] .hero-art{min-height:clamp(180px,33vh,335px)}
[data-route="lobby"] .hero-copy{padding:clamp(18px,3.3vh,43px) clamp(20px,3.7vw,54px)}
[data-route="lobby"] .hero h1{font-size:clamp(29px,min(4vw,5.7vh),53px)}
[data-route="lobby"] #doors{margin:0;min-height:0}
[data-route="lobby"] .course-art{height:clamp(95px,17vh,173px)}
[data-route="lobby"] .course-body{padding-top:clamp(8px,1.5vh,17px)}
[data-route="lobby"] .course-body p{margin-block:4px 10px}
[data-route="subject"] .stats,[data-route="subject"] .section{margin:0}
[data-route="subject"] .subject-hero .hero-art{min-height:clamp(144px,25vh,255px)}
[data-route="subject"] .subject-hero .hero-copy{padding:clamp(13px,2.8vh,33px) clamp(18px,3.6vw,44px)}
[data-route="subject"] .hero h1{margin:5px 0}
[data-route="subject"] .hero .btn{margin-top:10px}
[data-route="subject"] .section-row{margin-bottom:8px}
[data-route="subject"] .dash-grid{min-height:0}
[data-route="subject"] .chapter-line{padding:7px;gap:10px}
[data-route="subject"] .chapter-line img{width:71px;height:50px}
[data-route="subject"] .stat{padding:clamp(6px,1.3vh,17px) clamp(8px,1.7vw,20px)}
#save-warning{flex:none;font-size:12px;padding:3px 8px}
@media(max-width:750px){
  input[type="search"]{font-size:16px}
  .wrap,.main{width:calc(100% - 24px)}
  .head-in{min-height:49px}
  .brandmark{width:35px;height:35px}.brandmark i{left:4px;top:6px}.brandmark b{left:2px;top:19px}
  .foot{display:none}
  .scope .bottomnav:not([hidden]){position:static;padding:3px 4px max(3px,env(safe-area-inset-bottom));min-height:48px}
  body.scope.immersive .bottomnav{display:none}
  .main{padding-block:9px}
  .bottomnav .nav-link{padding-block:3px}
  body:is([data-route="lobby"],[data-route="subject"]) #page{gap:clamp(7px,1.6vh,14px)}
  .hero .hero-sign{letter-spacing:.05em}
  [data-route="lobby"] .hero-art{min-height:150px}
  [data-route="lobby"] .course-card{grid-template-columns:28% minmax(0,1fr);grid-template-rows:1fr auto}
  [data-route="lobby"] .course-grid{gap:clamp(5px,1vh,10px)}
  [data-route="lobby"] .course-art{height:auto;min-height:clamp(71px,12vh,106px)}
  [data-route="lobby"] .course-body{padding:6px 12px 0}
  [data-route="lobby"] .course-body p{margin:2px 0 3px}
  [data-route="lobby"] .cardfoot{margin-inline:12px;padding:3px 0;font-size:11px}
  [data-route="lobby"] .card-arrow{width:21px;height:21px}
  [data-route="lobby"] .course-title h3{font-size:clamp(16px,4.4vw,20px)}
  [data-route="lobby"] #doors .section-row{margin-bottom:7px}
  [data-route="lobby"] #doors .section-row p{flex:0 1 auto;font-size:11px}
  [data-route="subject"] .dash-grid{display:block}
  [data-route="subject"] .dash-grid>.section:nth-child(2){display:none}
  [data-route="subject"] .chapter-line img{width:62px;height:43px}
  [data-route="subject"] .chapter-list{gap:5px}
  [data-route="subject"] .row-data small{margin:0}
  [data-route="subject"] .hero .btn{min-height:40px}
}
@media(max-width:540px){
  body:is([data-route="lobby"],[data-route="subject"]) .hero-art{display:grid;place-items:center;min-height:0;height:clamp(92px,22dvh,192px);background:#123f37}
  body:is([data-route="lobby"],[data-route="subject"]) .hero-art img{display:block;position:static;max-height:100%;width:100%;height:100%;object-fit:contain}
  [data-route="lobby"] .hero-copy,[data-route="subject"] .subject-hero .hero-copy{padding:10px 14px 13px}
  [data-route="lobby"] .hero h1{font-size:clamp(17px,5.2vw,26px);line-height:1.4;margin:3px 0}
  [data-route="subject"] .subject-hero h1{font-size:clamp(20px,5.7vw,27px)}
  [data-route="lobby"] .hero-copy p,[data-route="subject"] .hero-copy p{font-size:12px;line-height:1.55}
  [data-route="lobby"] #doors .section-row{align-items:baseline}
  [data-route="lobby"] .sub-title{font-size:18px}
  [data-route="lobby"] .section-row p{font-size:10px}
  [data-route="subject"] .stat{padding:5px 11px}
  [data-route="subject"] .status-label{line-height:1.35}
  [data-route="subject"] .stat strong{font-size:20px;line-height:1.25}
  [data-route="subject"] .dash-grid .sub-title{font-size:17px}
  [data-route="subject"] .chapter-line{padding:5px 8px}
}
@media(max-width:540px) and (max-height:750px){
  body:is([data-route="lobby"],[data-route="subject"]) .hero-art{height:clamp(64px,16dvh,106px)}
  [data-route="lobby"] .hero-copy,[data-route="subject"] .subject-hero .hero-copy{padding:7px 12px}
  [data-route="subject"] .hero .btn{min-height:36px;margin-top:6px;padding:5px 11px}
  [data-route="subject"] .hero h1{font-size:20px;margin:2px 0}
  [data-route="subject"] .hero-copy p{font-size:10.5px}
  [data-route="subject"] .run-note{margin:2px 0 0;font-size:10px}
  [data-route="subject"] .chapter-line img{width:48px;height:36px}
  [data-route="subject"] .row-data h3{font-size:13px}
  [data-route="subject"] .row-data small{display:none}
  [data-route="lobby"] .course-body p{display:none}
  [data-route="lobby"] .course-art{min-height:66px}
  [data-route="lobby"] .course-title .type-icon{width:23px;height:23px}
}
@media(min-width:541px) and (max-height:640px){
  .foot{display:none}.head-in{min-height:43px}.main{padding-block:5px}
  [data-route="lobby"] .hero{grid-template-columns:55% 45%}
  [data-route="lobby"] .hero-art,[data-route="subject"] .subject-hero .hero-art{min-height:95px}
  [data-route="lobby"] .hero-copy,[data-route="subject"] .subject-hero .hero-copy{padding:8px 16px}
  [data-route="lobby"] .hero h1,[data-route="subject"] .subject-hero h1{font-size:23px;line-height:1.2;margin:3px 0}
  [data-route="lobby"] .hero h1 span{display:inline}
  [data-route="lobby"] .hero-copy p,[data-route="subject"] .hero-copy p{font-size:12px;line-height:1.4}
  [data-route="lobby"] .course-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  [data-route="lobby"] .course-card{display:flex}
  [data-route="lobby"] .course-art{height:clamp(38px,14vh,82px);min-height:0;flex:none}
  [data-route="lobby"] .course-art img{position:static}
  [data-route="lobby"] .course-body{padding:5px 7px 0;align-self:stretch}
  [data-route="lobby"] .course-body p{display:none}
  [data-route="lobby"] .course-title h3{font-size:14px}
  [data-route="lobby"] .course-title{gap:4px}
  [data-route="lobby"] .cardfoot{margin-inline:7px;padding:4px 0;font-size:10px}
  [data-route="subject"] .dash-grid>.section:nth-child(2){display:none}
  [data-route="subject"] .chapter-list{grid-template-columns:1fr 1fr;gap:5px}
  [data-route="subject"] .dash-grid{display:block}
  [data-route="subject"] .hero .btn{min-height:33px;margin-top:4px;padding:5px 12px}
  [data-route="subject"] .run-note{margin:0;font-size:10px}
  [data-route="subject"] .chapter-line img{width:45px;height:36px}
  [data-route="subject"] .row-data small{display:none}
  [data-route="subject"] .row-data h3{font-size:14px}
  [data-route="subject"] .stat{padding-block:3px}
  [data-route="subject"] .stat strong{font-size:19px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}
[data-route="subject"] .stats,[data-route="subject"] .dash-grid{flex:none}
.dash-study{display:grid;gap:clamp(9px,1.8vh,17px);min-width:0}
.hero-course-controls{display:contents}
[data-route="subject"] .random50-course{
  display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;gap:clamp(6px,1.45vw,12px);
  min-height:44px;color:#164e44;line-height:1.3;
}
.random50-course strong{font-size:clamp(13px,2.6vw,16px);font-weight:800}
.random50-course small{color:#45645a;font-size:clamp(10px,2.3vw,13px)}
.random50-thumb{display:grid;position:relative;overflow:hidden;border-radius:6px;background:#285e52}
.random50-thumb img{image-rendering:pixelated;object-position:24% 48%}
.random50-icon{
  position:absolute;right:2px;bottom:2px;display:grid;place-items:center;width:20px;height:20px;
  border-radius:4px;background:#164e44;color:#fff6d7;border:1px solid #fff7d5a1;
}
.random50-icon .icon{width:12px;height:12px}
@media(max-width:540px){
  [data-route="subject"] .subject-hero .hero-art{min-height:0}
  [data-route="subject"] .subject-hero .hero-art img,[data-route="lobby"] .hero .hero-art img{min-height:0;min-width:0}
}
@media(max-width:540px) and (max-height:880px){
  [data-route="subject"] .chapter-list .row-data small{display:none}
  [data-route="subject"] .chapter-list .row-data .eyebrow{display:block;line-height:1.3}
  [data-route="subject"] .chapter-list .chapter-line{min-height:44px}
}
@media(max-width:540px) and (min-height:751px) and (max-height:880px){
  [data-route="subject"] .subject-hero .hero-art{height:min(17.5dvh,155px)}
}
@media(max-width:540px) and (max-height:690px){
  [data-route="subject"] .hero.subject-hero{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr)}
  [data-route="subject"] .subject-hero .hero-art{min-height:0;height:100%;width:100%;overflow:hidden}
  [data-route="subject"] .subject-hero .hero-art img{object-fit:contain}
  [data-route="subject"] .subject-hero .hero-copy{padding:9px 11px}
  [data-route="subject"] .subject-hero .hero-copy p{display:none}
  [data-route="subject"] .subject-hero .hero-copy .btn{font-size:11px;gap:5px;padding:5px 7px;min-height:36px}
}
@media(max-width:540px) and (max-height:630px){
  body[data-route="subject"] #page,.dash-study{gap:6px}
  [data-route="subject"] .stat{padding-block:4px}
  [data-route="subject"] .section-row{margin-bottom:5px}
  [data-route="subject"] .chapter-list .chapter-line{padding-block:3px}
}
@media(min-width:541px) and (max-height:440px){
  body[data-route="subject"] #page{gap:4px}
  [data-route="subject"] .stats{grid-template-columns:repeat(4,minmax(0,1fr))}
  [data-route="subject"] .hero.subject-hero{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}
  [data-route="subject"] .subject-hero .hero-art{min-height:0;overflow:hidden}
  [data-route="subject"] .subject-hero .hero-art img{position:absolute;inset:0;height:100%;object-fit:cover}
  [data-route="subject"] .subject-hero .hero-copy{padding-block:5px}
  [data-route="subject"] .hero-copy p{display:none}
  .hero-course-controls{display:flex;align-items:center;gap:8px;max-width:100%}
  .hero-course-controls .btn{flex-shrink:0}
  .hero-course-controls .run-note{line-height:1.3}
  [data-route="subject"] .dash-grid .chapter-list{display:none}
  [data-route="subject"] .dash-grid .section-row{margin:0}
  [data-route="subject"] .dash-study .sub-title{font-size:18px;line-height:1.3}
  [data-route="subject"] .random50-course{padding-block:3px}
  .dash-study{gap:4px}
}
body[data-route="trophies"] #page { overflow: hidden; }
.cq-screen.cq-shelf {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr);
  overflow: hidden;
}
.shelf-list {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 0;
  gap: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  padding: 2px 3px 9px;
}
.shelf-list:focus-visible {
  outline: 2px solid #4f7967;
  outline-offset: -2px;
  border-radius: 5px;
}
.shelf-section > h2 {
  margin-bottom: 7px;
  color: #254b3f;
  font-size: 17px;
  line-height: 1.35;
}
.shelf-cards {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 8px;
}
.shelf-cards > .trophy { min-width: 0; padding: 8px 12px; }
.shelf-cards > .trophy div { min-width: 0; }
.shelf-cards > .trophy h3, .shelf-cards > .trophy p { overflow-wrap: anywhere; }
.shelf-cards > .trophy .bar { height: 4px; margin: 3px 0; }
.cq-shelf .shelf-groups {
  display: flex; padding: 3px; gap: 3px; background: #e9ede3;
  border: 1px solid #d9dfd1; border-radius: 10px;
}
.shelf-groups button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 40px; flex: 1;
  border: 1px solid transparent; border-radius: 7px; color: #52665a; background: transparent;
}
.shelf-groups button strong { font-size: 15px; }
.shelf-groups button span { font-size: 12px; font-variant-numeric: tabular-nums; }
.shelf-groups button[aria-pressed=true] { background: #fffdf5; color: #1c4f40; border-color: #cad2c3; box-shadow: 0 1px 3px #223b2810; }
.shelf-tools { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-width: 0; }
.shelf-tools .pillrow { flex: none; }
.shelf-tools [data-trophy-chapter] { max-width: 45%; min-width: 0; width: 18em; min-height: 40px; text-overflow: ellipsis; }
.shelf-chapter { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 7px; padding: 10px 12px; border: 1px solid #cfd8ca; background: #fffdf7; border-radius: 12px; }
.shelf-chapter h3 { display: flex; align-items: baseline; gap: 8px; font-size: 15px; line-height: 1.3; color: #1c4436; overflow-wrap: anywhere; }
.shelf-chapter h3 > span { flex: none; color: #61715e; font-size: 11px; }
.shelf-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.shelf-pair .shelf-badge { min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 5px; min-height: 60px; padding: 3px 8px; border-radius: 8px; }
.shelf-badge > span { min-width: 0; }
.shelf-pair .shelf-badge img { flex: 0 0 auto; object-fit: contain; width: 54px; height: 54px; }
.shelf-pair .shelf-badge.locked { border: 1px dashed #bcc6bb; background: #f4f5ef; color: #47584d; }
.shelf-pair .shelf-badge.locked img { opacity: .76; filter: saturate(.25); }
.shelf-pair .shelf-badge.earned { background: #fff4d7; border-color: #c5a355; }
.shelf-pair .shelf-badge.earned small { color: #70521d; }
.shelf-badge strong, .shelf-badge small { display: block; }
.shelf-badge strong { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.shelf-badge strong span { display: inline-block; white-space: nowrap; }
.shelf-badge small { margin-top: 3px; font-size: 11px; line-height: 1.3; }
.shelf-badge small .icon { width: 12px; height: 12px; margin-right: 2px; }
.shelf-detail-chapter { color: #4d6255; font-size: 14px; }
.cq-trophy-detail .btn { margin-top: 10px; }
@media (min-width:690px) { .shelf-cards { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (min-width:1090px) { .shelf-cards { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width:640px) {
  .shelf-list { gap: 16px; }
  .cq-shelf .shelf-tools { gap: 5px; }
  .cq-shelf .shelf-tools .pill { padding-inline: 7px; }
  .cq-shelf .shelf-tools [data-trophy-chapter] { flex: 0 1 9em; min-height: 39px; width: 0; padding: 5px; }
  .shelf-groups button { flex-direction: column; gap: 1px; line-height: 1.22; padding: 4px 1px; }
  .shelf-groups button strong { font-size: 13px; }
  .shelf-groups button span { font-size: 11px; }
  .shelf-chapter { padding: 8px; }
  .shelf-chapter h3 { font-size: 14px; gap: 6px; }
  .shelf-pair { gap: 5px; }
  .shelf-pair .shelf-badge { padding: 3px 5px; gap: 4px; min-height: 56px; }
  .shelf-pair .shelf-badge img { width: clamp(39px,12vw,50px); height: 45px; }
  .shelf-badge strong { font-size: 14px; }
}
@media (max-height:460px) and (min-width:540px) {
  .cq-screen.cq-shelf { gap: 5px; }
  .shelf-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cq-shelf .shelf-groups button, .cq-shelf .shelf-tools button, .cq-shelf .shelf-tools [data-trophy-chapter] { min-height: 30px; padding-block: 2px; }
  .cq-shelf .shelf-chapter { padding: 5px 7px; gap: 3px; }
  .cq-shelf .shelf-chapter h3 { font-size: 12px; }
  .cq-shelf .shelf-badge { min-height: 42px; }
  .cq-shelf .shelf-badge img { height: 40px; width: 40px; }
}
