:root {
  --black: #000;
  --white: #fff;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 16.5px;
  line-height: 1.8;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 42%, transparent 68%),
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 38%, transparent 64%),
    radial-gradient(circle, rgba(255, 255, 255, 0.75) 0 36%, transparent 62%);
  -webkit-mask-size: 260px 260px, 340px 340px, 420px 420px;
  -webkit-mask-position: 12% 18%, 70% 12%, 40% 78%;
  -webkit-mask-repeat: no-repeat;
  mask-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 42%, transparent 68%),
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 38%, transparent 64%),
    radial-gradient(circle, rgba(255, 255, 255, 0.75) 0 36%, transparent 62%);
  mask-size: 260px 260px, 340px 340px, 420px 420px;
  mask-position: 12% 18%, 70% 12%, 40% 78%;
  mask-repeat: no-repeat;
  animation: pulse-drift 40s ease-in-out infinite;
  will-change: opacity, mask-position, -webkit-mask-position, mask-size, -webkit-mask-size;
}

::selection {
  background: var(--white);
  color: var(--black);
}

a,
a:visited {
  color: var(--white);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  outline: none;
  text-decoration-style: dashed;
}

.ghost-link,
.ghost-link:visited,
.ghost-link:hover,
.ghost-link:focus {
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 70px;
  position: relative;
  z-index: 1;
}

.file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid var(--white);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 14px;
}

.file-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-transform: lowercase;
  letter-spacing: 0.6px;
}

.file-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.file-meta {
  font-size: 0.85rem;
}

.mini-portrait {
  width: 64px;
  height: 64px;
  border: 2px solid var(--white);
  object-fit: cover;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.code-window {
  border: 2px solid var(--white);
  background: rgba(255, 255, 255, 0.02);
  padding: 18px 18px 20px;
  overflow-x: auto;
  position: relative;
  --gutter: 72px;
}

.code-lines {
  counter-reset: line;
  position: relative;
}

.code-lines::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--gutter) - 8px);
  width: 1px;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.line {
  position: relative;
  padding-left: var(--gutter);
  white-space: pre;
  line-height: 1.9;
  min-height: 1.9em;
}

.line::before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: 0;
  width: calc(var(--gutter) - 20px);
  text-align: right;
  font-size: 0.8rem;
  opacity: 0.7;
  top: 0.08em;
  line-height: 1.9;
}

.line.spacer {
  height: 1.9em;
}

.line.wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kw {
  font-weight: 700;
}

.str,
.comment {
  font-style: italic;
}

.str {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.infoview {
  border: 2px solid var(--white);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.infoview-header {
  border-bottom: 1px solid var(--white);
  padding-bottom: 6px;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.6px;
}

.infoview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.infoview-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.infoview-group.nested {
  padding-left: 14px;
}

.fold-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.6px;
  padding: 2px 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.fold-toggle::before {
  content: "\25BE";
  display: inline-block;
  width: 1ch;
}

.fold-toggle:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.infoview-title {
  font-size: 0.95rem;
}

.infoview-subtitle {
  font-size: 0.9rem;
}

.fold-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 14px;
}

.infoview-group.is-collapsed > .fold-toggle::before {
  content: "\25B8";
}

.infoview-group.is-collapsed > .fold-body {
  display: none;
}

.infoview-line {
  white-space: pre-wrap;
}

.message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  white-space: pre-wrap;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag {
  border: 1px solid var(--white);
  padding: 1px 6px;
  font-size: 0.75rem;
  text-transform: lowercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.line.editable {
  outline: none;
  cursor: text;
  caret-color: transparent;
  user-select: none;
}

.line.editable:focus {
  outline: none;
  background: transparent;
}

.line.editable.is-active::after {
  content: "";
  position: absolute;
  left: calc(var(--gutter) + var(--caret-col, 0) * 1ch);
  top: 0.25em;
  width: 0.7ch;
  height: 1.25em;
  background: var(--white);
  animation: blink 1s steps(1) infinite;
  pointer-events: none;
}

.line.is-command {
  font-weight: 700;
}

@keyframes pulse-drift {
  0% {
    -webkit-mask-position: 10% 12%, 75% 20%, 35% 80%;
    mask-position: 10% 12%, 75% 20%, 35% 80%;
    -webkit-mask-size: 240px 240px, 320px 320px, 400px 400px;
    mask-size: 240px 240px, 320px 320px, 400px 400px;
    opacity: 0.32;
  }
  25% {
    -webkit-mask-position: 30% 18%, 60% 5%, 70% 60%;
    mask-position: 30% 18%, 60% 5%, 70% 60%;
    -webkit-mask-size: 280px 280px, 360px 360px, 430px 430px;
    mask-size: 280px 280px, 360px 360px, 430px 430px;
    opacity: 0.48;
  }
  50% {
    -webkit-mask-position: 15% 65%, 80% 35%, 25% 30%;
    mask-position: 15% 65%, 80% 35%, 25% 30%;
    -webkit-mask-size: 250px 250px, 340px 340px, 410px 410px;
    mask-size: 250px 250px, 340px 340px, 410px 410px;
    opacity: 0.36;
  }
  75% {
    -webkit-mask-position: 45% 75%, 55% 15%, 85% 45%;
    mask-position: 45% 75%, 55% 15%, 85% 45%;
    -webkit-mask-size: 290px 290px, 370px 370px, 450px 450px;
    mask-size: 290px 290px, 370px 370px, 450px 450px;
    opacity: 0.5;
  }
  100% {
    -webkit-mask-position: 10% 12%, 75% 20%, 35% 80%;
    mask-position: 10% 12%, 75% 20%, 35% 80%;
    -webkit-mask-size: 240px 240px, 320px 320px, 400px 400px;
    mask-size: 240px 240px, 320px 320px, 400px 400px;
    opacity: 0.32;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .file-bar {
    flex-direction: row;
    align-items: center;
  }

  .mini-portrait {
    width: 48px;
    height: 48px;
  }

  .code-window {
    --gutter: 56px;
  }

  .line::before {
    width: 50px;
  }
}
