:root {
  color-scheme: dark;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
}

* {
  box-sizing: border-box;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000 !important;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
}

body { line-height: 2; }
button, input { font: inherit; appearance: none; -webkit-appearance: none; }
.page, .game-window, #terminal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent !important;
  z-index: 2;
}
.xterm, .xterm-viewport, .xterm-screen {
  background: transparent !important;
}

/* The music strip floats over the game; it does not create a header or panel. */
.music {
  position: fixed;
  z-index: 30;
  top: 8px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  width: auto;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 0;
  background: transparent !important;
}
.music-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 24px;
  margin: 0;
  padding: 0;
}
.icon-button, .daily-button, .search-image {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  min-width: 23px;
  min-height: 23px;
  margin: 0;
  padding: 0;
  background: transparent !important;
  color: #aaa;
  cursor: pointer;
  opacity: .78;
}
.icon-button:hover, .icon-button:active, .icon-button:focus-visible,
.daily-button:hover, .daily-button:active, .search-image:hover,
.search-image:active, .search-image:focus-visible { opacity: .95; background: transparent !important; }
.icon-button img, .daily-button img, .search-image img {
  display: block;
  width: 21px;
  height: 21px;
  object-fit: contain;
  pointer-events: none;
}
.daily-button[hidden] { display: none !important; }

/* The live MUD countdown occupies one normal control-sized slot. */
.countdown-indicator {
  display: block;
  flex: 0 0 23px;
  width: 21px;
  height: 21px;
  margin: 0;
  padding: 0;
  object-fit: contain;
  opacity: .78;
  pointer-events: none;
  transform-origin: center;
}
.countdown-indicator[hidden] { display: none !important; }
.countdown-indicator.pulse { animation: countdown-pulse 340ms ease-out; }
@keyframes countdown-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.music-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
  background: transparent !important;
}
.video-stage {
  display: block;
  flex: 0 0 205px;
  width: 205px;
  height: 115px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000 !important;
}
.video-stage.is-hidden { display: none !important; }
#youtube-player, #youtube-player iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: #000 !important;
}
.music-tools {
  flex: 0 1 250px;
  width: 250px;
  min-width: 180px;
  max-width: min(250px, calc(100vw - 24px));
  margin: 0;
  padding: 0;
  background: transparent !important;
}
.search-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 25px;
  margin: 0;
  padding: 0;
  background: transparent !important;
}
.search-form input {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 25px;
  margin: 0;
  padding: 0 2px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 2;
}
.search-form input::placeholder { color: #777; opacity: 1; }
.search-form input:focus { border: 0 !important; outline: 0 !important; }
.search-image { width: 23px; height: 23px; }
.search-results {
  display: grid;
  gap: 0;
  max-height: 170px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  background: transparent !important;
  color: #bbb;
  font-size: 18px;
  line-height: 2;
}
.result-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 1px 0;
  border: 0 !important;
  background: transparent !important;
  color: #ddd;
  text-align: left;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 2;
  overflow-wrap: anywhere;
}
.result-button span { display: block; color: #888; }
.result-button:hover, .result-button:focus-visible { color: #fff; background: transparent !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

/* Strip xterm's default inset, panel padding and shadows. */
#terminal { z-index: 1; }
.xterm {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: var(--game-font-size, 18px) !important;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}
.xterm .xterm-viewport {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-y: auto !important;
  background: transparent !important;
}
.xterm .xterm-screen, .xterm .xterm-rows {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  font-family: Arial, Helvetica, sans-serif !important;
}
.xterm .xterm-rows {
  font-size: var(--game-font-size, 18px) !important;
  line-height: var(--game-line-height, 2) !important;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}
.xterm .xterm-helpers { background: transparent !important; }

@media (max-width: 620px) {
  html, body { width: 100%; height: 100%; min-width: 0; max-width: 100%; overflow: hidden; overscroll-behavior: none; }
  .page, .game-window, #terminal { width: 100%; height: 100%; max-width: 100%; overflow: hidden; }
  .music { top: max(4px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); max-width: calc(100vw - 12px); }
  .music-row { gap: 6px; max-width: calc(100vw - 12px); }
  .video-stage { flex: 0 0 min(164px, 44vw); width: min(164px, 44vw); height: auto; aspect-ratio: 16 / 9; }
  .music-tools { flex: 0 1 min(150px, 40vw); width: min(150px, 40vw); min-width: 0; }
  .search-form, .search-form input { height: 23px; }
  .search-form input { font-size: 18px; }
  .xterm, .xterm .xterm-rows {
    font-size: var(--game-font-size, 18px) !important;
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0 !important;
    word-spacing: normal !important;
  }
  .xterm .xterm-rows { line-height: var(--game-line-height, 2) !important; }
  .xterm-helper-textarea { font-size: 18px !important; transform: none !important; }
  .xterm .xterm-screen { touch-action: pan-y; }
  .music.is-minimized { top: max(5px, env(safe-area-inset-top)); right: max(7px, env(safe-area-inset-right)); }
}


/* Persistent mini-player: move the still-playing iframe off-screen rather
   than display:none, so minimising never pauses or destroys YouTube playback. */
.music.is-minimized .music-row {
  position: fixed;
  top: 0;
  left: -10000px;
  display: flex;
  width: 420px;
  max-width: none;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.music.is-minimized #muteToggle,
.music.is-minimized #dailyButton {
  display: none !important;
}
.music.is-minimized #videoToggle {
  width: 24px;
  height: 24px;
  opacity: .72;
}
.music.is-minimized #videoToggle img {
  width: 22px;
  height: 22px;
}

