/*
 * DOS-era gamebook look: the 16-colour VGA text-mode palette, a bitmap-style font (VT323,
 * SIL OFL, see fonts/OFL-VT323.txt), double-line frames, no rounded corners, no gradients.
 */
@font-face {
  font-family: "VT323";
  src: url("/fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  /* VGA palette (only these colours are used) */
  --black: #000000;
  --blue: #0000aa;
  --cyan: #00aaaa;
  --red: #aa0000;
  --brown: #aa5500;
  --grey: #aaaaaa;
  --dark-grey: #555555;
  --bright-cyan: #55ffff;
  --yellow: #ffff55;
  --white: #ffffff;

  --frame: 4px double var(--grey);
  font-size: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--black);
  color: var(--grey);
  font-family: "VT323", "Courier New", monospace;
  line-height: 1.15;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

[hidden] {
  display: none !important;
}

.screen {
  max-width: 820px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--blue);
  border-left: var(--frame);
  border-right: var(--frame);
}

.titlebar {
  display: flex;
  justify-content: space-between;
  gap: 1ch;
  padding: 0 1ch;
  background: var(--cyan);
  color: var(--black);
}

.where {
  color: var(--blue);
}

.panel {
  padding: 1rem 1.5ch;
}

.logo {
  margin: 1rem 0;
  color: var(--yellow);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
  white-space: pre;
  overflow: hidden;
}

.panel > p {
  color: var(--white);
}

.picture {
  margin: 0 0 1rem;
  padding: 6px;
  border: var(--frame);
  border-color: var(--yellow);
  background: var(--black);
}

.picture img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  background: var(--black);
}

.text {
  color: var(--white);
  font-size: 1.1rem;
}

.text p {
  margin: 0 0 0.8rem;
}

.text .action {
  color: var(--bright-cyan);
}

.choices {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.choices li {
  margin: 0.15rem 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 0.5ch;
  cursor: pointer;
  text-align: left;
}

.choices button {
  width: 100%;
  color: var(--yellow);
  font-size: 1.1rem;
}

.choices button:hover,
.choices button:focus-visible,
.bar button:hover,
.bar button:focus-visible,
.history button:hover,
.history button:focus-visible {
  background: var(--cyan);
  color: var(--black);
  outline: none;
}

.key {
  color: var(--white);
}

.choices button:hover .key,
.choices button:focus-visible .key {
  color: var(--blue);
}

.the-end {
  text-align: center;
  color: var(--yellow);
  font-size: 1.4rem;
}

.own-action {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5ch;
  margin: 1rem 0;
}

.own-action label {
  flex-basis: 100%;
  color: var(--grey);
}

.prompt {
  color: var(--white);
}

.own-action input {
  flex: 1;
  min-width: 10ch;
  font: inherit;
  font-size: 1.1rem;
  color: var(--white);
  background: var(--black);
  border: 0;
  border-bottom: 2px solid var(--grey);
  padding: 0 0.5ch;
  caret-color: var(--yellow);
}

.own-action input:focus {
  outline: none;
  border-bottom-color: var(--yellow);
}

.own-action button {
  color: var(--black);
  background: var(--grey);
}

.own-action button:hover,
.own-action button:focus-visible {
  background: var(--white);
  outline: none;
}

.bar {
  display: flex;
  gap: 2ch;
  padding: 0.2rem 0.5ch;
  background: var(--grey);
  color: var(--black);
}

.bar .key {
  color: var(--red);
}

.bar button:disabled {
  color: var(--dark-grey);
  cursor: default;
}

.bar button:disabled .key {
  color: var(--dark-grey);
}

.history {
  margin: 0;
  padding: 0.5rem 1ch 0.5rem 4ch;
  border: var(--frame);
  border-top: 0;
  background: var(--black);
  color: var(--grey);
}

.history button {
  color: var(--bright-cyan);
}

.history .current {
  color: var(--yellow);
}

.busy {
  padding-top: 4rem;
  text-align: center;
  color: var(--white);
}

.busy .hint {
  color: var(--grey);
}

.cursor {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    visibility: hidden;
  }
}

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

.error {
  margin: 1rem 1.5ch;
  padding: 0.3rem 1ch;
  background: var(--red);
  color: var(--white);
}

@media (max-width: 600px) {
  :root {
    font-size: 19px;
  }

  .screen {
    border: 0;
  }

  .logo {
    font-size: 0.55rem;
  }
}
