/*
[name]Project1 2026[/name]
[iconbgcolor]#d74545[/iconbgcolor]
*/

/* X5's own markup, with the old PlayerStyle palette. */
body.discuzx5 {
  --p1-red: #d74545;
  --p1-ink: #28252b;
  background: var(--dz-bodybg);
}
body.discuzx5 a:focus-visible { outline: 2px solid var(--p1-red); outline-offset: 3px; }
body.discuzx5 :is(.xi2, .xi2 a, a.xi2, .fl_g dd > a) { color: #bf3535; }

/* A static version of the old homepage banner; native navigation stays live. */
body.discuzx5 #dz_btm_layer { --p1-banner-height: clamp(140px, 14.1vw, 240px); position: relative; top: auto; }
body.discuzx5 #dz_btm_layer::before {
  content: "";
  display: block;
  height: var(--p1-banner-height);
  background: #c5edff url(https://c.moenext.com/project1/template/discuzx5/style/project12026/assets/header.jpg?v=46e15f1134b85da0) center / cover no-repeat;
  border-top: 4px solid var(--p1-red);
}
body.discuzx5 .dz_layer_top {
  background: var(--p1-ink);
  border-block: 2px solid var(--p1-red);
  box-shadow: none;
}
body.discuzx5 .dz_nav {
  display: flex;
  align-items: center;
  gap: 24px;
  box-sizing: border-box;
  width: 1200px;
  min-width: 0;
  max-width: calc(100% - 40px);
  height: 64px;
  margin: auto;
  padding: 0;
}
body.discuzx5 .dz_nav > .clear { display: none; }
body.discuzx5 .dz_nav .dz_nav_logo { display: block; position: absolute; inset: 0 0 auto; height: calc(var(--p1-banner-height) + 4px); margin: 0; }
body.discuzx5 .dz_nav_logo .dzlogo { display: block; width: 100%; height: 100%; background: none; }
body.discuzx5 .dz_nav_logo img { display: none; }
body.discuzx5 .dz_layer_nav { flex: 1; width: auto; height: 64px; }
body.discuzx5 .dz_layer_nav ul li a {
  height: 64px;
  line-height: 64px;
  margin-right: 24px;
  font-size: 15px;
  letter-spacing: 0;
  color: #eee;
}
body.discuzx5 .dz_layer_nav ul li:is(.a, .hover) a,
body.discuzx5 .dz_layer_nav ul li a:hover { color: #fff; }
body.discuzx5 .dz_layer_nav ul li a::before,
body.discuzx5 .dz_layer_nav ul li a::after { background: var(--p1-red); }
body.discuzx5 .dz_layer_dl { flex: 0 0 auto; }
body.discuzx5 .header-right { height: 64px; }
body.discuzx5 .header-searcher .search-input { width: 210px; }
body.discuzx5 #pt { margin-block: 12px; }

/* Use X5's native DIY sidebar on the left, with the forum list on the right. */
body.discuzx5.pg_index #ct {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0 22px;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}
body.discuzx5.pg_index #chart { grid-column: 1 / -1; width: auto; margin-right: 0; }
body.discuzx5.pg_index #diy_chart:empty { display: none; }
body.discuzx5.pg_index #diy_chart:not(:empty) { grid-column: 1 / -1; }
body.discuzx5.pg_index #ct > .mn { grid-column: 2; grid-row: 3; width: auto; min-width: 0; float: none; }
body.discuzx5.pg_index #ct > #sd { grid-column: 1; grid-row: 3; width: auto; min-width: 0; margin: 0; float: none; }
body.discuzx5.pg_index #ct:not(:has(#sd .block)) { grid-template-columns: 1fr; }
body.discuzx5.pg_index #ct:not(:has(#sd .block)) > .mn { grid-column: 1; }
body.discuzx5.pg_index #ct:not(:has(#sd .block)) > #sd { display: none; }
body.discuzx5.pg_index #sd .block {
  border: 0;
  border-bottom: 4px solid var(--p1-red) !important;
  border-radius: 5px;
  box-shadow: 0 1px 5px #00000012;
}
body.discuzx5.pg_index #sd .title { color: #bf3535; font-size: 16px; }
body.discuzx5.pg_index :is(#online, .lk) { border-radius: 5px; }

/* Section headings and two-column forum cards, like the old homepage. */
body.discuzx5.pg_index .fl:has(.flg),
body.discuzx5.pg_index .flg { background: transparent; border: 0; }
body.discuzx5.pg_index .flg { margin-bottom: 22px; }
body.discuzx5.pg_index .flg:last-child { margin-bottom: 0; }
body.discuzx5.pg_index .flg > .bm_h {
  height: auto;
  min-height: 44px;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 5px 14px;
  line-height: 32px;
  background: #fff;
  border: 0;
  border-bottom: 4px solid var(--p1-red) !important;
  border-radius: 5px;
  box-shadow: 0 1px 4px #0000000d;
}
body.discuzx5.pg_index .flg > .bm_h h2 { font-size: 19px; }
body.discuzx5.pg_index .flg > .bm_h h2 a { color: #bf3535; }
body.discuzx5.pg_index .flg > .bm_h .y { color: #888; font-size: 12px; }
body.discuzx5.pg_index .flg > .bm_h .o em { color: #e99c9c; font-size: 24px; }
body.discuzx5.pg_index .flg > .bm_c { padding: 0; }
body.discuzx5.pg_index .flg .fl_tb { display: block; width: 100%; }
body.discuzx5.pg_index .flg .fl_tb > tbody { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
body.discuzx5.pg_index .flg .fl_tb tr { display: contents; }
body.discuzx5.pg_index .flg .fl_tb td:empty { display: none; }
body.discuzx5.pg_index .flg :is(.fl_g, tr:has(> .fl_icn)) {
  display: block;
  box-sizing: border-box;
  position: relative;
  width: auto;
  min-width: 0;
  min-height: 146px;
  padding: 0 0 14px;
  background: #fff;
  border: 0;
  border-radius: 5px;
  box-shadow: 0 1px 3px #00000008;
}
body.discuzx5.pg_index .flg .fl_g dl { margin: 0 !important; padding: 0; }
body.discuzx5.pg_index .flg :is(.fl_g dt, tr:has(> .fl_icn) h2) {
  box-sizing: border-box;
  min-height: 43px;
  padding: 10px 94px 10px 14px;
  border-radius: 5px 5px 0 0;
  background: var(--p1-ink);
  line-height: 23px;
  font-size: 16px;
  font-weight: normal;
}
body.discuzx5.pg_index .flg :is(.fl_g dt, tr:has(> .fl_icn) h2) a { color: #fff; }
body.discuzx5.pg_index .flg :is(.fl_g dt, tr:has(> .fl_icn) h2) a:hover { color: #f5b5b5; }
body.discuzx5.pg_index .flg :is(.fl_g dt, tr:has(> .fl_icn) h2) .xi1 { color: #ffb7b7; font-size: 12px; }
body.discuzx5.pg_index .flg .fl_g dd { margin: 12px 14px 0; line-height: 22px; font-size: 13px; }
body.discuzx5.pg_index .flg .fl_g dd:first-of-type { padding-right: 76px; color: #888; }
body.discuzx5.pg_index .flg :is(.fl_icn_g, .fl_icn) {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 66px !important;
  height: 66px;
  padding: 0;
  margin: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
}
body.discuzx5.pg_index .flg :is(.fl_icn_g, .fl_icn) img { width: 66px !important; height: 66px; max-width: none; object-fit: contain; }

/* Up to three favorites use native four-cell rows rather than fl_g cards. */
body.discuzx5.pg_index #category_0 tr:has(> .fl_icn) > td:not(.fl_icn) { display: block; width: auto; padding: 0; text-align: left; }
body.discuzx5.pg_index #category_0 .fl_icn { padding: 0 !important; min-height: 0; }
body.discuzx5.pg_index #category_0 tr:has(> .fl_icn) :is(p, .fl_i, .fl_by) { margin: 12px 14px 0; line-height: 22px; font-size: 13px; }
body.discuzx5.pg_index #category_0 tr:has(> .fl_icn) p:first-of-type { padding-right: 76px; }
body.discuzx5.pg_index #category_0 .fl_by div { width: auto; margin: 0; padding: 0; }

/* Fit the native four-panel feed into the main column without fixed image widths. */
body.discuzx5.pg_index .fl:has(#category_grid) { border: 0; border-bottom: 4px solid var(--p1-red) !important; border-radius: 5px; overflow: hidden; }
body.discuzx5.pg_index #category_grid table { width: 100% !important; table-layout: fixed; }
body.discuzx5.pg_index #category_grid td { width: 25%; min-width: 0; }
body.discuzx5.pg_index #category_grid h4 { height: auto; padding: 10px 12px; color: #bf3535; font-size: 14px; }
body.discuzx5.pg_index #category_grid .category_newlist { padding: 10px 12px; }
body.discuzx5.pg_index #category_grid .category_newlist li { line-height: 24px; }
body.discuzx5.pg_index #category_grid .slidebox_grid { position: relative; width: 100% !important; height: 260px; }
body.discuzx5.pg_index #category_grid .slidebox_grid table { height: 240px !important; }
body.discuzx5.pg_index #category_grid .slideouter { box-sizing: border-box; width: 100% !important; height: 240px !important; border: 0 !important; }
body.discuzx5.pg_index #category_grid .slidebox_grid img { width: 100%; height: 240px; object-fit: contain; }
body.discuzx5.pg_index #category_grid .newimgbox { padding: 0; }

body.discuzx5 .dz_footc { margin-top: 26px; background: var(--p1-ink); border-top: 2px solid var(--p1-red); }
body.discuzx5 .dz_footc :is(a, .dz_footc_copy) { color: #b8b5bc; }
body.discuzx5 .dz_footc_nav { border-bottom-color: #ffffff20; }
body.discuzx5 .dz_rnav a { border-radius: 5px; }
@media (max-width: 1100px) {
  body.discuzx5.pg_index #ct { grid-template-columns: 200px minmax(0, 1fr); }
  body.discuzx5 .header-searcher .search-input { width: 160px; }
}

body.discuzx5.pg_index #category_grid .slidebox_grid > div[id^="switch_"] { display: flex; width: 100%; bottom: 0; margin: 0 !important; }
body.discuzx5.pg_index #category_grid .slideswitch { flex: 1; width: auto !important; }
body.discuzx5 .dz_footc_dico:not(:has(*)) { display: none; }

/* Compact thread rows: keep native links and controls, rearrange only this style. */
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  padding-left: 60px;
  min-height: 48px;
}
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot { display: contents; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmtit {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  order: 3;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  height: auto;
  margin: 0;
  line-height: 24px;
  overflow: visible;
  white-space: normal;
}
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > * { float: none; margin: 0; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > .kmimg {
  position: absolute;
  top: 18px;
  left: 0;
  width: 48px;
  height: 48px;
}
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > a:not([class]),
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > img { order: 1; font-size: 14px; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > :is(.kmico_bk, em:has(> .kmico_bk)) { order: 2; }
body.discuzx5.pg_forumdisplay .forumportal_listc .km_subject { order: 0; font-size: 16px; line-height: 24px; white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmtit > :not(.km_subject) { order: 1; float: none; margin: 0; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmtit > .kmnew,
body.discuzx5.pg_forumdisplay .forumportal_listc .kmtit > i { order: 2; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > :is(.kmbga, .kmbgb, .kmtxt) { order: 6; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > :is(.kmtxt, .kmimg_onebox, .kmimg_box) { order: 12; flex-basis: 100%; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > .kmtime { order: 7; white-space: nowrap; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > .kmck { order: 8; margin-left: auto; white-space: nowrap; }
body.discuzx5.pg_forumdisplay .forumportal_listc .kmfoot > .kmpl { order: 9; margin-left: 9px; white-space: nowrap; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .showcontent { position: absolute; top: 18px; right: 0; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .closeprev { order: 10; flex: none; float: none; margin: 6px 0 0; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .km_moderate { order: 11; flex: none; float: none; margin-top: 3px; }

body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .kmtxt { margin-top: 0; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] { padding-left: 0; min-height: 24px; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] > :is(.kmtxt, .kmimg_onebox, .kmimg_box) { display: none; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] .kmfoot > .kmimg { position: static; width: 20px; height: 20px; order: 7; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] .kmfoot > a:not([class]),
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] .kmfoot > img { order: 7; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] .kmfoot > :is(.kmck, .kmpl, .kmico_bk, em:has(> .kmico_bk)) { display: none; }
body.discuzx5.pg_forumdisplay .forumportal_listc li[id^="stickthread_"] .kmtit > .kmding { order: -1; }

body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist:not([id^="stickthread_"]) .kmfoot > .kmtime { display: none; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .kmimg_box { width: 100%; max-width: 788px; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: auto; }
body.discuzx5.pg_forumdisplay .forumportal_listc li.kmlist > .kmimg_box > .kmshowimg { aspect-ratio: 1; height: auto; padding: 0; margin: 0; }

/* The compact count sits outside the list; the expanded menu stays inside. */
body.discuzx5.pg_forumdisplay #threadlist:has(.forumportal_listc) #mdly.cpd { right: -15px; margin-right: 0; z-index: 100; }

body.discuzx5.pg_forumdisplay [id^="forum_rules_"] img { max-width: 100%; }
