:root {
  /* ブロックテーマの色プリセットが見つからない場合の保険（本番寄せの緑） */
  --mg-green-fallback: #0e5b3a;

  /* 可能なら theme.json の primary を拾う（無ければフォールバック） */
  --mg-primary: var(--wp--preset--color--primary, var(--mg-green-fallback));
  --mg-ink: var(--wp--preset--color--base, #ffffff);

  --mg-border: rgba(0, 0, 0, .08);
  --mg-shadow: 0 6px 18px rgba(0, 0, 0, .04);
}

.mg-wrap {
  /* max-width: 1260px; */
  margin: 0 auto;
  /* padding: 28px 16px; */
}

/* Filter */
.mg-filter {
  background: #fff;
  border: 1px solid var(--mg-border);
  border-radius: 14px;
  box-shadow: var(--mg-shadow);
  padding: 18px;
  margin: 0 0 22px;
}

.mg-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

@media (max-width: 980px) {
  .mg-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .mg-filter-grid {
    grid-template-columns: 1fr;
  }
}

.mg-field label {
  display: block;
  font-size: 13px;
  color: #2b2f36;
  margin: 0 0 6px;
  font-weight: 600;
}

.mg-field select,
.mg-field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, .14);
  background: #fff;
  outline: none;
}

.mg-field select:focus,
.mg-field input[type="text"]:focus {
  border-color: rgba(0, 0, 0, .35);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .06);
}

.mg-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mg-btn,
.mg-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--mg-primary);
  background: var(--mg-primary);
  color: var(--mg-ink);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.mg-btn:hover,
.mg-more:hover {
  opacity: .92;
}

.mg-btn.secondary {
  background: #fff;
  color: var(--mg-primary);
  border-color: rgba(0, 0, 0, .18);
}

/* Grid (PC 3 cols / Mobile 1 col) */
.mg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

@media (max-width: 900px) {
  .mg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .mg-grid {
    grid-template-columns: 1fr;
  }
}

.mg-card {
  background: #fff;
  border: 1px solid var(--mg-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--mg-shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}

.mg-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .08);
}

.mg-thumb {
  display: block;
  aspect-ratio: 4/3;
  width: 100%;
  background: #f3f4f6;
  overflow: hidden;
}

.mg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mg-thumb-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #889;
}

.mg-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
}

.mg-card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.mg-card-title a {
  text-decoration: none;
  color: inherit;
}

.mg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: #2b2f36;
}

.mg-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .08);
}

.mg-tags {
  font-size: 15px;
  color: #2b2f36;
  opacity: .9;
  line-height: 1.5;
}

.mg-desc {
  margin: 0;
  font-size: 13px;
  color: #3a3f48;
  line-height: 1.7;
}

.mg-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.mg-pagination {
  margin: 22px 0 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.mg-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  margin: 4px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, .12);
  text-decoration: none;
  color: rgba(0, 0, 0, .85);
  background: #fff;
}

.mg-pagination .page-numbers.current {
  background: var(--mg-primary);
  color: #fff;
  border-color: var(--mg-primary);
}

.mg-empty {
  padding: 20px 0;
}

/* --- Card head (title + area tag) --- */
.mg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mg-area-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(0, 0, 0, .04);
  border: 1px solid rgba(0, 0, 0, .08);
  color: #2b2f36;
  white-space: nowrap;
}

/* --- Thumbnail overlay (type + price) --- */
.mg-thumb {
  position: relative;
}

.mg-overlay {
  position: absolute;
  left: 10px;
  bottom: 10px;
  /* ↓ 右下にしたいので left をやめて right に */
  right: 10px;
  left: auto;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.mg-overlay-pill {
  background: #fff;
  color: #111;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

/* --- Specs row under title (icons + text) --- */
.mg-specs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #2b2f36;
}

.mg-spec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: .95;
}

.mg-spec svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
  opacity: .8;
}

/* ハッシュタグ表示を“それっぽく” */
.mg-tags {
  font-size: 13px;
  color: #2b2f36;
  opacity: .85;
  line-height: 1.5;
}

.mg-key-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}