/* Only compatibility rules for the existing eromagazine renderer. Layout comes from the niji gallery parts. */
.yms-topbar__name img { display:block; width:auto; max-width:min(100%,240px); height:30px; object-fit:contain; }
.yms-topbar__name { max-width:240px; min-width:0; white-space:normal; line-height:1.2; }
.yms-topbar .yms-topbar__nav a { color:#fff; }
.yms-layout-gallery .yms-card__cover { display:block; position:relative; width:100%; overflow:hidden; background:#f3f4f6; }
.yms-layout-gallery .yms-gpost__cover .yms-card__cover img { display:block; width:100%; height:100%; object-fit:cover; }
.yms-gmain .yms-gpost .yms-gtags { margin-top:8px; }
.yms-grank__thumb img { width:100%; height:100%; object-fit:cover; }
.yms-grank__list--official { display:block; }
.yms-grank__unlinked { display:flex; align-items:center; gap:10px; padding:5px 0; border-bottom:1px solid #eee; }
.yms-grank__body { min-width:0; }
.yms-grank__article-label { display:block; margin-top:2px; color:#555; font-size:10px; }
.yms-grank__pos--1,.yms-grank__pos--2,.yms-grank__pos--3 { background:#222; }
.yms-profile-doujin .yms-single--gallery .entry-content h2::after { background:#222; }
.yms-profile-doujin .yms-single--gallery .yf-five-lead { border-left-color:#222; }
.yms-gcommerce__btn { background:#222; color:#fff!important; box-shadow:none; }
.yms-gcommerce__btn:focus-visible { outline-color:#222; }
.yms-topbar .yms-topbar__ddmenu a { color:#fff; }
@media(max-width:767px){
 .yms-topbar__name { max-width:min(56vw,180px); font-size:16px; }
 .yms-topbar__name img { height:20px; max-width:100%; }
}

/* Intrinsic cover/title widths must not enlarge a gallery grid track. */
.yms-gstrip--rank .yms-homerank__board { grid-template-columns:repeat(5,minmax(0,1fr)); }
.yms-homerank__cell, .yms-homerank__link, .yms-gpost { min-width:0; }
.yms-homerank__name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.yme-design-v1 .yms-homerank__cover img { width:100%; height:100%; object-fit:cover; }
body.yme-design-v1 .yms-gpost__cover .yms-card__cover img { height:100%; }
.yms-layout-gallery .yms-gpost__cover .yms-card__cover { aspect-ratio:4/3; }
@media(max-width:899px){
 .yms-gstrip--rank .yms-homerank__board { grid-template-columns:repeat(3,minmax(0,1fr)); }
 .yms-gstrip--rank .yms-homerank__board > *:nth-child(n+9) { display:list-item; }
}

body.yme-design-v1 .yms-gpost__cover .yms-card__cover img { position:absolute; inset:0; }
.yms-layout-gallery a.yms-gbtn { color:#fff; }
.yme-footer { background:#0a0a0a; }
body.yme-design-v1 .yme-footer__brand img { display:block; width:auto; max-width:min(100%,220px); height:28px; aspect-ratio:1798/229; object-fit:contain; }
@media(max-width:767px){ body.yme-design-v1 .yme-footer__brand img { max-width:180px; height:23px; } }
.yme-visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}

/* Keep desktop tags compact; omit the repeated tag rows on phone cards. */
.yms-layout-gallery .yms-gmain { gap: 15px 12px; }
.yms-layout-gallery .yms-gpost__meta { margin: 7px 0 3px; }
.yms-layout-gallery .yms-gpost__title { margin-bottom: 4px; }
.yms-layout-gallery .yms-gmain .yms-gpost .yms-gtags { margin-top: 3px; gap: 4px; max-height: 24px; overflow: hidden; }
.yms-layout-gallery .yms-gpost .yms-gtag { min-height: 22px; padding: 3px 6px; font-size: 10.5px; }
@media (max-width: 767px) {
  .yms-layout-gallery .yms-gmain { gap: 11px 8px; }
  .yms-layout-gallery .yms-gpost .yms-gtags { display: none; }
}

/* Partner posts use the same compact rhythm as the ranking list. */
.yms-layout-gallery .yms-prss__list { display: block; }
.yms-layout-gallery .yms-prss__row { border-bottom: 1px solid #eee; }
.yms-layout-gallery .yms-prss__card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 76px; padding: 5px 0; aspect-ratio: auto; background: none; color: #222; }
.yms-layout-gallery .yms-prss__image { width: 72px; height: 66px; object-fit: cover; }
.yms-layout-gallery .yms-prss__title { font-size: 12px; line-height: 1.4; -webkit-line-clamp: 3; }
.yms-layout-gallery .yms-prss__card:hover .yms-prss__title { text-decoration: underline; }

/* Keep article width readable and place the partner list to its right. */
.yms-layout-gallery .yme-single-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.yms-layout-gallery .yme-single-layout > .yme-single-shell { min-width: 0; width: 100%; max-width: 920px; margin: 0; }
.yms-layout-gallery .yme-single-partners { min-width: 0; }
@media (max-width: 1099px) {
  .yms-layout-gallery .yme-single-layout { display: block; }
  .yms-layout-gallery .yme-single-partners { margin-top: 28px; }
}

/* The ranking edition follows the gallery's three-column reading order.
   Prism marks hierarchy and selection while covers retain their original colour. */
:root {
  --yme-prism: linear-gradient(135deg, #f5b942 0%, #f36b45 48%, #c82e68 100%);
  --yme-prism-surface: linear-gradient(135deg, #965006 0%, #b8472a 48%, #a82b57 100%);
  --niji-prism: var(--yme-prism);
  --niji-prism-surface: var(--yme-prism-surface);
  --niji-violet: #a82b57;
}
.yms-layout-gallery .yms-gbadge {
  background: #c62828 !important;
  color: #fff !important;
  box-shadow: none;
  text-shadow: none;
}
.yms-layout-gallery .yme-ranking-wrap { padding-top: 30px; }
.yms-layout-gallery .yme-ranking-layout { align-items: start; }
.yms-layout-gallery .yme-ranking-page { display: block; min-width: 0; }
.yme-ranking-page .yme-page-head--magazine { margin: 0 0 18px; border: 0; padding: 0; }
.yme-ranking-page .yme-page-head--magazine h1 { margin: 0; font-size: clamp(28px, 2.7vw, 34px); font-weight: 500; line-height: 1.35; letter-spacing: -.035em; }
.yme-ranking-page .yme-provider-tabs { display: flex; width: max-content; margin: 0 0 16px; border: 0; border-radius: 0; padding: 0; gap: 8px; background: transparent; }
.yme-ranking-page .yme-provider-tabs a { position: relative; min-width: 106px; min-height: 36px; border: 1px solid #e1e3e8; border-radius: 3px; background: #f3f4f6; color: #4b5563!important; font-size: 12px; }
.yme-ranking-page .yme-provider-tabs a + a { border-left: 1px solid #e1e3e8; }
.yme-ranking-page .yme-provider-tabs a.is-current { border-color: #111; background: #111; color: #fff!important; }
.yme-ranking-page .yme-provider-tabs a.is-current::after,
.yme-ranking-page .yme-ranking-period a.is-active::after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--yme-prism); }
.yme-ranking-page .yme-ranking-filters { display: flex; gap: 10px; align-items: center; margin: 0 0 20px; padding: 0; border: 0; }
.yme-ranking-page .yme-ranking-period { display: flex; flex: 1 1 360px; gap: 7px; }
.yme-ranking-page .yme-ranking-period a { position: relative; display: flex; flex: 1; min-width: 0; min-height: 44px; align-items: center; justify-content: center; border: 1px solid #e1e3e8; border-radius: 3px; background: #f3f4f6; padding: 7px 8px; color: #465064; font-size: 12px; font-weight: 700; white-space: nowrap; }
.yme-ranking-page .yme-ranking-period a:hover { border-color: #c66879; }
.yme-ranking-page .yme-ranking-period a.is-active { border-color: #111; background: #111; color: #fff; }
.yme-ranking-page .yme-ranking-filters form { gap: 6px; margin-left: auto; }
.yme-ranking-page .yme-ranking-filters select,
.yme-ranking-page .yme-ranking-filters button { min-height: 44px; border-radius: 3px; font-size: 12px; }
.yme-ranking-page .yme-ranking-filters button { background: #111; }
.yme-ranking-page .yme-official-ranking { margin: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; padding: 0; box-shadow: none; }
.yme-ranking-page .yme-official-ranking .yme-section-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.yme-ranking-page .yme-official-ranking .yms-rank__source { margin: 0 0 15px; color: #697386; font-size: 11px; line-height: 1.5; }
.yme-ranking-page .yme-official-ranking-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 29px 12px; }
.yme-ranking-page .yme-official-card { min-width: 0; content-visibility: auto; contain-intrinsic-size: 350px; }
.yme-ranking-page .yme-official-card__cover { aspect-ratio: 1; border-radius: 2px; background: #f1f2f5; box-shadow: none; }
.yme-ranking-page .yme-official-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.yme-ranking-page .yme-official-card__cover::after { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--yme-prism); opacity: 0; pointer-events: none; }
.yme-ranking-page .yme-official-card:hover .yme-official-card__cover::after,
.yme-ranking-page .yme-official-card:focus-visible .yme-official-card__cover::after { opacity: 1; }
.yme-ranking-page .yme-official-card__rank { width: auto; min-width: 35px; height: 24px; border-radius: 0 0 3px 0; padding: 0 7px; background: #222; font-size: 12px; box-shadow: none; }
.yme-ranking-page .yme-official-card:nth-child(1) .yme-official-card__rank { background: #c8a321; }
.yme-ranking-page .yme-official-card:nth-child(2) .yme-official-card__rank { background: #8c8c8c; }
.yme-ranking-page .yme-official-card:nth-child(3) .yme-official-card__rank { background: #a3693d; }
.yme-ranking-page .yme-official-card__body { padding: 5px 0 0; }
.yme-ranking-page .yme-official-card__body strong { min-height: 0; font-size: 13px; font-weight: 700; line-height: 1.45; }
.yme-ranking-side { min-width: 0; }
.yme-ranking-side .yms-ghead { margin-bottom: 12px; }
.yme-ranking-side .yms-gside__sec { margin-bottom: 24px; }

/* Top left DLsite chart: same compact image rows as the reference sidebar. */
.yme-dlsite-side { margin-top: 26px; }
.yme-dlsite-side__tabs { gap: 2px; padding: 3px; border-radius: 8px; }
.yme-dlsite-side__tabs label { min-width: 0; color: #555; font-size: 11px; border-radius: 6px; }
.yme-dlsite-side__tabs input:focus-visible + span { outline: 2px solid #222; outline-offset: 3px; }
.yme-dlsite-side__panel { display: none; }
.yme-dlsite-side:has(#yme-dlsite-side-day:checked) .yme-dlsite-side__panel--day,
.yme-dlsite-side:has(#yme-dlsite-side-week:checked) .yme-dlsite-side__panel--week,
.yme-dlsite-side:has(#yme-dlsite-side-month:checked) .yme-dlsite-side__panel--month,
.yme-dlsite-side:has(#yme-dlsite-side-year:checked) .yme-dlsite-side__panel--year { display: block; }
.yme-dlsite-side__tabs:has(#yme-dlsite-side-day:checked) label[for="yme-dlsite-side-day"],
.yme-dlsite-side__tabs:has(#yme-dlsite-side-week:checked) label[for="yme-dlsite-side-week"],
.yme-dlsite-side__tabs:has(#yme-dlsite-side-month:checked) label[for="yme-dlsite-side-month"],
.yme-dlsite-side__tabs:has(#yme-dlsite-side-year:checked) label[for="yme-dlsite-side-year"] { background: #111; color: #fff; }
.yme-dlsite-side .yms-grank__list { display: block; }
.yme-dlsite-side .yms-grank__thumb { flex-basis: 72px; width: 72px; }
.yme-dlsite-side .yms-grank__row a { gap: 8px; }
.yme-fanza-side__tabs { gap: 2px; padding: 3px; border-radius: 8px; }
.yme-fanza-side__tabs label { min-width: 0; color: #555; font-size: 11px; border-radius: 6px; }
.yme-fanza-side__tabs input:focus-visible + span { outline: 2px solid #222; outline-offset: 3px; }
.yme-fanza-side__panel { display: none; }
.yme-fanza-side:has(#yme-fanza-side-day:checked) .yme-fanza-side__panel--day,
.yme-fanza-side:has(#yme-fanza-side-week:checked) .yme-fanza-side__panel--week,
.yme-fanza-side:has(#yme-fanza-side-month:checked) .yme-fanza-side__panel--month,
.yme-fanza-side:has(#yme-fanza-side-year:checked) .yme-fanza-side__panel--year { display: block; }
.yme-fanza-side__tabs:has(#yme-fanza-side-day:checked) label[for="yme-fanza-side-day"],
.yme-fanza-side__tabs:has(#yme-fanza-side-week:checked) label[for="yme-fanza-side-week"],
.yme-fanza-side__tabs:has(#yme-fanza-side-month:checked) label[for="yme-fanza-side-month"],
.yme-fanza-side__tabs:has(#yme-fanza-side-year:checked) label[for="yme-fanza-side-year"] { background: #111; color: #fff; }
.yme-fanza-side .yms-grank__list { display: block; }
.yme-fanza-side .yms-grank__thumb { flex-basis: 72px; width: 72px; }
.yme-fanza-side .yms-grank__row a { gap: 8px; }
.yme-fanza-side .yms-gbtn { margin-top: 12px; }
.yme-dlsite-side .yms-gbtn { margin-top: 12px; }
.yme-ranking-side .yms-gcats { display: block; }
.yme-ranking-side .yms-gcat { display: flex; min-height: 43px; align-items: center; border-bottom: 1px solid #eceef1; }
.yme-ranking-side .yms-gtags { display: flex; flex-wrap: wrap; gap: 6px; }
.yme-ranking-side .yms-gtag { min-height: 28px; border-radius: 3px; padding: 5px 8px; }
.yme-ranking-side .yms-grank__row a { gap: 8px; padding: 6px 0; }
.yme-ranking-side .yms-grank__thumb { flex: 0 0 84px; width: 84px; aspect-ratio: 4/3; }
.yme-ranking-side .yms-grank__thumb img { width: 100%; height: 100%; object-fit: cover; }
.yme-ranking-side .yms-grank__pos--1 { background: #c8a321; }
.yme-ranking-side .yms-grank__pos--2 { background: #8c8c8c; }
.yme-ranking-side .yms-grank__pos--3 { background: #a3693d; }
.yme-ranking-side .yms-rank__source { margin: -4px 0 8px; font-size: 10px; line-height: 1.45; }
.yme-ranking-side__more { display: block; margin-top: 12px; color: #a82b57; font-size: 12px; font-weight: 700; text-decoration: none; }
.yme-ranking-side .yms-prss { margin-top: 27px; }
.yme-ranking-page a:focus-visible,
.yme-ranking-side a:focus-visible { outline: 2px solid var(--niji-violet); outline-offset: 3px; }
.yme-ranking-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 32px 0 8px; }
.yme-ranking-pagination a { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid #e1e3e8; border-radius: 3px; color: #273043; font-size: 13px; font-weight: 700; text-decoration: none; }
.yme-ranking-pagination a.is-current { border-color: #111; background: #111; color: #fff; box-shadow: inset 0 -3px 0 #f5b942; }
@media (max-width: 1099px) {
  .yms-layout-gallery .yme-ranking-layout { display: flex; flex-direction: column; gap: 30px; }
  .yms-layout-gallery .yme-ranking-page { order: 1; width: 100%; }
  .yms-layout-gallery .yme-ranking-layout > .yms-gside--r { order: 2; width: 100%; }
  .yms-layout-gallery .yme-ranking-layout > .yms-gside--l { order: 3; width: 100%; }
}
@media (max-width: 767px) {
  .yms-layout-gallery .yme-ranking-wrap { padding-top: 20px; }
  .yme-ranking-page .yme-ranking-filters form { width: 100%; margin-left: 0; }
  .yme-ranking-page .yme-ranking-filters select { flex: 1; }
  .yme-ranking-page .yme-official-ranking-grid { gap: 18px 9px; }
  .yme-ranking-page .yme-official-card__body strong { font-size: 12px; }
}
