/* =====================================================================
 * ネット系のカード（検索結果・サイト・動画・画像・音声）
 * 描くのは ai-media.js（スマホと共通）
 * ===================================================================== */
.ai-card-link,
.ai-card-site,
.ai-card-video,
.ai-card-image,
.ai-card-audio {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  padding: 8px 10px;
}
.ai-card-link { cursor: pointer; }
.ai-card-link:hover { background: var(--accent-weak); }

.ai-mk-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-mk-desc {
  font-size: 10.5px;
  color: var(--sub);
  line-height: 1.5;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-mk-host {
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* サイト */
.ai-mk-head { display: flex; gap: 8px; align-items: flex-start; }
.ai-mk-main { flex: 1; min-width: 0; }
.ai-mk-thumb {
  width: 58px;
  height: 58px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
}
.ai-mk-btns { display: flex; gap: 6px; margin-top: 7px; }
.ai-mk-btn {
  flex: 1;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid var(--line2, var(--line));
  background: var(--bg);
  color: var(--sub);
  border-radius: 7px;
  padding: 6px 0;
  cursor: pointer;
}
.ai-mk-btn:hover { background: var(--accent-weak); color: var(--accent-ink, var(--accent)); }

/* 埋め込みの枠。押されるまで作らない */
.ai-mk-frame {
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.ai-mk-frame iframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
}
/* 動画は 16:9。
 * height を 0 にしたうえで aspect-ratio を書いてはいけない。
 * aspect-ratio は「高さが auto のとき」だけ効くので、0 が優先されて
 * 枠が潰れ、音だけ鳴って何も映らなくなる（実機でそうなった）。 */
.ai-mk-vframe iframe { height: auto; aspect-ratio: 16 / 9; }
@supports not (aspect-ratio: 1) {
  .ai-mk-vframe iframe { height: 170px; }
}

/* 動画・音楽 */
.ai-mk-play {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}
.ai-mk-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-mk-tri {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 16px;
  line-height: 40px;
  text-align: center;
}
.ai-mk-play:hover .ai-mk-tri { background: var(--accent); }
.ai-mk-len {
  position: absolute;
  right: 5px;
  bottom: 5px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 4px;
}
.ai-card-video .ai-mk-main { margin-top: 6px; }

/* 画像 */
.ai-mk-photo {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  cursor: zoom-in;
  display: block;
}
.ai-mk-cap { font-size: 10.5px; color: var(--sub); margin-top: 5px; text-align: center; }

/* 音声 */
.ai-mk-audio { width: 100%; margin-top: 7px; }

/* 画面に余裕があるときは大きめに */
@media (min-height: 700px) {
  .ai-mk-title { font-size: 13px; }
  .ai-mk-desc { font-size: 12px; }
  .ai-mk-host { font-size: 11px; }
  .ai-mk-btn { font-size: 12px; padding: 8px 0; }
  .ai-mk-thumb { width: 66px; height: 66px; }
  .ai-mk-frame:not(.ai-mk-vframe) iframe { height: 320px; }
}

/* =====================================================================
 * 📎 渡したファイル
 * ===================================================================== */
.ai-attach {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line2, var(--line));
  border-radius: 9px;
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.ai-attach:hover { border-color: var(--accent); background: var(--accent-weak); }

.ai-attached {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 12px 0;
}
.ai-attached.hidden { display: none; }
.ai-att {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  background: var(--accent-weak);
  border: 1px solid var(--line2, var(--line));
  border-radius: 8px;
  padding: 5px 8px;
}
.ai-att.warn { background: #fdf3e7; border-color: #e8c9a0; }
.ai-att-n {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-att-s { flex: none; font-size: 9.5px; color: var(--faint); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-att-x {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.ai-att-x:hover { color: var(--urgent, #c0392b); }

/* 送ったあと、吹き出しの下に「何を渡したか」だけ残す */
.ai-sent-files {
  font-size: 9.5px;
  opacity: 0.8;
  margin-top: 4px;
  word-break: break-all;
}

/* チャットにファイルを落とせることを見せる */
.ai-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }

@media (min-height: 700px) {
  .ai-att { font-size: 12px; padding: 7px 10px; }
  .ai-attach { width: 36px; height: 36px; font-size: 16px; }
}

/* 見る・聴くのカードは横幅をめいっぱい使う。
 * 吹き出しと同じ92%に収めると、360pxのポップアップで動画が
 * 316×178にしかならず、小さくて見づらい */
.ai-cards:has(.ai-card-video),
.ai-cards:has(.ai-card-image),
.ai-cards:has(.ai-card-site) { max-width: 100%; }
