/* Review-only layout fixes by Codex. Load AFTER skin.css and themes.css. */
/* F1: use available width, including ultrawide screens and docked contents. */
#app, #app.wide, body.tv-mode #app, body[data-page=themes] #app,
body[data-page=work] #app { width:100%; max-width:none; }
body.toc-docked #app { width:calc(100% - 300px); max-width:none; }
/* F2: preserve complete titles, file names, episode descriptions and contents. */
.fname, .tv-eptitle, .tv-epdesc, .toc a {
  display:block; -webkit-line-clamp:unset; line-clamp:unset;
  white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere;
}
header.top { min-width:0; flex-wrap:wrap; }
header.top::before { inset:0; }
header.top h1 { overflow:visible; text-overflow:clip; min-width:0; }
/* F3: grid/flex children must be allowed to shrink before their text wraps. */
.wk-hero > :not(.wk-pulse), .wk-job, .wk-jt, .wk-done > :not(.wk-t),
.wk-svc > span, .tv-eptext, .aip-chiptext { min-width:0; overflow-wrap:anywhere; }
.wk-jobs { grid-template-columns:repeat(auto-fill,minmax(min(280px,100%),1fr)); }
.wk-ideas { grid-template-columns:repeat(auto-fill,minmax(min(420px,100%),1fr)); }
.wk-svcs { grid-template-columns:repeat(auto-fill,minmax(min(230px,100%),1fr)); }
.wk-hero, .wk-done, .wk-svc { flex-wrap:wrap; }
.wk-filters input, .wk-filters .select { min-width:0; max-width:100%; }
.aip-chip { max-width:100%; }
.aip-chiptext { white-space:normal; text-align:left; }
/* F4: keep a closed contents drawer out of the document's scrollable area. */
.toc.drawer:not(.open) { visibility:hidden; }
@media (max-width:900px) {
  /* F5: all navigation remains visible without sideways scrolling. */
  #tabs { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); overflow:visible; }
  #tabs a { min-width:0; max-width:none; min-height:40px; padding:4px 1px;
    overflow-wrap:anywhere; font-size:10px; }
  #tabs a .ic { width:22px; height:22px; }
  #app, body.music-mode #app { padding-bottom:calc(148px + env(safe-area-inset-bottom)); }
  .toc.dock { bottom:148px; }
  /* F6: move contents control into normal flow so it cannot cover text. */
  .toc-btn { position:static; display:block; writing-mode:horizontal-tb;
    transform:none; margin:8px 10px 148px auto; min-width:40px; min-height:40px; }
  .mu-player { bottom:calc(126px + env(safe-area-inset-bottom)); }
  body.music-mode #app { padding-bottom:calc(300px + env(safe-area-inset-bottom)); }
}
@media (max-width:520px) {
  /* F7: minimum 40px phone targets without clipping their labels. */
  #app button, #app a:not(.post-body a):not(.comment a):not(.msg a), #app select, #app summary, #app input:not([type=hidden]),
  .toc button, .toc a, .toc summary { min-width:40px; min-height:40px; }
  #app a:not([class]):not(.post-body a):not(.comment a):not(.msg a), .appban .ab-work, .appban .ab-theme { display:inline-flex; align-items:center; }
  .appban .ab-btns { flex-wrap:wrap; }
  .appban .ab-work, .appban .ab-theme { white-space:normal; overflow-wrap:anywhere; }
  .mu-row, .mu-prow { flex-wrap:wrap; }
  .mu-info { flex:1 1 110px; }
  .tv-hidebtn { width:40px; height:40px; }
  /* G16 2026-10-30: film tiles stack (thumbnail, title, text); the side-by-side rule was removed */
  .game-grid { grid-template-columns:minmax(0,1fr); }
}

/* F8: expose every TV channel in a wrapping grid instead of a sideways strip. */
.tv-guide { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr)); overflow:visible; scroll-snap-type:none; }
.tv-gch { min-width:0; overflow-wrap:anywhere; }

/* F10: filter labels keep their intrinsic width instead of colliding. */
.fseg { display:flex; flex-wrap:wrap; gap:4px; overflow:visible; }
.fseg button { flex:1 0 auto; }
@media (max-width:520px) {
  .fsel-row { flex-wrap:wrap; }
  .fsel-row .fseg { flex:1 1 100%; }
}

/* C32: feed photos carry width/height attributes (no layout jump); keep their shape */
.post-img{height:auto;cursor:zoom-in}

/* Fashion Studio fills the available page width rather than one tool-grid column. */
body[data-page=fashion] #app { width:100%; max-width:none; }
body[data-page=fashion].toc-docked #app { width:calc(100% - 300px); max-width:none; }
body[data-page=fashion] .aip-feats > [data-fid="fashion/studio"],
body[data-page=fashion] .aip-feats > [data-fid="fashion/vibe-explorer"] {
  grid-column:1 / -1;
  width:100%;
  min-width:0;
}
