/* The landing page: a green phosphor terminal. */

:root {
  --bg: #050a06;
  --fg: #3dff7a;
  --dim: #1f9e4a;
  --faint: #11552a;
  --amber: #ffb000;
  --glow: 0 0 6px rgb(61 255 122 / 0.45);
  --font: 'Cascadia Mono', 'IBM Plex Mono', 'DejaVu Sans Mono', ui-monospace, Consolas, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at center, #08140b 0%, var(--bg) 75%);
  color: var(--fg);
  font: 16px/1.6 var(--font);
  text-shadow: var(--glow);
}

/* Scanlines over everything. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgb(0 0 0 / 0.22) 0 1px, transparent 1px 3px);
}

::selection {
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 4px;
}

code,
kbd,
var {
  font: inherit;
}

kbd {
  color: var(--bg);
  background: var(--dim);
  padding: 0 0.35em;
  text-shadow: none;
}

var {
  color: var(--dim);
  font-style: normal;
}

var::before {
  content: '<';
}

var::after {
  content: '>';
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- the first screen ---- */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 0;
  text-align: center;
}

.boot {
  align-self: stretch;
  color: var(--dim);
  font-size: 0.8rem;
  text-align: left;
}

.boot p {
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
  animation: appear 0s 0s both;
}

.boot p:nth-child(2) { animation-delay: 0.25s; }
.boot p:nth-child(3) { animation-delay: 0.5s; }
.boot p:nth-child(4) { animation-delay: 0.75s; }

.ok {
  color: var(--fg);
}

h1 {
  margin: 0;
  animation: appear 0s 1s both;
}

.logo {
  margin: 0;
  /* Plain ASCII, so it lines up in any monospace font. 47 columns fit a phone. */
  font-size: clamp(7px, 2.9vw, 22px);
  line-height: 1.15;
  font-family: var(--font);
  font-weight: 700;
  /* The hero centres its text, which would centre each line on its own;
     the block is centred as a whole instead. */
  text-align: left;
}

.tagline {
  margin: 0;
  font-size: 1.1rem;
  animation: appear 0s 1.2s both;
}

/* The play command, in a box in the middle of the screen. */
.play {
  position: relative;
  width: min(40rem, 100%);
  border: 2px solid var(--fg);
  box-shadow: var(--glow), inset var(--glow);
  padding: 1.75rem 1rem;
  animation: appear 0s 1.4s both;
}

.play-label {
  position: absolute;
  top: -0.85em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 0.5em;
  background: var(--bg);
  color: var(--amber);
  text-shadow: 0 0 6px rgb(255 176 0 / 0.5);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.play-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
}

#command {
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  overflow-wrap: anywhere;
  text-align: left;
}

.sigil {
  color: var(--dim);
  user-select: none;
}

#copy {
  font: inherit;
  color: var(--bg);
  background: var(--fg);
  border: 0;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  text-shadow: none;
  box-shadow: var(--glow);
}

#copy:hover {
  background: var(--amber);
}

#copy u {
  text-decoration-thickness: 2px;
}

/* In the box's bottom padding, so the command stays in the middle. */
.status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  margin: 0;
  color: var(--amber);
  font-size: 0.8rem;
  line-height: 1.4;
}

.hint {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
  animation: appear 0s 1.6s both;
}

.more {
  color: var(--dim);
  text-decoration: none;
  animation: appear 0s 1.8s both;
}

.more:hover {
  color: var(--fg);
}

/* ---- the terminal session below ---- */

.session {
  padding: 2rem 0 4rem;
  border-top: 1px dashed var(--faint);
}

.prompt {
  margin: 2rem 0 0.5rem;
}

.prompt:first-child {
  margin-top: 0;
}

.who {
  color: var(--amber);
  text-shadow: 0 0 6px rgb(255 176 0 / 0.4);
}

.where {
  color: #66b3ff;
  text-shadow: 0 0 6px rgb(102 179 255 / 0.4);
}

.out {
  margin: 0;
  padding-left: 2ch;
  color: var(--fg);
}

.out p {
  margin: 0 0 0.75rem;
  max-width: 70ch;
}

.features div {
  display: grid;
  grid-template-columns: 22ch 1fr;
  gap: 0 2ch;
  margin-bottom: 0.4rem;
}

.features dt {
  color: #66b3ff;
  text-shadow: 0 0 6px rgb(102 179 255 / 0.4);
  white-space: nowrap;
}

.features dd {
  margin: 0;
}

