/* コードブロック本体(JSが tok-has-copy を付与した pre のみ対象) */
pre.tok-has-copy {
  position: relative;
  margin: 1.5em 0;
  padding: 1.1rem 1.25rem;
  background: #22262b;
  color: #e6e8eb;
  border: 1px solid #383e45;
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

pre.tok-has-copy > code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  line-height: 1.7;
  background: none;
  color: inherit;
  padding-right: 5.5em; /* 常時表示ボタンと1行目の重なりを回避 */
}

/* コピーボタン(常時表示) */
.tok-code-copy {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.3em 0.9em;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #e6e8eb;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tok-code-copy:hover,
.tok-code-copy:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.tok-code-copy.is-copied {
  background: rgba(46, 160, 87, 0.9);
  border-color: transparent;
  color: #fff;
}

/* 本文中のインラインコード(投稿ページのみ読み込まれるCSSなので影響範囲は記事内に限定) */
:not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}
