.page-code-editor .main-content {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 16px;
}

.code-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.code-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.code-title {
  margin: 0 8px 0 0;
  font-size: 20px;
  font-weight: inherit;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.code-toolbar .button {
  width: auto;
  min-height: 40px;
}

.code-language {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-language .form-label {
  color: var(--color-muted);
}

.code-language .select-menu {
  min-width: 148px;
}

.code-language .select-menu-button {
  min-height: 40px;
}

.code-language-note:empty {
  display: none;
}

.code-language-note {
  color: var(--color-muted);
  font-size: var(--font-help);
}

.code-file-name {
  flex: 1 1 160px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-status {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--font-help);
}

.code-status:empty {
  display: none;
}

.code-status.is-error {
  color: var(--color-error);
}

.code-back {
  margin-left: auto;
}

.code-help {
  margin: 0;
}

.code-frame {
  --code-frame: #141618;
  --code-bg: #202224;
  --code-text: #d5dae2;
  --code-muted: #8e949e;
  --code-line: #303234;
  --code-caret: #e7eaef;
  --code-selection: rgba(176, 182, 190, 0.36);
  --tok-comment: #a4bbd1;
  --tok-keyword: #e5a9f6;
  --tok-string: #fabb8c;
  --tok-number: #f8e89b;
  --tok-tag: #fba7a7;
  --tok-attr: #86eded;
  --tok-heading: #facf94;
  --tok-link: #8dc5fa;
  --tok-code: #efb0ef;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #2e3134;
  border-radius: var(--radius);
  background: var(--code-frame);
}

.code-frame.theme-warm {
  --tok-comment: #ceb195;
  --tok-keyword: #e9a5f0;
  --tok-string: #f9bb7a;
  --tok-number: #f8dc90;
  --tok-tag: #f9a6b9;
  --tok-attr: #f8918a;
  --tok-heading: #fac991;
  --tok-link: #f8bd86;
  --tok-code: #f9aac7;
}

.code-frame.theme-cool {
  --tok-comment: #9fb9d2;
  --tok-keyword: #8af1bb;
  --tok-string: #bdd48a;
  --tok-number: #8adff3;
  --tok-tag: #8cc3f8;
  --tok-attr: #cda9f5;
  --tok-heading: #a8f1cd;
  --tok-link: #8cd7f8;
  --tok-code: #a7efd4;
}

.code-frame.theme-rainbow {
  --tok-comment: #a4bbd1;
  --tok-keyword: #e5a9f6;
  --tok-string: #fabb8c;
  --tok-number: #f8e89b;
  --tok-tag: #fba7a7;
  --tok-attr: #86eded;
  --tok-heading: #facf94;
  --tok-link: #8dc5fa;
  --tok-code: #efb0ef;
}

.code-frame:focus-within,
.code-frame.is-dragover {
  border-color: #4c5562;
}

.code-gutter,
#gutter,
.code-highlight,
.code-highlight span,
.code-source {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  line-height: 22px;
  letter-spacing: 0;
  font-variant-ligatures: none;
  -webkit-text-stroke: 0;
  tab-size: 2;
}

.code-gutter {
  position: relative;
  flex: none;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--code-line);
  background: var(--code-frame);
  user-select: none;
}

.code-hover-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  visibility: hidden;
}

.code-hover-line.is-on {
  visibility: visible;
}

.code-selection {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.code-selection-block {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--code-selection);
}

#gutter {
  margin: 0;
  padding: 12px 8px 12px 12px;
  color: var(--code-muted);
  text-align: right;
  white-space: pre;
}

.code-stack {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--code-bg);
}

.code-highlight,
.code-source {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  overflow: auto;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  scrollbar-gutter: stable;
}

.code-highlight {
  color: var(--code-text);
  background: transparent;
  pointer-events: none;
  scrollbar-color: transparent transparent;
}

.code-highlight::-webkit-scrollbar {
  background: transparent;
}

.code-highlight::-webkit-scrollbar-thumb {
  background: transparent;
}

.code-source {
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  background: transparent;
  resize: none;
  border-radius: 0;
  scrollbar-color: #3c4452 transparent;
}

.code-caret {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 1px;
  height: 16px;
  margin-top: 3px;
  background: var(--code-caret);
  pointer-events: none;
  visibility: hidden;
}

.code-caret.is-on {
  visibility: visible;
  animation: code-caret-blink 1.05s steps(1) infinite;
}

@keyframes code-caret-blink {
  50% { visibility: hidden; }
}

.code-source::selection {
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.tok-comment {
  color: var(--tok-comment);
}

.tok-keyword {
  color: var(--tok-keyword);
}

.tok-string {
  color: var(--tok-string);
}

.tok-number {
  color: var(--tok-number);
}

.tok-tag {
  color: var(--tok-tag);
}

.tok-attr {
  color: var(--tok-attr);
}

.tok-heading {
  color: var(--tok-heading);
}

.tok-link {
  color: var(--tok-link);
}

.tok-code {
  color: var(--tok-code);
}
