/*
 * TorrentPier – Bull-powered BitTorrent tracker engine
 *
 * Modern skin layer for the "modern" template.
 *
 * Loaded ON TOP of the legacy stylesheet (main.css + dark-mode.css) and the
 * Tailwind Play CDN. Every rule is scoped under `body.modern-ui`, so the
 * "default" template is never affected. Dark mode reuses the existing
 * `body.dark-mode` class (kept in sync with Tailwind's `.dark` on <html>).
 *
 * Design language: orange accent, rounded corners, soft shadows, responsive.
 */

body.modern-ui .colorAdmin, a.colorAdmin, a.colorAdmin:visited {
  color: #DE0000 !important;
  font-weight: bold; 
  text-shadow: 0px 0px 7px; 
 /* font-family: Segoe UI; */
  background: url(../images/Nick/AdminEffect.gif),
  url(../images/Nick/adminicon.png) no-repeat ;   
   padding-left: 18px;
   padding-top: 1px;
}

body.modern-ui .colorTech, a.colorTech, a.colorTech:visited {
  color: #000 !important; 
  font-weight: bold;
  text-shadow: 0px 0px 7px #000;
  background: url(../images/Nick/TechEffect.gif),
  url(../images/Nick/techicon.png) no-repeat ;   
   padding-left: 18px;
   padding-top: 1px;
}

body.modern-ui .colorSupp, a.colorSupp, a.colorSupp:visited {
  color: #000 !important; 
  font-weight: bold;
  text-shadow: 0px 0px 7px #000;
}

body.modern-ui .colorSuperMod, a.colorSuperMod, a.colorSuperMod:visited { 
  color: #006400 !important;
  font-weight: bold; 
  text-shadow: 0px 0px 7px; 
  /* font-family: Segoe UI; */
  background: url(../images/Nick/supermod.gif),
  url(../images/Nick/sumodericon.png) no-repeat; 
  padding-left: 18px;
  padding-top: 1px;
 }

body.modern-ui .colorMod, a.colorMod, a.colorMod:visited {
  color: #009900 !important; 
  font-weight: bold; 
  text-shadow: 0px 0px 7px; 
  /* font-family: Segoe UI; */
  background: url(../images/Nick/ModerEffect.gif),
  url(../images/Nick/modericon.png) no-repeat;
  padding-left: 18px;
  padding-top: 1px;
}

body.modern-ui .colorUpload, a.colorUpload, a.colorUpload:visited {
  color: rgb(0, 135, 255) !important; 
  font-weight: bold; 
  text-shadow: 0px 0px 7px; 
  /* font-family: Segoe UI; */
  background: url(../images/Nick/ReleaseEffect.gif);
  /*url(../images/Nick/modericon.png) no-repeat; */
  /*padding-left: 18px; */
  padding-top: 1px;
}

body.modern-ui .colorModStaj, a.colorModStaj, a.colorModStaj:visited {
	color: #00bf07 !important;
	font-weight: bold;
	text-shadow: 1px 0px 4px rgb(37, 255, 0);
}

body.modern-ui .colorVip, a.colorVip, a.colorVip:visited {
  color: #ff7800 !important; 
  font-weight: bold;
  text-shadow: 0px 0px 7px #ff7800;
  background: url(../images/Nick/VIPEffect.gif),
  url(../images/Nick/vipicon.gif) no-repeat ;   
   padding-left: 18px;
   padding-top: 1px;
}

body.modern-ui .colorGirl, a.colorGirl, a.colorGirl:visited {
  color: #ff00d8 !important; 
  font-weight: bold;
  text-shadow: 0px 0px 7px #ff00d8;
  background: url(../images/Nick/GirlEffect.gif),
  url(../images/Nick/girlicon.png) no-repeat ;   
   padding-left: 18px;
   padding-top: 1px;
}

body.modern-ui .colorReporters, a.colorReporters, a.colorReporters:visited {
  color: #787878 !important;
  font-weight: bold; 
  text-shadow: 0px 0px 7px; 
 /* font-family: Segoe UI; */
  background: url(../images/Nick/boom.gif),
  url(../images/Nick/reportersico.png) no-repeat ;   
   padding-left: 18px;
   padding-top: 1px;
}

body.modern-ui .colorGroup, a.colorGroup, a.colorGroup:visited {
  color: #6700B3;
  font-weight: bold;
  text-shadow: 0px 0px 7px !important;
}

body.modern-ui .colorLeg, a.colorLeg, a.colorLeg:visited {
	color: rgb(0, 135, 255);
	font-weight: bold;
	text-shadow: 1px 0px 4px rgba(68, 108, 179, 0.7) !important;
}

body.modern-ui .colorProver, a.colorProver, a.colorProver:visited {
  color: #00a599;
  font-weight: bold;
  text-shadow: 1px 0px 4px !important;
}

/* ------------------------------------------------------------------ *
   Theme tokens
 * ------------------------------------------------------------------ */
body.modern-ui {
  --m-accent: #f97316;        /* orange-500 */
  --m-accent-600: #ea580c;    /* orange-600 */
  --m-accent-700: #c2410c;    /* orange-700 */
  --m-accent-soft: #fff7ed;   /* orange-50  */
  --m-accent-ring: rgba(249, 115, 22, .35);

  --m-bg: #eef1f5;
  --m-surface: #ffffff;
  --m-surface-2: #f6f8fb;
  --m-border: #e3e8ef;
  --m-text: #1f2937;
  --m-text-muted: #64748b;
  --m-link: #ea6a18;

  --m-radius: 16px;
  --m-radius-sm: 12px;
  --m-radius-xs: 9px;
  --m-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px rgba(16, 24, 40, .07);
  --m-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);

  min-width: 0;
  background: var(--m-bg);
  color: var(--m-text);
}

/* Dark theme — triggered by legacy `body.dark-mode` (synced from cookie) */
body.modern-ui.dark-mode {
  --m-accent-soft: #2a1707;
  --m-accent-ring: rgba(249, 115, 22, .45);
  --m-accent: #632900;        /* orange-500 */
  --m-accent-600: #591e00;    /* orange-600 */
  --m-accent-700: #c2410c;    /* orange-700 */

  --m-bg: #0f1216;
  --m-surface: #161a20;
  --m-surface-2: #1d222b;
  --m-border: #2a303b;
  --m-text: #e6e9ee;
  --m-text-muted: #98a2b3;
  --m-link: #ff9a4d;

  --m-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .55);
  --m-shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------------ *
   Reset a few legacy globals just for the modern skin
 * ------------------------------------------------------------------ */
body.modern-ui,
body.modern-ui th,
body.modern-ui td,
body.modern-ui font {
  font-family: "Inter", "Segoe UI", Verdana, Arial, sans-serif;
}

body.modern-ui #body_container {
  background: var(--m-bg);
}

body.modern-ui #page_container {
  /* Fills FullHD (~1920) almost edge-to-edge, but caps on 2K/4K so the
     content is centered instead of stretched too wide. */
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 28px;
}

/* ------------------------------------------------------------------ *
   Top utility bar  (#main-nav replacement)
 * ------------------------------------------------------------------ */
body.modern-ui .m-topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 16px;
  margin: 0 -14px 0;
  background: color-mix(in srgb, var(--m-surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--m-border);
}

body.modern-ui .m-topbar .m-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

body.modern-ui .m-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--m-text);
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}

body.modern-ui .m-nav-link:hover {
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
}

body.modern-ui.dark-mode .m-nav-link:hover {
  color: var(--m-link) !important;
}

body.modern-ui .m-nav-link.is-accent {
  color: var(--m-accent-700) !important;
}

/* dropdown */
body.modern-ui .m-nav-item {
  position: relative;
}

body.modern-ui .m-nav-item > .m-nav-link.has-caret::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: .55;
}

body.modern-ui .m-nav-sub {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  padding: 6px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  box-shadow: var(--m-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 950;
}

body.modern-ui .m-nav-item:hover > .m-nav-sub,
body.modern-ui .m-nav-item:focus-within > .m-nav-sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

body.modern-ui .m-nav-sub a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--m-radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--m-text) !important;
}

body.modern-ui .m-nav-sub a:hover {
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
}

body.modern-ui.dark-mode .m-nav-sub a:hover {
  color: var(--m-link) !important;
}

body.modern-ui .m-topbar .m-spacer {
  margin-left: auto;
}

/* theme toggle + round buttons in topbar/header */
body.modern-ui .m-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  color: var(--m-text) !important;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

body.modern-ui .m-icon-btn:hover {
  background: var(--m-accent-soft);
  border-color: var(--m-accent);
  transform: translateY(-1px);
}

/* mobile hamburger */
body.modern-ui .m-burger {
  display: none;
}

/* ------------------------------------------------------------------ *
   Header card: logo + search + account
 * ------------------------------------------------------------------ */
body.modern-ui .m-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
  padding: 16px 18px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow);
}

body.modern-ui .m-logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

body.modern-ui .m-logo img {
  max-width: 360px;
  width: 100%;
  height: auto;
}

/* ---- theme-aware logo: light & dark <img> toggled per theme ----
   The two logo files are set in page_header.twig on
   <img class="m-logo-light"> and <img class="m-logo-dark">. */
