:root {
  --bg: #12141a;
  --fg: #d7dae0;
  --dim: #7d8590;
  --accent: #b8e986;
  --link: #8ab4f8;
  --error: #ff7b72;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfaf7;
    --fg: #24292f;
    --dim: #6e7781;
    --accent: #2f7d32;
    --link: #0b57d0;
    --error: #cf222e;
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  font: 15px/1.5 ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.terminal {
  max-width: 88ch;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  cursor: text;
}

#screen > div {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* One div per output line; main.js sets a hanging indent on each, so wrapped
   text lines up under "Piet: " or after "[1] " instead of at column 0. */
.line {
  min-height: 1.5em;
}

/* Menu options are tappable. Old menus get disabled once a new one appears. */
.choice {
  all: unset;
  display: block;
  cursor: pointer;
  color: var(--link);
  padding: 0.2em 0;
}

.choice:hover,
.choice:focus-visible {
  text-decoration: underline;
}

.choice:disabled {
  color: inherit;
  cursor: text;
  text-decoration: none;
}

#screen > div + div {
  margin-top: 0.15em;
}

.echo {
  color: var(--dim);
  /* A little room above the answer when it's scrolled to the top. */
  scroll-margin-top: 1rem;
}

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

a {
  color: var(--link);
}

#prompt-line {
  display: flex;
  align-items: baseline;
}

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

#prompt {
  color: var(--accent);
  white-space: pre;
}

#input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  caret-color: var(--accent);
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

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

  .terminal {
    padding: 1rem max(0.75rem, env(safe-area-inset-right)) 1rem max(0.75rem, env(safe-area-inset-left));
  }

  /* iOS zooms into any input with text smaller than 16px. */
  #input {
    font-size: 16px;
  }
}
