/* Match the homepage frame on board, thread, collection and login pages. */
body.forum-layout { --forum-layout-gutter: 24px; --forum-layout-width: 1200px; min-width: 0; }
.widthauto body.forum-layout { --forum-layout-width: 1440px; }
.forum-layout #toptb { min-width: 0; }
.forum-layout #hd > .wp, .forum-layout #toptb > .wp, .forum-layout #wp, .forum-layout #ft.wp { box-sizing: border-box; width: calc(100% - 2 * var(--forum-layout-gutter)); max-width: var(--forum-layout-width); min-width: 0; margin-left: auto; margin-right: auto; }
.forum-layout #wp .wp { box-sizing: border-box; width: auto; min-width: 0; }
.forum-layout #ct .nfl .f_c { box-sizing: border-box; max-width: 100%; overflow-wrap: anywhere; }
.forum-layout #ct.ct2 { margin-right: 0; }
.forum-layout .ct2 > .mn { width: calc(100% - 235px); }
.forum-layout .ct2 > .sd { margin-right: 0; }
.forum-layout #nv { border-radius: 10px 10px 0 0; }
.forum-layout #scbar { border-radius: 0 0 10px 10px; }
.forum-layout #pt { height: auto; }
.forum-layout #pt .z { max-width: 100%; }
.forum-layout #pt .z a:not(.nvhm) { max-width: 100%; height: auto; overflow-wrap: anywhere; }
.forum-layout #qmenu_menu { box-sizing: border-box; max-width: calc(100vw - 24px); }
.forum-layout-side > summary, .forum-layout-author > summary { padding: 8px 10px; cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.forum-layout-side[open] > summary, .forum-layout-author[open] > summary { display: none; }
.forum-layout-side > summary:focus-visible, .forum-layout-author > summary:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }

/* Post actions stay readable before hover and when reached with the keyboard. */
.forum-layout.pg_viewthread .po.hin { opacity: 1; }
.forum-layout.pg_viewthread .pob .fastre { font-weight: 600; }
.forum-layout.pg_viewthread .pob a:hover { text-decoration: underline; }
.forum-layout.pg_viewthread .pob a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

