.oai-codebox {
  margin: 16px 0;
  overflow: hidden;
  color: #f0f0f0;
  background: #000 !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  direction: ltr;
}

.oai-codebox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.oai-codebox__label {
  max-width: 70%;
  overflow: hidden;
  padding: 4px 10px;
  color: #eaeaea;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  user-select: none;
}

.oai-codebox__copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  color: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
  appearance: none;
}

.oai-codebox__copy:hover,
.oai-codebox__copy:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}

.oai-codebox__copy:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.oai-codebox__copy:active { transform: scale(0.98); }
.oai-codebox__copy:disabled { opacity: 0.8; cursor: default; }

.oai-codebox__copyicon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: center / 16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="copied"] .oai-codebox__copyicon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="error"] .oai-codebox__copyicon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 6-12 12M6 6l12 12'/%3E%3C/svg%3E");
}

.oai-codebox__copy[data-copy-state="error"] { border-color: rgba(255, 80, 80, 0.5); }

.oai-codebox__pre,
html body .oai-codebox__pre {
  margin: 0 !important;
  padding: 14px !important;
  overflow: auto;
  color: #f0f0f0;
  text-align: left;
  background: #000 !important;
  border: 0 !important;
  border-radius: 0 !important;
  direction: ltr;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.24) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.oai-codebox__code,
html body .oai-codebox code,
html body .oai-codebox .hljs {
  display: block;
  padding: 0 !important;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  font-variant-ligatures: none;
  line-height: 1.75;
  letter-spacing: normal;
  white-space: pre !important;
  background: transparent !important;
  border: 0 !important;
  tab-size: 4;
  direction: ltr;
}

@media (max-width: 480px) {
  .oai-codebox { border-radius: 12px; }
  .oai-codebox__bar { padding: 8px 10px; }
  .oai-codebox__pre { padding: 12px !important; }
  .oai-codebox__code { font-size: 12.5px; line-height: 1.7; }
  .oai-codebox__copy { gap: 6px; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .oai-codebox__copy { transition: none; }
}

/* Compatibility details retained from the standalone CodeBox release. */
.oai-codebox__copy[data-copy-state="copied"] {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.oai-codebox__pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.oai-codebox__pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.oai-codebox__pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.oai-codebox__pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Token colors used by the safe built-in highlighter when Highlight.js is unavailable. */
.oai-codebox .cb-tok-comment { color: #8b949e; }
.oai-codebox .cb-tok-string { color: #a5d6ff; }
.oai-codebox .cb-tok-number { color: #79c0ff; }
.oai-codebox .cb-tok-keyword { color: #ff7b72; font-weight: 600; }
.oai-codebox .cb-tok-builtin { color: #d2a8ff; }
.oai-codebox .cb-tok-func { color: #7ee787; }
.oai-codebox .cb-tok-op { color: #c9d1d9; }
