/* One search and one featured collection, followed by compact game choices. */
#library > .featured{padding:24px 0 28px}
#library > .featured .section-heading{margin-bottom:16px}
#library > .featured .section-heading h2{font-size:26px}
.library-collection-title{margin:8px 0 16px;font-size:24px;line-height:1.3;letter-spacing:-.025em}
.library-card-info{min-width:0}
.featured-title-mobile{display:none}
.featured-heading-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px 20px}
.library-collection-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.browse-all-games{display:inline-flex;align-items:center;min-height:44px;margin-bottom:10px;color:var(--mint);font-size:13px;font-weight:750}
.home-games-view .browse-all-games{display:none}
.library-learning-summary,.library-card-details{display:none}
.library-is-filtered > .featured,.library-is-filtered > .recent-games{display:none}
.input-pill{display:inline-flex;align-items:center;border:1px solid #3b596e;border-radius:999px;padding:3px 7px;color:#c6e9e2;font-size:11px;line-height:1.35}
.recent-games-heading :is(h2,h3){margin:0;font-size:24px;line-height:1.25;letter-spacing:-.025em}

/* The header and Play action remain visible; only the preview content scrolls. */
.gameplay-dialog[open]{display:flex;flex-direction:column;height:min(900px,calc(100dvh - 24px));max-height:calc(100dvh - 24px);overflow:hidden}
.gameplay-dialog .preview-header{position:static;flex:none}
.gameplay-dialog .preview-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scroll-padding-block:16px}
.gameplay-dialog .preview-actions{flex:none;padding:12px 18px calc(12px + env(safe-area-inset-bottom,0px));border-top:1px solid #35546b;background:var(--panel)}
.gameplay-dialog .preview-keyboard{color:#c9dde9;font-size:14px;line-height:1.5}
.gameplay-dialog .preview-keyboard summary{display:flex;align-items:center;gap:10px;min-height:48px;cursor:pointer;color:#cce1ee;font-weight:700}
.gameplay-dialog .preview-keyboard summary::before{content:'+';font-size:22px;color:var(--mint)}
.gameplay-dialog .preview-keyboard[open] summary::before{content:'−'}
.gameplay-dialog .preview-keyboard summary:focus-visible{outline:3px solid var(--mint);outline-offset:3px;border-radius:6px}

@media(max-width:700px),(max-width:950px) and (max-height:500px){
  body.home-page main{padding-inline:14px}
  body.home-page .home-hero.hero{display:grid;grid-template-columns:minmax(0,1fr);gap:22px;min-height:0;margin:0 0 24px;padding:14px 2px 12px;border:0;border-radius:0;background:none;box-shadow:none}
  body.home-page .home-hero::before{display:none}
  body.home-page .home-hero .hero-showcase:not([hidden]){display:block}
  body.home-page .home-hero h1{font-size:clamp(34px,8.8vw,38px);line-height:1.08;letter-spacing:-.035em;margin:0 0 12px}
  body.home-page .home-hero .hero-copy>.hero-kicker{margin:0 0 12px;font-size:10px;line-height:1.5;letter-spacing:.06em}
  body.home-page .home-hero .hero-copy>p:not(.eyebrow){font-size:16px;line-height:1.5;max-width:39ch}
  body.home-page .home-hero .hero-actions{display:flex;flex-direction:column;align-items:stretch;gap:0;margin-top:18px}
  body.home-page .home-hero .hero-actions .button.primary{width:100%;min-height:52px;padding:13px 18px;font-size:16px}
  body.home-page .home-hero .hero-actions .hero-reassurance{margin:10px 0 4px;text-align:center;font-size:12px}
  body.home-page .home-hero .hero-actions .button.secondary{align-self:center;min-height:44px;padding:8px 4px;font-size:14px}
  #library.library-finder{padding-top:10px;scroll-margin-top:8px}
  body.home-page:not(.home-games-view) #library .library-heading{display:none}
  body.home-page.home-games-view #library :is(.library-total,.library-collection-heading){display:none}
  body.home-page.home-games-view .home-hero{display:none}
  body.home-page:not(.home-games-view) #library :is(.library-browse-row,.library-order-row,.library-result-row,.library-active-filters){display:none!important}
  body.home-page.home-games-view #library > :is(.featured,.recent-games){display:none!important}
  body.home-page:not(.home-games-view) #library > .featured{display:block}
  body.home-page:not(.home-games-view) #library > .recent-games:not([hidden]){display:block}
  #library .library-order-row{display:none}
  #library .library-browse-row :is(.library-subjects,.library-subject-mobile){display:none}
  #library .library-browse-row{display:flex;align-items:center;gap:12px;margin:2px 0 8px}
  #library .library-saved{font-size:13px;min-height:44px}
  #library .library-heading h2{font-size:26px}
  #library .library-search-row{position:sticky;top:0;z-index:15;padding:6px 0;margin-bottom:0;border-radius:0;background:#071522fa;box-shadow:none}
  #library .library-filter-button{font-size:13px}
  #library .library-search kbd{display:none}
  #library .library-subject-mobile select{font-size:16px}
  #library .library-syllabus,#library #resultCount,#library #savedCount{font-size:12px}
  #library .library-sort-options button{font-size:13px}
  #library > .featured{padding:10px 0 24px}
  #library > .featured .section-heading{display:flex;flex-wrap:nowrap;align-items:center;gap:8px;margin-bottom:10px}
  #library > .featured .section-heading h2{font-size:23px;flex:1;min-width:0}
  .featured-title-desktop{display:none}
  .featured-title-mobile{display:inline}
  #library .featured-heading-actions{display:flex;flex:none;gap:0}
  #library .featured-heading-actions .library-pick{flex:none;min-height:44px;padding:6px 4px;border:0;background:none;border-radius:7px;font-size:13px;gap:7px;color:var(--mint);white-space:nowrap}
  #library .featured-heading-actions .browse-popular{display:none}
  #library > .featured .browse-popular{font-size:12px;min-height:44px}
  #library .featured-grid{grid-template-columns:1fr;gap:10px}
  #library .featured-grid .featured-card{display:grid;grid-template-columns:80px minmax(0,1fr);gap:10px 12px;padding:12px;border-radius:16px;box-shadow:none;transform:none}
  #library .featured-card .cover-link{width:80px;height:80px;aspect-ratio:1;grid-column:1;grid-row:1;border-radius:10px}
  #library .featured-card .game-body{display:contents}
  #library .featured-card .featured-info{grid-column:2;grid-row:1}
  #library .featured-card h3{font-size:17px;line-height:1.3;margin:0 0 6px}
  #library .featured-card .description{font-size:13px;line-height:1.45;margin:0}
  #library .featured-card :is(.playstyle,.focus,.card-stats){display:none}
  #library .featured-card .card-actions{grid-column:1/-1;margin:0;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 48px;gap:8px}
  #library .featured-card :is(.play-button,.gameplay-preview-button){min-height:48px;padding:9px 6px;font-size:13px}
  #library .featured-card .favorite-button{width:48px;height:48px}
  .library-collection-title{margin:0 0 12px;font-size:23px}
  #library .game-grid{grid-template-columns:1fr;gap:12px}
  #library .library-card{display:grid;grid-template-columns:88px minmax(0,1fr);gap:10px 12px;align-content:start;padding:12px;border-radius:16px;transform:none}
  #library .library-card .cover-link{grid-column:1;grid-row:1;align-self:start;width:88px;height:88px;aspect-ratio:1;border-radius:10px}
  #library .library-card .game-cover{object-fit:cover}
  #library .library-card .cover-link .play-mark{display:none}
  #library .library-card .game-body{display:contents}
  #library .library-card .library-card-info{grid-column:2;grid-row:1;min-width:0}
  #library .library-card .card-meta{gap:4px 6px;margin:0 0 5px}
  #library .library-card .category-pill{font-size:12px;padding:0;border:0;background:none;color:#b6d7e7}
  #library .library-card h3{margin:0 0 6px;font-size:17px;line-height:1.3;letter-spacing:-.015em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
  #library .library-card .library-learning-summary{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:#b8d0df;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
  #library .library-card .game-body > :is(.description,.focus,.card-stats){display:none}
  #library .library-card .card-actions{grid-column:1/-1;margin:0;gap:8px}
  #library .library-card .library-card-details{display:block;grid-column:1/-1;min-width:0;border-top:1px solid #29495f}
  #library .library-card .library-card-details summary{display:flex;align-items:center;justify-content:space-between;min-height:44px;padding:6px 0 0;color:#c2d9e7;font-size:12px;line-height:1.4;font-weight:650;cursor:pointer}
  #library .library-card .library-card-details summary::after{content:'+';color:var(--mint);font-size:21px;margin-left:12px}
  #library .library-card .library-card-details[open] summary::after{content:'−'}
  #library .library-card .library-card-details p{margin:10px 0;color:#bbd1df;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
  #library .library-card .library-card-details .library-detail-title{font-weight:750;color:var(--ink)}
  #library .library-card .library-card-details .focus{display:block;margin-bottom:6px}
  #library .library-card .library-card-details summary:focus-visible{outline:3px solid var(--mint);outline-offset:3px;border-radius:5px}
  .gameplay-dialog .preview-actions{padding-inline:14px}
  .recent-games-heading :is(h2,h3){font-size:22px}
  .home-page #community{padding-top:32px}
  .home-page #community .creator-section-heading{margin-bottom:14px}
  .home-page #community .creator-section-heading h2{font-size:26px}
  .home-page #community .creator-section-footer{display:none}
  .home-page #communityGrid > article:nth-child(n+3),.home-page #communityMore{display:none}
}
@media(max-width:350px){
  body.home-page .home-hero.hero{padding:12px 2px}
  body.home-page .home-hero h1{font-size:34px}
  #library .library-card{grid-template-columns:72px minmax(0,1fr);gap:8px 10px;padding:10px}
  #library .library-card .cover-link{width:72px;height:72px}
  #library .library-card h3{font-size:16px}
  #library .library-card .library-learning-summary{font-size:12px}
  #library .library-card .card-actions{gap:6px}
  #library .library-card :is(.play-button,.gameplay-preview-button){font-size:12px}
  #library .library-subject-mobile > span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  #library .library-subject-mobile{gap:0}
}
@media(prefers-reduced-motion:reduce){
  .home-page :is(.featured-card,.library-card,.game-cover){transition:none}
}

