/* NCO Blackbox */
.nco-blackbox{
  background:#2c2c30;
  color:#f2f2f2;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  padding:14px 16px;
  margin:16px 0;
  line-height:1.75;
  overflow-wrap:anywhere;
  word-break:break-word;
  font-size: 0.9em;
}
.nco-blackbox *{
  font-size: inherit;
  color: inherit;
}
.nco-blackbox rt {
  font-size: 0.6em;
}
.nco-blackbox a{ color:#9bdcff; }

/* NCO Log (Dark) */
.nco-log{
  max-width: 46rem;
  margin: 1rem auto;
  padding: 0.75rem;
  border-radius: 10px;
  line-height: 1.75;
  overflow-wrap:anywhere;
  word-break:break-word;

  /* デフォルト（ライトを残すならここをライトに） */
  background:#fafafa;
  color:#111;
  border:1px solid #ddd;

  font-size: 0.9em; /* blackboxに寄せる */
}

/* 黒基調版 */
.nco-log--dark{
  background:#2c2c30; /* blackboxと同系 */
  color:#f2f2f2;
  border:1px solid rgba(255,255,255,.12);
}

/* 発言ブロック：モバイルは縦積み */
.nco-msg{
  /* HTMLから差し込む変数のデフォルト */
  --msg-bg: rgba(255,255,255,.06);
  --msg-br: rgba(255,255,255,.10);
  --name: #f2f2f2;

  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;

  padding: 0.65rem 0.75rem;
  border-radius: 6px;

  background: var(--msg-bg);
  border: 1px solid var(--msg-br);
  margin: 0.6rem 0;
  --avatar-size: 60px;
  --icon-bg: #6b4ae0; /* デフォルトのビビッド色（仮） */
}

/* PCでは2列 */
@media (min-width: 640px){
  .nco-msg{
    grid-template-columns: var(--avatar-size) 1fr;
    align-items: start;
  }
}

.nco-avatar{
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 10px;
  overflow: hidden;

  position: relative;
  background: var(--icon-bg);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6) inset;
}

.nco-avatar img{
  width: 90%;
  height: 90%;
  margin: 5%;
  display: block;      /* 謎の隙間対策 */
  object-fit: contain;   /* 正方形に収めつつ、はみ出しはトリミング */
  object-position: 50% 50%; /* 切り抜き中心。必要なら変える */

  position: relative;
  z-index: 1;
}

.nco-avatar::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(255,255,255,.45);
  box-shadow: none;
  z-index: 2;
  pointer-events: none;
}

/* 発言内容 */
.nco-text{
  overflow-wrap:anywhere;
  word-break:break-word;
  white-space: pre-wrap;
}

/* 名前 */
.nco-name{
  font-weight: 700;
  font-size: 1.15em;
  color: var(--name);
  opacity: 0.8;
}

/* はてな側の影響を受けにくくする（必要最低限のリセット） */
.nco-log, .nco-log *{
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .nco-msg {
    display: grid;
    grid-template-columns: var(--avatar-size, 60px) 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 6px;
    align-items: start; /* ← center をやめる */
  }

  .nco-avatar {
    grid-column: 1;
    grid-row: 1;
  }

  .nco-name {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    line-height: 1.2;
    align-self: end; /* ← ここが肝。下ぞろえ */
  }

  .nco-text {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 2px;
  }

  .nco-body {
    display: contents;
  }
}