/* 広告配信・X配信（promo.js）。部品は ui.css（UI.*）、値はトークンだけ（X のプレビューだけは X の見た目に合わせた値）
   面は UI.panel（白・角丸・影）。面の中の区切りだけ 1px の罫。状態は UI.status（線アイコン＋文字） */

/* ── 画面の組み方: 面を縦に積む。2つ並べる所は pm-grid2（1023px 以下は縦） ── */
.pm-stack, .pm-col { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.pm-stack .ui-panel, .pm-col .ui-panel, .pm-grid2 .ui-panel { margin-top: 0; }
.pm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); align-items: start; }
.pm-grid2.is-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.pm-wrap-hd > .ui-sec-hd { flex-wrap: wrap; row-gap: 0; }
.pm-wrap-hd .ui-sec-aside { flex-wrap: wrap; justify-content: flex-end; gap: 0 var(--sp-3); }

/* ── 一覧の表: 1列目に画像の小さな見本・名前・補足。ページ送りで面の上端をヘッダーの下に合わせる ── */
.pm-list { scroll-margin-top: calc(var(--hd-top, 0px) + var(--hd-h, 0px) + var(--sp-3)); }
.pm-list .ui-table-link { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.pm-list .ui-table td.ui-m-title { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
.pm-th {
  flex: none; display: flex; align-items: center; justify-content: center; width: var(--sp-10); height: var(--sp-10);
  overflow: hidden; border-radius: var(--r-s); background: var(--c-bg);
}
.pm-th img { width: 100%; height: 100%; object-fit: cover; }
.pm-th .ic { width: var(--ic-m); height: var(--ic-m); color: var(--c-text-3); }
.pm-th-b { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
/* 名前: PC は1行（表のセルの nowrap を受け継ぐ）、カード行は2行まで（セルの white-space: normal を受け継ぐ） */
.pm-th-t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere; }
.pm-th-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-12); font-weight: 500; line-height: var(--lh-ui); color: var(--c-text-3); }
.pm-spl { margin-right: var(--sp-1); font-family: var(--f); font-size: var(--fs-12); font-weight: 700; letter-spacing: var(--ls-ui); color: var(--c-text-3); }

/* ── 1件: 題名は2行まで（X の投稿は本文の1行目が題名） ── */
.pm-head .ui-page-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 1件: 判断の材料 ── */
.pm-bigimg { display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--r-s); background: var(--c-bg); }
.pm-bigimg img { display: block; max-width: 100%; max-height: calc(var(--sp-16) * 6); object-fit: contain; }
.pm-bigimg.is-empty { aspect-ratio: 4 / 3; }
.pm-bigimg.is-empty .ic { width: var(--ic-xl); height: var(--ic-xl); color: var(--c-text-3); }
.pm-nums { container: pm-nums / inline-size; }
.ui-stats.pm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-4); }
@container pm-nums (min-width: 520px) { .ui-stats.pm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── 1件: 主な操作（評価、その下に操作の帯。1023px 以下の帯は画面の下に浮く） ── */
.pm-ops-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-4); }
.pm-ops-row > .ui-actionbar { margin-top: 0; }
.pm-verdicts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-5); }
.pm-ops-l { margin-right: var(--sp-1); font-size: var(--fs-12); font-weight: 700; color: var(--c-text-3); }
.pm-verdict {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--ctl-h); padding: 0 var(--sp-1);
  border: 0; border-top: 2px solid transparent; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  font-family: var(--f); font-size: var(--fs-14); font-weight: 700; letter-spacing: var(--ls-ui); color: var(--c-text-3);
  transition: color var(--dur) ease, border-color var(--dur) ease;
}
.pm-verdict .ic { width: var(--ic-m); height: var(--ic-m); }
.pm-verdict:hover { color: var(--c-text); }
.pm-verdict[aria-pressed="true"] { color: var(--c-text); border-bottom-color: var(--c-text); }

/* ── 1件: 中身と記録 ── */
.pm-periods .ui-table td:last-child { overflow: visible; }
.kv.pm-kv { font-size: var(--fs-14); }
.kv.pm-kv dt { font-size: var(--fs-12); font-weight: 700; }
/* 指の端末とスマホ幅: 情報の中のリンク（飛び先・投稿の URL）も押せる高さに */
@media (pointer: coarse), (max-width: 767px) { .kv.pm-kv a { display: inline-flex; align-items: center; min-height: var(--tap); } }
.pm-comments { list-style: none; margin: 0 0 var(--sp-4); padding: 0; }
.pm-comment { padding: var(--sp-3) 0; border-bottom: 1px solid var(--c-line-soft); }
.pm-comment:first-child { padding-top: 0; }
.pm-comment p { margin: var(--sp-1) 0 0; font-size: var(--fs-14); line-height: var(--lh-text); }
.pm-comment-meta { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--ctl-h-sm); }
.pm-comment-meta > .ui-btn { margin-left: auto; }
.pm-comment-by { font-size: var(--fs-14); font-weight: 700; }
.pm-comment-at { font-size: var(--fs-12); color: var(--c-text-3); }
.pm-comment-act { display: flex; justify-content: flex-end; margin-top: var(--sp-2); }
.pm-log { list-style: none; margin: 0; padding: 0; }
.pm-log > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--c-line-soft); font-size: var(--fs-14); line-height: var(--lh-ui); }
.pm-log > li:first-child { padding-top: 0; border-top: 0; }
.pm-log-at { font-size: var(--fs-12); color: var(--c-text-3); }
.pm-log-t { font-weight: 700; }
.pm-log-by { color: var(--c-text-3); }
.pm-danger { display: flex; justify-content: flex-end; }