body.modern-ui .m-logo-dark { display: none; }
body.modern-ui.dark-mode .m-logo-light { display: none; }
body.modern-ui.dark-mode .m-logo-dark { display: block; }

body.modern-ui .m-header-mid {
  flex: 0 1 540px;
  max-width: 540px;
  min-width: 220px;
  margin-left: auto;   /* push the search box to the right */
}

body.modern-ui .m-search {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  background: var(--m-surface-2);
  border: 1px solid var(--m-border);
  border-radius: 999px;
  padding: 4px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

body.modern-ui .m-search:focus-within {
  border-color: var(--m-accent);
  box-shadow: 0 0 0 4px var(--m-accent-ring);
}

body.modern-ui .m-search input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--m-text);
}

body.modern-ui .m-search select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--m-text-muted);
  font-size: 12px;
  max-width: 120px;
}

body.modern-ui .m-search .m-search-go {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
  cursor: pointer;
  transition: filter .15s ease;
}

body.modern-ui .m-search .m-search-go:hover {
  filter: brightness(1.06);
}

body.modern-ui .m-header-end {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

/* logged-in account → its own full-width row below logo/search */
body.modern-ui .m-account-row {
  flex: 1 1 100%;
  margin-left: 0;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 0;
}

body.modern-ui .m-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  width: 100%;
  font-size: 12px;
  color: var(--m-text-muted);
  line-height: 1.5;
}

body.modern-ui .m-welcome {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  flex-wrap: wrap;
  color: var(--m-text-muted);
}

/* username → chip (keeps its rank icon/colour inside) */
body.modern-ui .m-welcome b {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border-radius: 999px;
  background: var(--m-surface-2);
  border: 1px solid var(--m-border);
  color: var(--m-text);
  font-weight: 700;
}

body.modern-ui .m-account-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body.modern-ui .m-account b { color: var(--m-text); }

/* account action buttons → pills */
body.modern-ui .m-acc-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface-2);
  color: var(--m-text) !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

body.modern-ui .m-acc-btn:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
  transform: translateY(-1px);
}

body.modern-ui.dark-mode .m-acc-btn:hover { color: var(--m-link) !important; }

/* the dropdown caret next to Profile */
body.modern-ui .m-acc-caret { padding: 5px 10px; font-size: 9px; }

/* logout → red accent */
body.modern-ui .m-acc-logout:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, .12);
  color: #ef4444 !important;
}

/* ================================================================== *
   Live search dropdown → frosted glass (transparency + blur)
 * ================================================================== */
body.modern-ui .ls-dropdown {
  background: rgba(255, 255, 255, .72) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--m-border) !important;
  border-radius: var(--m-radius) !important;
  box-shadow: var(--m-shadow) !important;
  padding: 6px !important;
}

body.modern-ui.dark-mode .ls-dropdown {
  background: rgba(16, 20, 26, .80) !important;
  border-color: rgba(255, 255, 255, .12) !important;
}

body.modern-ui .ls-item {
  border-bottom: 0 !important;
  border-radius: var(--m-radius-sm);
  margin: 2px 0;
  padding: 7px 10px;
  color: var(--m-text) !important;
}

body.modern-ui .ls-item:hover,
body.modern-ui .ls-item.ls-active {
  background: var(--m-accent-soft) !important;
}

body.modern-ui.dark-mode .ls-item:hover,
body.modern-ui.dark-mode .ls-item.ls-active {
  background: rgba(255, 255, 255, .09) !important;
}

body.modern-ui .ls-poster,
body.modern-ui .ls-poster-empty {
  border-radius: 8px;
  border-color: var(--m-border) !important;
}

body.modern-ui .ls-title { color: var(--m-text) !important; font-weight: 700; }
body.modern-ui .ls-hl { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .ls-hl { color: var(--m-link) !important; }
body.modern-ui .ls-meta,
body.modern-ui .ls-size,
body.modern-ui .ls-forum,
body.modern-ui .ls-status { color: var(--m-text-muted) !important; }

/* ================================================================== *
   Modern colour palette (posting editor) — works on every OS
 * ================================================================== */
body.modern-ui .m-color-native { display: none !important; }

body.modern-ui .m-color-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

body.modern-ui .m-color-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  color: var(--m-text);
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

body.modern-ui .m-color-trigger:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  transform: translateY(-1px);
}

body.modern-ui .m-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  border: 1px solid rgba(0, 0, 0, .2);
}

body.modern-ui .m-color-pop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 3000;
  width: 282px;
  padding: 10px;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  box-shadow: var(--m-shadow);
}

body.modern-ui .m-color-pop.open { display: grid; }

body.modern-ui .m-color-sw {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 16px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .18);
  transition: transform .1s ease, box-shadow .1s ease;
}

body.modern-ui .m-color-sw:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px var(--m-accent);
  position: relative;
  z-index: 1;
}

/* ---- full-colour photo backdrop for the header card ----
   Light theme → beach / sea (day), dark theme → night.
   Swap the URLs for your own (e.g. ../images/header-day.jpg). */
body.modern-ui .m-header {
  background-image: url(../images/fons/fonleto.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

body.modern-ui.dark-mode .m-header {
  background-image: url(../images/fons/fonletodark.png);
}

/* welcome text sits directly on the photo → white with a soft shadow */
body.modern-ui .m-welcome {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .75);
}

/* --- frosted glass (transparency + blur) for the header controls --- */
body.modern-ui .m-header .m-search,
body.modern-ui .m-header .m-acc-btn,
body.modern-ui .m-header .m-welcome b {
  background: rgba(255, 255, 255, .42) !important;
  border-color: rgba(255, 255, 255, .55) !important;
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  backdrop-filter: blur(10px) saturate(150%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

body.modern-ui.dark-mode .m-header .m-search,
body.modern-ui.dark-mode .m-header .m-acc-btn,
body.modern-ui.dark-mode .m-header .m-welcome b {
  background: rgba(12, 16, 22, .40) !important;
  border-color: rgba(255, 255, 255, .16) !important;
}

/* the search INPUT stays transparent so the glass shows through */
body.modern-ui .m-header .m-search input[type="text"],
body.modern-ui .m-header .m-search #search-text {
  background: transparent !important;
  border: 0 !important;
}

/* the search SELECT is a solid pill control (native dropdowns can't be
   styled reliably, so keep it solid → the option list stays clean) */
body.modern-ui .m-header .m-search select {
  background: var(--m-surface) !important;
  color: var(--m-text) !important;
  border: 1px solid var(--m-border) !important;
  border-radius: 999px;
  padding: 4px 10px;
}

body.modern-ui.dark-mode .m-header .m-search select {
  background: #161a20 !important;
  color: #eef2f7 !important;
}

/* dark theme: native <select> dropdown options render white by default —
   darken them (keep the chat colour/size pickers untouched) */
body.modern-ui.dark-mode select:not(.text_color):not(.text_size) option,
body.modern-ui.dark-mode select:not(.text_color):not(.text_size) optgroup {
  background-color: #161a20;
  color: #e6e9ee;
}

body.modern-ui .m-header .m-acc-btn:hover {
  background: rgba(255, 255, 255, .62) !important;
}

body.modern-ui.dark-mode .m-header .m-acc-btn:hover {
  background: rgba(255, 255, 255, .15) !important;
}

/* primary / pill buttons reused in header */
body.modern-ui .m-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  color: var(--m-text) !important;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

body.modern-ui .m-btn:hover {
  border-color: var(--m-accent);
  transform: translateY(-1px);
}

body.modern-ui .m-btn-primary {
  border-color: transparent;
  color: #fff !important;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .m-btn-primary:hover {
  filter: brightness(1.06);
}

/* --- guest login buttons → frosted glass over the header photo --- */
body.modern-ui .m-header .m-btn {
  background: rgba(255, 255, 255, .60) !important;
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border-color: rgba(255, 255, 255, .70) !important;
  color: var(--m-text) !important;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(255, 255, 255, .5);
}

body.modern-ui .m-header .m-btn:hover {
  background: rgba(255, 255, 255, .58) !important;
  border-color: #fff !important;
  transform: translateY(-1px);
}

body.modern-ui .m-header .m-btn-primary {
  background: rgba(249, 115, 22, .82) !important;
  border-color: rgba(255, 255, 255, .45) !important;
  color: #fff !important;
}

body.modern-ui .m-header .m-btn-primary:hover {
  background: rgba(234, 88, 12, .92) !important;
}

body.modern-ui .m-header .m-nav-link {
  color: var(--m-text) !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .6);
}

body.modern-ui .m-header .m-nav-link:hover {
  background: rgba(255, 255, 255, .25) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff !important;
}

body.modern-ui.dark-mode .m-header .m-btn {
  background: rgba(12, 16, 22, .48) !important;
  border-color: rgba(255, 255, 255, .16) !important;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

body.modern-ui.dark-mode .m-header .m-nav-link {
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

body.modern-ui.dark-mode .m-header .m-btn:hover {
  background: rgba(12, 16, 22, .62) !important;
}

/* ================================================================== *
   Auth pages (login) → modern centered card
 * ================================================================== */
body.modern-ui .m-auth {
  display: flex;
  justify-content: center;
  padding: 26px 12px;
}

body.modern-ui .m-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow);
  padding: 28px 28px 22px;
}

body.modern-ui .m-auth-head {
  text-align: center;
  margin-bottom: 22px;
}

body.modern-ui .m-auth-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
  box-shadow: 0 6px 16px rgba(249, 115, 22, .35);
}