.forum-board-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.forum-layout .tl .th th { height: auto; }
.forum-filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.forum-filter-label { font-size: 12px; color: #666; }
.forum-filter-group > a, .forum-filter-group > button { display: inline-flex; align-items: center; box-sizing: border-box; min-height: 36px; padding: 4px 6px; font: inherit; line-height: 24px; }
.forum-filter-group > button { border: 1px solid #c5d2df; border-radius: 5px; background: transparent; cursor: pointer; }
.forum-filter-group .xw1 { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.forum-new-window { order: 3; display: inline-flex; align-items: center; gap: 5px; margin-left: auto; min-height: 36px; white-space: nowrap; cursor: pointer; }
.forum-new-window input { width: 16px; height: 16px; }
.forum-new-window #atarget::before { content: none; }
.forum-filter-menu { box-sizing: border-box; max-width: calc(100vw - 24px); max-height: 70vh; overflow: auto; }
.forum-filter-menu .pop_moremenu { width: auto; max-width: 100%; }
.forum-filter-menu .pop_moremenu li { height: auto; white-space: normal; }
.forum-filter-menu a { min-height: 32px; box-sizing: border-box; line-height: 24px; }
.forum-filter-menu .pop_moremenu a { display: inline-block; padding: 4px 6px; }
.forum-filter-group > button:focus-visible, .forum-filter-group > a:focus-visible, .forum-filter-menu a:focus-visible, .forum-new-window input:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* A missing cover does not reserve an empty image; real covers share one ratio. */
.forum-layout #waterfall { align-items: start; }
.forum-layout #waterfall .forum-picture-card .c a { display: block; float: none; aspect-ratio: 4 / 3; overflow: hidden; }
.forum-layout #waterfall .forum-picture-card .c img { display: block; width: 100%; height: 100%; object-fit: cover; }
.forum-layout #waterfall .forum-picture-card h3 { overflow-wrap: anywhere; }
.forum-layout #waterfall .forum-picture-text h3 { padding-top: 14px; }
.forum-layout #waterfall .forum-picture-text .forum-picture-select { right: 0; }
.forum-layout #waterfall .forum-picture-text .forum-picture-select ~ h3 { padding-right: 30px; }

@media (max-width: 1230px) {
  .forum-layout #toptb .wp { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .forum-layout #toptb .wp > div { max-width: 100%; }
  .forum-layout #hd .hdc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
  .forum-layout #hd h2 { max-width: 100%; padding-right: 0; }
  .forum-layout #hd h2 img { max-width: 100%; height: auto; }
  .forum-layout #lsform { max-width: 100%; margin-left: auto; }
  .forum-layout #um { flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
  .forum-layout #nv { display: flex; flex-wrap: wrap; height: auto; min-height: 33px; padding: 0; }
  .forum-layout #nv ul { display: flex; flex: 1 1 180px; flex-wrap: wrap; min-width: 0; }
  .forum-layout #nv li { float: none; max-width: 100%; }
  .forum-layout #qmenu { order: 1; flex: none; }
  .forum-layout #mu li { height: auto; }
  .forum-layout #mu a { white-space: normal; }
  .forum-layout .bm_h { height: auto; min-height: 31px; white-space: normal; }
  .forum-layout #ft { overflow-wrap: anywhere; }
}

@media (max-width: 1000px) {
  .forum-layout .boardnav > #ct { margin-left: 0 !important; }
  .forum-layout .ct2 > .mn, .forum-layout .ct2 > .sd { float: none; width: 100%; margin: 0 0 12px; }
  .forum-layout #sd_bdl { float: none; box-sizing: border-box; width: 100% !important; margin: 0 0 12px !important; }
  .forum-layout-side[open] > summary { display: list-item; }
  .forum-layout .forum-layout-side .bdl_h { display: none; }
  .forum-layout .bdl dt, .forum-layout .bdl dd a { height: auto; overflow-wrap: anywhere; }
  .forum-layout .clct_list .xld { float: none; width: 100%; height: auto; min-height: 105px; overflow-wrap: anywhere; }
  .forum-layout .clct_list .xld dd { overflow-wrap: anywhere; }
  .forum-layout .member-login { max-width: 100%; }
  .forum-layout .member-login .rfm { box-sizing: border-box; width: 100%; max-width: 760px; }
  .forum-layout .member-login .rfm table { width: 100%; }
}

@media (max-width: 900px) {
  /* Reflow native table rows without losing links, moderation controls or data. */
  .forum-layout .tl .th table, .forum-layout .tl .th tbody, .forum-layout .tl .th tr, .forum-layout .tl .th th { display: block; width: auto; }
  .forum-layout .tl .th td.by:not([colspan]), .forum-layout .tl .th td.num { display: none; }
  .forum-layout #threadlisttableid, .forum-layout #threadlisttableid > tbody, .forum-layout.pg_collection .tl .bm_c > table, .forum-layout.pg_collection .tl .bm_c > table > tbody { display: block; width: 100%; }
  .forum-layout .tl tr.forum-thread-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 3px 8px; padding: 10px 0; border-bottom: 1px solid #ddd; }
  .forum-layout .forum-thread-row > th, .forum-layout .forum-thread-row > td { display: block; width: auto; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .forum-layout .forum-thread-row > .icn { grid-column: 1; grid-row: 1; }
  .forum-layout .forum-thread-row > th { grid-column: 2; grid-row: 1; }
  .forum-layout .forum-thread-row > .o { grid-column: 3; grid-row: 1; }
  .forum-layout .forum-thread-row > .by { grid-column: 2; grid-row: 2; }
  .forum-layout .forum-thread-row > .num { grid-column: 3; grid-row: 2; }
  .forum-layout .forum-thread-row > .by:last-child { grid-column: 2 / -1; grid-row: 3; }
  .forum-layout .forum-thread-row > [data-label]::before { content: attr(data-label) " "; font-size: 12px; }
  .forum-layout .forum-thread-row .by cite, .forum-layout .forum-thread-row .by em { display: inline; white-space: normal; }
  .forum-layout .forum-thread-row .by em { margin-left: 8px; }
  .forum-layout #waterfall { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; width: 100% !important; height: auto !important; }
  .forum-layout #waterfall > li { position: relative !important; inset: auto !important; width: auto !important; margin: 0; }
  .forum-layout #waterfall .c a { display: block; float: none; }
  .forum-layout #waterfall img, .forum-layout #waterfall .nophoto { max-width: 100%; }
  .forum-layout #waterfall img { height: auto; }
  .forum-layout #waterfall .auth { display: flex; flex-wrap: wrap; gap: 4px 8px; }
  .forum-layout #f_pst .hasfsl { margin-right: 0; }
  .forum-layout #f_pst .px { box-sizing: border-box; max-width: 100%; }
  .forum-layout #f_pst .tedt { width: auto !important; }
  .forum-layout.pg_viewthread .plc { padding-left: 12px; padding-right: 12px; }
  .forum-layout.pg_viewthread .pcb { margin-right: 0; }
  .forum-layout.pg_viewthread .pi { height: auto; min-height: 16px; }
  .forum-layout.pg_viewthread .psth { box-sizing: border-box; max-width: 100%; width: auto; margin-left: 0; padding-left: 12px; }
  .forum-layout.pg_viewthread .t_f { overflow-wrap: anywhere; }
  .forum-layout.pg_viewthread .t_f img, .forum-layout.pg_viewthread .t_f video { max-width: 100%; height: auto; }
  .forum-layout.pg_viewthread .t_f iframe, .forum-layout.pg_viewthread .t_f table { max-width: 100%; }
  .forum-layout.pg_viewthread .t_f pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}

@media (max-width: 600px) {
  body.forum-layout { --forum-layout-gutter: 12px; }
  .forum-layout #qmenu_menu { left: 12px !important; }
  .forum-layout #lsform { width: 100%; }
  .forum-layout .fastlg .pns, .forum-layout .fastlg table, .forum-layout .fastlg tbody { display: block; float: none; width: 100%; }
  .forum-layout .fastlg tr { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 6px; margin-bottom: 10px; }
  .forum-layout .fastlg td { display: block; padding: 0; }
  .forum-layout .fastlg .fastlg_l { border: 0; padding: 0; }
  .forum-layout .fastlg .px { box-sizing: border-box; width: 100%; }
  .forum-layout .pgs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .forum-layout .pgs > .pg, .forum-layout .pgs > .pgt { flex-basis: 100%; }
  .forum-layout .pg { display: flex; flex-wrap: wrap; gap: 4px; }
  .forum-layout .pg > * { margin-left: 0; }
  .forum-layout .ttp a { height: auto; max-width: 100%; white-space: normal; }
  .forum-layout #f_pst .bm_c { padding: 12px; }
  .forum-layout .member-login .rfm table, .forum-layout .member-login .rfm tbody, .forum-layout .member-login .rfm tr { display: block; }
  .forum-layout .member-login .rfm th, .forum-layout .member-login .rfm td { display: block; box-sizing: border-box; width: 100%; padding: 4px 12px; text-align: left; }
  .forum-layout .member-login .rfm .p_fre { width: 100% !important; }
  .forum-layout .member-login .rfm select { max-width: 100%; }
  .forum-layout.pg_viewthread #postlist > table, .forum-layout.pg_viewthread .plhin,
  .forum-layout.pg_viewthread #postlist > table > tbody, .forum-layout.pg_viewthread .plhin > tbody,
  .forum-layout.pg_viewthread #postlist > table > tbody > tr, .forum-layout.pg_viewthread .plhin > tbody > tr { display: block; }
  .forum-layout.pg_viewthread #postlist > table > tbody > tr > td, .forum-layout.pg_viewthread .plhin > tbody > tr > td { display: block; box-sizing: border-box; width: auto; }
  .forum-layout.pg_viewthread .plhin > tbody > tr > td.pls:empty { display: none; }
  .forum-layout.pg_viewthread .pl .pls { width: auto; border-right: 0; }
  .forum-layout-author[open] > summary { display: list-item; }
  .forum-layout.pg_viewthread .pls .favatar { padding-bottom: 8px; }
  .forum-layout.pg_viewthread .pls .avatar { margin: 8px; }
  .forum-layout.pg_viewthread .pls .avatar img { box-sizing: border-box; max-width: 100%; width: 64px; }
  .forum-layout.pg_viewthread .pls .pi, .forum-layout.pg_viewthread .pls p, .forum-layout.pg_viewthread .pls .pil, .forum-layout.pg_viewthread .pls .o { margin-left: 6px; margin-right: 6px; padding-left: 0; overflow-wrap: anywhere; }
  .forum-layout.pg_viewthread .pob { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .forum-layout.pg_viewthread .pob em, .forum-layout.pg_viewthread .pob p { float: none; }
}

/* Full-page extensions keep their local controls inside the shared outer frame. */
.forum-layout.pg_post #ct.wp { width: 100%; padding: 0; background-image: none; }
.forum-layout.pg_post #postform, .forum-layout.pg_post #postbox { min-width: 0; }
.forum-layout.pg_post #editorbox > .tb { display: flex; flex-wrap: wrap; gap: 4px; }
.forum-layout.pg_post #editorbox > .tb li { float: none; max-width: 100%; }
.forum-layout.pg_post #editorbox > .tb a { height: auto; white-space: normal; }
.forum-layout.pg_post #post_extra_tb { display: flex; flex-wrap: wrap; gap: 6px; }
.forum-layout.pg_post #post_extra_tb label { float: none; height: auto; }
.forum-layout.pg_post #e_body .bar .btn { min-width: 0; }
.forum-layout.pg_publicchat .publicchat { max-width: none; }
.forum-layout .cf-page { padding-left: 0; padding-right: 0; }
.forum-select-panel { box-sizing: border-box; width: 620px; max-width: calc(100vw - 48px); }
.forum-layout #ct .forum-select-panel { max-width: 100%; }
.forum-select-panel .pbl { display: flex; width: 100%; max-width: 100%; }
.forum-select-panel .pbl li { box-sizing: border-box; flex: 1 1 0; float: none; width: auto; min-width: 0; }
.forum-select-panel .pbl a { overflow-wrap: anywhere; white-space: normal; height: auto; min-height: 32px; }
@media (max-width: 600px) {
 .forum-select-panel .pbl { flex-direction: column; gap: 8px; }
 .forum-select-panel .pbl li { flex: none; height: auto; max-height: 180px; border: 1px solid var(--dm-line); border-radius: 6px; }
 .forum-select-panel .pbl a { min-height: 44px; line-height: 24px; padding: 10px; }
 .forum-layout.pg_post .exfm { max-width: 100%; box-sizing: border-box; }
 .forum-layout.pg_post #extra_additional_c label { width: 50%; min-height: 32px; }
}

/* Header search controls use the same palette as the full-page components. */
.forum-layout #scbar.scbar-modern { background: var(--dm-soft); border-color: var(--dm-line); }
.forum-layout #scbar.scbar-modern .scbar-controls { border-color: var(--dm-field-line); background: var(--dm-field); }
.forum-layout #scbar.scbar-modern .scbar-controls:focus-within { border-color: var(--dm-accent); box-shadow: 0 0 0 3px var(--dm-active); }
.forum-layout #scbar.scbar-modern #scbar_txt { background: transparent; color: var(--dm-text); }
.forum-layout #scbar.scbar-modern #scbar_txt::placeholder, .forum-layout #scbar.scbar-modern #scbar_hot strong, .forum-layout #scbar.scbar-modern .scbar-search-icon { color: var(--dm-muted); }
.forum-layout #scbar.scbar-modern #scbar_type { border-color: var(--dm-line); color: var(--dm-accent); }
.forum-layout #scbar.scbar-modern #scbar_btn { background: var(--dm-primary); color: var(--dm-primary-text) !important; }
.forum-layout #scbar.scbar-modern #scbar_hot a { color: var(--dm-accent); background: var(--dm-surface); border-color: var(--dm-line); }
.forum-layout #scbar.scbar-modern #scbar_hot a:hover { background: var(--dm-active); border-color: var(--dm-active-line); }
.forum-layout #scbar_type_menu.scbar-type-menu, .forum-layout .scbar-modern #sg, .forum-layout .scbar-modern #sg .sml { background: var(--dm-surface); border-color: var(--dm-line); }
.forum-layout #scbar_type_menu.scbar-type-menu a { color: var(--dm-accent); }
.forum-layout #scbar_type_menu.scbar-type-menu a:hover, .forum-layout .scbar-modern #sg .smo { background: var(--dm-active); color: var(--dm-accent); }
.forum-layout #scbar.scbar-modern a:focus-visible, .forum-layout #scbar.scbar-modern button:focus-visible, .forum-layout #scbar_type_menu.scbar-type-menu a:focus-visible { outline-color: var(--dm-accent); }

/* Full-page notices opt in independently of the route that raised the message. */
.forum-layout #ct.forum-system-message { padding: 24px 0; }
.forum-system-message .nfl { min-height: 0; }
.forum-layout #ct.forum-system-message .nfl .f_c { width: 100%; max-width: 680px; margin: 24px auto; padding: 20px; border: 1px solid var(--dm-line); border-radius: 10px; background: var(--dm-surface); color: var(--dm-text); }
.forum-system-message #messagetext { overflow-wrap: anywhere; }
.forum-system-message #messagetext a { color: var(--dm-accent); }
.forum-system-message #messagetext a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.forum-system-message #messagelogin .member-login .rfm { width: 100%; }

/* Personal-space skins keep their own colors; only their geometry is shared. */
#space.space-index-layout > .wp { box-sizing: border-box; width: calc(100% - 2 * var(--forum-layout-gutter)); max-width: var(--forum-layout-width); min-width: 0; margin-left: auto; margin-right: auto; }
#space.space-index-layout #toptb { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
#space.space-index-layout #toptb > div { display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; }
#space.space-index-layout #toptb > .z { order: -1; }
#space.space-index-layout #toptb a { height: auto; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
#space.space-index-layout #hd { height: auto; min-height: 140px; padding-bottom: 12px; border-radius: 10px; }
#space.space-index-layout #spaceinfoshow { padding: 20px; overflow-wrap: anywhere; }
#space.space-index-layout #nv { position: static; margin: 8px 12px 0; }
#space.space-index-layout #nv ul { display: flex; flex-wrap: wrap; }
#space.space-index-layout #nv li { height: auto; max-width: 100%; }
#space.space-index-layout #nv a { height: auto; white-space: normal; overflow-wrap: anywhere; border-radius: 6px; }
#space.space-index-layout:not(:has(#controlpanel)) #frame1 { display: flex; gap: 8px; }
#space.space-index-layout:not(:has(#controlpanel)) #frame1::after { content: none; }
#space.space-index-layout:not(:has(#controlpanel)) #frame1 > .column { box-sizing: border-box; flex: var(--space-column-width, 1) 1 0; float: none; min-width: 0; width: auto !important; }
#space.space-index-layout:not(:has(#controlpanel)) .block { border-radius: 8px; overflow-wrap: anywhere; }
#space.space-index-layout:not(:has(#controlpanel)) .block img, #space.space-index-layout:not(:has(#controlpanel)) .block video { max-width: 100%; height: auto; }
#space.space-index-layout:not(:has(#controlpanel)) .block iframe { max-width: 100%; }
/* DIY continues using its saved pixel widths and native drag coordinates. */
#space.space-index-layout:has(#controlpanel) #diypage { overflow-x: auto; }
#space.space-index-layout:has(#controlpanel) #frame1 { width: 1200px; }
@media (max-width: 1000px) {
 #space.space-index-layout:not(:has(#controlpanel)) #frame1 { flex-direction: column; }
 #space.space-index-layout:not(:has(#controlpanel)) #frame1 > .column { flex: none; width: 100% !important; }
}
