/* v1.7.1 | The only shared advertisement grid layout for all three themes.
   Keep columns in lib/ad-layout.php; colors and artwork remain per theme.
   CSS box sizing + 5px inset on the two left-aligned fields prevent edge-hugging text. */
:root{--ad-font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,"Segoe UI",Arial,Roboto,"PingFang SC",miui,"Hiragino Sans GB","Microsoft Yahei",sans-serif;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night){font-family:var(--ad-font-family);-webkit-text-size-adjust:100%;text-size-adjust:100%;}
body.home-theme-classic{--ad-border:#ff9900;--ad-heading:#ff3300;--ad-heading-ink:#fff;}
body.home-theme-modern{--ad-border:#c2d9e9;--ad-heading:linear-gradient(180deg,#2876ab,#154977);--ad-heading-ink:#fff;}
body.home-theme-dnf_night{--ad-border:#8d4d77;--ad-heading:#151932;--ad-heading-ink:#fff;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid{
 width:1350px;max-width:none;table-layout:fixed;border:0;border-collapse:separate;border-spacing:0;
 margin:0;box-sizing:border-box;font-family:inherit;font-size:var(--ad-text-size,13px);
 line-height:normal;background:transparent;
}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid *{box-sizing:border-box;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid :is(th,td){
 border:0;border-right:1px solid var(--ad-border);border-bottom:1px solid var(--ad-border);
 overflow:hidden;white-space:nowrap;text-overflow:ellipsis;vertical-align:middle;
 padding:0 2px;font-family:inherit;letter-spacing:normal;
}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid tr>:first-child{border-left:1px solid var(--ad-border);}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid thead th{border-top:1px solid var(--ad-border);}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid th{
 height:40px;line-height:39px;text-align:center;font-size:14px;font-weight:800;
 color:var(--ad-heading-ink);background:var(--ad-heading);
}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td{
 height:32px;line-height:30px;font-size:var(--ad-text-size,13px);font-weight:400;
 text-align:center;color:var(--ad-text-color,#222);
}
/* Name and description use exactly the same readable inset in ALL themes. */
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid :is(.ad-col-name,.ad-col-desc){
 padding-left:5px;padding-right:5px;position:relative;
}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid .ad-col-name a,
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid .ad-desc-text{
 display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;
}
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-col-name[data-mark="1"] a{max-width:calc(100% - 19px);}
/* Classic and modern: NEW/TOP flame immediately BEFORE the server name. */
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-mark{
 display:inline-block;width:14px;height:16px;margin-right:4px;
 vertical-align:middle;position:static;float:none;transform:none;
}
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-mark-icon{display:block;width:14px;height:16px;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td a{
 color:inherit;text-decoration:none;font-size:inherit;
}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td a:hover{text-decoration:underline;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid .ad-time{font:inherit;color:inherit;}
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-time--top{color:#d90000;}
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-time--qtjp{color:#008873;}
body:is(.home-theme-classic,.home-theme-modern) .ad-grid .ad-time--qtth{color:#ff0000;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td img{vertical-align:middle;max-height:16px;}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid .ad-date-heading{
 height:36px;line-height:35px;font-size:14px;font-weight:700;text-align:center;
}
body.home-theme-modern .ad-grid .ad-date-heading{background:linear-gradient(90deg,#15558a,#278db7 50%,#15558a);}
/* Dark theme preserves its original button, icon movement and status position. */
body.home-theme-dnf_night .ad-grid .ad-mark{display:none!important;}
body.home-theme-dnf_night .ad-grid .ad-time{color:#e54202;}
body.home-theme-dnf_night .ad-grid .ad-time--qtth{color:#f00;}
body.home-theme-dnf_night .ad-grid .ad-time--qtjp{color:#008873;}
/* The theme-owned GIF is 22x14; intrinsic sizing avoids squashing replacement flames. */
body.home-theme-dnf_night .ad-grid .lead-fire{display:inline-block;width:auto;height:auto;max-width:24px;max-height:16px;margin-right:4px;vertical-align:-2px;}
body.home-theme-dnf_night .ad-grid .ad-col-link a{
 display:inline-block;width:60px;max-width:100%;line-height:24px;
 text-align:center;color:#fff;font-size:12px;background:#2e2541;border-radius:4px;
}
body.home-theme-dnf_night .ad-grid .ad-col-link a:hover{color:#fff;background:#443452;text-decoration:none;}
/* Hover requires no per-row JavaScript; selected colors come from PHP. */
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid tbody tr[data-ad-type]:hover{
 background:var(--ad-row-hover,#fff)!important;
}
@media(max-width:1350px){body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night){min-width:1350px;}}

/* Per-template name left by default, description center. User choices override these. */
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td.ad-col-name{text-align:var(--ad-name-align,left);}
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid td.ad-col-desc{text-align:var(--ad-desc-align,center);}

/* Keep four-character Chinese category/status labels whole across the default themes. */
body:is(.home-theme-classic,.home-theme-modern,.home-theme-dnf_night) .ad-grid .ad-col-status {font-size:min(var(--ad-text-size,13px),12px);letter-spacing:-.3px;padding-left:0;padding-right:0;}
