body {
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #f9fafb;
  color: #111;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1000px;
  margin: 0rem auto;
  padding: 1rem;
}

h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-top: 0rem;
  margin-bottom: 1.5rem;
}

/* 3列を基本にする */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* 画面が狭くなっても 1 列にはせず 2 列を維持する */
@media screen and (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* さらに狭い幅でも 2 列を維持。必要なら余白を少し詰める */
@media screen and (max-width: 420px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.cat-nav {
  margin: 0px auto 20px;
}
.cat-link {
  margin: 0 10px;
  padding: 6px 12px;
  background: #e5e7eb;
  color: #374151;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.cat-link:first-child {
  margin-left: 0px;
}

.cat-link.active {
  background-color: #111;
  color: #fff;
  font-weight: bold;
}

.card {
  display: block;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-decoration: none;
  color: inherit;
  padding: 0rem;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}


.info {
  padding: 0.2rem 0.5rem 0.2rem 0.5rem;
}

.info h2 {
  font-size: 0.85rem;
  margin: 0;
}

.info .desc {
  font-size: 0.7rem;
  color: #555;
  margin: 0.3rem 0;
  line-height: 1.4;
}

.info .url {
  display: none;
  font-size: 0.85rem;
  color: #777;
  word-break: break-all;
}

.loading {
  color: #666;
  margin-top: 1rem;
}


/* カード内レイアウトはそのまま */
.card-inner {
  display: inline-block;
  gap: 0.5rem;
  align-items: center;
  height: 120px;       /* 固定の高さ */
  overflow: hidden;
}

/* .img-box を card-inner の高さに合わせる */
.img-box {
  position: relative;
  flex: 0 0 100px;     /* 幅を固定しつつ高さも同じに */
  height: 100%;        /* 親 (.card-inner) の高さに追従 */
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

/* 画像を縦横比を保ってトリミング（小さい辺フィット） */
.img-box .icon {
  width: 100%;
  height: 100%;
  object-fit: cover;       /* 小さい方を合わせて中央トリミング */
  object-position: center; /* 左右・上下とも中央基準 */
  border-radius: 8px;
}

/* フォールバック文字の中央配置 */
.icon-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #e5e7eb;
  color: #555;
  font-weight: 600;
  font-size: 1.2rem;
}

/* 2カラム維持のグリッドは前の指示どおり */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media screen and (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media screen and (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