body.modern-ui .m-auth-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--m-text);
}

body.modern-ui .m-auth-sub {
  font-size: 12.5px;
  color: var(--m-text-muted);
  margin-top: 5px;
}

body.modern-ui .m-auth-note {
  text-align: center;
  color: var(--m-accent-700);
  font-weight: 600;
  margin: 0 0 16px;
}
body.modern-ui.dark-mode .m-auth-note { color: var(--m-link); }

body.modern-ui .m-field { margin-bottom: 15px; }

body.modern-ui .m-field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-text-muted);
  margin-bottom: 6px;
}

body.modern-ui .m-auth-card input[type="text"],
body.modern-ui .m-auth-card input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px !important;
  font-size: 14px !important;
  border-radius: var(--m-radius-sm) !important;
}

body.modern-ui .m-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--m-text);
  margin: 0 0 18px;
  cursor: pointer;
}

body.modern-ui .m-check input { margin: 0; }

body.modern-ui .m-check-inline {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--m-text-muted);
}

body.modern-ui .m-auth-submit {
  width: 100%;
  padding: 12px !important;
  font-size: 14px !important;
  border-radius: var(--m-radius-sm) !important;
}

body.modern-ui .m-auth-links {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
}

body.modern-ui .m-auth-links a { color: var(--m-link) !important; font-weight: 600; }
body.modern-ui .m-auth-links a:hover { color: var(--m-accent-700) !important; }
body.modern-ui .m-auth-links span { margin: 0 8px; color: var(--m-text-muted); opacity: .6; }

/* ------------------------------------------------------------------ *
   Generic surface card used on the home page & around content
 * ------------------------------------------------------------------ */
body.modern-ui .m-card {
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  overflow: hidden;
}

body.modern-ui .m-card + .m-card {
  margin-top: 16px;
}

body.modern-ui .m-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--m-text);
  background: var(--m-surface-2);
  border-bottom: 1px solid var(--m-border);
}

body.modern-ui .m-card-head::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .m-card-head a { color: var(--m-text) !important; }

/* ------------------------------------------------------------------ *
   Home page — forum categories as cards
 * ------------------------------------------------------------------ */
body.modern-ui .m-cat { margin-bottom: 20px; }

body.modern-ui .m-forum-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto minmax(190px, 250px);
  align-items: center;
  gap: 10px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--m-border);
}

body.modern-ui .m-forum-row:last-child { border-bottom: 0; }
body.modern-ui .m-forum-row:hover { background: var(--m-surface-2); }

body.modern-ui .m-forum-ico {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--m-accent-soft);
}

body.modern-ui .m-forum-name {
  font-size: 15px;
  font-weight: 700;
}

body.modern-ui .m-forum-name a { color: var(--m-text) !important; }
body.modern-ui .m-forum-name a:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .m-forum-name a:hover { color: var(--m-link) !important; }

body.modern-ui .m-forum-desc {
  font-size: 12px;
  color: var(--m-text-muted);
  margin-top: 3px;
}

body.modern-ui .m-stat {
  text-align: center;
  min-width: 64px;
}

body.modern-ui .m-stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--m-text);
}

body.modern-ui .m-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--m-text-muted);
}

body.modern-ui .m-last {
  font-size: 12px;
  color: var(--m-text-muted);
  min-width: 0;
}

body.modern-ui .m-last a { color: var(--m-link) !important; font-weight: 600; }
body.modern-ui .m-last .last_topic {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.modern-ui .m-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}
body.modern-ui.dark-mode .m-chip { color: var(--m-link); }

/* ------------------------------------------------------------------ *
   Re-skin legacy blocks that still render inside the modern shell
   (sidebar widgets, category titles, tables that come from default)
 * ------------------------------------------------------------------ */
body.modern-ui #main_content_wrap,
body.modern-ui #sidebar1-wrap,
body.modern-ui #sidebar2-wrap {
  padding-top: 4px;
}

body.modern-ui .ss-block {
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
}

/* widget / section headers (Мини чат, Последние комментарии, топы, новости…)
   styled like the forum card header — surface bar with an orange accent */
body.modern-ui .ss-head {
  position: relative;
  background: var(--m-surface-2);
  color: var(--m-text);
  border-bottom: 1px solid var(--m-border);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px 10px 22px;
}

body.modern-ui .ss-head::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

/* widget row dividers — legacy uses bright #e6e6e6, too white in dark theme */
body.modern-ui .ss-item + .ss-item,
body.modern-ui .ss-row + .ss-row {
  border-top-color: var(--m-border) !important;
}

/* ================================================================== *
   Top lists (Топ сидеров / личеров / скачиваемых) → modern
 * ================================================================== */

/* --- ranked user lists (Топ сидеров / Топ личеров) --- */
body.modern-ui .ss-block { counter-reset: ssrank; }

body.modern-ui .ss-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 0 !important;
  border-radius: 9px;
  margin: 1px 6px;
  transition: background-color .12s ease;
}

body.modern-ui .ss-row:hover { background: var(--m-surface-2); }

body.modern-ui .ss-row::before {
  counter-increment: ssrank;
  content: counter(ssrank);
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  background: var(--m-surface-2);
  color: var(--m-text-muted);
}

/* medals for the top 3 (head is child 1 → rows start at child 2) */
body.modern-ui .ss-row:nth-child(2)::before { background: linear-gradient(135deg, #ffd86b, #f0b000); color: #5a4500; }
body.modern-ui .ss-row:nth-child(3)::before { background: linear-gradient(135deg, #e3e7ec, #aab2bd); color: #3a3f45; }
body.modern-ui .ss-row:nth-child(4)::before { background: linear-gradient(135deg, #edb083, #cd7f4e); color: #4a2e16; }

body.modern-ui .ss-user {
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
}

body.modern-ui .ss-user a { white-space: normal !important; }

body.modern-ui .ss-val {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

/* --- torrent list (Топ скачиваемых / Новые торренты) --- */
body.modern-ui .ss-item {
  padding: 10px 12px;
  border-top: 1px solid var(--m-border);
  transition: background-color .12s ease;
}

body.modern-ui .ss-block .ss-head + .ss-item,
body.modern-ui .ss-item:first-of-type { border-top: 0; }

body.modern-ui .ss-item:hover { background: var(--m-surface-2); }

body.modern-ui .ss-title {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--m-link) !important;
  margin-bottom: 4px;
}

body.modern-ui .ss-title:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .ss-title:hover { color: var(--m-accent) !important; }

body.modern-ui .ss-meta {
  font-size: 11px;
  line-height: 1.55;
  color: var(--m-text-muted);
}

body.modern-ui .ss-meta b { color: var(--m-text); }
body.modern-ui .ss-meta a { color: var(--m-link) !important; }

/* ================================================================== *
   Rating sidebar card (#user_ratio) → modern stat panel
 * ================================================================== */
body.modern-ui #user_ratio .ss-block { overflow: hidden; }

/* avatar / banner */
body.modern-ui #user_ratio .tCenter {
  padding: 12px 12px 2px;
  line-height: 0;
}

body.modern-ui #user_ratio .tCenter img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--m-border);
  box-shadow: var(--m-shadow-sm);
}

/* stats table → clean flex rows (label left / value right) */
body.modern-ui #user_ratio table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  padding: 6px 8px 10px;
  box-sizing: border-box;
}

body.modern-ui #user_ratio tr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
}

body.modern-ui #user_ratio tr:nth-child(even) {
  background: var(--m-surface-2);
}

body.modern-ui #user_ratio td {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

body.modern-ui #user_ratio td:first-child {
  color: var(--m-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

body.modern-ui #user_ratio td:last-child {
  text-align: right;
  font-weight: 700;
  font-size: 13px;
}

/* highlight the ratio (first row) */
body.modern-ui #user_ratio tr:first-child {
  background: rgba(249, 115, 22, .10);
  margin-bottom: 3px;
}

body.modern-ui #user_ratio tr:first-child td:last-child b {
  color: var(--m-accent-700);
  font-size: 16px;
}

body.modern-ui.dark-mode #user_ratio tr:first-child td:last-child b {
  color: var(--m-link);
}

/* seed-bonus points accent */
body.modern-ui #user_ratio .points { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode #user_ratio .points { color: var(--m-link) !important; }

body.modern-ui .cat_title {
  position: relative;
  background: var(--m-surface-2);
  border: 1px solid var(--m-border) !important;
  border-radius: var(--m-radius-sm) var(--m-radius-sm) 0 0;
  color: var(--m-text);
  font-weight: 700;
  text-indent: 0;
  padding-left: 22px;
}

body.modern-ui .cat_title::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .cat_title a { color: var(--m-text) !important; }

/* generic legacy buttons inside modern skin → pill + orange focus */
body.modern-ui input.med,
body.modern-ui input.lite,
body.modern-ui input.long,
body.modern-ui input.bold,
body.modern-ui button.lite {
  border-radius: 999px !important;
}

