.previewer-ui {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
  box-sizing: border-box;
}

.previewer-ui__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.previewer-ui__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.previewer-ui__title {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
}

.previewer-ui__description {
  color: rgba(71, 85, 105, 0.86);
  font-size: 12px;
}

.previewer-ui__body {
  position: relative;
  min-height: 0;
  padding: 16px;
}

.previewer-ui--light-surface .previewer-ui__body {
  background: #f8fafc;
}

.previewer-ui__scroll {
  overflow: auto;
}

.previewer-ui__text,
.previewer-ui__markdown,
.previewer-ui__empty {
  color: #182230;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.previewer-ui__pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #dbe7ff;
  font-size: 13px;
  line-height: 1.65;
  background: linear-gradient(180deg, #0f172a 0%, #111f39 100%);
}

.previewer-ui__image {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  object-fit: contain;
  background: #f8fafc;
}

.previewer-ui__toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.previewer-ui__floating-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -4px -4px 12px;
  padding: 4px;
}

.previewer-ui__findbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px -4px 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(10px);
}

.previewer-ui__findbar .ant-input-affix-wrapper {
  flex: 1 1 auto;
  min-width: 0;
}

.previewer-ui__action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  padding-inline: 0;
}

.previewer-ui--headerless {
  border-color: transparent;
  border-radius: 0;
  background: transparent;
}

.previewer-ui--headerless .previewer-ui__body {
  padding: 0;
}

.previewer-ui--expanded {
  position: fixed;
  inset: 0;
  z-index: 1200;
  height: auto;
  border-radius: 0;
  border-inline: 0;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.28),
    0 12px 28px rgba(15, 23, 42, 0.16);
}

.previewer-ui--expanded .previewer-ui__header {
  position: sticky;
  top: 0;
  z-index: 4;
}

.previewer-ui--expanded .previewer-ui__body {
  height: calc(100vh - 53px) !important;
}

.previewer-ui--expanded.previewer-ui--light-surface {
  background: #f8fafc;
}

.previewer-ui--expanded.previewer-ui--light-surface .previewer-ui__header {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%);
}

.previewer-ui__language-select {
  min-width: 108px;
}

.previewer-ui__markdown h1,
.previewer-ui__markdown h2,
.previewer-ui__markdown h3 {
  margin-top: 0;
}

.previewer-ui__markdown code {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(22, 93, 255, 0.08);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.previewer-ui__markdown pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.previewer-ui__markdown pre {
  margin: 0;
  padding: 14px;
  max-width: 100%;
  overflow: auto;
  color: #dbe7ff;
  background: linear-gradient(180deg, #0f172a 0%, #111f39 100%);
  border-radius: 14px;
}

.previewer-ui__editor {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #1e1e1e;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.45);
  box-sizing: border-box;
}

.previewer-ui__editor-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #252526;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.previewer-ui__editor-dots {
  display: inline-flex;
  gap: 6px;
}

.previewer-ui__editor-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.previewer-ui__editor-dots span:nth-child(1) {
  background: #ff5f56;
}

.previewer-ui__editor-dots span:nth-child(2) {
  background: #ffbd2e;
}

.previewer-ui__editor-dots span:nth-child(3) {
  background: #27c93f;
}

.previewer-ui__editor-tab {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.previewer-ui__editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
}

.previewer-ui--headerless .previewer-ui__editor {
  border-width: 0;
  border-radius: 0;
}

.previewer-ui__line {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  min-height: 24px;
}

.previewer-ui__line--diff-added {
  background: rgba(46, 160, 67, 0.12);
}

.previewer-ui__line--diff-removed {
  background: rgba(248, 81, 73, 0.12);
}

.previewer-ui__line--diff-hunk {
  background: rgba(56, 139, 253, 0.12);
}

.previewer-ui__line-number {
  padding: 0 12px 0 16px;
  color: #6e7681;
  font-size: 12px;
  line-height: 24px;
  text-align: right;
  user-select: none;
}

.previewer-ui__line-code {
  padding: 0 16px;
  overflow-wrap: anywhere;
  color: #d4d4d4;
  font-size: 13px;
  line-height: 24px;
  white-space: pre-wrap;
}

.previewer-ui__token--keyword {
  color: #569cd6;
}

.previewer-ui__token--string {
  color: #ce9178;
}

.previewer-ui__token--number {
  color: #b5cea8;
}

.previewer-ui__token--boolean,
.previewer-ui__token--null {
  color: #569cd6;
}

.previewer-ui__token--property {
  color: #9cdcfe;
}

.previewer-ui__token--comment {
  color: #6a9955;
}

.previewer-ui__token--operator,
.previewer-ui__token--punctuation {
  color: #d4d4d4;
}

.previewer-ui__token--tag {
  color: #569cd6;
}

.previewer-ui__token--attribute {
  color: #9cdcfe;
}

.previewer-ui__token--selector {
  color: #d7ba7d;
}

.previewer-ui__token--command {
  color: #4fc1ff;
}

.previewer-ui__token--path {
  color: #ce9178;
}

.previewer-ui__token--option {
  color: #c586c0;
}

@media (max-width: 720px) {
  .previewer-ui__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .previewer-ui__toolbar {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .previewer-ui__findbar {
    flex-wrap: wrap;
  }

  .previewer-ui__findbar .ant-btn {
    flex: 1 1 calc(50% - 4px);
  }
}
