:root {
  --bg: #1b2230;
  --surface: #242d3f;
  --surface-2: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1b2230;
  --input-border: #2b3449;

  --primary: #7aa6ff;
  --primary-2: #a78bfa;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a:link {
  text-decoration: none;
}

body {
  height: 100%;
  overflow-y: hidden;
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.2;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

button:hover {
  background: var(--primary-2);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
textarea,
select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.25rem;
  border-radius: 3px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(122, 166, 255, 0.2);
}

input::placeholder {
  color: var(--muted);
}

#app {
  display: flex;
  height: 100vh;
}

#tree {
  flex: 0 1 16em;
  margin: 1em 0.5em;
}

#toolbar {
  flex: 0 0 auto;
  margin: 2em 1em 1em 1em;
  z-index: 100;
}

#content-container {
  flex: 1;
  overflow-y: auto;
}
#content {
  margin: 1em 0.5em;
}

#footer {
  position: absolute;
  bottom: 10px;
  left: 10px;
  color: #404040;
}
#footer a:link, #footer a:visited {
  color: #404040;
}


button.icon {
  background-color: #ddd;
  color: black;
  font-size: 20px;
  box-sizing: border-box;
  border: 1px solid #666;
  width: 30px;
  height: 30px;
  margin: 1px;
  padding: 0;
}

button.icon:hover {
  filter: brightness(75%);
}

button.icon.enabled {
  background-color: #bbb;
  border: 2px solid #444;
}

input.coordinate { width: 3.5em; }
input.force { width: 4em; }
input.damages { width: 3em; }

.tree-links ul {
  list-style-type: none;
  font-size: 120%;
  padding: 0;
}

.tree-links ul i.fas {
  font-size: 90%;
  margin-left: 0.1em;
}
.tree-links li {
  margin: 0.3em 0.2em;
}

.tree-file-bar input {
  width: 50%;
  margin-right: 0.2em;
}
.tree-file-bar i.fas {
  font-size: 90%;
  padding: 0.2em;
}

.tree-files ul {
  list-style-type: none;
  padding: 0;
}
.tree-files ul i.fas {
  font-size: 90%;
  margin-right: 0.1em;
}
.tree-files li {
  padding: 0.1em;
  margin: 0;
  margin-left: 0.5em;
  cursor: default;
}
.tree-files li:hover {
  background-color: #242d3f;
}


#toolbar table.color-picker {
  background-color: #000;
}

#toolbar .color-picker td {
  width: 25px;
  height: 25px;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
}

#toolbar .color-picker tr.active-color td {
  border: 2px solid red;
}

#toolbar .palette-picker {
  position: absolute;
  display: flex;
  border: 1px solid black;
  background-color: #222;
  width: max-content;
}

.palette-picker table {
  border-collapse: collapse;
  margin: 2px;
  border: 1px solid black;
}

.palette-picker td {
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: none;
}

.color-swaps .palette-picker {
  display: flex;
}

.color-swaps .palette-picker table {
  border: 2px solid black;
}

.color-swaps .selected-swap {
  display: flex;
  margin-top: 1em;
}

.color-swaps .color-picker {
  border-collapse: collapse;
  margin: 5px;
  flex: 0 0 150px;
}

.color-swaps .color-picker table {
  background-color: #000;
  padding: 2px;
}

.color-swaps .color-picker td {
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
}

.color-swaps .color-picker td.selected {
  border: 2px solid red;
}

.color-swaps .full-palette table {
  border-collapse: collapse;
}

.color-swaps .full-palette td {
  width: 3em;
  height: 3em;
  text-align: center;
  font-family: monospace;
  user-select: none;
  padding: 0;
  border: none;
  color: #222;
}

.color-swaps .full-palette td.selected {
  outline: 2px solid red;
  outline-offset: -2px;
}

.color-swaps .preview {
  margin-top: 2em;
}


table.stb-tile {
  box-sizing: border-box;
  border-collapse: collapse;
  user-select: none;
}

table.stb-tile td {
  box-sizing: border-box;
  width: var(--grid-zoom);
  height: var(--grid-zoom);
  padding: 0;
}

