:root {
  font-family: system-ui, sans-serif;
  color: #dce5f3;
  background: #10141c;
  color-scheme: dark
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column
}

header {
  padding: 16px 22px;
  border-bottom: 1px solid #30394b;
  display: flex;
  align-items: center;
  gap: 14px
}

h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 650
}

.badge {
  font-size: 11px;
  color: #89ddbc;
  border: 1px solid #365e51;
  padding: 4px 8px;
  border-radius: 20px
}

header p {
  margin: 0 0 0 auto;
  color: #9faec2;
  font-size: 13px
}

main {
  display: grid;
  grid-template-columns: minmax(260px, 350px) 1fr;
  flex: 1;
  min-height: 0
}

.editor {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #30394b;
  min-height: 0;
  background: #171e29
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #30394b
}

label {
  font-size: 13px;
  font-weight: 600
}

button,
.file {
  border: 1px solid #435069;
  background: #222d3e;
  color: #e3ecf9;
  padding: 7px 11px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px
}

button:hover,
.file:hover {
  background: #33435c
}

button:focus-visible,
.file:focus-within,
summary:focus-visible {
  outline: 2px solid #8ab9ff;
  outline-offset: 2px
}

button.primary {
  background: #8cb9ff;
  color: #101e33;
  border-color: #8cb9ff;
  font-weight: 650
}

button:disabled {
  opacity: .4;
  cursor: default
}

textarea {
  flex: 1;
  min-height: 170px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: #d2dff2;
  padding: 16px;
  font: 12px/1.65 ui-monospace, monospace;
  tab-size: 2
}

textarea:focus {
  box-shadow: inset 0 0 0 1px #718fb7
}

.editor footer {
  padding: 10px 14px;
  color: #9faec2;
  font-size: 11px;
  border-top: 1px solid #30394b
}

details {
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px solid #30394b;
  padding: 12px 14px;
  color: #b9c8dc
}

summary {
  cursor: pointer;
  color: #dce5f3
}

details p {
  margin: 8px 0
}

code {
  color: #b9d4ff
}

.preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0
}

.preview .bar {
  background: #171e29
}

#zoomLabel {
  min-width: 50px;
  text-align: center;
  font-size: 12px;
  color: #adbed5
}

#status {
  margin-left: auto;
  font-size: 12px;
  color: #a9b9ce
}

#viewport {
  flex: 1;
  min-height: 0;
  width: 100%;
  background-color: #10141c;
  background-image: radial-gradient(#344052 1px, transparent 1px);
  background-size: 20px 20px;
  touch-action: none;
  cursor: grab
}

#viewport:active {
  cursor: grabbing
}

#error {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #8c4b4b;
  background: #3c222b;
  color: #ffd0d0;
  font: 12px/1.5 ui-monospace, monospace;
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto
}

#error[hidden] {
  display: none
}

.hint {
  font-size: 11px;
  color: #9faec2;
  padding: 8px 12px;
  border-top: 1px solid #30394b;
  background: #171e29
}

.edge-input { color: #8cb9ff }
.edge-output { color: #ffc078 }
.edge-both { color: #d6a4ff }

.spacer {
  flex: 1
}

.file {
  display: inline-block;
  font-weight: 400
}

.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0
}

@media(max-width:700px) {
  header {
    padding: 12px
  }

  header p {
    display: none
  }

  main {
    grid-template-columns: 1fr;
    grid-template-rows: 42% 58%
  }

  .editor {
    border-right: 0;
    border-bottom: 1px solid #30394b
  }

  textarea {
    min-height: 60px
  }

  details {
    max-height: 110px;
    overflow: auto
  }

  .editor footer {
    display: none
  }

  .bar {
    padding: 8px
  }

  #status {
    width: 100%;
    margin-left: 0
  }
}
