*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #000;
  --s1: #09090a;
  --s2: #0f0f11;
  --s3: #151517;
  --s4: #1c1c1f;
  --s5: #242428;
  --line: rgba(255, 255, 255, 0.05);
  --tx: #ededed;
  --dim: #8e8e8e;
  --faint: #56565c;
  --acc: #8b7cff;
  --side: 232px;
  --col: 250px;
  --stage: 152px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
  scrollbar-color: #242428 transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font: 400 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum", "cv11";
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #1c1c1f;
  border-radius: 10px;
  border: 2px solid #000;
}

::-webkit-scrollbar-track {
  background: transparent;
}

kbd {
  font: 500 11px/1 Inter, system-ui, sans-serif;
  color: var(--dim);
  background: var(--s4);
  padding: 4px 6px;
  border-radius: 6px;
}

.glow {
  position: fixed;
  left: -160px;
  top: -200px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: var(--acc);
  opacity: 0.17;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.side {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  padding: 22px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
}

.brand b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  font-size: 12px;
  color: var(--dim);
}

.mark {
  width: 30px;
  height: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  flex: none;
}

.mark i {
  border-radius: 4px;
  background: #fff;
}

.mark i:nth-child(2) {
  opacity: 0.55;
  border-radius: 50%;
}

.mark i:nth-child(3) {
  opacity: 0.3;
  border-radius: 50%;
}

.mark i:nth-child(4) {
  opacity: 0.8;
}

#nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#nav a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 12px 0 14px;
  border-radius: 10px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

#nav a span {
  font-size: 11px;
  color: var(--faint);
  transition: color 0.15s;
}

#nav a:hover {
  color: var(--tx);
}

#nav a.on {
  color: #fff;
}

#nav a.on span {
  color: var(--dim);
}

#nav a.none {
  opacity: 0.35;
}

.pill {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 34px;
  border-radius: 10px;
  background: var(--s4);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.3, 0.9, 0.3, 1), width 0.3s cubic-bezier(0.3, 0.9, 0.3, 1), opacity 0.2s;
}

.pill::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 14px;
  margin-top: -7px;
  border-radius: 2px;
  background: #fff;
}

.side-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--faint);
}

.side-foot span {
  margin-right: 6px;
}

.main {
  position: relative;
  margin-left: var(--side);
  padding: 0 28px 96px 16px;
  min-width: 0;
  z-index: 1;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 68px;
  margin: 0 -28px 0 -16px;
  padding: 0 28px 0 16px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 460px;
  height: 40px;
  padding: 0 10px 0 14px;
  border-radius: 12px;
  background: var(--s2);
  color: var(--dim);
  cursor: text;
  transition: background 0.15s;
}

.search:hover {
  background: var(--s3);
}

.search:focus-within {
  background: var(--s4);
  color: #fff;
}

.search span {
  display: grid;
}

.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--tx);
  font: inherit;
}

.search input::placeholder {
  color: var(--faint);
}

.shown {
  margin-left: auto;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--s2);
}

.seg button,
.tog,
.d-btn,
.d-ico,
.tacts button {
  border: 0;
  cursor: pointer;
  font: 500 12px/1 Inter, system-ui, sans-serif;
}

.seg button {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  transition: background 0.15s, color 0.15s;
}

.seg button:hover {
  color: var(--tx);
}

.seg button.on {
  background: var(--s5);
  color: #fff;
}

.tog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border-radius: 11px;
  background: var(--s2);
  color: var(--dim);
  transition: background 0.15s, color 0.15s;
}

.tog:hover {
  background: var(--s4);
}

.tog i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  transition: background 0.15s;
}

.tog.on {
  color: #fff;
}

.tog.on i {
  background: #3ecf8e;
}

.sec {
  padding-top: 30px;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 14px;
}

.sec-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.sec-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--dim);
  background: var(--s3);
  padding: 4px 8px;
  border-radius: 20px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--col), 1fr));
  grid-auto-flow: dense;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 18px;
  background: var(--s1);
  border: 1px solid var(--line);
  overflow: hidden;
}

.tile.w2 {
  grid-column: span 2;
}

.tile.w3 {
  grid-column: span 3;
}

.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--stage);
  padding: 24px 18px;
  overflow: hidden;
  color: #ededed;
  font-size: 13px;
}

.tfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 38px;
  padding: 0 7px 0 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}

.tname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tacts {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.tile:hover .tacts,
.tile:focus-within .tacts {
  opacity: 1;
}

.tacts button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  transition: background 0.15s, color 0.15s;
}

.tacts button:hover {
  background: var(--s4);
  color: #fff;
}

body.dense {
  --col: 200px;
  --stage: 124px;
}

.tile.paused .stage *,
.tile.paused .stage *::before,
.tile.paused .stage *::after,
body.still .stage *,
body.still .stage *::before,
body.still .stage *::after {
  animation-play-state: paused !important;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 120px 0;
  color: var(--dim);
}

.empty b {
  color: var(--tx);
  font-weight: 500;
  margin-top: 8px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 60;
  width: min(540px, 100vw);
  display: flex;
  flex-direction: column;
  background: #070708;
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.34s cubic-bezier(0.3, 0.9, 0.3, 1);
}

body.coding .scrim {
  opacity: 1;
  pointer-events: auto;
}

body.coding .drawer {
  transform: none;
}

.d-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 14px 22px;
}

.d-head div {
  flex: 1;
  min-width: 0;
}

.d-head b {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.d-head small {
  font-size: 12px;
  color: var(--dim);
}

.d-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--s4);
  color: var(--tx);
  transition: background 0.15s;
}

.d-btn:hover {
  background: #2a2a2e;
}

.d-btn.white {
  background: #fff;
  color: #000;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
}

.d-btn.white:hover {
  background: #dcdcdc;
}

.d-ico {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  transition: background 0.15s, color 0.15s;
}

.d-ico:hover {
  background: var(--s4);
  color: #fff;
}

.d-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.d-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.d-body pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--s2);
  max-height: 46vh;
  overflow: auto;
  font: 400 12px/1.65 "JetBrains Mono", ui-monospace, Consolas, monospace;
  color: #cfcfd4;
  tab-size: 2;
}

.d-body pre.wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.flash {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.flash.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
[contenteditable]:focus-visible {
  outline: 0;
}

@media (max-width: 1080px) {
  .tile.w3 {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .side {
    position: static;
    width: auto;
    padding: 16px 16px 0;
    gap: 14px;
    overflow: visible;
  }

  #nav {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 0 16px;
  }

  #nav a {
    gap: 8px;
    flex: none;
  }

  .pill::before,
  .side-foot,
  .shown,
  .search kbd {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 0 16px 80px;
  }

  .top {
    margin: 0 -16px;
    padding: 0 16px;
  }
}

@media (max-width: 620px) {
  :root {
    --col: 220px;
  }

  .tile.w2,
  .tile.w3 {
    grid-column: auto;
  }

  .seg {
    display: none;
  }
}
