/* =========================================================
   Affiliate Blocks - Ranking Block
========================================================= */

.ab-ranking,
.ab-ranking * {
  box-sizing: border-box;
}

.ab-ranking {
  width: 100%;
  max-width: 920px;
  margin: 32px auto;
  padding: 24px 18px;
  background: linear-gradient(180deg, #fffaf0 0%, var(--ab-ranking-bg, #ffffff) 45%, #ffffff 100%);
  border: 3px solid var(--ab-ranking-accent, #f59e0b);
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.16);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: #222;
  overflow: hidden;
}

/* ===============================
   見出し
================================ */

.ab-ranking-head {
  text-align: center;
  margin: 0 0 24px;
}

.ab-ranking-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 16px;
  background: var(--ab-ranking-accent, #f59e0b);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.ab-ranking-title {
  margin: 0 0 10px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #222;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.ab-ranking-description {
  max-width: 720px;
  margin: 0 auto !important;
  color: #555;
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
}

/* ===============================
   ランキングリスト
================================ */

.ab-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ab-ranking-card {
  position: relative;
  padding: 22px;
  background: #fff;
  border: 2px solid #f1f1f1;
  border-radius: 22px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.ab-ranking-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--ab-ranking-accent, #f59e0b);
}

.ab-ranking-card.is-rank-1 {
  border-color: #f6c343;
  background: linear-gradient(180deg, #fff8df 0%, #ffffff 38%);
  box-shadow: 0 12px 30px rgba(246, 195, 67, 0.26);
}

.ab-ranking-card.is-rank-2 {
  border-color: #94a3b8;
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 38%);
  box-shadow: 0 10px 26px rgba(100, 116, 139, 0.18);
}

.ab-ranking-card.is-rank-3 {
  border-color: #c98945;
  background: linear-gradient(180deg, #fff4e8 0%, #ffffff 38%);
  box-shadow: 0 10px 26px rgba(180, 83, 9, 0.16);
}

.ab-ranking-card.is-rank-normal {
  border-color: #e5e7eb;
}
/* ===============================
   順位バッジ
================================ */

.ab-ranking-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  margin: 0 0 14px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
  border: 2px solid transparent;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

/* 1位：金 */
.ab-ranking-card.is-rank-1 .ab-ranking-rank-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #fde68a 100%);
  color: #4a2c00;
  border-color: #f59e0b;
  box-shadow: 0 7px 16px rgba(245, 158, 11, 0.28);
}

/* 2位：濃い青 */
.ab-ranking-card.is-rank-2 .ab-ranking-rank-badge {
  background: linear-gradient(135deg, #1d4ed8 0%, #60a5fa 100%);
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 7px 16px rgba(29, 78, 216, 0.24);
}

/* 3位：青系 少し薄め */
.ab-ranking-card.is-rank-3 .ab-ranking-rank-badge {
  background: linear-gradient(135deg, #2563eb 0%, #93c5fd 100%);
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 7px 16px rgba(37, 99, 235, 0.2);
}

/* 4位以降：落ち着いた青系 */
.ab-ranking-card.is-rank-normal .ab-ranking-rank-badge {
  background: linear-gradient(135deg, #3b82f6 0%, #bfdbfe 100%);
  color: #0f172a;
  border-color: #3b82f6;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.16);
}

/* ===============================
   ラベル
================================ */

.ab-ranking-label {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 12px;
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

/* ===============================
   本体レイアウト
================================ */

.ab-ranking-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: start;
}

.ab-ranking-image {
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #eee;
  background: #f8fafc;
}

.ab-ranking-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.ab-ranking-main {
  min-width: 0;
}

.ab-ranking-name {
  margin: 0 0 10px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #222;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.35;
}

/* ===============================
   星評価
================================ */

.ab-ranking-rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.ab-ranking-stars {
  display: inline-flex;
  gap: 2px;
  line-height: 1;
}

.ab-ranking-star {
  color: #ddd;
  font-size: 20px;
  line-height: 1;
}

.ab-ranking-star.is-active {
  color: #f59e0b;
}

.ab-ranking-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  background: #111827;
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

/* ===============================
   説明文
================================ */

.ab-ranking-text {
  margin: 0 0 16px !important;
  color: #444;
  font-size: 15px;
  line-height: 1.8;
}

/* ===============================
   メリット・注意点
================================ */

.ab-ranking-points {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 16px;
}

.ab-ranking-points.is-merit {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.ab-ranking-points.is-demerit {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.ab-ranking-points-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.4;
}

.ab-ranking-points.is-merit .ab-ranking-points-title {
  color: #15803d;
}

.ab-ranking-points.is-demerit .ab-ranking-points-title {
  color: #c2410c;
}

.ab-ranking-points ul {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.ab-ranking-points li {
  position: relative;
  margin: 8px 0 !important;
  padding: 0 0 0 28px !important;
  color: #333;
  font-size: 15px;
  line-height: 1.7;
}

.ab-ranking-points li::before {
  position: absolute;
  top: 0.1em;
  left: 0;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 21px;
  text-align: center;
}

.ab-ranking-points.is-merit li::before {
  content: "✓";
  background: #22c55e;
}

.ab-ranking-points.is-demerit li::before {
  content: "!";
  background: #f97316;
}

/* ===============================
   CTA
================================ */

.ab-ranking-cta-wrap {
  margin: 18px 0 0;
  text-align: center;
}

.ab-ranking-microcopy {
  display: inline-block;
  position: relative;
  margin: 0 0 8px;
  color: #e11d48;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.ab-ranking-microcopy::before,
.ab-ranking-microcopy::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin: 0 7px 4px;
  background: currentColor;
}

.ab-ranking-microcopy::before {
  transform: rotate(35deg);
}

.ab-ranking-microcopy::after {
  transform: rotate(-35deg);
}

.ab-ranking-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 440px);
  min-height: 56px;
  margin: 0 auto;
  padding: 14px 26px;
  background: var(--ab-ranking-button, #ef4444);
  color: #fff !important;
  border-radius: 999px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18), 0 12px 22px rgba(239, 68, 68, 0.25);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  text-decoration: none !important;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.ab-ranking-button::after {
  content: "›";
  margin-left: 10px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.ab-ranking-button:hover {
  transform: translateY(2px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18), 0 9px 18px rgba(239, 68, 68, 0.22);
  filter: brightness(1.04);
}

.ab-ranking-button.is-shiny::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -80%;
  width: 45%;
  height: 180%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 35%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(255, 255, 255, 0.2) 65%,
    transparent 100%
  );
  transform: rotate(25deg);
  animation: abRankingShine 2.6s infinite;
}

@keyframes abRankingShine {
  0% {
    left: -90%;
  }
  45% {
    left: 130%;
  }
  100% {
    left: 130%;
  }
}

/* ===============================
   CTAボタンサイズ
================================ */

.ab-ranking-button.is-size-small {
  width: min(100%, 340px);
  min-height: 46px;
  padding: 10px 20px;
  font-size: 14px;
}

.ab-ranking-button.is-size-medium {
  width: min(100%, 440px);
  min-height: 56px;
  padding: 14px 26px;
  font-size: 17px;
}

.ab-ranking-button.is-size-large {
  width: min(100%, 560px);
  min-height: 66px;
  padding: 18px 32px;
  font-size: 20px;
}

/* =========================================================
   編集画面用
========================================================= */

.ab-ranking-block-editor {
  max-width: 100%;
}

.ab-ranking-block-editor .ab-ranking-card {
  padding: 22px;
}

.ab-ranking-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 14px;
}

.ab-ranking-card-top .components-base-control {
  flex: 1;
  margin-bottom: 0;
}

.ab-ranking-edit-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: start;
}

.ab-ranking-image-area {
  padding: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  text-align: center;
}

.ab-ranking-image-area img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 10px;
  border-radius: 12px;
}

.ab-ranking-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin: 0 0 10px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  font-weight: 800;
}