body.modern-ui input[type="text"]:focus,
body.modern-ui input[type="password"]:focus,
body.modern-ui input[type="search"]:focus,
body.modern-ui textarea:focus,
body.modern-ui select:focus {
  outline: 0;
  border-color: var(--m-accent) !important;
  box-shadow: 0 0 0 3px var(--m-accent-ring);
}

/* links across the modern skin use the warm accent on hover */
body.modern-ui a:hover { color: var(--m-accent-700); }
body.modern-ui.dark-mode a:hover { color: var(--m-link); }

/* ------------------------------------------------------------------ *
   Footer
 * ------------------------------------------------------------------ */
body.modern-ui .m-footer {
  margin: 26px 0 0;
  padding: 22px 18px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  text-align: center;
  color: var(--m-text-muted);
  font-size: 12px;
}

body.modern-ui .m-footer a { color: var(--m-link) !important; font-weight: 600; }

body.modern-ui .m-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-weight: 600;
}

body.modern-ui .m-footer-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--m-border);
  line-height: 1.6;
}

body.modern-ui .m-footer-note b { color: var(--m-accent-700); }
body.modern-ui.dark-mode .m-footer-note b { color: var(--m-link); }

/* scroll-top button → round + orange */
body.modern-ui #scroll-top {
  border-radius: 999px !important;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: var(--m-shadow) !important;
}

/* ------------------------------------------------------------------ *
   Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 900px) {
  body.modern-ui .m-burger {
    display: inline-flex;
    margin-left: auto;
  }

  body.modern-ui .m-topbar .m-nav {
    order: 3;
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 8px;
  }

  body.modern-ui .m-topbar.is-open .m-nav { display: flex; }

  body.modern-ui .m-nav-item { width: 100%; }
  body.modern-ui .m-nav-sub {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    padding: 0 0 0 14px;
    min-width: 0;
  }

  body.modern-ui .m-header {
    gap: 12px;
  }

  body.modern-ui .m-header-end {
    width: 100%;
    justify-content: space-between;
  }

  body.modern-ui .m-forum-row {
    grid-template-columns: 40px 1fr;
  }

  body.modern-ui .m-forum-row .m-stat,
  body.modern-ui .m-forum-row .m-last {
    grid-column: 2 / -1;
    text-align: left;
  }

  body.modern-ui .m-forum-row .m-stats-wrap {
    display: flex;
    gap: 16px;
    grid-column: 2 / -1;
  }
}

@media (max-width: 560px) {
  body.modern-ui #page_container { padding: 0 8px 22px; }
  body.modern-ui .m-logo img { max-width: 240px; }
  body.modern-ui .m-header { padding: 14px; }
}

/* ================================================================== *
   Legacy components re-skin
   Modernises the shared building blocks used by the pages that are
   still inherited from the "default" template (tracker, viewforum,
   viewtopic, search, profile, …) so the whole site feels consistent.
   Everything is scoped under body.modern-ui and only touches visuals.
 * ================================================================== */

/* --- List / data tables → rounded cards ---------------------------- */
body.modern-ui .forumline,
body.modern-ui table.bordered,
body.modern-ui table.border {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  overflow: hidden;
  box-shadow: var(--m-shadow-sm);
  background: var(--m-surface);
}

/* soft horizontal separators instead of the heavy legacy grid */
body.modern-ui .forumline th,
body.modern-ui .forumline td {
  border: 0;
  border-bottom: 1px solid var(--m-border);
}

body.modern-ui .forumline tr:last-child td {
  border-bottom: 0;
}

/* table headers */
body.modern-ui .forumline th,
body.modern-ui .thHead,
body.modern-ui th.thHead {
  background: var(--m-surface-2);
  color: var(--m-text);
  font-weight: 700;
  letter-spacing: .2px;
}

body.modern-ui .forumline th a,
body.modern-ui .thHead a { color: var(--m-text) !important; }

/* category / section header cells */
body.modern-ui .cat,
body.modern-ui td.cat,
body.modern-ui td.catTitle,
body.modern-ui td.catHead,
body.modern-ui td.catBottom {
  background: var(--m-surface-2);
  color: var(--m-text);
  border-bottom: 1px solid var(--m-border);
}

/* --- Alternating rows --------------------------------------------- */
body.modern-ui .row1, body.modern-ui .row1 td,
body.modern-ui .prow1, body.modern-ui .row4, body.modern-ui .row4 td {
  background: var(--m-surface);
}

body.modern-ui .row2, body.modern-ui .row2 td,
body.modern-ui .row3, body.modern-ui .row3 td,
body.modern-ui .prow2, body.modern-ui .prow3,
body.modern-ui .row5, body.modern-ui .row5 td,
body.modern-ui .row6, body.modern-ui .row6 td {
  background: var(--m-surface-2);
}

body.modern-ui .forumline tr:hover > td.row1,
body.modern-ui .forumline tr:hover > td.row2,
body.modern-ui .forumline tr:hover > td.row3,
body.modern-ui .forumline tr:hover > td.row4 {
  background: var(--m-accent-soft);
}

/* --- Fieldsets / filter panels ------------------------------------ */
body.modern-ui fieldset {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  background: var(--m-surface);
}

body.modern-ui legend {
  color: var(--m-accent-700);
  font-weight: 700;
}

body.modern-ui.dark-mode legend { color: var(--m-link); }

/* --- Form controls ------------------------------------------------- */
body.modern-ui input[type="text"],
body.modern-ui input[type="password"],
body.modern-ui input[type="search"],
body.modern-ui input[type="email"],
body.modern-ui input[type="number"],
body.modern-ui textarea,
body.modern-ui select {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-xs);
  background: var(--m-surface);
  color: var(--m-text);
  padding: 6px 11px;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}

body.modern-ui select { padding: 5px 10px; }

/* legacy push-buttons → pill with warm accent */
body.modern-ui input.med,
body.modern-ui input.long,
body.modern-ui input.lite,
body.modern-ui input.gen,
body.modern-ui input.bold,
body.modern-ui button.lite,
body.modern-ui input[type="submit"],
body.modern-ui input[type="button"],
body.modern-ui input[type="reset"] {
  border: 1px solid var(--m-border);
  border-radius: 999px !important;
  background: var(--m-surface);
  color: var(--m-text);
  padding: 5px 14px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

body.modern-ui input.med:hover,
body.modern-ui input.long:hover,
body.modern-ui input.lite:hover,
body.modern-ui input.gen:hover,
body.modern-ui input.bold:hover,
body.modern-ui button.lite:hover,
body.modern-ui input[type="submit"]:hover,
body.modern-ui input[type="button"]:hover,
body.modern-ui input[type="reset"]:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  transform: translateY(-1px);
}

/* primary submit (main action buttons commonly use class "long") */
body.modern-ui input.long {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui input.long:hover {
  filter: brightness(1.06);
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

/* --- Tablesorter (tracker results) header hover -------------------- */
body.modern-ui .tablesorter .header:hover {
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}

body.modern-ui.dark-mode .tablesorter .header:hover { color: var(--m-link); }

/* --- Page titles --------------------------------------------------- */
body.modern-ui .pagetitle,
body.modern-ui h1.pagetitle {
  font-weight: 800;
}

body.modern-ui .pagetitle a { color: var(--m-text) !important; }

/* --- Misc legacy info / message boxes ----------------------------- */
body.modern-ui .info_msg_wrap table,
body.modern-ui table.error {
  border-radius: var(--m-radius-sm);
  overflow: hidden;
}

/* ================================================================== *
   Fine-grained polish — avatars, chat, posting, pagination, tabs
 * ================================================================== */

/* --- Avatars → rounded -------------------------------------------- */
body.modern-ui .avatar,
body.modern-ui .avatar img,
body.modern-ui img.avatar,
body.modern-ui .chat-avatar img,
body.modern-ui .lc-avatar img,
body.modern-ui #avatar-img img {
  border-radius: 12px;
}

/* --- Chat ---------------------------------------------------------- */
body.modern-ui .chat-comment {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-xs);
  background: var(--m-surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

body.modern-ui .chat-comment:hover {
  border: 1px solid var(--m-accent);
  box-shadow: 0 0 0 3px var(--m-accent-ring);
}

body.modern-ui .chat-comment.hl-selected-post {
  background: var(--m-accent-soft);
}

body.modern-ui .chat-btn {
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-surface);
  color: var(--m-text);
  padding: 4px 14px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

body.modern-ui .chat-btn:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}

body.modern-ui.dark-mode .chat-btn:hover { color: var(--m-link); }

body.modern-ui .chat-btn-danger { color: #e2574c; }
body.modern-ui .chat-btn-danger:hover {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

body.modern-ui .chat-spin { border-top-color: var(--m-accent); }

body.modern-ui textarea.chat_message,
body.modern-ui #message {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-xs);
  background: var(--m-surface);
  color: var(--m-text);
}

/* ================================================================== *
   Mini chat + Last comments — modern design
 * ================================================================== */

/* --- chat input area --- */
body.modern-ui #message {
  width: 99%;
  box-sizing: border-box;
  min-height: 46px;
  padding: 8px 12px;
}

body.modern-ui #chat-wrap .buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  margin: 8px 0 0;
  background: var(--m-surface-2);
  border-radius: var(--m-radius-xs);
}

body.modern-ui #chat-wrap .buttons input[type="button"] {
  border-radius: 999px !important;
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  color: var(--m-text);
  width: auto !important;
}

