:root {
  --bg-color: #dddede;
  --text-color: black;
  --link-bg: #fffccc;
  --link-hover-bg: #fffc7d;
  --button-bg: #f0f0f0;
  --button-active-bg: #e0e0e0;
  --button-border: #aaa;
  --editor-bg: white;
  --editor-text: rgba(0, 0, 0, 0.9);
  --container-bg: white;
  --container-border: #bbb;
  --toc-hover-bg: #fffccc;

  --cm-motion: #4a6cd4;
  --cm-looks: #8a55d7;
  --cm-sound: #bb42c3;
  --cm-pen: #0e9a6c;
  --cm-events: #c88330;
  --cm-control: #e1a91a;
  --cm-sensing: #2ca5e2;
  --cm-operators: #5cb712;
  --cm-variables: #ee7d16;
  --cm-list: #cc5b22;
  --cm-custom: #632d99;
  --cm-extension: #4b4a60;
  --cm-grey: #888;
  --cm-obsolete: #d41919;
  --cm-comment: #999;
  --cm-string: #904949;
  --cm-number: #4548af;
  --cm-keyword: #5cb712;
}

[data-theme="dark"] {
  --bg-color: #1e1e1e;
  --text-color: #d4d4d4;
  --link-bg: #3e3e3e;
  --link-hover-bg: #4e4e4e;
  --button-bg: #333;
  --button-active-bg: #444;
  --button-border: #555;
  --editor-bg: #252526;
  --editor-text: #d4d4d4;
  --container-bg: #2d2d2d;
  --container-border: #444;
  --toc-hover-bg: #3e3e3e;

  --cm-motion: #6688ff;
  --cm-looks: #a070ff;
  --cm-sound: #cf63d8;
  --cm-pen: #13c48a;
  --cm-events: #ffab45;
  --cm-control: #ffbf00;
  --cm-sensing: #5cb3ff;
  --cm-operators: #59c059;
  --cm-variables: #ff8c1a;
  --cm-list: #ff661a;
  --cm-custom: #a060f0;
  --cm-extension: #7d7c90;
  --cm-grey: #aaa;
  --cm-obsolete: #ff4d4d;
  --cm-comment: #777;
  --cm-string: #ce9178;
  --cm-number: #b5cea8;
  --cm-keyword: #c586c0;
}

* {
  box-sizing: border-box;
}

body, div, p, textarea, pre {
  margin: 0;
  padding: 0;
  line-height: 1.5em;
  font: inherit;
}

body {
  font-size: 1em;
  padding: 1em;
  margin: 0 auto;
  max-width: 60em;

  background: var(--bg-color);
  color: var(--text-color);
}

#side {
  margin-bottom: 2em;
}

#editor {
  position: relative;
  overflow: hidden;
  margin: 1em 0;
  border: 1px solid var(--container-border);
  max-width: 100%;
  height: 20em;
  width: 100%;

  color: var(--editor-text);
  background: var(--editor-bg);
}

body, .CodeMirror {
  font-family: Noto Sans, sans-serif;
}

select, input, button {
  font: inherit;
  font-size: 1em;
}

select {
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid var(--button-border);
}

input {
  border: 1px solid #ccc;
  max-width: 100%;
  background: var(--editor-bg);
  color: var(--text-color);
}

h1, h2, code, input[type=url], #num-chosen-scripts {
  font-family: Noto Sans, sans-serif;
}

h1 {
  font-weight: 700;
  font-size: 1.5em;
  margin-bottom: 1em;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

h1 span {
  font-weight: 400;
  font-size: 1.125rem;
  letter-spacing: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
}

h1 span a {
  margin-right: 0;
}

h1 span a b {
  font-weight: 600;
}

a#title {
  background: none;
  margin-right: 0.5em;
}

a {
  color: var(--text-color);
  text-decoration: none;
  background: var(--link-bg);
  cursor: pointer;
}

a:hover {
  background: var(--link-hover-bg);
}

h1 span a:hover {
  border-bottom: 0.1em solid;
  background: var(--link-hover-bg);
}