.tool-grid-pixels table.stb-tile td {
  border: 1px solid black;
}
.tool-grid-pixels table tr td:nth-child(1) {
  width: calc(var(--grid-zoom) - 1px);
}
.tool-grid-pixels table tr:nth-child(1) td {
  height: calc(var(--grid-zoom) - 1px);
}

.stb-illustration {
  display: grid;
  outline: 2px solid black;
  outline-offset: -1px;
  width: fit-content;
}
.tool-grid-tiles .stb-illustration table.stb-tile {
  border-right: 1px solid black;
  border-bottom: 1px solid black;
}


.tileset-tiles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  line-height: 0;
}
.tileset-tiles .stb-tile-thumbnail {
  margin: 2px;
}
.tileset-tiles .icon {
  font-size: 32px;
  width: 48px;
  text-align: center;
  margin-right: 1em;
}

.tile-details {
  display: flex;
  margin: 1em;
}

.tile-canvas .stb-tile {
  outline: 3px solid black;
  outline-offset: -1px;
  width: fit-content;
}

.tile-canvas {
  flex: 0 0 fit-content;
  position: relative;
}

.tile-info {
  flex: 1 1;
  margin-left: 2em;
}

.tile-info .icon {
  margin-left: 2em;
}

.frame-canvas {
  outline: 2px solid black;
  width: fit-content;
  height: fit-content;
}

.frame-sprite {
  position: absolute;
}

.frame-sprite.selected { z-index: 1; }
.frame-sprite.foreground { z-index: 10; }
.frame-sprite.foreground.selected { z-index: 11; }

.tool-grid-tiles table.frame-sprite {
  box-sizing: content-box;
  border: 1px solid black;
}
.tool-grid-tiles table.frame-sprite tr td:nth-child(1) {
  width: calc(var(--grid-zoom) - 1px);
}
.tool-grid-tiles table.frame-sprite tr:nth-child(1) td {
  height: calc(var(--grid-zoom) - 1px);
}
.tool-grid-pixels table.frame-sprite {
  outline: 2px solid black;
  outline-offset: -1px;
}

.tool-select table.frame-sprite:hover {
  outline: 3px solid red;
  z-index: 30;
  filter: brightness(110%);
}

table.frame-sprite.selected {
  outline: 3px solid blue;
}

.frame-hurtbox {
  position: absolute;
  outline: 2px solid #008000d0;
  outline-offset: -1px;
  background: #80ff8060;
  z-index: 20;
  pointer-events: none;
}

.frame-hitbox {
  position: absolute;
  outline: 2px solid #800000d0;
  outline-offset: -1px;
  background: #ff808060;
  z-index: 25;
  pointer-events: none;
}

.tool-boxes-off .frame-hurtbox { display: none; }
.tool-boxes-off .frame-hitbox { display: none; }

.frame-origin {
  position: absolute;
  background: #f00;
  border-radius: 50%;
  z-index: 30;
}

.tool-grid-off .frame-origin {
  display: none;
}


div.animation-frame {
  display: flex;
  margin-top: 1em;
}

div.frame-canvas {
  flex: 0 0 fit-content;
  position: relative;
}

div.frame-info {
  flex: 1 1;
  margin-left: 2em;
}

.frame-info .box-header {
  margin-top: 0.5em;
  font-weight: bold;
}

.frame-info hr {
  border: none;
  border-top: 1px solid #444;
}

div.sprite-info {
  vertical-align: middle;
}

.sprite-tile-picker {
  margin-top: 0.5em;
  line-height: 0;
  text-align: left;
}
.sprite-tile-picker > * {
  vertical-align: middle;
}
.sprite-tile-picker .stb-tile-thumbnail {
  margin: 1px;
}
.sprite-tile-picker .icon {
  display: inline-block;
  font-size: 24px;
  width: 34px;
  text-align: center;
  vertical-align: middle;
  line-height: 0;
}

.stb-tile-thumbnail {
  border: 1px solid black;
}

.stb-tile-thumbnail.selected {
  outline: 2px solid red;
}

.animation-duplicate {
  display: inline-block;
  margin-left: 0.5em;
}
.animation-delete {
  display: inline-block;
  margin-left: 0.5em;
}