body.modern-ui #chat-wrap .buttons input[type="button"]:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}

body.modern-ui #chat-wrap .buttons select {
  border-radius: 999px;
  padding: 3px 8px;
}

body.modern-ui #chat-wrap > .ss-block .pad_4 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

/* --- chat messages --- */
body.modern-ui #chat { padding: 6px 4px 4px; }

body.modern-ui #chat .chat-comment {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  background: var(--m-surface-2);
  transition: border-color .15s ease, box-shadow .15s ease;
}

body.modern-ui #chat .chat-comment:hover {
  border: 1px solid var(--m-accent);
  box-shadow: 0 0 0 3px var(--m-accent-ring);
}

body.modern-ui .chat-avatar { margin-right: 10px; }
body.modern-ui .chat-avatar img { width: 38px; height: 38px; border-radius: 10px; }
body.modern-ui .chat-nick { font-weight: 700; font-size: 12px; }
body.modern-ui .chat-date { color: var(--m-text-muted); font-size: 10px; }
body.modern-ui .chat-text { color: var(--m-text); font-size: 12px; margin-top: 5px; line-height: 1.45; word-break: break-word; }

/* reply / quote controls keep subtle */
body.modern-ui .chat-edit-btn,
body.modern-ui .chat-reply-btn { color: var(--m-text-muted); }
body.modern-ui .chat-edit-btn:hover,
body.modern-ui .chat-reply-btn:hover { color: var(--m-accent-700); }

/* --- last comments --- */
body.modern-ui #last_comments .last-comments-list {
  list-style: none;
  margin: 0;
  padding: 8px 6px;
}

