@media (orientation:portrait), (max-width: 720px) {
  #container{
    grid-template-columns: 1fr;
  }
  #new,#open,#save,#pub,#doc{
    display: none;
  }
  #commandbar{
    right: 0;
    width: 220px; /* firefox */
  }
  .date{
    display: none;
  }
  #logo span{
    display: none;
  }
  /* .ace_gutter-cell.ace_breakpoint::before{
    display: none;
  } */
} 

@media (orientation:landscape) and (min-width: 721px) {
  #container{
    grid-template-columns: 1fr 1fr;
  }
  #commandbar{
    left: 50%;
    transform: translate(-50%);
    width: 440px; /* firefox */
  }
}

@media (hover: hover) and (pointer: fine) {
  .button:hover{
    filter: invert(0%);
    background-color: white;
  }
}

#container {  
  display: grid;
/*   grid-template-columns: 1fr 1fr; */
  grid-template-rows: 50px 1fr 36px;
  gap: 0px 0px;
  grid-auto-flow: row;
  grid-template-areas:
    "header header"
    "left right"
    "footer footer";
}

#header {
  grid-area: header;
  background-color: #999;
/*   display: flex; */
  position: relative;
}

#editor {
  grid-area: left;
  position: relative;
  font-size:16px;
}

#scene { 
  grid-area: right;
  position: relative;
  overflow: hidden;
}

#footer { 
  grid-area: footer; 
  background-color: #999; 
  overflow-y: hidden;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;
  font-size: 14px;
  padding-left:5px;
  cursor: pointer;
  word-break: break-all;
}

a {
	color: unset;
	text-decoration: none;
}

html, body, #container {
  height: 100%;
  margin: 0;
}
    
#logo {
  color: lightgray;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;
	font-size: 20px;
	line-height: 50px;
	padding-left: 5px;
  position: absolute;
/* 	width: 180px; */
}

#logo a{
  color: white;
}

#commandbar{
  height : 100%;
/*   width : fit-content; */
/*   margin: 0 auto; */
  display:flex;
  position: absolute;
/*   left: 50%;
  transform: translate(-50%) */
}
    
.button{
  height: 100%;
  cursor: pointer;
  aspect-ratio: 1.1;
  align-content: center;
  justify-content: center;
  display: grid;
  filter: invert(100%);
}
    

    
#doc{
/*   float: right; */
/*   margin-right: 0px;
  margin-left: 145px; */
  position: absolute;
  right: 0;
}

#docframe {
  width: 100%;
  height: 100%;
  position: absolute;
  box-sizing: border-box;
  padding: 0 0 0 12px;
  overflow: auto;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;
  font-size: 14px;
  line-height: 1.3;
  background-color: white;
  z-index: 3;
}
#docframe h1, h2, h3, h4, h5, h6{
  padding-bottom: 0.3em;
  border-bottom: 1px solid #ccc;
}
#docframe hr {
  margin: 1em 0;
  border: 0;
  border-bottom: 1px solid #ccc;
}
#docframe blockquote {
  margin-left: 0;
  padding: 0.5em 0 0.5em 2em;
  border-left: 3px solid rgb(211, 218, 234);
}
#docframe li, code {
  margin: 0.4em 0;
}
#docframe p {
  margin: 0.9em 0;
}
#docframe code {
  background: rgba(211, 218, 234, 0.25);
}
#docframe pre > code {
  display: block;
  padding: 0.5em 0.5em;
}
#docframe table {
  border-spacing: 0;
  border-collapse: collapse;
}
#docframe td {
  padding: 4px 8px;
}
#docframe tr:nth-child(2n) {
  background: #f3f3f3;
}
#docframe th {
  border-bottom: 1px solid #aaa;
}
/* #docframe img {
  max-width: 96px;
} */
#docframe a {
  color: #0969da;
}

#docframe a[id] {
    /*color: #d30038;*/
    font-size: 1.2em;
}

#chartframe {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  background: white;
  overflow: hidden;
  min-width: 200px;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  color: white;
  border: 1px solid #2a2a2a;
  box-sizing: border-box;
  z-index: 2;
}

#chartframe.collapsed {
  max-height: 30px;
}