.ab-ranking-admin-button,
.ab-ranking-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #334155 !important;
  font-weight: 800;
  box-shadow: none !important;
}

.ab-ranking-admin-button.is-remove {
  margin-top: 8px;
  color: #dc2626 !important;
  border-color: #fecaca !important;
}

.ab-ranking-content-area .components-base-control {
  margin-bottom: 14px;
}

.ab-ranking-preview-box {
  margin: 16px 0 0;
  padding: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

.ab-ranking-service-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 8px;
}

.ab-ranking-service-head .ab-ranking-label {
  margin: 0;
}

.ab-ranking-service-head .ab-ranking-name {
  font-size: 18px;
}

.ab-ranking-card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid #eee;
}

.ab-ranking-card-controls .components-button {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  font-weight: 700;
}

.ab-ranking-card-controls .components-button.is-destructive {
  color: #dc2626;
  border-color: #fecaca;
}

.ab-ranking-add-wrap {
  margin: 24px 0 0;
  text-align: center;
}

.ab-ranking-add-button {
  min-height: 44px;
  padding: 10px 20px !important;
  background: var(--ab-ranking-accent, #f59e0b) !important;
  color: #fff !important;
  border-color: var(--ab-ranking-accent, #f59e0b) !important;
}

/* =========================================================
   スマホ対応
========================================================= */

@media (max-width: 768px) {
  .ab-ranking {
    margin: 24px auto;
    padding: 18px 12px;
    border-radius: 20px;
  }

  .ab-ranking-title {
    font-size: 22px;
  }

  .ab-ranking-description {
    font-size: 14px;
    text-align: left;
  }

  .ab-ranking-card {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .ab-ranking-card::before {
    width: 6px;
  }

  .ab-ranking-rank-badge {
    min-width: 104px;
    padding: 7px 13px 7px 10px;
    font-size: 15px;
    gap: 8px;
  }

  .ab-ranking-rank-badge::before {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .ab-ranking-body,
  .ab-ranking-edit-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ab-ranking-name {
    font-size: 21px;
  }

  .ab-ranking-rating {
    flex-wrap: wrap;
  }

  .ab-ranking-star {
    font-size: 19px;
  }

  .ab-ranking-text,
  .ab-ranking-points li {
    font-size: 14px;
  }

  .ab-ranking-points {
    padding: 13px 14px;
  }

  .ab-ranking-button {
    width: 100%;
    min-height: 54px;
    padding: 13px 18px;
    font-size: 16px;
  }

  .ab-ranking-button.is-size-small,
  .ab-ranking-button.is-size-medium,
  .ab-ranking-button.is-size-large {
    width: 100%;
  }

  .ab-ranking-button.is-size-small {
    min-height: 44px;
    font-size: 14px;
  }

  .ab-ranking-button.is-size-medium {
    min-height: 54px;
    font-size: 16px;
  }

  .ab-ranking-button.is-size-large {
    min-height: 62px;
    font-size: 18px;
  }

  .ab-ranking-card-top {
    flex-direction: column;
  }

  .ab-ranking-card-top .components-base-control {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .ab-ranking {
    padding: 16px 10px;
  }

  .ab-ranking-title {
    font-size: 20px;
  }

  .ab-ranking-card {
    padding: 16px 12px;
  }

  .ab-ranking-name {
    font-size: 19px;
  }

  .ab-ranking-button {
    font-size: 15px;
  }
}

/* =========================================
   Ranking Block：テーマ見出し装飾リセット
========================================= */

.ab-ranking .ab-ranking-title,
.ab-ranking .ab-ranking-name {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  border: none !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ab-ranking .ab-ranking-title::before,
.ab-ranking .ab-ranking-title::after,
.ab-ranking .ab-ranking-name::before,
.ab-ranking .ab-ranking-name::after {
  content: none !important;
  display: none !important;
}