body.modern-ui .last-comments-list .chat-comment {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 11px;
  grid-auto-rows: min-content;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  background: var(--m-surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

body.modern-ui .last-comments-list .chat-comment:hover {
  border-color: var(--m-accent);
  box-shadow: var(--m-shadow-sm);
}

body.modern-ui .lc-avatar {
  grid-column: 1;
  grid-row: 1 / span 3;
  line-height: 0;
}

body.modern-ui .lc-avatar img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
}

body.modern-ui .lc-title {
  grid-column: 2;
  font-weight: 700;
  font-size: 12px;
  color: var(--m-link) !important;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.modern-ui .lc-meta {
  grid-column: 2;
  color: var(--m-text-muted);
  font-size: 11px;
  margin-top: 2px;
}

body.modern-ui .lc-text {
  grid-column: 2;
  color: var(--m-text);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Posting / BBCode editor -------------------------------------- */
body.modern-ui .buttons,
body.modern-ui fieldset.attach {
  border-radius: var(--m-radius-xs);
}

body.modern-ui textarea.editor,
body.modern-ui .editor textarea,
body.modern-ui #post_textarea {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-xs);
}

/* --- Pagination (safe, targeted) ---------------------------------- */
/* The "Go to page" trigger is unique to pagination — pill it. */
body.modern-ui a.menu-root[href="#pg-jump"] {
  display: inline-block;
  padding: 2px 11px;
  border-radius: 999px;
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
  font-weight: 600;
}

body.modern-ui.dark-mode a.menu-root[href="#pg-jump"] { color: var(--m-link) !important; }

body.modern-ui .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

/* current page marker inside the dedicated pagination wrapper */
body.modern-ui .pagination b {
  display: inline-block;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

/* --- Лента новинок (new-releases strip) --------------------------- */
body.modern-ui #lenta {
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  padding: 12px;
  margin: 14px 0;
}

/* category tabs → clean pill row (kills the legacy grey bar), centred */
body.modern-ui .lenta-tabs {
  background: transparent;
  padding: 0;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: center;
}

body.modern-ui .lenta-tab {
  flex: 0 0 auto;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--m-surface-2);
  color: var(--m-text-muted);
  font-size: 11px;
  letter-spacing: .3px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

body.modern-ui .lenta-tab:hover {
  border-color: var(--m-accent);
  color: var(--m-accent-700);
  transform: translateY(-1px);
}

body.modern-ui.dark-mode .lenta-tab:hover { color: var(--m-link); }

body.modern-ui .lenta-tab.is-active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
  box-shadow: 0 4px 12px var(--m-accent-ring);
}

/* poster strip — hide the horizontal scrollbar (our global scrollbar
   rule re-enabled it) and drop snap so wheel scrolling stays smooth */
body.modern-ui .lenta-strip {
  gap: 10px;
  padding-bottom: 0;
  scroll-snap-type: none;
  scrollbar-width: none;
}

body.modern-ui .lenta-strip::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body.modern-ui .lenta-thumb img {
  width: 110px;
  height: 140px;
  border: 1px solid var(--m-border);
  border-radius: 12px;
  box-shadow: var(--m-shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

body.modern-ui .lenta-thumb:hover img {
  border-color: var(--m-accent);
  transform: translateY(-3px);
  box-shadow: var(--m-shadow);
}

/* NEW badge → rounded chip */
body.modern-ui .lenta-new {
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .5px;
  background: #e11d48;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

/* hover preview card */
body.modern-ui .lenta-card {
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  box-shadow: var(--m-shadow);
  color: var(--m-text);
}

body.modern-ui .lenta-card-img { border-radius: var(--m-radius-xs); }
body.modern-ui .lenta-card-title a { color: var(--m-link); }
body.modern-ui .lenta-card-row { color: var(--m-text-muted); }

/* ================================================================== *
   Soften legacy grid lines
   The legacy tables draw a full grid in medium grey (#B7C0C5 / #C3CBD1),
   which reads as heavy/"жирно". Re-colour those lines to the soft modern
   border (colour only — widths & layout untouched, so nothing shifts).
   Covers tables not caught by the .forumline re-skin (.bordered, .topic,
   .border / bw_* helpers, .forums).
 * ================================================================== */
body.modern-ui table.bordered,
body.modern-ui .bordered th,
body.modern-ui .bordered td,
body.modern-ui table.topic,
body.modern-ui .topic .td1,
body.modern-ui .topic .td2,
body.modern-ui .topic .td3,
body.modern-ui .post_head,
body.modern-ui .post_btn_2,
body.modern-ui .border,
body.modern-ui [class^="bw_"],
body.modern-ui [class*=" bw_"],
body.modern-ui .cat_title,
body.modern-ui .f_tbl_wrap,
body.modern-ui #board_stats_wrap,
body.modern-ui table.forums th,
body.modern-ui .forums td.row1 {
  border-color: var(--m-border) !important;
}

/* drop the grey table fill that shows through as grid lines */
body.modern-ui table.bordered,
body.modern-ui table.topic {
  background: var(--m-surface);
}

/* ================================================================== *
   Completion pass — dropdowns, BBCode blocks, posts, polls,
   alerts, scrollbars, text selection
 * ================================================================== */

/* --- Dropdown menus (menu-root popups, profile/download menus) ----- */
body.modern-ui .menu-sub table,
body.modern-ui .menu-a {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  overflow: hidden;
  box-shadow: var(--m-shadow);
  background: var(--m-surface);
}

body.modern-ui .menu-sub table th {
  background: var(--m-surface-2);
  color: var(--m-text);
}

body.modern-ui .menu-sub table td,
body.modern-ui .menu-a a {
  background: var(--m-surface);
  color: var(--m-text);
}

body.modern-ui .menu-sub table td.cat { background: var(--m-surface-2); }

body.modern-ui .menu-sub label:hover,
body.modern-ui .menu-a a:hover {
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}

body.modern-ui.dark-mode .menu-sub label:hover,
body.modern-ui.dark-mode .menu-a a:hover { color: var(--m-link); }

/* --- BBCode blocks: quote / code / spoiler → modern cards --------- */
/* wrappers = rounded card */
body.modern-ui .q-wrap,
body.modern-ui .c-wrap,
body.modern-ui .sp-wrap {
  margin: 10px 0;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  overflow: hidden;
  background: var(--m-surface);
  box-shadow: var(--m-shadow-sm);
}

/* headers = bar with orange accent */
body.modern-ui .q-head,
body.modern-ui .c-head,
body.modern-ui .sp-head {
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--m-border);
  border-left: 3px solid var(--m-accent);
  background: var(--m-surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--m-text);
  line-height: 1.4;
  text-align: left;
}

body.modern-ui .q-head b,
body.modern-ui .c-head b { color: var(--m-accent-700); }
body.modern-ui.dark-mode .q-head b,
body.modern-ui.dark-mode .c-head b { color: var(--m-link); }

body.modern-ui .q-head::before { content: "\201D"; margin-right: 6px; color: var(--m-accent); font-weight: 800; }
body.modern-ui .c-head::before { content: "</>"; margin-right: 6px; color: var(--m-accent); font-family: monospace; }

/* bodies = content */
body.modern-ui .q,
body.modern-ui .c-body,
body.modern-ui .sp-body {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: var(--m-surface);
}

/* code: monospace on a subtle code surface */
body.modern-ui .c-body {
  font-family: "JetBrains Mono", "Consolas", "Courier New", monospace;
  background: var(--m-surface-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* spoiler header: clickable with a rotating arrow */
body.modern-ui .sp-head {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color .15s ease;
}

body.modern-ui .sp-head:hover { background: var(--m-accent-soft); }
body.modern-ui.dark-mode .sp-head:hover { background: var(--m-surface); }

body.modern-ui .sp-head::before {
  content: "\25B6";
  font-size: 9px;
  color: var(--m-accent);
  transition: transform .15s ease;
}

body.modern-ui .sp-head.unfolded::before { transform: rotate(90deg); }

/* title already shown in the spoiler head — hide the duplicate inside body */
body.modern-ui .sp-body .sp-title { display: none; }

/* spoiler "close" control → pill */
body.modern-ui .sp-fold {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 13px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface-2);
  color: var(--m-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}

body.modern-ui .sp-fold:hover {
  border-color: var(--m-accent);
  color: var(--m-accent-700);
}

body.modern-ui.dark-mode .sp-fold:hover { color: var(--m-link); }

/* --- Posts -------------------------------------------------------- */
body.modern-ui .post_body { line-height: 1.55; }

body.modern-ui .signature {
  border-top: 1px solid var(--m-border) !important;
  margin-top: 10px !important;
  padding-top: 6px !important;
}

body.modern-ui .post-box {
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-xs);
}

/* --- Polls -------------------------------------------------------- */
body.modern-ui img.poll-vote-img { border-radius: 4px; }

/* --- Alerts (mod comment / info / warning / violation) ------------ */
body.modern-ui .alert {
  border-radius: var(--m-radius-sm);
  border: 1px solid var(--m-border);
  border-left: 4px solid var(--m-accent);
  background-image: none !important;
  background: var(--m-surface-2);
  color: var(--m-text) !important;
  text-shadow: none !important;
  box-shadow: var(--m-shadow-sm);
  padding: 12px 16px;
}

body.modern-ui .alert .alert-heading,
body.modern-ui .alert > h4 {
  font-weight: 700;
  color: var(--m-text);
}

body.modern-ui .alert hr {
  border: 0;
  border-top: 1px solid var(--m-border);
  opacity: 1;
  margin: 8px 0;
}

body.modern-ui .alert a { color: var(--m-link) !important; font-weight: 600; }

/* success — comment / approved */
body.modern-ui .alert-success {
  background: rgba(34, 197, 94, .12);
  border-color: rgba(34, 197, 94, .30);
  border-left-color: #22c55e;
}
body.modern-ui .alert-success .alert-heading,
body.modern-ui .alert-success > h4 { color: #16a34a; }
body.modern-ui.dark-mode .alert-success .alert-heading,
body.modern-ui.dark-mode .alert-success > h4 { color: #4ade80; }

/* info — information */
body.modern-ui .alert-info {
  background: rgba(59, 130, 246, .12);
  border-color: rgba(59, 130, 246, .30);
  border-left-color: #3b82f6;
}
body.modern-ui .alert-info .alert-heading,
body.modern-ui .alert-info > h4 { color: #1d4ed8; }
body.modern-ui.dark-mode .alert-info .alert-heading,
body.modern-ui.dark-mode .alert-info > h4 { color: #60a5fa; }

/* warning — caution */
body.modern-ui .alert-warning {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .35);
  border-left-color: #f59e0b;
}
body.modern-ui .alert-warning .alert-heading,
body.modern-ui .alert-warning > h4 { color: #b45309; }
body.modern-ui.dark-mode .alert-warning .alert-heading,
body.modern-ui.dark-mode .alert-warning > h4 { color: #fbbf24; }

/* danger — violation */
body.modern-ui .alert-danger {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .35);
  border-left-color: #ef4444;
}
body.modern-ui .alert-danger .alert-heading,
body.modern-ui .alert-danger > h4 { color: #b91c1c; }
body.modern-ui.dark-mode .alert-danger .alert-heading,
body.modern-ui.dark-mode .alert-danger > h4 { color: #f87171; }

/* gray — neutral (release group) */
body.modern-ui .alert-gray {
  background: var(--m-surface-2);
  border-color: var(--m-border);
  border-left-color: var(--m-accent);
}

/* --- Custom scrollbars (subtle, accent on hover) ------------------ */
body.modern-ui,
body.modern-ui * {
  scrollbar-width: thin;
  scrollbar-color: var(--m-border) transparent;
}

body.modern-ui ::-webkit-scrollbar,
body.modern-ui::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.modern-ui ::-webkit-scrollbar-track,
body.modern-ui::-webkit-scrollbar-track { background: transparent; }

body.modern-ui ::-webkit-scrollbar-thumb,
body.modern-ui::-webkit-scrollbar-thumb {
  background: var(--m-border);
  border-radius: 999px;
}

body.modern-ui ::-webkit-scrollbar-thumb:hover,
body.modern-ui::-webkit-scrollbar-thumb:hover { background: var(--m-accent); }

/* --- Text selection ---------------------------------------------- */
body.modern-ui ::selection {
  background: var(--m-accent);
  color: #fff;
}

/* ================================================================== *
   viewtopic — posts as modern cards (CSS only, markup untouched)
 * ================================================================== */

/* author column */
body.modern-ui .poster_info,
body.modern-ui table.topic .td1 {
  background: var(--m-surface-2);
  vertical-align: top;
}

/* message column always on the clean surface */
body.modern-ui td.message,
body.modern-ui .message.td2 {
  background: var(--m-surface);
}

/* post header bar (date / # / actions) */
body.modern-ui .post_head {
  background: var(--m-surface-2);
  padding: 6px 12px !important;
  font-size: 11px;
}

/* post body */
body.modern-ui .post_body {
  margin: 0 !important;
  padding: 14px 16px;
}

body.modern-ui .post_wrap { line-height: 1.6; }

/* post action buttons (Опрос / Цитата / Редактировать / … ) → pills */
body.modern-ui a.txtb,
body.modern-ui a.txtb:link,
body.modern-ui a.txtb:visited {
  display: inline-block;
  padding: 4px 12px;
  margin: 2px 0;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface-2);
  color: var(--m-text) !important;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

body.modern-ui a.txtb:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
  transform: translateY(-1px);
}

body.modern-ui.dark-mode a.txtb:hover { color: var(--m-link) !important; }

/* keep the moderation/warning buttons visually distinct (red) */
body.modern-ui a.txtb .adm { color: #e2574c !important; }
body.modern-ui a.txtb:hover .adm { color: #e2574c !important; }

/* topic action bar (Модерировать / Закрепить / Распечатать / Мои сообщения / Опции) → pills */
body.modern-ui .m-topic-actions a {
  display: inline-block;
  padding: 4px 13px;
  margin: 2px 1px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface-2);
  color: var(--m-text) !important;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

body.modern-ui .m-topic-actions a:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
  transform: translateY(-1px);
}

body.modern-ui.dark-mode .m-topic-actions a:hover { color: var(--m-link) !important; }

/* drop the "|" separators between the now-pill buttons */
body.modern-ui .m-topic-actions span[style*="CDCDCD"] { display: none; }

/* a bit more room for the dropdown-arrow on the options pill */
body.modern-ui .m-topic-actions a.menu-root { padding-right: 22px; }

/* topic title → forum-style card header with orange accent bar */
body.modern-ui .maintitle {
  position: relative;
  margin: 14px 0 12px;
  padding: 14px 18px 14px 26px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

body.modern-ui .maintitle::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .maintitle a.tt-text {
  color: var(--m-text) !important;
  font-size: 17px;
  font-weight: 800;
}

body.modern-ui .maintitle a.tt-text:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .maintitle a.tt-text:hover { color: var(--m-link) !important; }

body.modern-ui .pagetitle {
  position: relative;
  margin: 14px 0 12px;
  padding: 14px 18px 14px 26px;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

body.modern-ui .pagetitle::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .pagetitle a.tt-text {
  color: var(--m-text) !important;
  font-size: 17px;
  font-weight: 800;
}

body.modern-ui .pagetitle a.tt-text:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .pagetitle a.tt-text:hover { color: var(--m-link) !important; }

/* row under the title: reply button + breadcrumb → tidy toolbar bar */
body.modern-ui .m-topic-bar {
  margin: 0 0 14px;
  background: var(--m-surface-2);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  box-shadow: var(--m-shadow-sm);
}

body.modern-ui .m-topic-bar td {
  vertical-align: middle !important;
  padding: 9px 14px;
}

body.modern-ui .m-topic-bar .nav { margin: 0; font-size: 12px; }
body.modern-ui .m-topic-bar .btn-post-topic { white-space: nowrap; }

body.modern-ui .nav a { font-weight: 600; }

/* ================================================================== *
   Peers list (seeders/leechers) + releaser stats — modern tables
 * ================================================================== */
body.modern-ui table.peers {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  overflow: hidden;
  background: var(--m-surface);
  box-shadow: var(--m-shadow-sm);
}

body.modern-ui .peers thead th {
  background: var(--m-surface-2) !important;
  color: var(--m-text);
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--m-border);
  font-weight: 700;
  white-space: nowrap;
}

body.modern-ui .peers td {
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--m-border);
}

body.modern-ui .peers tr:last-child td { border-bottom: 0; }

body.modern-ui .peers tbody tr:hover td,
body.modern-ui .peers tr:hover td { background: var(--m-accent-soft) !important; }
body.modern-ui.dark-mode .peers tbody tr:hover td,
body.modern-ui.dark-mode .peers tr:hover td { background: var(--m-surface-2) !important; }

body.modern-ui .peers .header:hover { color: var(--m-accent-700); }
body.modern-ui.dark-mode .peers .header:hover { color: var(--m-link); }

/* ================================================================== *
   Profile nav → toolbar bar with pill buttons
 * ================================================================== */
body.modern-ui .m-profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 12px;
  background: var(--m-surface-2);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  box-shadow: var(--m-shadow-sm);
}

body.modern-ui .m-profile-bar p {
  margin: 0;
  float: none !important;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body.modern-ui .m-profile-bar .clear { display: none; }

body.modern-ui .m-profile-bar a {
  display: inline-block;
  padding: 6px 15px;
  border-radius: 999px;
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  color: var(--m-text) !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}

body.modern-ui .m-profile-bar a:hover {
  border-color: var(--m-accent);
  background: var(--m-accent-soft);
  color: var(--m-accent-700) !important;
  transform: translateY(-1px);
}

body.modern-ui.dark-mode .m-profile-bar a:hover { color: var(--m-link) !important; }

/* ================================================================== *
   Profile status alerts (no bans / has warnings)
 * ================================================================== */
body.modern-ui .m-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 4px;
  padding: 11px 14px;
  border-radius: var(--m-radius-sm);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

body.modern-ui .m-status-ico {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
}

/* no bans → success */
body.modern-ui .m-status-ok {
  background: rgba(34, 197, 94, .12);
  border-color: rgba(34, 197, 94, .35);
  color: #15803d;
}
body.modern-ui .m-status-ok .m-status-ico { background: #22c55e; }
body.modern-ui.dark-mode .m-status-ok { color: #4ade80; }

/* has warnings → caution */
body.modern-ui .m-status-warn {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .40);
  color: #b45309;
}
body.modern-ui .m-status-warn .m-status-ico { background: #f59e0b; }
body.modern-ui.dark-mode .m-status-warn { color: #fbbf24; }

body.modern-ui .m-status a {
  color: inherit !important;
  text-decoration: underline;
  font-weight: 700;
}

/* ================================================================== *
   Gift catalog (presents) — modern cards
 * ================================================================== */
/* drop the legacy light-grey page background */
body.modern-ui #custom_html-2 {
  background-color: transparent !important;
}

/* gift card */
body.modern-ui #present {
  height: 178px;
  background: var(--m-surface) !important;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

body.modern-ui #present:hover {
  transform: translateY(-3px);
  border-color: var(--m-accent);
  box-shadow: var(--m-shadow);
}

body.modern-ui #present img {
  max-height: 108px;
  width: auto;
  object-fit: contain;
}

/* "Give" button → orange pill */
body.modern-ui #present .lblock {
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%) !important;
  width: auto;
  height: auto;
  line-height: 1;
  padding: 7px 16px;
  border-radius: 999px;
  left: 10px;
  top: auto;
  bottom: 10px;
  z-index: 2;
  box-shadow: 0 4px 10px var(--m-accent-ring);
}

body.modern-ui #present .lblock b,
body.modern-ui #present .lblock b:hover { color: #fff; }

/* price → soft chip */
body.modern-ui #present .rblock {
  background: var(--m-accent-soft) !important;
  width: auto;
  height: auto;
  line-height: 1;
  padding: 7px 14px;
  border-radius: 999px;
  right: 10px;
  top: auto;
  bottom: 10px;
  z-index: 2;
  color: var(--m-accent-700);
  border: 1px solid var(--m-border);
}

body.modern-ui.dark-mode #present .rblock { color: var(--m-link); }

/* presents grid (profile view) spacing */
body.modern-ui .presents-item { padding: 8px; }

/* pagination footer bar */
body.modern-ui .cat_categories2 {
  background: var(--m-surface-2);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm) !important;
  padding: 9px 14px;
  margin-top: 10px;
}

body.modern-ui .cat_categories2 a { color: var(--m-link) !important; font-weight: 600; }

/* releaser / traffic stats table */
body.modern-ui #traf-stats-tbl {
  background: var(--m-surface) !important;
  border: 1px solid var(--m-border) !important;
  border-radius: var(--m-radius-sm);
  overflow: hidden;
  box-shadow: var(--m-shadow-sm);
}

body.modern-ui #traf-stats-tbl th {
  background: var(--m-surface-2) !important;
  color: var(--m-text) !important;
}

body.modern-ui #traf-stats-tbl th,
body.modern-ui #traf-stats-tbl td { border-color: var(--m-border) !important; }

/* poster name */
body.modern-ui .poster_info .nick {
  font-size: 15px;
  margin: 4px 0 6px;
  color: var(--m-text);
}

body.modern-ui .poster_info .nick a { color: var(--m-link) !important; }

/* poster meta text */
body.modern-ui .poster_info p { color: var(--m-text-muted); }
body.modern-ui .poster_info em { color: var(--m-text); font-weight: 600; font-style: normal; }

/* avatar block card */
body.modern-ui .topicAva {
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  padding: 8px;
}

body.modern-ui .topicAvaB {
  background: var(--m-surface) !important;
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius-sm);
  margin-top: 8px;
  padding: 10px 12px;
}

body.modern-ui .poster_info .avatar img {
  border-radius: 14px;
  max-width: 150px;
  height: auto;
}

/* banned badge */
body.modern-ui .poster-banned {
  background: rgba(220, 38, 38, .1);
  border-color: #dc2626;
  border-radius: var(--m-radius-xs);
  color: #dc2626;
}

/* ================================================================== *
   viewforum — topic list polish (CSS only, markup untouched)
 * ================================================================== */

/* topic titles — bigger & clearer */
body.modern-ui .tt-text,
body.modern-ui a.topictitle,
body.modern-ui a.torTopic {
  font-size: 13px;
  font-weight: 600;
}

body.modern-ui .tt-text b { font-weight: 700; }

/* author line */
body.modern-ui .topicAuthor,
body.modern-ui a.topicAuthor,
body.modern-ui a.topicAuthor:visited { color: var(--m-text-muted); }

/* section separator rows */
body.modern-ui td.topicSep {
  color: var(--m-text);
  text-transform: uppercase;
  font-size: 11px;
  border-left: 3px solid var(--m-accent) !important;
}

/* row hover (backgrounds come from <col>, so highlight the cells) */
body.modern-ui #forum-table tr:hover > td:not(.topicSep):not(.catBottom) {
  background: var(--m-accent-soft);
}

/* topic badges → pills */
body.modern-ui .topicPoll {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
}

body.modern-ui.dark-mode .topicPoll { color: var(--m-link); }

body.modern-ui .iconDL {
  display: inline-block;
  border: 0 !important;
  border-radius: 999px;
  padding: 1px 9px;
  margin: 2px 2px 2px 0;
  font-size: 10px;
  background: var(--m-accent-soft) !important;
  color: var(--m-accent-700);
  vertical-align: middle;
}

body.modern-ui.dark-mode .iconDL { color: var(--m-link); }

body.modern-ui .topicPG a { color: var(--m-link) !important; }

/* primary "post new topic" CTA */
body.modern-ui .btn-post-topic {
  border: 0;
  border-radius: 999px;
  padding: 7px 18px;
  font-weight: 600;
  color: #fff !important;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui .btn-post-topic:hover {
  filter: brightness(1.06);
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

/* subforum list (viewforum top) */
body.modern-ui .forumlink a {
  font-size: 14px;
  font-weight: 700;
  color: var(--m-text) !important;
}

body.modern-ui .forumlink a:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .forumlink a:hover { color: var(--m-link) !important; }

body.modern-ui .forum_desc { color: var(--m-text-muted); }
body.modern-ui .last_topic a { color: var(--m-text) !important; font-weight: 600; }
body.modern-ui .last_topic a:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .last_topic a:hover { color: var(--m-link) !important; }

/* breadcrumb separators (shared .nav) — soften the » marks site-wide */
body.modern-ui .nav em { color: var(--m-text-muted); font-style: normal; }

/* ================================================================== *
   Statistics block (#board_stats) — modern typography
 * ================================================================== */
body.modern-ui #board_stats_wrap .forum_icon {
  width: 26px;
  height: 26px;
  padding: 9px;
  border-radius: 12px;
  background: var(--m-accent-soft);
  box-sizing: content-box;
  vertical-align: top;
}

body.modern-ui #board_stats_wrap .med p {
  margin: 4px 0;
  line-height: 1.65;
  font-size: 12px;
}

body.modern-ui #board_stats_wrap .hr1 {
  border-top: 1px solid var(--m-border) !important;
  margin: 12px 0 !important;
}

