/*
Theme Name: MuscleGay Magazine
Theme URI: https://muscle-gay.com
Author: MuscleGay
Description: ダーク×レッド マガジン型テーマ — Layout 2 完全再現版
Version: 1.0.0
License: Private
Text Domain: musclegay
*/

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
  --mg-bg:       #0d0d0d;
  --mg-bg2:      #111111;
  --mg-bg3:      #1a1a1a;
  --mg-border:   #222222;
  --mg-red:      #e63946;
  --mg-red-dark: #c1121f;
  --mg-text:     #e0e0e0;
  --mg-muted:    #888888;
  --mg-card-bg:  #161616;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;        /* 横スクロール完全禁止 */
  max-width: 100vw;
}
body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--mg-bg);
  color: var(--mg-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;        /* 横スクロール完全禁止 */
  max-width: 100vw;
  width: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--mg-red); text-decoration: none; transition: color .2s; }
a:hover { color: #ff6b75; }
ul, ol { list-style: none; }
::selection { background: var(--mg-red); color: #fff; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--mg-red); }

/* ============================================================
   Layout Wrapper
   ============================================================ */
.mg-wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============================================================
   Header
   ============================================================ */
#mg-header {
  background: var(--mg-bg2);
  border-bottom: 1px solid var(--mg-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mg-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.mg-logo {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.mg-logo span { color: var(--mg-red); }
.mg-logo:hover { color: #fff; }

.mg-search {
  display: flex;
  flex: 1;
  max-width: 320px;
  margin: 0 auto;
}
.mg-search input {
  flex: 1;
  background: #1e1e1e;
  border: 1px solid #333;
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}
.mg-search input::placeholder { color: #555; }
.mg-search button {
  background: var(--mg-red);
  border: none;
  border-radius: 0 6px 6px 0;
  padding: 8px 14px;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.mg-search button:hover { background: var(--mg-red-dark); }

.mg-header-cta {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.mg-header-cta a {
  color: #ccc;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #333;
  white-space: nowrap;
}
.mg-header-cta a:hover { color: #fff; border-color: #555; }
.mg-header-cta a.mg-cta-btn {
  background: var(--mg-red);
  color: #fff;
  border-color: var(--mg-red);
  font-weight: 700;
}
.mg-header-cta a.mg-cta-btn:hover { background: var(--mg-red-dark); }

/* ============================================================
   Global Nav
   ============================================================ */
#mg-nav {
  background: #161616;
  border-bottom: 1px solid var(--mg-border);
}
.mg-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 20px;
}
.mg-nav-inner::-webkit-scrollbar { display: none; }
.mg-nav-inner a {
  display: block;
  padding: 13px 16px;
  color: #aaa;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.mg-nav-inner a:hover,
.mg-nav-inner a.current-menu-item,
.mg-nav-inner a.current-cat { color: #fff; border-bottom-color: var(--mg-red); }

/* ============================================================
   Main Layout
   ============================================================ */
.mg-main-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
}
@media (max-width: 960px) {
  .mg-main-wrap { grid-template-columns: 1fr; }
}

/* ============================================================
   Hero Section
   ============================================================ */
.mg-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 28px;
}
@media (max-width: 640px) {
  .mg-hero { grid-template-columns: 1fr; }

  /* === モバイル: 全コンテナ幅を統一・オーバーフロー完全防止 === */

  /* 主要コンテナ: 全部 viewport 幅・統一 padding */
  #mg-header,
  #mg-nav,
  .mg-main-wrap {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .mg-header-inner {
    max-width: 100%;
    width: 100%;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .mg-logo {
    font-size: 17px;
    letter-spacing: 2px;
    flex-shrink: 1;
    min-width: 0;
  }
  .mg-search {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-width: 0;
  }
  .mg-search input {
    min-width: 0;
    font-size: 12px;
    padding: 7px 10px;
  }
  .mg-search button { padding: 7px 12px; font-size: 12px; }
  .mg-header-cta { margin-left: auto; flex-shrink: 0; }
  .mg-header-cta a {
    font-size: 11px;
    padding: 5px 10px;
  }

  .mg-nav-inner {
    max-width: 100%;
    width: 100%;
    padding: 0 12px;
  }
  .mg-nav-inner a {
    padding: 11px 12px;
    font-size: 12px;
  }

  .mg-main-wrap {
    padding: 16px 12px;
    grid-template-columns: 1fr;  /* サイドバーを下に */
  }

  /* 記事グリッド: モバイルでも2列に固定（!importantで確実に） */
  .mg-article-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* 記事数が奇数のとき最後の段が1記事のみになるのを防ぐ（孤立カードを非表示） */
  .mg-article-grid > .mg-a-card:last-child:nth-child(odd) {
    display: none;
  }
  .mg-a-card,
  .mg-a-thumb,
  .mg-a-thumb img {
    max-width: 100%;
  }
  /* 2列時のカード内テキスト調整（狭幅対応） */
  .mg-a-title {
    font-size: 12px;
    line-height: 1.5;
  }
  .mg-a-badge { font-size: 10px; }
  .mg-a-meta { font-size: 10px; }

  /* DUGAプレイヤー（data-w="864"）をレスポンシブに */
  [id^="dugaflvplayer"] {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  [id^="dugaflvplayer"] iframe,
  [id^="dugaflvplayer"] video,
  [id^="dugaflvplayer"] embed,
  [id^="dugaflvplayer"] object {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* 単一記事ページの要素をすべて viewport 内に収める */
  .mg-single-article,
  .mg-single-body,
  .mg-entry-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }
  .mg-entry-content img,
  .mg-entry-content iframe,
  .mg-entry-content video,
  .mg-entry-content table,
  .mg-entry-content pre,
  .mg-single-body img,
  .mg-single-body iframe {
    max-width: 100% !important;
    height: auto !important;
  }
  .mg-entry-content table { display: block; overflow-x: auto; }

  /* サイドバー */
  #mg-sidebar { max-width: 100%; }
  .mg-widget { max-width: 100%; }
}

.mg-hero-main {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.mg-hero-main .mg-thumb {
  height: 300px;
  overflow: hidden;
}
.mg-hero-main .mg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.mg-hero-main:hover .mg-thumb img { transform: scale(1.05); }
.mg-thumb-fallback {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
}
.mg-hero-main .mg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, transparent 60%);
}
.mg-hero-main .mg-overlay-content {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
}
.mg-badge {
  display: inline-block;
  background: var(--mg-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 8px;
}
.mg-hero-main h2 {
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}
.mg-hero-main .mg-meta { font-size: 12px; color: #aaa; }

.mg-hero-sub {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
}
.mg-hero-sub-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.mg-hero-sub-item .mg-thumb {
  height: 149px;
  overflow: hidden;
}
.mg-hero-sub-item .mg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.mg-hero-sub-item:hover .mg-thumb img { transform: scale(1.05); }
.mg-thumb-fallback-sm {
  height: 149px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.mg-hero-sub-item .mg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 60%);
}
.mg-hero-sub-item .mg-sub-content {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
}
.mg-hero-sub-item .mg-sub-content .mg-badge {
  background: rgba(230,57,70,.85);
  font-size: 10px;
  padding: 2px 7px;
  margin-bottom: 5px;
}
.mg-hero-sub-item h3 {
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
}

/* ============================================================
   Section Title
   ============================================================ */
.mg-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--mg-red);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}
.mg-section-title a {
  font-size: 12px;
  font-weight: 400;
  color: #888;
}
.mg-section-title a:hover { color: var(--mg-red); }

/* ============================================================
   Article Grid
   ============================================================ */
.mg-article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
  align-items: start;   /* 各カードを上揃えに */
  justify-items: start; /* セル内で左揃えに（伸びないよう固定） */
}
@media (max-width: 900px) {
  .mg-article-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 540px) {
  .mg-article-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

.mg-a-card {
  display: block;
  width: 100%;        /* グリッドセル幅に合わせる */
  cursor: pointer;
  transition: transform .2s;
}
.mg-a-card:hover { transform: translateY(-3px); }
.mg-a-card:hover .mg-a-thumb { box-shadow: 0 8px 24px rgba(230,57,70,.2); }

.mg-a-thumb {
  aspect-ratio: 16/9;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  transition: box-shadow .2s;
}
.mg-a-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter .2s;
}
.mg-a-card:hover .mg-a-thumb img { filter: brightness(1.1); }
.mg-a-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.mg-a-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--mg-red);
  margin-bottom: 4px;
}
.mg-a-title {
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--mg-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mg-a-card:hover .mg-a-title { color: #fff; }
.mg-a-meta { font-size: 11px; color: #666; }

/* ============================================================
   Pagination
   ============================================================ */
.mg-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 28px 0;
  flex-wrap: wrap;
}
.mg-pagination a,
.mg-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: var(--mg-card-bg);
  border: 1px solid var(--mg-border);
  border-radius: 4px;
  color: var(--mg-text);
  font-size: 13px;
}
.mg-pagination a:hover {
  background: var(--mg-red);
  border-color: var(--mg-red);
  color: #fff;
}
.mg-pagination .current {
  background: var(--mg-red);
  border-color: var(--mg-red);
  color: #fff;
}

/* ============================================================
   Sidebar
   ============================================================ */
.mg-sidebar { display: flex; flex-direction: column; gap: 20px; }

.mg-widget {
  background: var(--mg-bg3);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--mg-border);
}
.mg-widget-head {
  background: var(--mg-red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  letter-spacing: .5px;
}
.mg-widget-body { padding: 14px; }

/* CTA Widget */
.mg-cta-widget {
  background: linear-gradient(135deg, #1a0a0a, #2a0505);
  border: 1px solid #3a1515;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.mg-cta-widget p {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 12px;
  line-height: 1.7;
}
.mg-cta-widget a {
  display: block;
  background: var(--mg-red);
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  transition: background .2s;
}
.mg-cta-widget a:hover { background: var(--mg-red-dark); color: #fff; }

/* Rank items */
.mg-rank-list { list-style: none; }
.mg-rank-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #2a2a2a;
  align-items: flex-start;
}
.mg-rank-item:last-child { border-bottom: none; }
.mg-rank-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.mg-rank-num.r1 { background: var(--mg-red); color: #fff; }
.mg-rank-num.r2 { background: #aaa; color: #000; }
.mg-rank-num.r3 { background: #cd7f32; color: #fff; }
.mg-rank-num.r4, .mg-rank-num.r5 { background: #2a2a2a; color: #666; }
.mg-rank-text { font-size: 12px; line-height: 1.5; color: #ccc; flex: 1; }
.mg-rank-text small { display: block; font-size: 10px; color: #666; margin-top: 2px; }

/* Tag cloud */
.mg-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.mg-tag-cloud a {
  display: inline-block;
  background: #222;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  transition: all .2s;
}
.mg-tag-cloud a:hover { background: var(--mg-red); color: #fff; border-color: var(--mg-red); }

/* New list */
.mg-new-list { list-style: none; }
.mg-new-list li {
  padding: 8px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 12px;
  color: #ccc;
  line-height: 1.5;
}
.mg-new-list li:last-child { border-bottom: none; }
.mg-new-list li a { color: #ccc; display: block; }
.mg-new-list li a:hover { color: var(--mg-red); }
.mg-new-list li small { display: block; font-size: 10px; color: #555; margin-top: 2px; }

/* ============================================================
   Single Post
   ============================================================ */
.mg-single-article {
  background: var(--mg-card-bg);
  border: 1px solid var(--mg-border);
  border-radius: 10px;
  overflow: hidden;
}
.mg-single-thumb img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}
.mg-single-thumb-fallback {
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, #0a0a2a, #1a1a4a);
}
.mg-single-body { padding: 28px; }

.mg-single-cats { margin-bottom: 12px; }
.mg-single-cats a {
  display: inline-block;
  background: var(--mg-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 3px;
  margin-right: 4px;
}
.mg-single-cats a:hover { background: var(--mg-red-dark); color: #fff; }

.mg-single-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  margin-bottom: 14px;
  border-left: 4px solid var(--mg-red);
  padding-left: 14px;
}
.mg-single-meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--mg-border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.mg-single-meta span { display: flex; align-items: center; gap: 5px; }

.mg-entry-content { color: #cccccc; font-size: 15px; line-height: 1.9; }
.mg-entry-content p { margin-bottom: 18px; }
.mg-entry-content h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-left: 4px solid var(--mg-red);
  padding-left: 12px;
  margin: 28px 0 14px;
}
.mg-entry-content h3 {
  font-size: 16px;
  color: #f0f0f0;
  border-bottom: 1px solid var(--mg-border);
  padding-bottom: 8px;
  margin: 22px 0 12px;
}
/* 記事内の全画像を中央寄せ（サイズは元のまま維持） */
.mg-entry-content img,
.mg-single-body img {
  display: block !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 10px auto !important;
  border-radius: 6px;
}
/* 画像を含む<a>タグをブロック化（CSS対応ブラウザ向け） */
.mg-entry-content a:has(img),
.mg-single-body a:has(img) {
  display: block !important;
  text-align: center;
  margin: 10px 0;
}
/* <p>が画像を包んでいる場合も中央寄せ */
.mg-entry-content p:has(img),
.mg-entry-content p:has(a > img) {
  text-align: center;
}
.mg-entry-content a { color: var(--mg-red); }
.mg-entry-content a:hover { color: #ff6b75; }
.mg-entry-content ul, .mg-entry-content ol {
  padding-left: 20px;
  margin-bottom: 16px;
  list-style: disc;
}
.mg-entry-content ol { list-style: decimal; }
.mg-entry-content li { margin-bottom: 6px; }
.mg-entry-content blockquote {
  background: #1a1a2e;
  border-left: 4px solid var(--mg-red);
  padding: 14px 18px;
  border-radius: 4px;
  margin: 16px 0;
  color: #bbb;
}
.mg-entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.mg-entry-content th {
  background: #222;
  color: #fff;
  padding: 10px 12px;
  border: 1px solid var(--mg-border);
  text-align: left;
}
.mg-entry-content td {
  padding: 10px 12px;
  border: 1px solid var(--mg-border);
  color: var(--mg-text);
}

/* CTA in content */
.cta-wrap {
  text-align: center;
  margin: 24px 0;
}
.cta-button {
  display: inline-block;
  background: var(--mg-red);
  color: #fff !important;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: 8px;
  transition: background .2s, transform .2s;
  box-shadow: 0 4px 16px rgba(230,57,70,.4);
}
.cta-button:hover {
  background: var(--mg-red-dark) !important;
  color: #fff !important;
  transform: translateY(-2px);
}

/* Post navigation */
.mg-post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--mg-border);
}
.mg-post-nav a {
  display: block;
  background: var(--mg-bg3);
  border: 1px solid var(--mg-border);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  color: #aaa;
  transition: all .2s;
}
.mg-post-nav a:hover { border-color: var(--mg-red); color: var(--mg-red); }
.mg-post-nav-next { text-align: right; }

/* Related posts */
.mg-related { margin-top: 28px; }

/* ============================================================
   Archive / Search Header
   ============================================================ */
.mg-archive-header {
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--mg-card-bg);
  border-left: 4px solid var(--mg-red);
  border-radius: 0 6px 6px 0;
}
.mg-archive-header h1 {
  font-size: 20px;
  color: #fff;
  margin-bottom: 4px;
}
.mg-archive-header p { font-size: 13px; color: #888; }

/* ============================================================
   Footer
   ============================================================ */
#mg-footer {
  background: var(--mg-bg2);
  border-top: 1px solid var(--mg-border);
  padding: 32px 20px 20px;
  margin-top: 32px;
  text-align: center;
}
.mg-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}
.mg-footer-nav a { color: #555; font-size: 12px; transition: color .2s; }
.mg-footer-nav a:hover { color: var(--mg-red); }
.mg-footer-copy { font-size: 11px; color: #333; }

/* ============================================================
   404 / No Results
   ============================================================ */
.mg-not-found {
  text-align: center;
  padding: 60px 20px;
  background: var(--mg-card-bg);
  border-radius: 10px;
  border: 1px solid var(--mg-border);
}
.mg-not-found h1 { font-size: 80px; color: var(--mg-red); margin-bottom: 8px; }
.mg-not-found h2 { font-size: 20px; color: #fff; margin-bottom: 12px; }
.mg-not-found p { color: #888; margin-bottom: 24px; }
.mg-not-found a {
  display: inline-block;
  background: var(--mg-red);
  color: #fff;
  padding: 10px 28px;
  border-radius: 6px;
  font-weight: 700;
}

/* ============================================================
   Utilities
   ============================================================ */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* Gradient backgrounds for fallback thumbnails */
.mg-grad-1 { background: linear-gradient(135deg,#0a0a2a,#1a1a4a); }
.mg-grad-2 { background: linear-gradient(135deg,#1a2a00,#2a4000); }
.mg-grad-3 { background: linear-gradient(135deg,#2a0a2a,#4a1a3a); }
.mg-grad-4 { background: linear-gradient(135deg,#0d1117,#1a3040); }
.mg-grad-5 { background: linear-gradient(135deg,#2a1a00,#3a2800); }
.mg-grad-6 { background: linear-gradient(135deg,#001a10,#003020); }
.mg-hero-grad-1 { background: linear-gradient(135deg,#1a1a3e,#3d1a40); }
.mg-hero-grad-2 { background: linear-gradient(135deg,#0a1a2a,#1a3a2a); }
.mg-hero-grad-3 { background: linear-gradient(135deg,#2a1500,#4a2800); }

/* 人気順ナビリンク */
#mg-nav .mg-nav-popular { color: #ff6b75; font-weight: 700; }
#mg-nav .mg-nav-popular.current-menu-item {
  border-bottom-color: var(--mg-red);
  color: #fff;
}

/* ヒーロー上の人気作品ヘッダー */
.mg-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mg-hero-header h1 {
  font-size: 20px;
  color: #fff;
  margin-bottom: 0;
}
.mg-hero-header-link {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}
.mg-hero-header-link:hover { color: var(--mg-red); }

/* ============================================================
   Sort Tabs (新着順 / 人気順)
   ============================================================ */
.mg-sort-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.mg-sort-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #aaa;
  background: var(--mg-bg3);
  border: 1px solid #333;
  transition: all .2s;
  text-decoration: none;
}
.mg-sort-tab:hover {
  color: var(--mg-red);
  border-color: var(--mg-red);
}
.mg-sort-tab.active {
  background: var(--mg-red);
  color: #fff;
  border-color: var(--mg-red);
  box-shadow: 0 2px 10px rgba(230,57,70,.35);
}
