:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #d6d6dd;
  --muted: #6e7681;
  --line: #3a3a3a;
  --line-strong: #5c5c5c;
  --box: #070707;
  --box-line: #2b2b2b;
  --button: #2a2a2a;
  --button-hover: #333333;
  --frame: 24px;
  --sheet-w: 220px;
  --sheet-h: 140px;
  --font: Menlo, Monaco, "Courier New", monospace;
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  overflow: hidden;
}

.track {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 48px 32px;
  transition: opacity 0.28s ease;
}

.track.is-inactive {
  opacity: 0;
  pointer-events: none;
}

.track-row {
  display: flex;
  align-items: center;
  margin: 0 auto;
}

.card,
.add-file,
.save,
.close {
  font-family: var(--ui-font);
  cursor: pointer;
}

.card:focus-visible,
.add-file:focus-visible,
.save:focus-visible,
.close:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 2px;
}

.card {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--sheet-w);
  height: var(--sheet-h);
  border: 1px solid var(--line);
  background: var(--bg);
  color: #ececec;
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
}

.card.is-titled {
  display: block;
  padding: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
}

.card-text {
  display: block;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 8px 16px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card:hover {
  border-color: var(--line-strong);
  color: #fff;
}

.arrow {
  flex: 0 0 84px;
  height: 18px;
  margin: 0 8px;
  background: #ececec;
  clip-path: polygon(0 6px, 54px 6px, 54px 0, 84px 9px, 54px 18px, 54px 12px, 0 12px);
}

.sheet {
  position: fixed;
  z-index: 2;
  width: var(--sheet-w);
  height: var(--sheet-h);
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  transition:
    top 0.48s cubic-bezier(0.16, 0.84, 0.24, 1),
    left 0.48s cubic-bezier(0.16, 0.84, 0.24, 1),
    width 0.48s cubic-bezier(0.16, 0.84, 0.24, 1),
    height 0.48s cubic-bezier(0.16, 0.84, 0.24, 1);
}

.sheet.is-open,
.sheet.is-present {
  visibility: visible;
  pointer-events: auto;
}

.sheet.is-instant,
.sheet.is-instant .sheet-label,
.sheet.is-instant .composer,
.sheet.is-instant .sheet-actions,
.track.is-instant {
  transition: none;
}

.sheet-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #ececec;
  font-family: var(--ui-font);
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-label.is-titled {
  padding: 18px 16px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sheet.is-open .sheet-label {
  opacity: 0;
}

.sheet-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.sheet.is-open .sheet-actions {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.28s ease 0.18s;
}

.save {
  height: 26px;
  padding: 0 10px;
  border: 1px solid #3c3c3c;
  border-radius: 6px;
  background: var(--button);
  color: var(--fg);
  font-size: 12px;
  line-height: 1;
}

.save:hover {
  background: var(--button-hover);
}

.close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

.close:hover {
  color: #fff;
}

.composer {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 46px 32px 36px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s ease 0.18s;
}

.sheet.is-open .composer {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.project-head {
  margin-bottom: 28px;
}

.stamp {
  display: block;
  width: 100%;
  height: 36px;
  margin: 0 0 14px;
  padding: 0 12px;
  border: 1px solid var(--box-line);
  border-radius: 0;
  background: var(--box);
  color: var(--muted);
  font-family: var(--ui-font);
  font-size: 13px;
  outline: none;
  cursor: default;
}

.stamp[hidden] {
  display: none;
}

.version-title {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--box-line);
  border-radius: 0;
  resize: vertical;
  overflow: auto;
  background: var(--box);
  color: var(--fg);
  caret-color: #c6c6c6;
  font-family: var(--ui-font);
  outline: none;
}

.version-title::placeholder {
  color: var(--muted);
}

.version-title {
  height: 180px;
  min-height: 120px;
  font-size: 15px;
  line-height: 1.5;
}

.version-title:focus {
  border-color: #4a4a4a;
}

.version-title::selection {
  background: #264f78;
}

.entry + .entry {
  margin-top: 28px;
}

.code {
  display: block;
  width: 100%;
  height: 200px;
  min-height: 120px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--box-line);
  border-radius: 0;
  resize: vertical;
  overflow: auto;
  background: var(--box);
  color: var(--fg);
  caret-color: #c6c6c6;
  font-family: var(--font);
  font-size: 13px;
  line-height: 22px;
  tab-size: 4;
  white-space: pre;
  outline: none;
}

.code:focus {
  border-color: #4a4a4a;
}

.code::selection {
  background: #264f78;
}

.add-file {
  display: grid;
  place-items: center;
  width: 148px;
  height: 88px;
  margin: 28px auto 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: #ececec;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.add-file:hover {
  border-color: var(--line-strong);
  color: #fff;
}

.card-text::-webkit-scrollbar,
.track::-webkit-scrollbar,
.composer::-webkit-scrollbar,
.code::-webkit-scrollbar,
.version-title::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.card-text::-webkit-scrollbar-thumb,
.track::-webkit-scrollbar-thumb,
.composer::-webkit-scrollbar-thumb,
.code::-webkit-scrollbar-thumb,
.version-title::-webkit-scrollbar-thumb {
  background: rgba(121, 121, 121, 0.35);
  border: 4px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.card-text::-webkit-scrollbar-thumb:hover,
.track::-webkit-scrollbar-thumb:hover,
.composer::-webkit-scrollbar-thumb:hover,
.code::-webkit-scrollbar-thumb:hover,
.version-title::-webkit-scrollbar-thumb:hover {
  background: rgba(180, 180, 180, 0.45);
  border: 4px solid transparent;
  background-clip: padding-box;
}

.card-text::-webkit-scrollbar-corner,
.track::-webkit-scrollbar-corner,
.composer::-webkit-scrollbar-corner,
.code::-webkit-scrollbar-corner,
.version-title::-webkit-scrollbar-corner {
  background: transparent;
}

@media (max-width: 640px) {
  :root {
    --frame: 12px;
  }

  .composer {
    padding: 44px 16px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-label,
  .composer,
  .sheet-actions,
  .track {
    transition: none;
  }
}