body.modern-ui #board_stats_wrap a {
  color: var(--m-link) !important;
  font-weight: 600;
}

/* online users list spacing */
body.modern-ui #online_userlist { line-height: 1.9; }
body.modern-ui #online_explain { color: var(--m-text-muted); }

/* "data for the last five minutes" footnote */
body.modern-ui #board_stats .small,
body.modern-ui #board_stats i { color: var(--m-text-muted); }

/* ================================================================== *
   memberlist / search / private messages / groups
 * ================================================================== */

/* avatars rendered by get_avatar() have no class — round them where we
   tag the cell/wrapper with .m-ava (memberlist, group member tables) */
body.modern-ui .m-ava img {
  border-radius: 10px;
  vertical-align: middle;
  max-width: 80px;
  height: auto;
}

/* private messages — folder nav → pill buttons */
body.modern-ui .m-pm-folders {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px auto 14px;
}

body.modern-ui .m-pm-folder {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-surface-2);
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
}

body.modern-ui .m-pm-folder:hover {
  border-color: var(--m-accent);
  transform: translateY(-1px);
}

body.modern-ui .m-pm-folder .pm_box_icon { width: 18px; height: 18px; }
body.modern-ui .m-pm-folder a { color: var(--m-text) !important; text-decoration: none !important; }
body.modern-ui .m-pm-folder a:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode .m-pm-folder a:hover { color: var(--m-link) !important; }

