.inline-code-block {
  margin: 1.5rem 0;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #0f172a;
}
.dark .inline-code-block {
  border-color: rgba(255, 255, 255, 0.1);
}

.inline-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dark .inline-code-header {
  background: #0f172a;
}

.inline-code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.inline-code-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.inline-code-btn-run {
  background: #22c55e;
  color: #fff;
}
.inline-code-btn-run:hover {
  background: #16a34a;
}
.inline-code-btn-run:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.inline-code-btn-copy {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}
.inline-code-btn-copy:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

.inline-code-btn-collapse {
  background: transparent;
  color: #64748b;
  padding: 0.375rem;
  font-size: 0.875rem;
}
.inline-code-btn-collapse:hover {
  color: #94a3b8;
}

.inline-code-btn-font {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  min-width: 1.75rem;
  text-align: center;
}
.inline-code-btn-font:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

.inline-code-font-size {
  font-size: 0.6875rem;
  color: #64748b;
  min-width: 2rem;
  text-align: center;
  user-select: none;
}

.inline-code-editor-wrap {
  position: relative;
  transition: max-height 0.3s ease;
  overflow: hidden;
}
.inline-code-editor-wrap.collapsed {
  max-height: 0 !important;
}

.inline-code-spinner {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: inline-spin 0.6s linear infinite;
}
@keyframes inline-spin {
  to { transform: rotate(360deg); }
}

.inline-code-output {
  background: #020617;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  font-family: "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}
.inline-code-output:empty {
  display: none;
}

.inline-code-output iframe {
  width: 100%;
  height: 300px;
  border: none;
  border-radius: 8px;
  background: #fff;
}

.inline-code-output-error {
  color: #f87171;
}

.inline-code-output-time {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: #64748b;
}

.inline-code-note {
  font-size: 0.8125rem;
  color: #64748b;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(6, 182, 212, 0.06);
  border-left: 3px solid #06b6d4;
  border-radius: 0 0.375rem 0.375rem 0;
}
.dark .inline-code-note {
  background: rgba(6, 182, 212, 0.08);
  color: #94a3b8;
}

@media (max-width: 640px) {
  .inline-code-header {
    flex-wrap: wrap;
    gap: 0.375rem;
  }
  .inline-code-btn {
    font-size: 0.6875rem;
    padding: 0.3125rem 0.625rem;
  }
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  .inline-code-block { border: 1px solid #ccc !important; background: #f8f8f8 !important; }
  .inline-code-header { background: #eee !important; border-bottom: 1px solid #ccc !important; }
  .inline-code-actions { display: none !important; }
  .inline-code-output { background: #f0f0f0 !important; color: #000 !important; border-top: 1px solid #ccc !important; }
  .inline-code-editor-wrap { max-height: none !important; overflow: visible !important; }
  .ace_editor { background: #f8f8f8 !important; }
  .ace_gutter { background: #eee !important; }
  .ace_content { color: #000 !important; }
  nav, aside, .back-to-top, #resume-btn, #back-to-top, .ad-sidebar, footer, header { display: none !important; }
  .tutorial-content, .rounded-xl { break-inside: avoid; }
  a { color: #000 !important; text-decoration: underline !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.75rem; color: #666; }
  a[href^="/"]::after { content: " (https://labsict.online" attr(href) ")"; }
}