h1 a#title:hover {
  border-bottom: none;
  background: none;
}

p a:hover {
  border-bottom: 0.1em solid;
}
a:active {
  opacity: 0.4;
}

p {
  margin: 0 0 1.5rem;
  line-height: 1.5em;
}

p a {
  background: none;
  border-bottom: 0.08em #aaa solid;
  border-radius: 0;
  padding: 0;
  top: 0;
  -webkit-transition: top 200ms ease-in;
  position: relative;
}
p a:visited {
  color: #aaa;
}
p a:hover, p a:visited:hover {
  background: none;
  color: #006ed8;
  border-bottom-color: #006ed8;
  -webkit-transition: color 100ms linear, border-bottom-color 100ms linear;
}
p a:active {
  top: 0.05em;
  -webkit-transition: none;
  opacity: 1;
}

label {
  font-weight: bold;
  cursor: pointer;
}

button, .button {
  display: inline-block;
  font-size: 1.25em;
  margin-bottom: 1em;
  padding: 2px 4px;
  color: var(--text-color);

  font-weight: 500;
  position: relative;
  top: -2px;
  left: -2px;
  vertical-align: middle;
  /*-webkit-appearance: none;
  outline: none;*/
  -webkit-transition: none;
}
button, .button, button:hover, .button:hover, .button:visited {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-bottom-width: 3px;
  cursor: default;
  color: var(--text-color);
  -webkit-transition: none;
}
button:focus, .button:focus {
  /*box-shadow: 0 0 1px rgba(0, 0, 255, 0.5);*/
}
button:active, button.pressed, .button:active, .button.pressed {
  border-bottom-width: 1px;
  border-top-width: 2px;
  background: var(--button-active-bg);
  baseline: 2px;
  color: var(--text-color);
  opacity: 1;
}

.theme-switcher {
  position: fixed;
  top: 0.25em;
  right: 0.25em;
  left: auto;
  z-index: 1000;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.theme-switcher svg {
  width: 24px;
  height: 24px;
}

[data-theme="dark"] .theme-switcher .sun {
  display: block;
}
[data-theme="dark"] .theme-switcher .moon {
  display: none;
}
.theme-switcher .sun {
  display: none;
}
.theme-switcher .moon {
  display: block;
}

/* editor */

.cm-s-block { color: var(--cm-motion); font-weight: bold; }
.cm-s-comment { color: var(--cm-comment); font-style: italic; }
.cm-s-string { color: var(--cm-string); }
.cm-s-number { color: var(--cm-number); }
.cm-s-override { color: var(--cm-grey); }
.cm-s-keyword { color: var(--cm-keyword); }

.cm-s-motion { color: var(--cm-motion); }
.cm-s-looks { color: var(--cm-looks); }
.cm-s-sound { color: var(--cm-sound); }
.cm-s-pen { color: var(--cm-pen); }
.cm-s-events { color: var(--cm-events); }
.cm-s-control { color: var(--cm-control); }
.cm-s-sensing { color: var(--cm-sensing); }
.cm-s-operators { color: var(--cm-operators); }
.cm-s-variables, .cm-s-variable { color: var(--cm-variables); }
.cm-s-list { color: var(--cm-list); }
.cm-s-custom { color: var(--cm-custom); }
.cm-s-extension { color: var(--cm-extension); }
.cm-s-grey { color: var(--cm-grey); }
.cm-s-obsolete { color: var(--cm-obsolete); }

#lang-status {
  font-size: 0.6rem;
  line-height: 1em;
}

.zoom-controls {
  display: inline-block;
  vertical-align: middle;
  margin-top: 2em;
  padding: 0.5em;
  margin-left: 0.5em;
  margin-right: 1.5em;
}

.zoom-controls button {
  margin-bottom: 0 !important;
  padding: 0 8px !important;
  top: 0 !important;
  left: 0 !important;
  height: 32px;
  line-height: 28px;
}

#zoom-label {
  display: inline-block;
  min-width: 3.5em;
  text-align: center;
  font-size: 0.9em;
  vertical-align: middle;
}