/* Keep the xterm input at readable size on touch browsers and re-fit to viewport. */
.xterm-helper-textarea { font-size: 18px !important; font-family: Arial, Helvetica, sans-serif !important; }


/* Typography controls stay beside the mini-player icon and remain image-like. */
#fontSizeToggle, #spacingToggle {
  width: 23px;
  height: 23px;
  min-width: 23px;
  min-height: 23px;
}
#fontSizeToggle img, #spacingToggle img {
  width: 19px;
  height: 19px;
}

/* Mobile: lock the layout to the device viewport, not a zoomed desktop canvas. */
@media (max-width: 620px) {
  html, body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-width: 100vw;
    overflow: hidden;
    touch-action: pan-y;
  }
  .page, .game-window, #terminal {
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    height: 100dvh;
  }
  .xterm {
    width: 100% !important;
    height: 100% !important;
    font-size: var(--game-font-size, 18px) !important;
  }
  .xterm .xterm-screen {
    width: 100% !important;
    max-width: 100% !important;
  }
  .xterm-helper-textarea {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 1px !important;
    height: 1px !important;
    font-size: 18px !important;
    transform: none !important;
    opacity: 0 !important;
  }
  .music-actions { gap: 8px; }
}



/* Live terminal typography: values are updated by the two top-right controls. */
#terminal .xterm,
#terminal .xterm .xterm-rows,
#terminal .xterm .xterm-rows > div {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: var(--game-font-size, 18px) !important;
  letter-spacing: 0 !important;
  word-spacing: normal !important;
}
#terminal .xterm .xterm-rows {
  line-height: var(--game-line-height, 2) !important;
}

/* PayPal donation icon: same tiny, borderless treatment as the other controls. */
.paypal-donate {
  text-decoration: none !important;
  outline: none;
}
.paypal-donate img {
  width: 21px;
  height: 21px;
  object-fit: contain;
}
.paypal-donate:hover, .paypal-donate:focus-visible {
  opacity: .95;
}



/* Generated location/welcome artwork: foreground presentation plus a persistent,
   low-opacity image layer underneath the live terminal text. */
.word-art-backdrop,
.word-art-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
}
.word-art-backdrop {
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 500ms ease, visibility 0s linear 500ms;
}
.word-art-backdrop.is-visible {
  opacity: .2;
  visibility: visible;
  transition: opacity 500ms ease;
}

/* The foreground artwork is intrinsically 50% opaque. The persistent layer
   uses a fully opaque image inside a 20%-opaque container, so its final
   effective opacity is exactly 20%, not 10%. */
.word-art-backdrop .word-art-image {
  display: block;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  object-fit: cover;
  opacity: 1;
}
.word-art-overlay {
  z-index: 20000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}
.word-art-overlay[hidden] {
  display: none !important;
}
.word-art-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 450ms ease;
}
.word-art-presentation {
  position: absolute;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  pointer-events: none;
}
.word-art-image {
  display: block;
  opacity: .5;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.word-art-song-choices {
  position: fixed;
  z-index: 25002;
  left: 50%;
  bottom: clamp(12px, 3vh, 30px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 32px);
  width: min(94vw, 945px);
  min-height: 30px;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: auto;
}
.word-art-song-choices[hidden] { display: none !important; }
.word-art-song-choices.is-visible {
  opacity: .7;
  transform: translate(-50%, 0);
}
.word-art-song-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  max-width: calc(50% - 10px);
  min-width: 0;
  margin: 0;
  padding: 2px 0;
  background: transparent !important;
  color: #49ff49;
  font-family: "Courier New", monospace;
  font-size: clamp(12px, 1.65vw, 17px);
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  text-shadow: 0 0 5px rgba(40, 255, 40, .85), 0 0 12px rgba(40, 255, 40, .45);
  opacity: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: filter 150ms ease, transform 150ms ease;
}
.word-art-song-button:hover,
.word-art-song-button:focus-visible {
  filter: brightness(1.35);
  transform: translateY(-1px);
}
.word-art-song-button:active { transform: translateY(0); }
.word-art-song-play {
  display: inline-block;
  flex: 0 0 auto;
  color: #50ff50;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.05em;
  line-height: 1;
  text-shadow: 0 0 6px #21ff21, 0 0 14px rgba(40, 255, 40, .7);
}
.word-art-song-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Player-name welcome uses one unobtrusive control for the existing player;
   it is never a track recommendation or a link to another music service. */