#chartframe.collapsed > #handle-vertical {
  display: none;
  pointer-events: none;
}

#chartframe.hidden{
  display: none;
}

#handle-horizontal {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
}

#handle-vertical {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  cursor: ns-resize;
}

#handle-horizontal:hover,
#handle-vertical:hover {
  background: rgba(0, 0, 0, 0.2);
}

#chart-title {
  margin: 0;
  line-height: 30px;
  padding: 0 8px;
  cursor: pointer;
  user-select: none;
  background-color: #2d3436;
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.chart-title::before,
#chart-title::before{
  content: "▼";
  display: inline-block;
  font-size: 0.7em;
  margin-right: 4px;
  transition: transform 0.2s;
}

.chart-title.collapsed::before,
#chartframe.collapsed #chart-title::before {
  transform: rotate(-90deg);
}

#chart-title:hover {
  background-color: #373c3f;
}

.chart-container {
  border-top: 1px solid #eceef0;
  box-sizing: border-box;
  position: relative;
}

.chart-resizer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  cursor: ns-resize;
  z-index: 1;
  pointer-events: auto;
}

.chart-title.collapsed ~ .chart-resizer {
  pointer-events: none;
}

.chart-resizer:hover {
  background: rgba(0, 0, 0, 0.2);
}

.chart-title {
  background-color: #f5f6f7;
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
  color: #2d3436;
  font-size: 13px;
  border-bottom: 1px solid #eceef0;
}

.chart-title:hover {
  background-color: #eceef0;
  transition: background-color 0.2s;
}

#chart-header {
  background: #2d3436;
  cursor: pointer;
  user-select: none;
  height: 30px;
  overflow: hidden;
  flex: none;
  border-bottom: 1px solid #40454a;
}

#chart-content {
  overflow: auto;
  scrollbar-gutter: stable;
  flex: 1;
}

#offcanvas {
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 1; /* offcanvas:1, chartframe:2, docframe:3 */
}

.ace_gutter-cell.ace_breakpoint::before{ 
  content: '🔴';
  font-size: 11px;
  position: absolute;
  left: 1px;
  line-height:19px;
/*   background-image: url("/img/breakpoint.png"); */
}

.ace_gutter_debug_current{ 
  background-color: yellow;
}
    
.ace_gutter-active-line.ace_gutter_debug_current{ 
  background-color: yellow;
}

.ace_mobile-button{
  display: none;
}

.prompt, #version {
  color:lightgray;
}

#command {
  border: none;
  background: transparent;
  outline: none;
  color: blue;
  padding: 0;
  font-size: 14px;
  width: 30%;
}

#statusbar {
  position: fixed;
  right: 5px;
/*   bottom: 0; */
  text-align: right;
}

#state {
  color: white;
}

#newdialog{
  width: 720px;
  height: 435px;
  padding: 0;
  border: 0;
  overflow: hidden;
}
.dialogtitle{
  width:100%;
  height: 30px;
  line-height:30px;
  background-color:grey;
  padding: 0 10px;
}
.dialogclose{
  position: absolute;
  right:10px;
  cursor: pointer;
}
.dialogclose:hover{
  color:white;
}
.newcodecontainer{
  display: flex;
  flex-wrap: wrap;
  width: 710px;
  height: 400px;
  padding-top: 5px;
  padding-left:10px;
  overflow-y: scroll;
}
.newcode{
  width:320px;
  height:180px;
  margin:10px;
  border-color:lightgray;
  border-width:thin;
  border-style:solid;
  cursor: pointer;
}

.newcode:hover{
  filter: brightness(70%);
}

#downdialog{
  width: 720px;
  height: 435px;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.downcontainer{
  width: 710px;
  height: 400px;
  padding-top: 5px;
  padding-left:10px;
  overflow-y: scroll;
}

.downfiletable{
  width: 690px;
}

/* 设置表头背景色为浅灰 */
.downfiletable thead th {
  background-color: lightgray;
}
/* 设置表格行在鼠标悬停时背景色为浅蓝 */
.downfiletable tbody tr:hover {
  background-color: lightblue;
}

#debugwatch{
  position: fixed;
  left: 50%;
  color: yellow;
}