/* リスト外枠 */
#results {
  padding-bottom: 40px;
}

/* PC表示・グリッドレイアウト */
@media (min-width: 768px) {
  #results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
  }

  .result-item {
    border: 1px solid rgba(255,255,255,0.04);
    backdrop-filter: blur(6px);
  }
}

/* 初期：PC（横並び） */
.meta-inline {
  display: inline;
}

.meta-stack {
  display: none;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--sub);
}

/* チャンネル名 */
.meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* モバイル */
@media (max-width: 767px) {
  .meta {
    display: flex;
    align-items: flex-start; /* 上揃えに変更 */
    gap: 10px;
    width: 100%;
  }

  /* チャンネル名：2行まで表示して省略 */
  .meta .channel-name {
    /* 標準プロパティ */
    line-clamp: 2; 
    
    /* 互換性のためのベンダープレフィックス */
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    
    /* レイアウト維持のための設定 */
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* その他 */
    flex: 1;
    max-width: none;
    font-size: 12px;
    line-height: 1.4;
  }

  .meta-inline {
    display: none;
  }

  /* 右側のスタック（視聴回数・日付） */
  .meta-stack {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 34px;           /* 2行分相当の高さで固定 */
    min-width: fit-content; /* 中身に合わせて幅を確保 */
    text-align: right;
    font-size: 11px;
    color: var(--sub);
    flex-shrink: 0;         /* チャンネル名に押し潰されないように固定 */
  }

  .meta-stack span {
    line-height: 1.2;
  }
}

/* チャンネルアイコンの微調整 */
.channel-icon {
  width: 32px;  /* モバイルで見やすいよう少し大きく */
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* カード単体 */
.result-item {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-item:active {
  transform: scale(0.97);
}

/* カードホバーアニメーション */
.result-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}

/* サムネイル・バッジ */
.thumb-wrap {
  position: relative;
}
/* サムネに軽いグラデ（可読性UP） */
.thumb-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.4), transparent 50%);
  pointer-events: none;
}

.result-item .thumbnail-main {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  max-height: 200px;
}

.duration-badge {
  font-family: monospace;
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.85);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 500;
}

/* カード内情報 */
.info {
  padding: 14px 16px;
}

.title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* 視聴回数 */
.views {
  margin-left: auto;
  font-size: 11px;
  color: #b0b6bd;
  opacity: 0.9;
}

.date {
  font-size: 11px;
  color: #8b9096;
  margin-left: 6px;
}

.channel-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-block;
  overflow: hidden;
}

.channel-icon:hover {
  transform: scale(1.08);
  transition: 0.15s;
}

/* 保存バッジを少し浮かせる */
.saved {
  font-size: 10px;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(124,92,255,0.15);
  color: #a78bfa;
}

/* 特殊モード（Musicモード） */
body.music-mode .result-item .thumbnail-main,
.result-item.music img {
  aspect-ratio: 1/1;
  object-fit: cover;
  object-position: center;
}
