body {
  margin: 0;
  min-height: 100vh;
  background: #1a1a1a;
  padding: 2rem 1rem;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
}

.page-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

.center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
}

.margins {
  flex-shrink: 0;
  width: 11em;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 28px;
  align-self: stretch;
}

.margins-left {
  align-items: flex-end;
}

.margins-right {
  align-items: flex-start;
}

.margins-bottom {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 4rem;
  flex-wrap: wrap;
  width: 100%;
}

.terminal {
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
  background: #0c0c0c;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2d2d2d;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.terminal-titlebar {
  height: 28px;
  background: #2d2d2d;
  display: flex;
  align-items: center;
  padding-left: 12px;
  gap: 8px;
}

.terminal-titlebar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
  position: relative;
}

.terminal-titlebar span:nth-child(1) { background-color: #ffbd2e; }
.terminal-titlebar span:nth-child(2) { background-color: #27c93f; }

.terminal-titlebar span::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s ease;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1;
  transform: translate(0.25px, -1px);
}

.terminal-titlebar .window-control[data-action="minimize"]::after {
  content: "\2212";
}

.terminal-titlebar .window-control[data-action="expand"]::after {
  content: "+";
}

.terminal-titlebar:hover span::after {
  opacity: 1;
}

.terminal-titlebar span:active {
  transform: scale(0.97);
}

.terminal.minimized .terminal-content {
  display: none;
}

.terminal.expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  max-width: none;
  width: 90vw;
  height: 90vh;
  margin: auto;
  border-radius: 12px;
}

.terminal.expanded .terminal-content {
  max-height: calc(90vh - 28px);
  overflow: auto;
}

.terminal-content {
  padding: 16px 20px 24px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
  color: #ff79c6;
  min-height: 200px;
}

.terminal-content main {
  margin: 0;
  max-width: none;
  padding: 0;
}

.terminal-content .passage {
  display: block;
  margin-bottom: 1rem;
  filter: blur(5px);
  opacity: 0.55;
  transition: filter 200ms ease, opacity 200ms ease;
}

.terminal-content .passage.revealed {
  filter: none;
  opacity: 1;
}

.terminal-content .passage:not(.revealed) a {
  pointer-events: none;
}

.terminal-content a {
  color: #ff79c6;
  text-decoration: underline;
}

.terminal-content a:hover {
  color: #ff9ed8;
}

.terminal-content a.choice.target-revealed {
  color: #d96ba3;
  text-decoration: none;
  border-bottom: 1px dotted #d96ba3;
}

.terminal-content a.choice.target-revealed:hover {
  color: #e080b0;
}

.terminal-content .aside {
  font-style: italic;
  color: #ff79c6;
}

.terminal-caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  background: currentColor;
  vertical-align: text-bottom;
  margin-left: -2px;
  animation: terminal-caret-blink 1s step-end infinite;
}

@keyframes terminal-caret-blink {
  50% { opacity: 0; }
}

.margin-window {
  flex-shrink: 0;
  width: max-content;
  min-width: 100px;
  background: #0c0c0c;
  border-radius: 8px;
  border: 1px solid #2d2d2d;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.margin-window-titlebar {
  height: 28px;
  background: #2d2d2d;
  display: flex;
  align-items: center;
  padding-left: 12px;
  gap: 8px;
}

.margin-window-titlebar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
  position: relative;
}

.margin-window-titlebar span:nth-child(1) { background-color: #ff5f56; }
.margin-window-titlebar span:nth-child(2) { background-color: #ffbd2e; }
.margin-window-titlebar span:nth-child(3) { background-color: #27c93f; }

.margin-window-titlebar span::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s ease;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1;
  transform: translate(0.25px, -1px);
}

.margin-window-titlebar .window-control[data-action="close"]::after {
  content: "\00D7";
}

.margin-window-titlebar .window-control[data-action="minimize"]::after {
  content: "\2212";
}

.margin-window-titlebar .window-control[data-action="expand"]::after {
  content: "+";
}

.margin-window-titlebar:hover span::after {
  opacity: 1;
}

.margin-window-titlebar span:active {
  transform: scale(0.97);
}

.margin-window.minimized .margin-window-content {
  display: none;
}

.margin-window.expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 90vw;
  height: 90vh;
  max-width: none;
  margin: auto;
  border-radius: 12px;
}

.margin-window.expanded .margin-window-content {
  padding: 20px 24px;
  max-height: calc(90vh - 28px);
  overflow: auto;
}

.margin-window-content {
  padding: 16px 20px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", "Consolas", "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
  color: #ff79c6;
  white-space: pre;
}

.title-author-window {
  white-space: normal;
  text-align: center;
}

.title-author-window .title-author-title {
  font-weight: 500;
  font-size: 14px;
  margin: 0 0 0.25em;
}

.title-author-window .title-author-by {
  font-size: 12px;
  opacity: 0.9;
  margin: 0;
}

/* Mobile phone only: all ASCII windows move to bottom of piece */
@media (max-width: 480px) {
  .page-row {
    flex-direction: column;
    align-items: center;
  }

  .center-column {
    order: 1;
  }

  .margins-left {
    order: 2;
    align-items: flex-start;
  }

  .margins-right {
    order: 3;
  }

  .margins {
    width: 100%;
    max-width: none;
    padding-top: 0.75rem;
    align-self: stretch;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .margins-bottom {
    gap: 0.75rem;
  }
}

