/* Discovery pages share the foundation gutter; this sheet only lays out their content.
   Hidden generation states, image decoding and server pagination remain untouched. */
html.atelier-theme body #app .shell .main[class]:is(.page-home,.page-explore,.page-courses,.page-words,.page-progress) { --hb-layout-gap:20px; --hb-layout-line:#e2e8f0; min-width:0; }
html.atelier-theme body #app .shell .main[class]:is(.page-courses,.page-words,.page-progress) .page-head { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin:0 0 28px; }
html.atelier-theme body #app .shell .main[class]:is(.page-courses,.page-words,.page-progress) .page-heading { flex:1 1 260px; min-width:0; }
html.atelier-theme body #app .shell .main[class]:is(.page-courses,.page-words,.page-progress) .page-head>.btn { flex:0 1 auto; min-height:44px; margin:0; white-space:normal; text-align:center; }
html.atelier-theme body #app .shell .main[class]:is(.page-explore,.page-courses,.page-words,.page-progress) :is(h1,h2,h3,p) { overflow-wrap:anywhere; }

/* A focused welcome, a roomy composer and a natural-height generation result. */
html.atelier-theme body #app .shell .main[class].page-home .generation-home { flex:none; width:100%; max-width:920px; min-height:0; margin:0 auto; gap:22px; justify-content:flex-start; padding-top:clamp(24px,5vh,64px); }
html.atelier-theme body #app .shell .main[class].page-home .generation-home:is(.has-generation,.has-conversation) { max-width:1080px; padding-top:0; gap:20px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-stage { flex:none; height:auto; min-height:0; max-height:none; width:100%; margin:0; padding:0; background:transparent; border-radius:0; overflow:visible; }
html.atelier-theme body #app .shell .main[class].page-home .generation-thread:not([hidden]) { height:auto; max-height:none; min-height:0; padding:0; overflow:visible; scroll-behavior:auto; }
html.atelier-theme body #app .shell .main[class].page-home .generation-welcome { gap:14px; padding:0 0 4px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-welcome h1 { margin:0; font-size:clamp(27px,3.2vw,38px); line-height:1.5; color:#27384f; }
/* The older .st-home theme forces these properties and its glow with !important. */
html.atelier-theme body #app .shell .main[class].page-home .generation-composer { width:100%; height:auto; max-height:none!important; padding:20px!important; border:1px solid var(--hb-layout-line); border-radius:12px!important; background:#fff; box-shadow:none!important; }
html.atelier-theme body #app .shell .main[class].page-home .generation-composer::before { display:none; }
html.atelier-theme body #app .shell .main[class].page-home .generation-composer #generation-prompt { width:100%; height:auto!important; min-height:106px!important; max-height:260px!important; margin:0; padding:0 0 16px!important; resize:vertical; font-size:16px; line-height:1.8; color:#334155; background:transparent; }
html.atelier-theme body #app .shell .main[class].page-home .generation-composer:focus-within { border-color:#8ea6cb!important; box-shadow:none!important; outline:2px solid #e9eff9; outline-offset:2px; }
html.atelier-theme body #app .shell .main[class].page-home .composer-bottom { display:flex; flex-wrap:wrap; align-items:center; gap:14px; padding:14px 0 0; border-top:1px solid #edf1f6; }
html.atelier-theme body #app .shell .main[class].page-home .composer-settings { flex:1 1 210px; flex-wrap:wrap; gap:10px; }
html.atelier-theme body #app .shell .main[class].page-home .composer-level { min-height:44px; padding:4px 10px!important; border-radius:6px!important; border-color:var(--hb-layout-line); background:#f8fafc; }
html.atelier-theme body #app .shell .main[class].page-home .generation-send { min-height:44px!important; padding:10px 18px!important; border-radius:6px!important; white-space:normal; font-size:14px; line-height:1.5; }
html.atelier-theme body #app .shell .main[class].page-home .suggestion-row { grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
html.atelier-theme body #app .shell .main[class].page-home .topic-suggestion { min-height:88px; padding:12px; gap:10px; border:1px solid var(--hb-layout-line); border-radius:8px; background:#fff; box-shadow:none; transform:none; transition:none; }
html.atelier-theme body #app .shell .main[class].page-home .suggestion-image { flex:0 0 60px; width:60px; height:56px; object-fit:contain; }
html.atelier-theme body #app .shell .main[class].page-home .suggestion-copy { min-width:0; }
html.atelier-theme body #app .shell .main[class].page-home .suggestion-copy strong { white-space:normal; overflow-wrap:anywhere; font-size:13px; line-height:1.65; }
html.atelier-theme body #app .shell .main[class].page-home .generation-project { padding:clamp(18px,2.5vw,28px); border:1px solid var(--hb-layout-line); border-radius:10px; background:#fff; box-shadow:none; }
html.atelier-theme body #app .shell .main[class].page-home .generation-project-head { align-items:flex-start; flex-wrap:wrap; gap:12px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-project-head>div { flex:1 1 220px; min-width:0; }
html.atelier-theme body #app .shell .main[class].page-home .generation-result { display:grid; grid-template-columns:minmax(150px,240px) minmax(0,1fr); width:100%; max-width:none; margin-top:20px; border-color:var(--hb-layout-line); border-radius:8px; box-shadow:none; }
html.atelier-theme body #app .shell .main[class].page-home .generation-result .result-visual { width:100%; min-width:0; max-width:none; align-self:stretch; }
html.atelier-theme body #app .shell .main[class].page-home .generation-result .result-copy { min-width:0; padding:20px; }
html.atelier-theme body #app .shell .main[class].page-home :is(.result-actions,.generation-recovery-actions,.generation-service-actions) { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
html.atelier-theme body #app .shell .main[class].page-home :is(.result-actions,.generation-recovery-actions,.generation-service-actions)>:is(a,button) { min-height:44px; margin:0; white-space:normal; text-align:center; }
html.atelier-theme body #app .shell .main[class].page-home .generation-result .result-actions>:is(a,button) { min-height:44px!important; }
html.atelier-theme body #app .shell .main[class].page-home .workspace-footnote { margin:0; padding:0 8px; text-align:center; line-height:1.8; }