.zoom-controls button, #zoom-label {
  box-sizing: border-box;
}

@media screen and (max-width: 48em) {
  .zoom-controls {
    margin-top: 0.5rem;
    display: block;
  }
}

.export-link {
  display: inline-block;
  margin-left: 2px;
  margin-top: 2em;
  margin-right: 1em;
}

.CodeMirror {
  letter-spacing: +0.5px;
  line-height: 1.5em;
  font-size: 1em;
  background: var(--editor-bg) !important;
  color: var(--editor-text) !important;
}

[data-theme="dark"] .CodeMirror-cursor {
  border-left: 1px solid #d4d4d4;
}

[data-theme="dark"] .CodeMirror-gutters {
  background-color: #2d2d2d !important;
  border-right: 1px solid #444;
}

[data-theme="dark"] .CodeMirror-linenumber {
  color: #858585;
}

[data-theme="dark"] .CodeMirror-selected {
  background-color: #3a3d41 !important;
}

.CodeMirror .CodeMirror-placeholder {
  color: #aaa;
}

.CodeMirror-linenumber {
  font-size: 0.85rem;
  line-height: 1.5rem;
  min-width: 17px;
}

.sb2 {
  margin: 0;
  margin-bottom: 20px;
}

#preview {
  position: relative;
  overflow-x: auto;
  margin: 1em 0;
}

#preview > svg {
  display: block;
  margin-bottom: 20px;
  max-width: 100%;
  height: auto;
}

.export-link {
  display: inline-block;
  margin-left: 2px;
  margin-top: 2em;
  margin-right: 1em;
}

#custom-icons-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--container-border);
}

#custom-icons-section h3 {
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.custom-icons-help {
  font-size: 0.85rem;
  color: var(--cm-comment);
  margin-bottom: 1rem;
}

.custom-icons-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  background: var(--container-bg);
  padding: 1rem;
  border: 1px solid var(--container-border);
  border-radius: 4px;
}

.custom-icons-form input[type="text"],
.custom-icons-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--button-border);
  background: var(--editor-bg);
  color: var(--text-color);
  border-radius: 2px;
}

.custom-icons-form textarea {
  height: 80px;
  resize: vertical;
  font-family: monospace;
  font-size: 0.9rem;
}

.custom-icons-form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

#icon-file-upload {
  font-size: 0.9rem;
  flex: 1;
}

#add-icon-btn {
  margin-bottom: 0;
  top: 0;
  left: 0;
}

#custom-icons-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.custom-icon-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  background: var(--container-bg);
  border: 1px solid var(--container-border);
  border-radius: 4px;
  gap: 0.75rem;
  transition: transform 0.1s;
}

.custom-icon-item:hover {
  border-color: var(--cm-variables);
}

.custom-icon-preview {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fdfdfd;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

[data-theme="dark"] .custom-icon-preview {
  background: #fff;
  border-color: #555;
}

.custom-icon-preview img,
.custom-icon-preview svg {
  max-width: 24px;
  max-height: 24px;
}

.custom-icon-name {
  flex: 1;
  font-family: monospace;
  font-weight: 600;
  color: var(--cm-variables);
}

.delete-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cm-obsolete);
  border-radius: 4px;
  transition: background 0.2s;
  top: 0;
  left: 0;
  margin-bottom: 0;
}

.delete-icon-btn:hover,
.delete-icon-btn:active {
  background: rgba(212, 25, 25, 0.1) !important;
  border: none !important;
  top: 0 !important;
  left: 0 !important;
  border-bottom-width: 0 !important;
}

.delete-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}


@media screen and (min-width: 62em) {
  body {
    padding: 1em 2em;
    max-width: none;
  }

  h1 {
    position: relative;
  }
  h1 span {
    display: block;
    position: absolute;
    top: 0;
    left: 45%;
    margin-left: 2rem;
  }

  #preview, #side {
    position: absolute;
    bottom: 2em; left: 2em; right: 2em;
  }

  #editor {
    position: absolute;
    top: 3.25em; bottom: 0; left: 2em; right: 0;
    margin: 0;
    height: 30em;
  }

  #side {
    top: 4.75em;
    left: 45%;
    padding-left: 2em;
  }

  #preview {
    top: 8em;
    right: 55%;
  }

  .export-link {
    margin-top: 0;
    margin-left: 0;
    margin-right: 0.5em;
  }

  .zoom-controls {
    margin-top: 0;
  }
}