.welcome-art-controls {
  position: fixed;
  z-index: 20001;
  left: 50%;
  bottom: clamp(54px, 9vh, 92px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: auto;
}
.welcome-art-controls[hidden] { display: none !important; }
.welcome-art-controls.is-visible {
  opacity: .5;
  transform: translate(-50%, 0);
}
.welcome-art-play-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  margin: 0;
  padding: 0;
  background: transparent !important;
  color: #49ff49;
  font-size: 24px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(40, 255, 40, .9), 0 0 14px rgba(40, 255, 40, .55);
  cursor: pointer;
  pointer-events: auto;
  transition: filter 150ms ease, transform 150ms ease;
}
.welcome-art-play-button:hover,
.welcome-art-play-button:focus-visible {
  filter: brightness(1.35);
  transform: translateY(-1px);
}
.welcome-art-play-button:active { transform: translateY(0); }
@media (max-width: 620px) {
  .word-art-song-choices { gap: 8px 14px; }
  .welcome-art-controls { min-height: 30px; }
  .welcome-art-play-button { width: 30px; height: 30px; min-width: 30px; font-size: 22px; }
  .word-art-song-button {
    max-width: calc(50% - 7px);
    gap: 5px;
    font-size: clamp(10px, 2.7vw, 14px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .word-art-backdrop,
  .word-art-backdrop.is-visible,
  .word-art-overlay,
  .word-art-overlay.is-visible,
  .welcome-art-controls,
  .welcome-art-controls.is-visible {
    transition-duration: 100ms;
  }
}

/* Split-wordmark splash: image first, then Brians and Mind separately. */
.intro-splash {
  position: fixed;
  inset: 0;
  z-index: 20000;
  overflow: hidden;
  background: #000;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: opacity 1100ms ease;
}
.intro-splash[hidden] {
  display: none !important;
}
.intro-splash.is-fading {
  opacity: 0;
}
.intro-art {
  position: absolute;
  display: block;
  top: 0;
  left: 50%;
  width: min(61.5vw, 1260px);
  height: auto;
  transform: translateX(-50%);
  opacity: 0;
  animation: intro-art-fade-in 900ms ease-out forwards;
}
@keyframes intro-art-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.intro-wordmark {
  position: absolute;
  top: 49.2vh;
  left: 50%;
  display: flex;
  align-items: flex-start;
  width: min(87vw, 1820px);
  transform: translateX(-50%);
  gap: 0;
}
.intro-word {
  display: block;
  height: auto;
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.intro-word-brians {
  width: 44.8%;
}
.intro-word-mind {
  width: 55.2%;
}
.intro-word.is-visible {
  opacity: 1;
}
@media (max-width: 700px), (orientation: portrait) {
  .intro-art {
    top: 16vh;
    width: min(92vw, 720px);
  }
  .intro-wordmark {
    top: 45vh;
    width: 94vw;
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro-splash {
    display: none !important;
  }
}

/* Lightweight text annotations: SVG spray marks sit above xterm without ever
   intercepting pointer input or changing the terminal's rendered text. */
.terminal-annotation-layer {
  position: fixed;
  inset: 0;
  z-index: 15000;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.terminal-annotation {
  position: fixed;
  display: block;
  margin: 0;
  padding: 0;
  pointer-events: none;
  user-select: none;
  transform-origin: center;
  animation: terminal-annotation-life 4000ms ease-out forwards;
  will-change: opacity, transform;
}
.terminal-spray-mark { overflow: visible; }
.terminal-spray-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.terminal-spray-path {
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1.5px currentColor);
}
.terminal-spray-speck {
  transform-box: fill-box;
  transform-origin: center;
  animation: terminal-spray-speck-pop 760ms cubic-bezier(.16,.82,.3,1) both;
}
.terminal-spray-mark.is-green { color: #39ff14; }
.terminal-spray-mark.is-red { color: #ff2929; }
.terminal-credit-smile {
  display: grid;
  place-items: center;
}
.terminal-credit-smile-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0 4px rgba(255, 220, 45, .7));
  transform-origin: center;
  animation: terminal-credit-smile-pop 620ms cubic-bezier(.16,.82,.3,1) both;
}
@keyframes terminal-annotation-life {
  0% { opacity: 0; transform: scale(.94); }
  9% { opacity: 1; transform: scale(1.025); }
  18% { opacity: .96; transform: scale(1); }
  74% { opacity: .94; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.015); }
}
@keyframes terminal-spray-speck-pop {
  0% { opacity: 0; transform: scale(.15); }
  45% { opacity: 1; transform: scale(1.25); }
  100% { opacity: .72; transform: scale(1); }
}
@keyframes terminal-credit-smile-pop {
  0% { opacity: 0; transform: scale(.35) rotate(-18deg); }
  70% { opacity: 1; transform: scale(1.12) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .terminal-annotation { animation-duration: 4000ms; }
  .terminal-spray-speck { animation-duration: 240ms; }
  .terminal-credit-smile-svg { animation-duration: 240ms; }
}

