:root {
  --bg-top: #3b2a52;
  --bg: #1b1530;
  --term-bg: #16131e;
  --term-border: #3a3150;
  --titlebar: #221d2e;
  --text: #ece5d9;
  --muted: #8f87a0;
  --user: #9fd27c;
  --path: #82a6f5;
  --accent: #f5a35c;
  --motd: #f7bccb;
  --err: #f0808f;
  --warn: #ebc76f;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas,
    "DejaVu Sans Mono", "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 72%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 9%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 26%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 64%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 14%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 86%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 94% 88%, #fff7 50%, transparent 51%),
    radial-gradient(ellipse at top, var(--bg-top) 0%, var(--bg) 65%);
  background-attachment: fixed;
  font: 15px/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--motd);
}

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Room at the bottom for the cat to wander. */
  padding: 56px 16px 72px;
}

/* ---- terminal window ---- */

.terminal {
  width: 100%;
  max-width: 760px;
  height: min(560px, calc(100dvh - 170px));
  min-height: 320px;
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 10px;
  box-shadow: 0 24px 70px #0009, 0 0 0 1px #0004;
  overflow: hidden;
}

.terminal.fit {
  height: auto;
  min-height: 0;
}

/* The chat page's window: bigger than the privacy page's, with a note stuck on. */
.win {
  position: relative;
  width: 100%;
  max-width: 1120px;
}

.win .terminal {
  max-width: none;
  height: calc(100dvh - 170px);
}

.sticky {
  position: absolute;
  top: -34px;
  right: -18px;
  z-index: 1;
  width: 210px;
  padding: 20px 16px 16px;
  background: #fde58a;
  color: #3a2216;
  font-size: 14px;
  line-height: 1.4;
  transform: rotate(4deg);
  box-shadow: 0 10px 24px #0008, inset 0 -18px 18px -14px #0002;
}

/* tape */
.sticky::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 22px;
  margin-left: -35px;
  background: #ffffff55;
  border: 1px solid #ffffff33;
  transform: rotate(-6deg);
}

.sticky strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.sticky small {
  font-size: 12px;
  opacity: 0.8;
}

.titlebar {
  position: relative;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  background: var(--titlebar);
  border-bottom: 1px solid var(--term-border);
  user-select: none;
}

.dots {
  display: flex;
  gap: 7px;
}

.dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff6f6f;
}

.dots i:nth-child(2) {
  background: #ffcf5c;
}

.dots i:nth-child(3) {
  background: #6fd67a;
}

.title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.screen {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--term-border) transparent;
}

.line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 1.55em;
}

.ps1 {
  white-space: nowrap;
}

.ps1 .user {
  color: var(--user);
  font-weight: 700;
}

.ps1 .path {
  color: var(--path);
  font-weight: 700;
}

.prompt-line {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
}

.prompt-line[hidden] {
  display: none;
}

.prompt-line input {
  flex: 1;
  min-width: 4ch;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  caret-color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}

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

.muted {
  color: var(--muted);
}

.motd {
  color: var(--motd);
}

.err {
  color: var(--err);
}

.warn {
  color: var(--warn);
}

.partial {
  opacity: 0.6;
}

.footer {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---- privacy page ---- */

.notes {
  margin: 0.4em 0 1em;
  padding-left: 3ch;
}

.notes li {
  margin: 0.35em 0;
  padding-left: 0.5ch;
}

.notes li::marker {
  color: var(--accent);
}

/* ---- cat ---- */

#cat {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  will-change: transform;
}

.zzz {
  position: fixed;
  z-index: 11;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
  animation: zfloat 2.6s ease-out forwards;
}

@keyframes zfloat {
  from {
    opacity: 0;
    transform: translate(0, 0) scale(0.8);
  }
  20% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(12px, -34px) scale(1.2);
  }
}

/* Keep the note inside the page once there's no room beside the window. */
@media (max-width: 1180px) {
  .sticky {
    right: -4px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .stage {
    justify-content: flex-start;
    padding: 20px 16px 60px;
  }

  .terminal {
    height: calc(100dvh - 118px);
  }

  /* Extra room on top so the note sits over the titlebar, not the text. */
  .stage:has(.sticky) {
    padding-top: 92px;
  }

  .win .terminal {
    height: calc(100dvh - 190px);
  }

  .sticky {
    top: -78px;
    right: 4px;
    width: 160px;
    padding: 12px 10px 8px;
    font-size: 12px;
    transform: rotate(3deg);
  }

  .sticky strong {
    font-size: 14px;
  }

  .sticky small {
    font-size: 11px;
  }

  .title {
    font-size: 12px;
  }

  /* 16px stops iOS from zooming in on focus. */
  .prompt-line input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}
