.container {
  width: 100%;
  max-width: 28rem;
  margin: 0.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.tabs {
  display: inline-flex;
  background-color: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
  gap: 0.25rem;
}

.tabItem {
  display: flex;
  align-items: center;
}

.tabButton {
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  background-color: transparent;
  color: #64748b;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  border: none;
  line-height: 1.5;

  &:hover {
    color: #0f172a;
  }

  &.active {
    background-color: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
  }
}

.codeWrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: #fff;
  overflow: hidden;
  min-height: 42px;
}

.codeContent {
  flex-grow: 1;
  min-width: 0; /* 防止 flex 子项溢出 */
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.875rem;

  /* Shiki output styles override */
  :global(pre.shiki) {
    margin: 0 !important;
    padding: 0.625rem 1rem !important;
    background-color: transparent !important;
    overflow-x: auto;
  }
}

.fallbackPre {
  margin: 0;
  padding: 0.625rem 1rem;
  overflow-x: auto;
  white-space: pre;
}

.copyButton {
  flex-shrink: 0;
  margin: 0 0.5rem;
  padding: 0.375rem;
  cursor: pointer;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: all 0.2s;
  border: none;
  background: transparent;

  &:hover {
    background-color: #f3f4f6;
    color: #111827;
  }
}

.icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

.checkIcon {
  color: #10b981;
}

.container.dark {
  .tabs {
    background-color: #1f2937;
  }

  .tabButton {
    color: #9ca3af;

    &:hover {
      color: #f3f4f6;
    }

    &.active {
      background-color: #374151;
      color: #f3f4f6;
      box-shadow: 0 1px 2px 0 rgb(0 0 0 / 20%);
    }
  }

  .codeWrapper {
    border-color: #374151;
    background-color: #1f2937;
  }

  .copyButton {
    color: #9ca3af;

    &:hover {
      background-color: #374151;
      color: #f3f4f6;
    }
  }

  .fallbackPre {
    color: #e5e7eb;
  }
}