/* active folder (rendered as plain text, no link) → highlighted */
body.modern-ui .m-pm-folder:not(:has(a)) {
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
  border-color: transparent;
  color: #fff;
}

body.modern-ui .m-pm-folder:not(:has(a)) .pm_box_icon { filter: brightness(0) invert(1); opacity: .9; }

/* mailbox usage box → clean card */
body.modern-ui .pm_box_size {
  border-radius: var(--m-radius-sm) !important;
  overflow: hidden;
}

body.modern-ui .pm_box_size td { padding: 5px 10px; }

/* private messages — mailbox usage bar → rounded accent */
body.modern-ui .pm_box_size .progress {
  border-radius: 999px;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%) !important;
}

body.modern-ui .pm_box_size td.row3 {
  padding: 3px;
  border-radius: 999px;
}

/* primary option submit buttons (mainoption) → orange */
body.modern-ui input.mainoption {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

body.modern-ui input.mainoption:hover {
  filter: brightness(1.06);
  background: linear-gradient(135deg, var(--m-accent) 0%, var(--m-accent-600) 100%);
}

/* search: keep the username popup box tidy */
body.modern-ui table.search_username { box-shadow: var(--m-shadow-sm); }

/* ================================================================== *
   News widgets — Новости трекера / Новости в сети (#latest_news)
 * ================================================================== */

/* two columns side by side, stack on narrow screens */
body.modern-ui .news-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

body.modern-ui .news-row > .ss-block {
  flex: 1 1 320px;
  margin-bottom: 0;
}

body.modern-ui #latest_news { margin-bottom: 16px; }
body.modern-ui #latest_news table { width: 100%; border-collapse: collapse; }

/* rows: separators + hover (compact) */
body.modern-ui #latest_news td {
  padding: 3px 9px;
  border-top: 1px solid var(--m-border);
  vertical-align: middle;
}

body.modern-ui #latest_news a { font-size: 12px; }

body.modern-ui #latest_news tr:first-child td { border-top: 0; }
body.modern-ui #latest_news tr:hover td { background: var(--m-accent-soft); }

/* date → rounded accent chip (drop legacy grey bordered box) */
body.modern-ui .news_date {
  float: none;
  display: inline-block;
  padding: 1px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--m-accent-soft);
  color: var(--m-accent-700);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}

body.modern-ui.dark-mode .news_date { color: var(--m-link); }

/* title (drop the legacy gradient image, accent on hover) */
body.modern-ui .news_title {
  background: none;
  padding: 0;
  margin: 0;
}

body.modern-ui #latest_news a {
  color: var(--m-text) !important;
  font-weight: 500;
}

body.modern-ui #latest_news a:hover { color: var(--m-accent-700) !important; }
body.modern-ui.dark-mode #latest_news a:hover { color: var(--m-link) !important; }

body.modern-ui #latest_news .new a {
  color: var(--m-accent-700) !important;
  font-weight: 700;
}

body.modern-ui.dark-mode #latest_news .new a { color: var(--m-link) !important; }

/* ================================================================== *
   Dark mode — kill the legacy neutral greys
   (legacy dark-mode.css paints #main_content #2b2b2b, table.forumline
   #555, .row3 #4a4a4a, editor cells #333… and wins on specificity —
   override with body.modern-ui.dark-mode + !important to keep the
   theme's dark surfaces everywhere)
 * ================================================================== */
/* containers */
body.modern-ui.dark-mode #body_container,
body.modern-ui.dark-mode div#body_container {
  background: var(--m-bg) !important;
}

body.modern-ui.dark-mode #main_content,
body.modern-ui.dark-mode #main_content_wrap,
body.modern-ui.dark-mode #page_content {
  background: transparent !important;
}

body.modern-ui.dark-mode #page_container {
  background: var(--m-bg) !important;
  border-color: var(--m-border) !important;
}

/* table shells → dark surface */
body.modern-ui.dark-mode table.forumline,
body.modern-ui.dark-mode table.bordered,
body.modern-ui.dark-mode table.topic,
body.modern-ui.dark-mode table.bodyline,
body.modern-ui.dark-mode .bodyline,
body.modern-ui.dark-mode table.forumline.message {
  background: var(--m-surface) !important;
}

/* table cells transparent — beats legacy `.forumline td {#3a3a3a}` etc.,
   so the colour comes from the row/col/table instead of the grey */
body.modern-ui.dark-mode .forumline tr,
body.modern-ui.dark-mode .forumline td,
body.modern-ui.dark-mode .bordered tr,
body.modern-ui.dark-mode .bordered td,
body.modern-ui.dark-mode .attach tr,
body.modern-ui.dark-mode .attach td {
  background: transparent !important;
}

/* primary surface rows/cells */
body.modern-ui.dark-mode .row1,
body.modern-ui.dark-mode .row1 td,
body.modern-ui.dark-mode .row4,
body.modern-ui.dark-mode .row4 td,
body.modern-ui.dark-mode .prow1,
body.modern-ui.dark-mode .has_sf,
body.modern-ui.dark-mode td.message,
body.modern-ui.dark-mode .message.td2 {
  background: var(--m-surface) !important;
}

/* secondary surfaces (headers, alt rows, author column, editor cells) */
body.modern-ui.dark-mode .row2,
body.modern-ui.dark-mode .row2 td,
body.modern-ui.dark-mode .row3,
body.modern-ui.dark-mode .row3 td,
body.modern-ui.dark-mode .row5,
body.modern-ui.dark-mode .row5 td,
body.modern-ui.dark-mode .row6,
body.modern-ui.dark-mode .row6 td,
body.modern-ui.dark-mode .row7,
body.modern-ui.dark-mode .prow2,
body.modern-ui.dark-mode .prow3,
body.modern-ui.dark-mode .poster_info,
body.modern-ui.dark-mode .topic .td1,
body.modern-ui.dark-mode .forumline th,
body.modern-ui.dark-mode .attach th,
body.modern-ui.dark-mode .thHead,
body.modern-ui.dark-mode .cat,
body.modern-ui.dark-mode td.cat,
body.modern-ui.dark-mode td.catHead,
body.modern-ui.dark-mode td.catBottom,
body.modern-ui.dark-mode .cat_title,
body.modern-ui.dark-mode .catTitle,
body.modern-ui.dark-mode .ss-head,
body.modern-ui.dark-mode .post_head,
body.modern-ui.dark-mode .infobox,
body.modern-ui.dark-mode .infobox h1,
body.modern-ui.dark-mode .menu-sub th,
body.modern-ui.dark-mode table.message td,
body.modern-ui.dark-mode table.forumline.message th,
body.modern-ui.dark-mode table.forumline.message td {
  background: var(--m-surface-2) !important;
}

/* borders → dark theme border */
body.modern-ui.dark-mode table.forumline,
body.modern-ui.dark-mode .forumline th,
body.modern-ui.dark-mode .forumline td,
body.modern-ui.dark-mode table.bordered,
body.modern-ui.dark-mode .bordered th,
body.modern-ui.dark-mode .bordered td,
body.modern-ui.dark-mode table.topic,
body.modern-ui.dark-mode .topic .td1,
body.modern-ui.dark-mode .topic .td2,
body.modern-ui.dark-mode .topic .td3,
body.modern-ui.dark-mode .bodyline {
  border-color: var(--m-border) !important;
}

/* form controls → distinct dark field, high-contrast bright text, visible
   border (so editor/title/search fields don't blend into the dark theme) */
body.modern-ui.dark-mode input[type="text"],
body.modern-ui.dark-mode input[type="password"],
body.modern-ui.dark-mode input[type="search"],
body.modern-ui.dark-mode input[type="email"],
body.modern-ui.dark-mode input[type="number"],
body.modern-ui.dark-mode input.post,
body.modern-ui.dark-mode input[name="subject"],
body.modern-ui.dark-mode textarea,
body.modern-ui.dark-mode textarea.editor,
body.modern-ui.dark-mode #message,
body.modern-ui.dark-mode select,
body.modern-ui.dark-mode #search-text {
  background: #11151b !important;
  color: #eef2f7 !important;
  border: 1px solid #39424f !important;
}

body.modern-ui.dark-mode input::placeholder,
body.modern-ui.dark-mode textarea::placeholder {
  color: #8a93a3 !important;
}

body.modern-ui #page_content {
  padding: 1px 1px 0;
  margin: 0 auto;
  clear: both;
  position: relative;
}

body.modern-ui #sidebar1-wrap {
  margin-top: -1px;
  width: 248px;
}

