body {
  min-width: 320px;
  overflow-x: hidden;
}

.editor-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid rgba(125, 211, 252, .2);
  background: rgba(8, 15, 28, .97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.editor-topbar__brand {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-decoration: none;
  text-transform: uppercase;
}

.editor-topbar__nav,
.editor-topbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.editor-topbar__nav a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.editor-topbar__nav a:hover,
.editor-topbar__nav a:focus-visible {
  border-color: rgba(56, 189, 248, .3);
  color: var(--text);
}

.editor-topbar__actions { justify-content: flex-end; }

.editor-topbar .btn {
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .04em;
}

.editor-topbar .btn-preview {
  border-color: rgba(56, 189, 248, .4);
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #061827;
}

.editor-topbar .status {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: .7rem;
  text-align: right;
}

.project-manager {
  grid-template-columns:
    minmax(150px, 1.2fr)
    minmax(160px, 1fr)
    repeat(4, minmax(94px, auto));
  max-width: 1600px;
  margin: 12px auto 14px;
  border-radius: 10px;
}

.project-manager input,
.project-manager select {
  border-radius: 6px;
}

.project-manager button {
  border-radius: 6px;
  letter-spacing: .03em;
}

.project-manager-status {
  line-height: 1.5;
}

.project-manager-auth {
  display: block;
}

.project-manager byte-mascot {
  width: 100%;
}

.project-manager [hidden],
.project-complete[hidden],
.project-complete [hidden] {
  display: none !important;
}

.project-complete {
  max-width: 1600px;
  margin: 0 auto 14px;
  border-radius: 10px;
}

.project-complete h2 {
  color: var(--text);
}

.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100% - 32px, 1600px);
  min-height: 540px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin: 0 auto 24px;
}

.editor-pane,
.preview-pane {
  display: flex;
  min-width: 0;
  min-height: 540px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, .2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(17, 24, 39, .98), rgba(8, 15, 28, .98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
}

.tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(7, 13, 24, .76);
}

.tabs .tab {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 7px 7px 0 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font: 700 .72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.tabs .tab.active {
  border-color: rgba(56, 189, 248, .24);
  border-bottom-color: #111827;
  background: #111827;
  color: var(--text);
}

.tab-icon {
  color: var(--accent);
  font-weight: 900;
}

.editors {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 48px minmax(0, 1fr);
  background: #09111e;
}

.line-numbers {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  padding: 14px 9px 14px 0;
  border-right: 1px solid rgba(255, 255, 255, .08);
  color: #657c96;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  user-select: none;
  white-space: pre;
}

.editors .editor {
  display: none;
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  padding: 14px;
  resize: none;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: #09111e;
  color: #d9f99d;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editors .editor.active {
  display: block;
}

.editors .editor:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, .5);
}

.preview-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.preview-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 10px;
  background: #0a1220;
}

.preview-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 5px;
  background: #fff;
}

.editor-topbar a:focus-visible,
.editor-topbar button:focus-visible,
.project-manager input:focus-visible,
.project-manager select:focus-visible,
.project-manager button:focus-visible,
.tabs .tab:focus-visible,
.project-complete a:focus-visible,
.project-complete button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .project-manager {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-right: 16px;
    margin-left: 16px;
  }

  .project-manager-status,
  .project-visibility,
  .project-share-link,
  .project-manager-auth,
  .project-manager byte-mascot { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .editor-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .editor-topbar__nav {
    order: 3;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 5px;
  }

  .editor-topbar__actions { margin-left: auto; }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-pane { min-height: 460px; }
  .preview-pane { min-height: 420px; }
  .editors .editor { min-height: 400px; }
  .preview-wrap iframe { min-height: 360px; }
}

@media (max-width: 520px) {
  .editor-topbar { padding: 10px 12px; }
  .editor-topbar__nav { gap: 2px; }
  .editor-topbar__nav a { padding: 6px 8px; font-size: .63rem; }
  .editor-topbar__actions { width: 100%; justify-content: stretch; }
  .editor-topbar__actions .btn { flex: 1 1 0; }
  .editor-topbar .status { flex-basis: 100%; text-align: left; }
  .project-manager { grid-template-columns: minmax(0, 1fr); margin: 10px; padding: 12px; }
  .project-manager-status,
  .project-visibility,
  .project-share-link,
  .project-manager-auth,
  .project-manager byte-mascot { grid-column: 1; }
  .project-manager button,
  .project-manager .project-view-link { width: 100%; }
  .workspace { width: calc(100% - 20px); gap: 10px; }
  .editor-pane { min-height: 420px; }
  .preview-pane { min-height: 360px; }
  .editors { grid-template-columns: 38px minmax(0, 1fr); }
  .line-numbers { font-size: 11px; }
  .editors .editor { padding: 11px 9px; font-size: 12px; }
  .preview-wrap iframe { min-height: 300px; }
  .project-complete { margin: 0 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .editor-topbar *,
  .project-manager *,
  .workspace * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