.common { color: #d0d0d0; text-shadow: none; }
.uncommon { color: #66b3ff; }
.rare { color: #ffd84d; }
.legendary { color: #ff8c1a; }

ol {
  margin: 0 0 1rem;
  padding-left: 3ch;
}

.commands {
  border-collapse: collapse;
}

.commands caption {
  text-align: left;
  color: var(--dim);
  padding-bottom: 0.25rem;
}

.commands td {
  padding: 0.1rem 2ch 0.1rem 0;
  vertical-align: top;
}

.commands td:first-child {
  white-space: nowrap;
}

/* ---- the world map ---- */

.map-hint {
  color: var(--dim);
}

/* The map keeps a readable size and scrolls inside its frame. */
.map-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--faint);
  cursor: grab;
  overscroll-behavior: contain;
}

.map-wrap.dragging {
  cursor: grabbing;
  user-select: none;
}

.map {
  display: block;
  font: 14px var(--font);
}

.map .exit {
  stroke: var(--faint);
  stroke-width: 3;
}

.map .exit.vertical {
  stroke-dasharray: 6 6;
}

.map .room {
  cursor: pointer;
  outline: none;
}

.map .room rect {
  fill: var(--bg);
  stroke: var(--dim);
  stroke-width: 2;
}

.map .room.deep rect {
  stroke: #66b3ff;
  stroke-opacity: 0.6;
}

.map .room text {
  fill: var(--fg);
  text-anchor: middle;
}

.map .room:hover rect,
.map .room:focus-visible rect {
  stroke: var(--fg);
}

.map .room.selected rect {
  fill: var(--faint);
  stroke: var(--amber);
  stroke-width: 3;
}

.map .room:focus-visible rect {
  stroke-dasharray: 6 4;
}

.map .mobs {
  font-size: 16px;
  letter-spacing: 0.15em;
}

.glyph {
  color: var(--amber);
  fill: var(--amber);
  font-weight: 700;
}

.glyph.boss {
  color: #ff4d4d;
  fill: #ff4d4d;
}

.room-cards {
  margin-top: 1rem;
  min-height: 8rem;
}

.room-name {
  color: var(--amber);
}

.map .zone {
  fill: var(--dim);
  font-size: 13px;
  letter-spacing: 0;
}

.area,
.zone-level,
.lv,
.quiet {
  color: var(--dim);
}

.mob-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mob-list .glyph {
  display: inline-block;
  width: 2ch;
}

/* The map's buttons, over its corners. */
.map-frame {
  position: relative;
}

.map-button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--dim);
  cursor: pointer;
  box-shadow: var(--glow);
}

.map-button:hover:not(:disabled) {
  color: var(--amber);
  border-color: var(--amber);
}

.map-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.map-button:focus-visible,
.map-zoom input:focus-visible {
  outline: 2px dashed var(--fg);
  outline-offset: 2px;
}

.map-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-open {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
}

.map-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.map-zoom {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg);
  border: 1px solid var(--faint);
  font-size: 0.7rem;
}

.map-zoom[hidden],
.map-button[hidden] {
  display: none;
}

.map-zoom .map-button {
  border: 0;
  box-shadow: none;
}

/* A vertical slider, most zoomed in at the top. */
.map-zoom input {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 1.25rem;
  height: 8rem;
  margin: 0;
  accent-color: var(--fg);
  cursor: pointer;
}

/* Full screen: the map fills the window, with the room's card over its
   bottom left corner. */
.map-view.expanded {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--bg);
}

.map-view.expanded .map-frame {
  flex: 1;
  min-height: 0;
}

.map-view.expanded .map-wrap {
  display: flex;
  height: 100%;
  max-height: none;
}

/* Smaller than the window when zoomed out, so in the middle. */
.map-view.expanded .map {
  flex: none;
  margin: auto;
}

.map-view.expanded .room-cards {
  position: absolute;
  left: 2rem;
  bottom: 2rem;
  width: min(28rem, calc(100% - 8rem));
  max-height: 40vh;
  min-height: 0;
  margin: 0;
  overflow: auto;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--dim);
  box-shadow: var(--glow);
}

.room-card p:last-child {
  margin-bottom: 0;
}

html.map-open {
  overflow: hidden;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--fg);
  box-shadow: var(--glow);
  animation: blink 1s steps(1) infinite;
}

@keyframes appear {
  from { visibility: hidden; }
  to { visibility: visible; }
}

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

@media (max-width: 40rem) {
  body {
    font-size: 14px;
  }
  .features div {
    grid-template-columns: 1fr;
  }
  .boot {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
  }
}