/* ── 入力（ラベルは上・1列。ダイアログの数字は2列） ── */
.pm-form { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.pm-form > .ui-field, .pm-fgrid > .ui-field { margin: 0; }
.pm-fl { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.pm-fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.pm-body-ta { min-height: calc(var(--sp-16) * 3); }
.pm-count { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-12); font-weight: 700; color: var(--c-text-3); }
.pm-count.is-over { color: var(--c-text); }
.pm-count .ic { width: var(--ic-s); height: var(--ic-s); }
p.pm-count { display: flex; justify-content: flex-end; margin: var(--sp-2) 0 0; }
.pm-form-end { display: flex; flex-direction: column; gap: var(--sp-3); }
.pm-form-end > .ui-actionbar { margin-top: 0; }
.pm-mline { display: flex; flex-wrap: wrap; align-items: center; margin: 0; font-size: var(--fs-14); line-height: var(--lh-ui); color: var(--c-text-3); }
.pm-mline .ic { width: var(--ic-m); height: var(--ic-m); margin-right: var(--sp-2); }
.pm-mline b { margin: 0 var(--sp-hair); font-size: var(--fs-16); color: var(--c-text); }
.pm-imgcount { font-family: var(--f-en); font-weight: 700; }
.pm-new-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--sp-16) * 2), 1fr)); gap: var(--sp-3); }
.pm-new-imgs:not(:empty) { margin-bottom: var(--sp-4); }
.pm-new-img { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); margin: 0; min-width: 0; }
.pm-new-img img { display: block; width: 100%; max-height: calc(var(--sp-16) * 5); object-fit: contain; border-radius: var(--r-s); background: var(--c-bg); }
.pm-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); min-height: calc(var(--sp-16) * 2); padding: var(--sp-6);
  border: 1px dashed var(--c-ring); border-radius: var(--r-s); transition: background-color var(--dur) ease, border-color var(--dur) ease;
}
.pm-drop.is-over { background: var(--c-ink-hover); border-color: var(--c-brand); }
.pm-drop > .ic { width: var(--ic-xl); height: var(--ic-xl); color: var(--c-text-3); }
.pm-drop-l { font-size: var(--fs-12); font-weight: 700; line-height: var(--lh-ui); color: var(--c-text-3); }
.pm-acct-row { display: flex; align-items: center; gap: var(--sp-4); }
.pm-acct-icon img, .pm-acct-icon .pm-xp-avatar { display: block; width: calc(var(--sp-12) + var(--sp-2)); height: calc(var(--sp-12) + var(--sp-2)); border-radius: 50%; object-fit: cover; }

/* ── X: 投稿の画像（保存・外す） ── */
.pm-post-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--sp-16) * 2), 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.pm-post-fig { margin: 0; min-width: 0; }
.pm-post-fig img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-s); background: var(--c-bg); }
.pm-post-fig-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1); margin-top: var(--sp-1); }

