/* terminal.css, the dark surface every terminal here is drawn on, the widgets' and Play's: its palette, the transcript,
 * the header bar with its lamp, and the prompt row. The widgets carry it into their shadow roots and Play links it.
 * The faces, the radius and the border's green come from palette.css. */

/* The palette of every dark surface: terminal shells and their header bars, the live widgets' player cards and map
 * viewport, the prompt row. Declared on :root for the pages that link this file and on :host for the shadow roots
 * anywidget delivers it into, so one list of values serves both and no component keeps a private copy. */
:root,
:host {
  --mudgym-ground: #0b171c;
  --mudgym-panel: #122630;
  --mudgym-line: #234655;
  --mudgym-line-soft: #17313d;
  --mudgym-text: #eaf2f4;
  --mudgym-muted: #93aab4;
  --mudgym-accent: #f2b43c;
  --mudgym-accent-lit: #ffcc63;
  --mudgym-ok: #43d9a3;
  --mudgym-danger: #ff7a5c;
  /* The transcript's own ground is a shade darker than the panels round it: the engine's ANSI palette was tuned for
     near-black. */
  --mudgym-terminal-background: #0b0d0c;
  --mudgym-terminal-foreground: #dde0ed;
}

.mudgym-terminal {
  overflow: hidden;
  border: 1px solid var(--notebook-primary);
  background: var(--mudgym-ground);
}
/* The dark surface's focus ring, drawn as the light surface's is but in this surface's gold. */
.mudgym-terminal :focus-visible { outline: 2px solid var(--mudgym-accent); outline-offset: 2px; }
.mudgym-transcript {
  margin: 0;
  padding: 1.1em 1.2em;
  color: var(--mudgym-terminal-foreground);
  background: var(--mudgym-terminal-background);
  font: 14px/1.5 var(--notebook-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-color: var(--notebook-primary) transparent;
  scrollbar-width: thin;
}
/* Inside the edge, where the terminal round it would clip a ring outside. */
.mudgym-transcript:focus-visible { outline: 2px solid var(--mudgym-accent); outline-offset: -2px; }

/* The same quiet header over Play's terminal, the live terminals and the live map. */
.mudgym-panel-bar {
  display: flex;
  align-items: center;
  gap: .55rem;
  box-sizing: border-box;
  min-height: var(--mudgym-panel-bar-height, 2.36rem);
  padding: .45rem .8rem;
  border-bottom: 1px solid var(--mudgym-line-soft);
  color: var(--mudgym-muted);
  background: var(--mudgym-ground);
  font: .7rem var(--notebook-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* One lamp for anything that can be alive or dead, Play's engine or a widget's run: a disc in the current colour with
 * a ring of the same, so a state is set once, as `color`, by whoever owns the lamp. The widgets report their run on
 * their root element. */
.mudgym-lamp {
  flex: none;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
[data-status-kind="busy"] .mudgym-lamp { color: var(--mudgym-accent); }
[data-status-kind="done"] .mudgym-lamp { color: var(--mudgym-ok); }
[data-status-kind="error"] .mudgym-lamp { color: var(--mudgym-danger); }

/* The prompt row under a terminal: MUD2's own prompt glyph, which is the form's own text, the command field and Send. */
.mudgym-prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  padding: .6rem .8rem;
  border-top: 1px solid var(--mudgym-line-soft);
  color: var(--mudgym-accent-lit);
  background: var(--mudgym-panel);
  font: 700 1rem var(--notebook-mono);
}
.mudgym-prompt input {
  min-width: 0;
  padding: .45rem .55rem;
  border: 1px solid var(--mudgym-line);
  border-radius: var(--notebook-radius);
  color: var(--mudgym-terminal-foreground);
  background: var(--mudgym-ground);
  font: 1rem var(--notebook-mono);
}
.mudgym-prompt input::placeholder { color: var(--mudgym-muted); }
.mudgym-prompt button {
  padding: .45rem .85rem;
  border: 1px solid var(--mudgym-accent);
  border-radius: var(--notebook-radius);
  color: var(--mudgym-ground);
  background: var(--mudgym-accent);
  font: 650 .85rem var(--notebook-sans);
  cursor: pointer;
}
.mudgym-prompt button:hover:not(:disabled) { border-color: var(--mudgym-accent-lit); background: var(--mudgym-accent-lit); }
.mudgym-prompt :disabled { cursor: default; opacity: .45; }
