@charset "UTF-8";
/* Ragdoll Sandbox -- used by the /arcade/ page only. Sits beside snake.css / mines.css, so it
   reuses the same pill buttons and the same fullscreen approach (.is-full / .pseudo-full). */

.rd-stage { display: block; }

/* ---------- what-to-spawn menu ---------- */

.rd-menu {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
}

.rd-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.rd-tabs button,
.rd-bar button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}

.rd-tabs button:hover,
.rd-bar button:hover { border-color: var(--accent); color: var(--accent); }

.rd-tabs button[aria-selected="true"],
.rd-bar button[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(255,159,46,0.14);
  color: var(--accent);
}

/* the items of the open tab, each with a little picture of itself */
.rd-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.rd-items:empty { display: none; }

.rd-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 5.4rem;
  padding: 0.35rem 0.3rem 0.4rem;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease);
}

.rd-item canvas { display: block; width: 56px; height: 56px; }
.rd-item small { color: var(--muted); font-size: 0.66rem; }

.rd-item:hover { border-color: var(--accent); transform: translateY(-2px); }

.rd-item[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(255,159,46,0.14);
  color: var(--accent);
}

/* ---------- the playfield ---------- */

.rd-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  outline-offset: 4px;
  overflow: hidden;
}

@media (max-width: 640px) {
  .rd-wrap { aspect-ratio: 4 / 5; }
}

.rd-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: #0a0e1a;
  box-shadow: 0 30px 70px -34px rgba(0,0,0,1);
  touch-action: none;        /* dragging in the field throws things; it doesn't scroll the page */
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.rd-wrap.is-grabbing canvas { cursor: grabbing; }
.rd-wrap.can-grab canvas    { cursor: grab; }

/* the button that appears over the field while the camera is free (after WASD / arrow keys) */
.rd-follow-pop {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  z-index: 3;
  padding: 0.55rem 1.3rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgb(13,17,32);
  color: var(--accent);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.9);
  animation: rd-pop-in 0.25s var(--ease-out);
}

.rd-follow-pop[hidden] { display: none; }
.rd-follow-pop:hover { background: var(--accent); color: #07090f; }

@keyframes rd-pop-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translateX(-50%); }
}

html.calm .rd-follow-pop { animation: none; box-shadow: none; }

/* the Fire button: only on touch screens, only while a gun is held */
.rd-fire-pop {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 3;
  padding: 0.9rem 1.5rem;
  border: 1px solid #ff5252;
  border-radius: 999px;
  background: rgb(60,12,16);
  color: #ffb3b3;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.rd-fire-pop[hidden] { display: none; }
.rd-fire-pop:active { background: #ff5252; color: #1b0508; }

@media (hover: hover) and (pointer: fine) {
  .rd-fire-pop { display: none; }
}

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

/* ---------- buttons, muscle slider, readouts ---------- */

.rd-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.9rem 0 0.7rem;
}

.rd-muscle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.85rem;
  color: var(--text);
}

.rd-muscle input { width: 7.5rem; accent-color: var(--accent); }
.rd-muscle output { min-width: 2.6em; text-align: right; color: var(--accent); font-variant-numeric: tabular-nums; }

.rd-stats {
  margin: 0;
  text-align: center;
  font: 600 0.78rem/1.5 "Consolas", "Courier New", ui-monospace, monospace;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.rd-hint {
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.rd-status {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text);
}

/* ---------- fullscreen: the stage fills the screen, the field takes what is left ---------- */

.rd-stage:fullscreen,
.rd-stage:-webkit-full-screen,
.rd-stage.pseudo-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  padding: 0.8rem;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-2) 0%, var(--bg) 70%);
  overflow: auto;
}

.rd-stage.pseudo-full {
  position: fixed;
  inset: 0;
  z-index: 200;
  height: 100dvh;
}

.rd-stage.is-full .rd-menu,
.rd-stage.is-full .rd-bar { margin: 0; }

.rd-stage.is-full .rd-wrap {
  width: min(96vw, calc((100vh - 19rem) * 16 / 9));
  width: min(96vw, calc((100dvh - 19rem) * 16 / 9));
}

.rd-stage.is-full .rd-hint { display: none; }

.rd-noscroll, .rd-noscroll body { overflow: hidden; }

/* ---------- while the game is running: a quieter page behind it ----------
   ragdoll.js puts rd-playing on <html> only while the field is on screen and the loop is running.
   A canvas that redraws 60 times a second inside a blurred panel, in front of swimming seals with
   big drop-shadows, makes a weak graphics chip redo all of that every frame -- that is what made
   it choppy. So for that time the seals stop, the glow stops and the blur is switched off (the
   same things calm mode switches off, but only while you play, and your calm setting is untouched). */

html.rd-playing .seals { display: none; }
html.rd-playing .bg-glow { animation: none; }
html.rd-playing .topbar,
html.rd-playing .panel,
html.rd-playing .live-bar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html.rd-playing .topbar.scrolled { background: rgba(7,9,15,0.96); }
html.rd-playing .rd-wrap canvas { box-shadow: none; }

/* ---------- calm mode: the same game, less to draw ---------- */

html.calm .rd-item,
html.calm .rd-tabs button,
html.calm .rd-bar button { transition: none; }

html.calm .rd-item:hover { transform: none; }

html.calm .rd-wrap canvas { box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .rd-item, .rd-tabs button, .rd-bar button { transition: none; }
  .rd-item:hover { transform: none; }
}
