:root {
  color-scheme: dark;
  --bg: #141619;
  --panel: #191c20;
  --raised: #22262b;
  --ink: #dadde1;
  --muted: #8b939e;
  --line: #2c3138;
  --accent: #8bceb6;
  font:
    13px/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;
}
button,
input,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 0;
  background: none;
  color: inherit;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
}
button:hover {
  background: var(--raised);
}
button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
a {
  color: var(--accent);
}
[hidden] {
  display: none !important;
}
header {
  height: 45px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 15px;
  background: var(--panel);
}
.brand {
  font-size: 19px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}
.brand span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 3px;
}
.spacer {
  flex: 1;
}
#connection {
  font-size: 11px;
  color: var(--muted);
}
#install {
  color: var(--accent);
  border: 1px solid var(--line);
}
main {
  display: flex;
  height: calc(100dvh - 45px);
}
aside {
  width: 235px;
  min-width: 170px;
  max-width: 40vw;
  resize: horizontal;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}
.panel-head {
  height: 41px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 2px;
  font-size: 10px;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--line);
}
.panel-head span {
  flex: 1;
}
.panel-head button {
  padding: 4px 6px;
}
#tree {
  flex: 1;
  overflow: auto;
  padding: 10px 0;
}
.tree-row {
  display: flex;
  align-items: center;
  height: 31px;
}
.tree-row.active {
  background: var(--raised);
  color: var(--accent);
}
.tree-row > button:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  flex: 1;
  border-radius: 0;
}
.tree-row .more {
  opacity: 0;
  padding: 2px 7px;
}
.tree-row:hover .more,
.tree-row:focus-within .more {
  opacity: 1;
}
.storage {
  padding: 12px;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--line);
}
.storage button {
  display: block;
  padding-left: 0;
  color: var(--accent);
}
#workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tab-row {
  display: flex;
  height: 41px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
#tabs {
  display: flex;
  flex: 1;
  overflow: auto;
}
.tab {
  display: flex;
  border-right: 1px solid var(--line);
  max-width: 240px;
  align-items: center;
  color: var(--muted);
}
.tab.selected {
  color: var(--ink);
  background: var(--panel);
  box-shadow: inset 0 2px var(--accent);
}
.tab button:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 90px;
}
.tab button:last-child {
  padding: 4px 8px;
}
#welcome {
  display: grid;
  place-items: center;
  flex: 1;
}
.welcome-inner {
  width: min(420px, 85%);
  padding-bottom: 55px;
}
.wordmark {
  font-size: 76px;
  font-weight: 650;
  letter-spacing: -7px;
}
.wordmark span {
  color: var(--accent);
}
h1 {
  font-size: 19px;
  font-weight: 400;
  margin: 8px 0;
}
p,
small {
  color: var(--muted);
}
.welcome-actions {
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.welcome-actions button {
  display: flex;
  text-align: left;
  padding: 10px 0;
}
.welcome-actions kbd,
.welcome-actions span {
  margin-left: auto;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
}
#canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}
#gutter {
  width: 58px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: pre;
  text-align: right;
  padding: 22px 14px;
  color: #68717c;
  font-size: 14px;
  line-height: 23px;
  user-select: none;
}
textarea {
  background: transparent;
  color: var(--ink);
  border: 0;
  outline: 0;
  resize: none;
  flex: 1;
  min-width: 0;
  padding: 22px 24px 60px 0;
  font-size: 14px;
  line-height: 23px;
  tab-size: 2;
  caret-color: var(--accent);
}
textarea::selection {
  background: #426052;
}
footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  height: 32px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
#message {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 60%;
}
#mode {
  color: var(--accent);
}
#findbar {
  padding: 8px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}
input,
select {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 9px;
  color: var(--ink);
  min-width: 0;
  outline-color: var(--accent);
}
#findbar input {
  width: 180px;
}
#preview {
  padding: 30px 7%;
  overflow: auto;
  width: 100%;
  font: 15px/1.8 system-ui;
}
#preview h1 {
  font-size: 2em;
}
#preview pre {
  padding: 16px;
  background: var(--panel);
  overflow: auto;
}
#preview blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  color: var(--muted);
}
#preview table {
  border-collapse: collapse;
  font:
    13px/1.6 ui-monospace,
    monospace;
}
#preview td,
#preview th {
  border: 1px solid var(--line);
  padding: 7px 16px;
  text-align: left;
  white-space: pre-wrap;
}
#preview th {
  background: var(--panel);
}
#menu {
  position: fixed;
  z-index: 5;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px #0005;
  padding: 5px;
  min-width: 225px;
  max-height: 80vh;
  overflow: auto;
}
#menu button {
  display: flex;
  width: 100%;
  text-align: left;
  justify-content: space-between;
  gap: 25px;
}
#menu kbd {
  color: var(--muted);
  font: inherit;
  font-size: 11px;
}
dialog {
  width: min(540px, 92vw);
  max-height: 85dvh;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 22px;
  box-shadow: 0 24px 100px #0008;
}
dialog::backdrop {
  background: #0007;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
h2 {
  font-size: 16px;
  font-weight: 500;
}
#dialog-body {
  margin: 18px 0;
  max-height: 55vh;
  overflow: auto;
}
#dialog-body input {
  width: 100%;
}
#dialog-body button {
  display: block;
  width: 100%;
  text-align: left;
}
#dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
#dialog-submit {
  background: var(--accent);
  color: var(--bg);
}
.hint {
  font-size: 11px;
  color: var(--muted);
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open],
  #menu:not([hidden]) {
    animation: appear 0.12s ease-out;
  }
  @keyframes appear {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  button {
    transition: background 0.12s;
  }
}
@media (max-width: 650px) {
  header {
    gap: 6px;
    padding: 0 8px;
  }
  .brand span,
  #connection {
    display: none;
  }
  nav button {
    padding: 6px 8px;
  }
  aside {
    position: absolute;
    z-index: 3;
    top: 86px;
    bottom: 32px;
    width: 240px;
    max-width: 85vw;
    box-shadow: 15px 0 40px #0004;
  }
  footer {
    gap: 8px;
  }
  footer > span:last-child {
    display: none;
  }
  #position {
    white-space: nowrap;
  }
  #findbar {
    flex-wrap: wrap;
  }
  #findbar input {
    width: calc(50% - 5px);
  }
  #gutter {
    width: 40px;
    padding-right: 9px;
  }
  .tree-row .more {
    opacity: 1;
  }
}
