/* What is drawn on the stage: items (pictures, frames, videos, plots, choices,
   stickers), and the idle screens. The page around them is viewer.css. */

/* ── Items ────────────────────────────────────────────────────────────── */
.image-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.image-frame .item-image { display: block; }

.sticker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* A sticker: a translucent white or black label, text in the opposite ink. */
.sticker {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: min(320px, 60%);
  padding: 8px 12px;
  border-radius: 8px;
  font: 600 var(--text-size)/1.3 var(--font-body);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  overflow-wrap: anywhere;
  backdrop-filter: blur(2px);
  white-space: pre-wrap;
}

.sticker.is-light { background: rgba(255, 255, 255, 0.78); color: #1a1a1a; }
.sticker.is-dark { background: rgba(0, 0, 0, 0.66); color: #f5f5f2; }

/* The sticker being written: the same sticker, editable, with a visible caret. */
.sticker.is-editing {
  min-width: 2ch;
  outline: 2px solid currentColor;
  outline-offset: 2px;
  caret-color: currentColor;
  cursor: text;
  z-index: 16;
}

.sticker.is-editing:empty::before {
  content: attr(data-placeholder);
  opacity: 0.55;
}

.item-image, .item-screenshot {
  max-width: var(--stage-width);
  max-height: var(--stage-height);
  object-fit: contain;
  cursor: crosshair;
  user-select: none;
  -webkit-user-drag: none;
}

.item-frame {
  width: var(--stage-width);
  height: var(--stage-height);
  border: 0;
  background: #fff;
}

/* A video fits whole, never cut: as wide as the page (or as tall as the
   screen, for a tall one), with black bars filling the rest. A player is
   drawn at the video's own shape, so even its preview picture is never
   cropped; a video file fits itself inside the screen. */
#stage.is-video { background: #000; }
.item-video { border: 0; background: #000; }
iframe.item-video.is-wide { width: min(var(--stage-width), calc(var(--stage-height) * 16 / 9)); aspect-ratio: 16 / 9; }
iframe.item-video.is-tall { width: min(var(--stage-width), calc(var(--stage-height) * 9 / 16)); aspect-ratio: 9 / 16; }
video.item-video { width: var(--stage-width); height: var(--stage-height); object-fit: contain; }

.screenshot-wrapper {
  width: var(--stage-width);
  height: var(--stage-height);
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.screenshot-wrapper .item-screenshot { max-height: none; height: auto; align-self: flex-start; }

.open-button {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 15;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  text-decoration: none;
}

.gallery, .fonts {
  width: var(--stage-width);
  height: var(--stage-height);
  overflow-y: auto;
  padding: 24px 24px 32px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.gallery { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.fonts { grid-template-columns: 1fr; max-width: 1100px; margin: 0 auto; }

.choice {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px;
  cursor: pointer;
  color: inherit;
  text-align: left;
  font: inherit;
}

.choice:hover { border-color: var(--muted); }
.choice.is-picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.choice img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; background: #0c0c0e; border-radius: 8px; }
.choice .label { display: block; margin-top: 8px; font-weight: 600; }
.choice .note { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.specimen { display: block; margin-top: 10px; line-height: 1.2; overflow-wrap: anywhere; }

.plot { width: var(--stage-width); height: var(--stage-height); padding: 8px 12px; }
.plot-canvas { width: 100%; height: 100%; }

/* Why a channel cannot be shown (not one of yours, or not shared with you). */
.stage-message { max-width: 28em; padding: 0 24px; text-align: center; color: var(--choice-chosen); font: 500 var(--text-size)/1.5 var(--font-body); }

/* ── Idle screens ─────────────────────────────────────────────────────── */
.colour-bars {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 67% 8% 25%;
}

.colour-bars .top { background: var(--colour-bars-top); }
.colour-bars .middle { background: linear-gradient(90deg,
  #0000c0 0 14.28%, #131313 0 28.57%, #c000c0 0 42.85%, #131313 0 57.14%,
  #00c0c0 0 71.42%, #131313 0 85.71%, #c0c0c0 0 100%); }
.colour-bars .bottom { background: linear-gradient(90deg,
  #00214c 0 17.85%, #ffffff 0 35.7%, #32006a 0 53.55%, #131313 0 71.4%,
  #090909 0 76.2%, #131313 0 81%, #1d1d1d 0 85.8%, #131313 0 100%); }

.static-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ── A game on a glimpse (the control room): what is being played, not the game. ── */
.game-card {
  display: grid;
  gap: 0.4em;
  place-items: center;
  text-align: center;
  padding: 0 1em;
  color: var(--text);
  font: 600 var(--game-card-size)/1.2 var(--font-body);
}

.game-card-name { font-family: var(--font-wordmark); text-transform: capitalize; }

.game-card-caption { font-size: 0.5em; color: var(--muted); }
