/* カラー一覧 */
.color-list-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 16px 10px;
  width: 100%;
  margin: 16px 0;
}

/* カラー選択ボタン */
.color-list-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* 丸い色見本 */
.color-list-swatch {
  display: block;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  max-width: 100%;
  border: 1px solid #d5d5d5;
  border-radius: 50%;
  box-sizing: border-box;
}

/* マウス・キーボード操作時 */
.color-list-item:hover .color-list-swatch,
.color-list-item:focus-visible .color-list-swatch {
  outline: 2px solid #ea9413;
  outline-offset: 3px;
}

/* カラー名 */
.color-list-name {
  display: block;
  width: 100%;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ポップアップの背景 */
.color-popup-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483647 !important;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.78);
}

/* ポップアップ表示中 */
.color-popup-overlay.is-open {
  display: flex !important;
}

/* ポップアップ本体 */
.color-popup-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-sizing: border-box;
}

/* 閉じるボタン */
.color-popup-close {
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #222;
  font-family: Arial, sans-serif;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* ポップアップ内のカラー名 */
.color-popup-name {
  max-width: 90vw;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

/* 拡大画像 */
.color-popup-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 78vh;
  margin: 0;
  padding: 0;
  border: none;
  object-fit: contain;
}

/* ポップアップ表示中は背面をスクロールさせない */
body.color-popup-open {
  overflow: hidden !important;
}

@media (max-width: 600px) {
  .color-list-items {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 6px;
  }

  .color-list-swatch {
    width: 38px;
    height: 38px;
  }

  .color-list-name {
    font-size: 11px;
  }

  .color-popup-overlay {
    padding: 12px;
  }

  .color-popup-image {
    max-width: 94vw;
    max-height: 75vh;
  }
}