.frame-thumbnails {
  display: flex;
  align-items: center;
  margin: 0.5em;
}
.stb-frame-thumbnail {
  flex: 0 0 fit-content;
  border: 1px solid black;
  margin: 4px;
}
.stb-frame-thumbnail.selected {
  outline: 2px solid red;
}
.frame-thumbnails .icon {
  font-size: 32px;
  padding: 0px 5px;
  line-height: 0;
  margin-right: 1em;
}

.sprite-thumbnails {
  display: flex;
  align-items: center;
  margin: 0.5em 0;
}
.stb-sprite-thumbnail {
  flex: 0 0 fit-content;
  border: 1px solid black;
  margin: 4px;
}
.stb-sprite-thumbnail.selected {
  outline: 2px solid red;
}
.sprite-thumbnails .icon {
  font-size: 24px;
  padding: 0px 5px;
  line-height: 0;
  margin-right: 1em;
}

.bg-none { background-color: var(--color-none); }

.bg-p0-c0 { background-color: transparent; }
.bg-p0-c1 { background-color: var(--color-p0-c1); }
.bg-p0-c2 { background-color: var(--color-p0-c2); }
.bg-p0-c3 { background-color: var(--color-p0-c3); }

.bg-p1-c0 { background-color: transparent; }
.bg-p1-c1 { background-color: var(--color-p1-c1); }
.bg-p1-c2 { background-color: var(--color-p1-c2); }
.bg-p1-c3 { background-color: var(--color-p1-c3); }

.bg-p2-c0 { background-color: transparent; }
.bg-p2-c1 { background-color: var(--color-p2-c1); }
.bg-p2-c2 { background-color: var(--color-p2-c2); }
.bg-p2-c3 { background-color: var(--color-p2-c3); }

.picker-p0-c0 { background-color: var(--color-none); }
.picker-p0-c1 { background-color: var(--color-p0-c1); }
.picker-p0-c2 { background-color: var(--color-p0-c2); }
.picker-p0-c3 { background-color: var(--color-p0-c3); }

.picker-p1-c0 { background-color: var(--color-none); }
.picker-p1-c1 { background-color: var(--color-p1-c1); }
.picker-p1-c2 { background-color: var(--color-p1-c2); }
.picker-p1-c3 { background-color: var(--color-p1-c3); }


.bg-illu-token-c0 { background-color: #000000; }
.bg-illu-token-c1 { background-color: #3CBCFC; }
.bg-illu-token-c2 { background-color: #747474; }
.bg-illu-token-c3 { background-color: #BCBCBC; }

.bg-illu-small-c0 { background-color: #000000; }
.bg-illu-small-c1 { background-color: #C4C4C4; }
.bg-illu-small-c2 { background-color: #00EBDB; }
.bg-illu-small-c3 { background-color: #FCD8A8; }

.bg-illu-large-c0 { background-color: #000000; }
.bg-illu-large-c1 { background-color: #3CBCFC; }
.bg-illu-large-c2 { background-color: #787878; }
.bg-illu-large-c3 { background-color: #C4C4C4; }


ul.code-states {
  list-style-type: none;
  padding: 0.2em;
}

textarea.sourcecode {
  width: 100%;
  min-height: 600px;
}

ul.ai-selectors {
  list-style-type: none;
  padding: 0.2em;
}

div.ai-attack-preview {
  display: flex;
  margin-top: 1em;
}

div.ai-attack-canvas {
  flex: 0 0 fit-content;
  position: relative;
}

div.ai-attack-canvas canvas {
  margin: 0;
}

.code-routines input {
  width: 30em;
}

.code-routines ul {
  list-style-type: none;
  padding: 0;
  margin: 0.2em 0 0.5em 2em;
}
.code-routines li label {
  display: flex;
  width: 30%;
  min-width: 40em;
  padding: 0.1em;
}
.code-routines li span {
  flex: 1;
}
.code-routines li input {
  flex: 3;
}

#help i.fas {
  font-size: 90%;
  vertical-align: baseline;
}

#help kbd {
  background-color: #222;
  font-family: monospace;
  padding: 0.1em 0.3em;
}


.tab-animations ul {
  list-style-type: none;
  font-size: 110%;
  padding: 0;
}

.tab-animations li {
  margin: 0.1em;
}

.tab-animations .stb-animation-thumbnail {
  margin-right: 0.5em;
  vertical-align: middle;
}