@media screen and (max-width: 48em) {
  body {
    padding: 0.75em;
  }
  
  h1 {
    font-size: 1.25em;
    margin-bottom: 1em;
  }
  
  h1 span {
    display: block;
    margin: 1rem 0 0.75rem;
  }
  
  h1 span a {
    display: inline-block;
    margin: 0.25rem 0.5rem 0.25rem 0;
    padding: 0.25em 0.5em;
  }

  #side {
    margin-bottom: 1.5em;
  }

  #editor {
    height: 18em;
    margin: 0.75em 0;
  }

  select {
    width: 100%;
    margin: 0.5rem 0;
  }

  .export-link {
    display: block;
    margin: 1em 0;
    padding: 0.5em 0;
  }
}

@media screen and (max-width: 32em) {
  body {
    padding: 0.5em;
  }
  
  h1 {
    font-size: 1.125em;
  }
  
  h1 span a {
    display: block;
    margin: 0.25rem 0;
    padding: 0.5em;
    text-align: center;
  }

  #editor {
    height: 16em;
    margin: 0.5em 0;
  }

  #side {
    margin-bottom: 1em;
  }

  .export-link {
    font-size: 0.9em;
  }
}



/* for generator */


/* Row */

#header, #wrap, #sprites-list-wrap, #intro {
  position: absolute;
  overflow: hidden;
  left: 0;
  right: 0;
  padding: 1em;
}

#header {
  top: 0;
}


/* Column */

#left-pane, #sprite-detail, #intro {
  position: absolute;
  overflow: hidden;
  overflow-y: auto;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 2em;
}


/* Intro pane */

#intro {
  z-index: 201;
  background: #fff;
  padding: 1em 2em;
}
.hidden {
  display: none;
}


/* Header stuff */

#header {
  height: 9.5em;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  z-index: 202;
  padding: 1em 2em;
}


#project-url {
  font-size: 1.25em;
  font-weight: 100;
  color: rgba(0, 0, 0, 0.75);
  width: 24em;
}
#fetch {
  margin: 0;
}
#status {
  display: inline-block;
  margin-left: 0.5em;
}
#bookmarklet {
  background: #888;
  color: #fff;
  border-radius: 1em;
  text-decoration: none;
  padding: 0.125em 0.25em;
  font-size: 0.9em;
}


#wrap {
  top: 9.5em;
  bottom: 0;
}


/* Left pane */

#left-pane {
  width: 14rem;
  left: 0;
}
#sprites-list-wrap {
  overflow-y: auto;
  top: 9.5em;
  bottom: 2em;
  margin: 0 2em;
  padding: 0;
  border: 1px solid #888;
}
#sprites-list {
  border-right: 0.5em solid #4ca6fb;
  min-height: 2em;
  margin: 0;
  padding: 0;
  list-style: none;
  cursor: default;
  min-height: 100%;
}
#sprites-list > li {
  padding: 0.125em 0.5em;
  border-bottom: 1px solid #eee;
}
#sprites-list > li.selected {
  background: #4ca6fb;
}


#chosen-scripts-info {
}
#num-chosen-scripts {
  font-size: 2em;
  float: left;
  margin-right: 0.25em;
  min-width: 1.125em;
  text-align: right;
}
#export {
  clear: both;
}


/* Right pane */

#sprite-detail {
  left: 12rem;
  right: 0;
}
#sprite-info {
  overflow: hidden; /* clearfix */
}


#sprite-name {
  float: left;
  font-size: 1.5em;
  margin: 0 1.2222222em;
}
#costume-preview {
  float: left;
  width: 6em;
  height: 6em;
  border: 1px solid #888;
}
#costume-preview img {
  width: 100%;
}




img .hidden {
  position: absolute;
  opacity: 0;
}


