* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --bg: #10121b;
  --panel: #181b27;
  --panel2: #1d202d;
  --line: #303443;
  --text: #ededf5;
  --muted: #a4a6bb;
  --purple: #b7a5ff;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 15px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
  padding: 7px 9px;
}
button:hover {
  background: #ffffff10;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
input,
select {
  border: 1px solid var(--line);
  background: #121520;
  border-radius: 5px;
  padding: 7px 9px;
  min-width: 0;
}
a {
  color: var(--purple);
}
.topbar {
  height: 62px;
  min-height: 62px;
  padding: 0 19px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1a1d29;
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand img {
  width: 33px;
  height: 33px;
}
.brand strong {
  font-size: 21px;
  letter-spacing: -0.9px;
}
.brand span {
  font-weight: 410;
  color: #d4d4e1;
  margin-left: 4px;
}
.file-wrap {
  position: relative;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.file-wrap > button {
  color: var(--muted);
  font-size: 14px;
}
.menu {
  position: absolute;
  min-width: 198px;
  padding: 6px;
  background: #242736;
  box-shadow: 0 14px 35px #0006;
  border: 1px solid var(--line);
  border-radius: 8px;
  top: 38px;
}
.menu button {
  width: 100%;
  justify-content: start;
  font-size: 14px;
}
.project-title {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  margin-left: 12px;
}
.project-title button {
  font-size: 15px;
  color: #e0dfed;
}
.save {
  margin-left: auto;
  font-size: 13px;
  color: #a4acbc;
}
.export,
.primary {
  background: #b5a1fa;
  color: #221937;
  font-weight: 650;
  padding: 9px 13px;
  border: 1px solid #c4b4fa;
}
.export:hover,
.primary:hover {
  background: #cbbaff;
}
main {
  display: grid;
  grid-template-columns: clamp(158px, 15vw, 220px) minmax(250px, 1fr) clamp(340px, 35vw, 565px);
  flex: 1;
  min-height: 0;
}
.explorer,
.rightpane,
.workspace {
  min-width: 0;
}
.explorer,
.rightpane {
  background: var(--panel);
}
.explorer {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.sectionhead,
.stagehead,
.consolebar,
.dialoghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.explorer .sectionhead {
  padding: 15px 14px 17px 18px;
}
.icon {
  padding: 5px;
  color: var(--muted);
}
.groupname {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 580;
  padding: 1px 12px 9px;
}
.file {
  display: flex;
  width: calc(100% - 16px);
  margin: 1px 8px;
  border-radius: 5px;
  justify-content: start;
  padding: 8px 10px;
  gap: 9px;
  font: 13px var(--mono);
  color: #c7c8d7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file.selected {
  background: #302c45;
  color: #d6c8ff;
}
.file svg {
  color: #9e95b7;
}
.file .tinyjs {
  font: bold 10px var(--mono);
  color: #dabc7e;
  letter-spacing: -0.8px;
  width: 17px;
}
.explorer-foot {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.explorer-foot button {
  justify-content: start;
  font-size: 14px;
  color: #c7c7d9;
}
.explorer-foot svg {
  color: #aca1d1;
}
.workspace {
  display: flex;
  flex-direction: column;
  background: #12151e;
}
.tabs,
.stagehead {
  display: flex;
  min-height: 49px;
  border-bottom: 1px solid var(--line);
  background: #1b1e2b;
}
.tabs {
  align-items: stretch;
  padding-left: 7px;
  gap: 3px;
}
.tabs button {
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  padding: 0 12px;
}
.tabs button.active {
  border-bottom-color: var(--purple);
  color: #d8cbff;
}
.editpane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.docbar {
  height: 43px;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  border-bottom: 1px solid #252937;
}
.docbar strong {
  font: 13px var(--mono);
  color: #dcdce7;
}
.jsmark {
  background: #e1ba6c;
  color: #251f16;
  font: bold 10px var(--mono);
  border-radius: 3px;
  padding: 2px 3px;
}
.lang {
  margin-left: auto;
  color: #898ea5;
  font: 12px var(--mono);
}
#editor {
  flex: 1;
  min-height: 0;
}
.CodeMirror {
  height: 100%;
  font: 14px/1.72 var(--mono);
  background: #12151e;
  color: #ced5e6;
}
.CodeMirror-scroll {
  padding-top: 9px;
}
.CodeMirror-gutters {
  border: 0;
  background: #12151e;
}
.CodeMirror-linenumber {
  color: #666e86;
  min-width: 32px;
  padding-right: 14px;
}
.CodeMirror-cursor {
  border-left: 2px solid #d7c5ff;
}
.CodeMirror-selected,
.CodeMirror-focused .CodeMirror-selected {
  background: #39344f;
}
.CodeMirror .cm-comment {
  color: #8893a4;
  font-style: italic;
}
.CodeMirror .cm-string {
  color: #a5d9b2;
}
.CodeMirror .cm-number,
.CodeMirror .cm-atom {
  color: #f5b483;
}
.CodeMirror .cm-keyword,
.CodeMirror .cm-operator {
  color: #cbacfa;
}
.CodeMirror .cm-variable,
.CodeMirror .cm-def {
  color: #91c1f1;
}
.CodeMirror .cm-property {
  color: #d2b3fb;
}
.CodeMirror-lines {
  padding: 3px 0 20px;
}
.CodeMirror pre.CodeMirror-line {
  padding-right: 20px;
}
.badline {
  background: #50222b;
}
.console {
  height: clamp(106px, 17vh, 180px);
  min-height: 94px;
  background: #151823;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.consolebar {
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid #282c39;
}
.consolebar h2,
.stagehead h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.consolebar h2 {
  font-size: 13px;
}
.consolebar h2 svg {
  color: #aeb1c7;
}
.consolebar button {
  font-size: 12px;
  color: var(--muted);
}
#logs {
  overflow: auto;
  font: 12px/1.65 var(--mono);
  padding: 9px 14px;
  color: #b4b9c9;
}
.log {
  display: flex;
  gap: 10px;
}
.log time {
  color: #7e859b;
}
.log.error {
  color: #f4a5a5;
}
.log.success {
  color: #a6d7bd;
}
.rightpane {
  border-left: 1px solid var(--line);
  overflow: auto;
}
.stagehead {
  padding: 0 14px;
}
.stagehead h2 svg {
  color: #a6acc4;
}
.playcontrols {
  display: flex;
  gap: 5px;
  align-items: center;
}
#run {
  background: #253a34;
  color: #a1e3b5;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border: 1px solid #385446;
}
.stop {
  color: #e99093;
  background: #372a32;
}
.playcontrols .icon:last-child {
  margin-left: 4px;
}
#stageframe {
  background: #10131d;
  padding: 12px 12px 0;
}
#scene {
  position: relative;
  aspect-ratio: 4/3;
  width: 100%;
  overflow: hidden;
  border-radius: 5px;
  background: #1e1a40;
}
#stage {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  touch-action: none;
}
#stage:focus-visible {
  outline: 2px solid #a398d3;
  outline-offset: -2px;
}
.stageinfo {
  background: #10131d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px 10px;
  color: #9096ae;
  font: 12px var(--mono);
  border-bottom: 1px solid var(--line);
}
.stageinfo span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stageinfo svg {
  width: 13px;
  height: 13px;
}
.spriteSection,
.inspector {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}
.sectionhead h2 small {
  font-size: 12px;
  color: #a8abc1;
  background: #2b2f40;
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: 4px;
}
.soft {
  font-size: 13px;
  border: 1px solid #454153;
  background: #292637;
  color: #cebef9;
  padding: 6px 9px;
}
.soft svg {
  width: 14px;
}
.spriteSection .sectionhead {
  margin-bottom: 12px;
}
#sprites {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sprite {
  width: 84px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--line);
  background: #202330;
  border-radius: 7px;
  padding: 5px 4px 6px;
  overflow: hidden;
}
.sprite img {
  width: 55px;
  height: 37px;
  object-fit: contain;
  image-rendering: pixelated;
}
.sprite span {
  max-width: 100%;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sprite.sel {
  border-color: #a591e4;
  background: #2f2a41;
}
.inspector > .sectionhead span {
  color: var(--muted);
  font-size: 12px;
}
.fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.field {
  display: flex;
  background: #131620;
  border: 1px solid var(--line);
  border-radius: 5px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
}
.field span {
  font: 12px var(--mono);
  color: #aeb1c7;
}
.field input {
  width: 100%;
  border: 0;
  text-align: right;
  font: 13px var(--mono);
  padding: 6px 0;
}
.field.wide {
  grid-column: 1/-1;
}
.inspectorActions {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}
.inspectorActions button {
  font-size: 12px;
}
.inspectorActions svg {
  width: 14px;
}
.footright,
footer > span {
  display: flex;
  align-items: center;
  gap: 9px;
}
footer {
  height: 29px;
  min-height: 29px;
  border-top: 1px solid #34394a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #aeb3c8;
  font: 12px var(--mono);
  background: #1c202c;
}
footer strong {
  font-weight: 400;
}
.statusdot {
  background: #88caa4;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.footright b {
  color: #6c7186;
}
.stageinfo,
#logs,
.docbar {
  font-variant-numeric: tabular-nums;
}
#question {
  position: absolute;
  bottom: 3%;
  left: 3%;
  width: 94%;
  background: #282638;
  border: 1px solid var(--purple);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
#question label {
  width: 100%;
}
#question input {
  flex: 1;
}
#stageframe:fullscreen {
  display: grid;
  place-items: center;
  padding: 0;
  background: #070911;
}
#stageframe:fullscreen #scene {
  width: min(100vw, 133.33vh);
}
#monitors {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.monitor {
  position: absolute;
  border-radius: 4px;
  background: #e9e9ed;
  color: #292d41;
  padding: 2px 6px;
  font: 600 12px system-ui;
}
.monitor em {
  background: #ef8727;
  color: white;
  border-radius: 3px;
  padding: 0 4px;
}
dialog {
  padding: 0;
  border: 1px solid #46485c;
  background: #1b1e2b;
  color: var(--text);
  border-radius: 12px;
  width: min(580px, 92vw);
  box-shadow: 0 20px 70px #0009;
}
dialog::backdrop {
  background: #080912a8;
}
.dialoghead {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.dialoghead h2 {
  font-size: 18px;
}
#dialogContent {
  padding: 18px 20px;
  max-height: 73vh;
  overflow: auto;
}
.dialogform {
  display: grid;
  gap: 12px;
}
.dialogform input {
  width: 100%;
  margin-top: 7px;
}
.dialogform > button {
  justify-self: end;
}
.help {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.refsearch {
  width: 100%;
  margin-bottom: 10px;
}
.ref-row {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  font: 13px var(--mono);
  border-bottom: 1px solid #303242;
  text-align: left;
  padding: 9px 6px;
}
.ref-row span {
  color: var(--muted);
  font: 12px system-ui;
}
.ref-row code {
  overflow-wrap: anywhere;
}
#media {
  padding: 18px;
  overflow: auto;
  flex: 1;
}
.mediahead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.mediahead > div {
  display: flex;
  gap: 5px;
}
.mediaitem {
  margin-top: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.mediaitem img {
  object-fit: contain;
  width: 72px;
  height: 52px;
  background: #272b39;
}
.mediaitem strong {
  flex: 1;
  overflow-wrap: anywhere;
}
.mediaitem audio {
  max-width: 140px;
  height: 30px;
}
.paintcanvas {
  background: repeating-conic-gradient(#aaa 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  width: 100%;
  image-rendering: pixelated;
  touch-action: none;
}
.tools {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}
.tools input {
  width: 56px;
}
kbd {
  font: 12px var(--mono);
  background: #323544;
  padding: 3px 5px;
  border-radius: 3px;
}
.help table {
  width: 100%;
}
@media (min-width: 1550px) {
  .CodeMirror {
    font-size: 15px;
  }
}
@media (max-width: 1050px) {
  main {
    grid-template-columns: 150px minmax(210px, 1fr) 34%;
  }
  .topbar {
    gap: 6px;
  }
  .tabs button {
    padding: 0 8px;
  }
  .rightpane .sectionhead h2 {
    font-size: 14px;
  }
  .save {
    font-size: 12px;
  }
}
@media (max-width: 790px) {
  body {
    height: auto;
    min-height: 100dvh;
  }
  .topbar {
    position: sticky;
    top: 0;
    height: 55px;
    min-height: 55px;
    padding: 0 10px;
    gap: 5px;
  }
  .brand strong {
    font-size: 17px;
  }
  .brand img {
    width: 27px;
    height: 27px;
  }
  .file-wrap {
    padding-left: 3px;
  }
  .project-title {
    margin: 0;
    min-width: 0;
  }
  .project-title > svg,
  .save {
    display: none;
  }
  .project-title button {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .export {
    margin-left: auto;
    white-space: nowrap;
    font-size: 13px;
    padding: 8px;
  }
  .explorer {
    grid-column: 1/-1;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-bottom: 1px solid var(--line);
    height: 44px;
  }
  .explorer .sectionhead,
  .groupname,
  .explorer-foot button:last-child {
    display: none;
  }
  #files {
    display: flex;
  }
  .file {
    width: auto;
    flex: none;
    margin: 0;
    padding: 7px;
  }
  .explorer-foot {
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  .explorer-foot button {
    font-size: 0;
    gap: 0;
  }
  main {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 40%);
    flex: none;
  }
  .workspace {
    height: 80vh;
  }
  .rightpane {
    max-height: 80vh;
  }
  .stagehead h2 svg {
    display: none;
  }
  .stagehead {
    padding: 0 8px;
  }
  .tabs {
    gap: 0;
  }
  .tabs button {
    font-size: 13px;
  }
  .tabs svg {
    display: none;
  }
  footer {
    margin-top: auto;
  }
}
@media (max-width: 570px) {
  main {
    display: flex;
    flex-direction: column;
  }
  .workspace {
    height: 60vh;
    min-height: 350px;
  }
  .rightpane {
    max-height: none;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .console {
    height: 85px;
    min-height: 75px;
  }
  .brand span {
    display: none;
  }
  .explorer {
    width: 100%;
    flex-shrink: 0;
  }
  .spriteSection,
  .inspector {
    padding: 13px;
  }
  .project-title > button {
    max-width: 104px;
  }
  .stagehead {
    height: 48px;
  }
  .footright {
    font-size: 11px;
  }
}