/* X のプレビュー（X の投稿の見た目に似せる） */
.pm-xp { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 16px 10px; border: 1px solid #EFF3F4; border-radius: 16px; background: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; letter-spacing: 0; color: #0F1419; }
.pm-xp-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; background: #CFD9DE; }
.pm-xp-main { min-width: 0; }
.pm-xp-head { display: flex; align-items: baseline; gap: 4px; min-width: 0; font-size: 15px; line-height: 20px; }
.pm-xp-name { flex: 0 1 auto; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-xp-sub { flex: 1 1 0; min-width: 0; color: #536471; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.pm-xp-text { margin: 2px 0 0; font-size: 15px; line-height: 20px; font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
.pm-xp-link { color: #1D9BF0; }
.pm-xp-media { display: grid; gap: 2px; margin-top: 12px; border: 1px solid #CFD9DE; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; }
.pm-xp-media img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.pm-xp-media.n1 { aspect-ratio: auto; }
.pm-xp-media.n1 img { height: auto; max-height: 510px; }
.pm-xp-media.n2 { grid-template-columns: 1fr 1fr; }
.pm-xp-media.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pm-xp-media.n3 img:first-child { grid-row: 1 / 3; }
.pm-xp-media.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pm-xp-acts { display: flex; justify-content: space-between; max-width: 425px; margin-top: 10px; color: #536471; }
.pm-xp-act { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 400; }
.pm-xp-act .ic { width: 17px; height: 17px; stroke-width: 1.4; }

/* ── 分析の表: 1列目を固定して横に動かす（右の端のぼかしと › は横に続きがあるときだけ） ── */
.pm-atable-box { position: relative; min-width: 0; }
.pm-atable-wrap { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 0 0 var(--r-l) var(--r-l); }
.pm-atable-wrap:focus-visible { outline-offset: calc(var(--sp-hair) * -1); }
.pm-atable { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14); line-height: var(--lh-ui); letter-spacing: var(--ls-ui); color: var(--c-text); }
.pm-atable th, .pm-atable td { height: var(--row-h); padding: 0 var(--sp-3); border-bottom: 1px solid var(--c-line-soft); text-align: left; white-space: nowrap; }
.pm-atable thead th { height: var(--th-h); border-bottom-color: var(--c-line); font-size: var(--fs-12); font-weight: 700; color: var(--c-text-3); }
.pm-atable .is-r { text-align: right; font-family: var(--f-en); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.pm-atable thead .is-r { font-family: var(--f); letter-spacing: var(--ls-ui); }
.pm-atable tr > :first-child {
  position: sticky; left: 0; min-width: calc(var(--sp-16) * 2); max-width: calc(var(--sp-16) * 4); padding-left: var(--pad-panel);
  background: var(--c-surface); white-space: normal; overflow-wrap: anywhere;
}
.pm-atable tbody th { font-weight: 700; }
.pm-atable tr > :last-child { padding-right: var(--pad-panel); }
.pm-atable tbody tr:last-child > * { border-bottom: 0; }
.pm-atable-box.is-scrolled .pm-atable tr > :first-child { border-right: 1px solid var(--c-line); }
.pm-atable-more {
  position: absolute; top: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: flex-end;
  width: var(--sp-12); padding-right: var(--sp-2); border-radius: 0 0 var(--r-l) 0; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--c-surface) 70%); color: var(--c-text-3); transition: opacity var(--dur) ease;
}
.pm-atable-box.is-more .pm-atable-more { opacity: 1; }
.pm-atable-more .ic { width: var(--ic-m); height: var(--ic-m); stroke-width: 2; }

/* 分析: 上位5件 */
.pm-rank { list-style: none; margin: 0; padding: 0 0 var(--sp-2); counter-reset: pm; }
.pm-rank > li { counter-increment: pm; }
.pm-rank > li + li .pm-rank-row { border-top: 1px solid var(--c-line-soft); }
.pm-rank-row {
  display: grid; grid-template-columns: var(--sp-5) var(--sp-10) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center;
  min-height: calc(var(--sp-12) + var(--sp-4)); padding: var(--sp-2) var(--pad-panel); color: var(--c-text);
}
.pm-rank-row::before { content: counter(pm); font-family: var(--f-en); font-size: var(--fs-13); font-weight: 800; color: var(--c-text-3); }
.pm-rank-row:hover { color: var(--c-text); }
.pm-rank-row:hover .pm-rank-title { color: var(--c-brand); }
.pm-rank-img { display: flex; align-items: center; justify-content: center; width: var(--sp-10); height: var(--sp-10); overflow: hidden; border-radius: var(--r-s); background: var(--c-bg); }
.pm-rank-img img { width: 100%; height: 100%; object-fit: cover; }
.pm-rank-img .ic { width: var(--ic-m); height: var(--ic-m); color: var(--c-text-3); }
.pm-rank-title { font-size: var(--fs-14); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-rank-val { font-size: var(--fs-16); font-weight: 800; }

@media (max-width: 1023px) {
  .pm-grid2, .pm-grid2.is-form { grid-template-columns: minmax(0, 1fr); }
  /* 操作の帯だけの面（評価も補足も無い）は、帯が画面の下に浮くので面を残さない */
  .pm-ops.is-bare, .pm-ops.is-bare > .ui-panel-body, .pm-ops.is-bare .pm-ops-row { display: contents; }
}
@media (max-width: 767px) {
  .pm-stack, .pm-col, .pm-grid2 { gap: var(--sp-4); }
  .pm-bigimg img { max-height: calc(var(--sp-16) * 4); }
  .pm-verdicts { gap: 0 var(--sp-4); }
  .pm-xp { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 12px 12px 8px; }
  .pm-xp-avatar { width: 36px; height: 36px; }
  .pm-xp-act { font-size: 12px; gap: 3px; }
  .pm-xp-act .ic { width: 15px; height: 15px; }
}