/* Keep the welcome balanced when theme examples are temporarily absent.
   Active generation workspaces retain their existing width and natural height. */
html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) { max-width:860px; gap:24px; padding:clamp(32px,8vh,96px) 0 24px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .generation-welcome { gap:12px; padding:0 0 4px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .generation-tagline { margin:4px 0 4px; }
html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) #generation-footnote { margin:0; }
html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .reference-preview { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:4px 12px; line-height:1.6; }

/* Equal-width course and vocabulary grids retain the actual image elements. */
html.atelier-theme body #app .shell .main[class].page-explore .course-square-grid,
html.atelier-theme body #app .shell .main[class].page-courses #course-list,
html.atelier-theme body #app .shell .main[class].page-words .collection-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; gap:var(--hb-layout-gap); }
html.atelier-theme body #app .shell .main[class].page-courses .course-card,
html.atelier-theme body #app .shell .main[class].page-explore .square-course-card,
html.atelier-theme body #app .shell .main[class].page-words .vocab-card { display:flex; flex-direction:column; min-width:0; height:100%; border:1px solid var(--hb-layout-line); border-radius:8px; background:#fff; box-shadow:none; transition:none; }
html.atelier-theme body #app .shell .main[class].page-courses .course-card .card-art { position:relative; flex:none; width:100%; height:auto; min-height:0; aspect-ratio:16 / 9; overflow:hidden; border-radius:0; }
html.atelier-theme body #app .shell .main[class].page-courses .course-card .card-art .course-image-frame { position:absolute; inset:0; width:100%; height:100%; min-height:0; aspect-ratio:auto; }
html.atelier-theme body #app .shell .main[class].page-courses .course-card-body,
html.atelier-theme body #app .shell .main[class].page-explore .square-course-body { display:flex; flex-direction:column; flex:1; min-width:0; padding:20px; }
html.atelier-theme body #app .shell .main[class].page-courses .course-card-body h3,
html.atelier-theme body #app .shell .main[class].page-explore .square-course-body h2 { margin:0 0 10px; font-size:19px; line-height:1.6; }
html.atelier-theme body #app .shell .main[class].page-courses .card-footer,
html.atelier-theme body #app .shell .main[class].page-explore .square-course-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-top:auto; padding-top:16px; }
html.atelier-theme body #app .shell .main[class].page-courses .card-footer>a,
html.atelier-theme body #app .shell .main[class].page-explore .square-course-actions>:is(a,button) { min-height:44px; display:inline-flex; align-items:center; font-size:13px; }

/* Filters can wrap without clipping the custom select menu. */
html.atelier-theme body #app .shell .main[class].page-explore .course-square-heading { align-items:flex-start; gap:20px; margin-bottom:24px; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square-heading p { max-width:76ch; font-size:14px; line-height:1.8; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square-filters { grid-template-columns:minmax(200px,2fr) minmax(130px,1fr) minmax(140px,1fr) auto; gap:12px; padding-bottom:22px; margin-bottom:24px; overflow:visible; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square-filters :is(input,select,.hb-select-trigger) { width:100%; min-width:0; height:44px; min-height:44px; font-size:14px; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square .square-button { min-height:44px; font-size:13px; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square-themes { gap:8px; padding:4px 3px 10px; margin-bottom:18px; overflow-x:auto; flex-wrap:nowrap; }
html.atelier-theme body #app .shell .main[class].page-explore .course-square-result-heading { align-items:baseline; gap:10px 16px; margin-bottom:20px; }
html.atelier-theme body #app .shell .main[class].page-explore .square-pagination { flex-wrap:wrap; gap:16px; margin-top:28px; padding-top:20px; font-size:13px; }
html.atelier-theme body #app .shell .main[class].page-explore .square-pagination>div { flex-wrap:wrap; justify-content:center; gap:12px; }
html.atelier-theme body #app .shell .main[class].page-explore :is(.square-empty,.square-loading),
html.atelier-theme body #app .shell .main[class]:is(.page-courses,.page-words) .empty { min-height:200px; padding:36px 20px; text-align:center; font-size:14px; line-height:1.8; }

/* Review cards and saved learning records use readable, uncrowded controls. */
html.atelier-theme body #app .shell .main[class].page-words .vocab-card { padding:22px; }
html.atelier-theme body #app .shell .main[class].page-words .vocab-card p { font-size:14px; line-height:1.85; }
html.atelier-theme body #app .shell .main[class].page-words .vocab-actions { margin-top:auto; padding-top:16px; gap:10px; }
html.atelier-theme body #app .shell .main[class].page-words .vocab-actions button { min-height:44px; padding:6px; font-size:13px; }
html.atelier-theme body #app .shell .main[class].page-words .vocab-actions .en { flex:1 1 100px; min-width:0; line-height:1.7; white-space:normal; }
html.atelier-theme body #app .shell .main[class].page-words .word-probe-entry { margin:0 0 24px; padding:20px; border:1px solid var(--hb-layout-line); border-radius:8px; background:#fff; }
html.atelier-theme body #app .shell .main[class].page-words #review-errors { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:20px; }
html.atelier-theme body #app .shell .main[class].page-words #review-errors>.panel { min-width:0; margin:0; padding:22px; }
html.atelier-theme body #app .shell .main[class].page-progress .stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
html.atelier-theme body #app .shell .main[class].page-progress .stat { min-width:0; padding:22px; border:1px solid var(--hb-layout-line); border-radius:8px; background:#fff; }
html.atelier-theme body #app .shell .main[class].page-progress .stat>strong { display:block; margin-top:10px; font-size:clamp(24px,2.8vw,34px); line-height:1.4; overflow-wrap:anywhere; }
html.atelier-theme body #app .shell .main[class].page-progress :is(.notice-actions,.list-row) { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
html.atelier-theme body #app .shell .main[class].page-progress .table-scroll { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
html.atelier-theme body #app .shell .main[class].page-progress :is(.panel,.notice) { margin-bottom:20px; }

@media (max-width:1024px) {
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-grid,
 html.atelier-theme body #app .shell .main[class].page-courses #course-list,
 html.atelier-theme body #app .shell .main[class].page-words .collection-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-filters { grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr); }
 html.atelier-theme body #app .shell .main[class].page-explore .square-filter-submit { grid-column:1/-1; justify-self:end; }
 html.atelier-theme body #app .shell .main[class].page-home .suggestion-row,
 html.atelier-theme body #app .shell .main[class].page-progress .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px) {
 html.atelier-theme body #app .shell .main[class].page-home .generation-home { padding-top:16px; gap:18px; }
 html.atelier-theme body #app .shell .main[class].page-home :is(.generation-project,.generation-result .result-copy) { padding:16px; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-composer { padding:16px!important; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-composer #generation-prompt { min-height:116px!important; }
 html.atelier-theme body #app .shell .main[class].page-home .composer-submit { flex:1 1 100%; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-send { width:100%; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) { gap:20px; padding:20px 0 12px; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .composer-bottom { gap:12px; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .composer-settings { flex:1 1 auto; min-width:0; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .composer-submit { flex:0 1 auto; max-width:100%; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-home:not(.has-generation):not(.has-conversation) .generation-send { width:auto; max-width:100%; }
 html.atelier-theme body #app .shell .main[class].page-home .generation-result { grid-template-columns:minmax(0,1fr); }
 html.atelier-theme body #app .shell .main[class].page-home .generation-result .result-visual { aspect-ratio:16 / 9; max-height:none; }
 html.atelier-theme body #app .shell .main[class].page-home .topic-suggestion { gap:8px; padding:10px; min-height:78px; }
 html.atelier-theme body #app .shell .main[class].page-home .suggestion-image { flex-basis:44px; width:44px; height:44px; }
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-grid,
 html.atelier-theme body #app .shell .main[class].page-courses #course-list,
 html.atelier-theme body #app .shell .main[class].page-words :is(.collection-grid,#review-errors) { grid-template-columns:minmax(0,1fr); gap:16px; }
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-heading { flex-wrap:wrap; gap:16px; }
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
 html.atelier-theme body #app .shell .main[class].page-explore .course-square-search,
 html.atelier-theme body #app .shell .main[class].page-explore .square-filter-submit { grid-column:1/-1; width:100%; }
 html.atelier-theme body #app .shell .main[class].page-explore .square-pagination { justify-content:center; text-align:center; }
 html.atelier-theme body #app .shell .main[class].page-progress .stat { padding:16px; }
}
