/* compactband.tv — one channel, one night.
 *
 * This is a compact.band room, not a compact.zone one. The zone is the only
 * black and white thing in the suite: it is a Twilight Zone door and the
 * grey is the joke. Everything else lives on the band's 90s bedroom wall,
 * and so does this.
 *
 * The rules of that room, taken from compact.band's own stylesheet and not
 * reinvented here:
 *   nothing sits perfectly straight, so most objects take a --tilt
 *   outlines are ink (#1b1530) and shadows are hard offsets, never blurs
 *   body copy is typewriter for Latin and Kiwi Maru for Japanese
 *   flashing stays under one blink a second, and stops entirely under
 *   prefers-reduced-motion
 *
 * The object is still a 1962 console television, drawn rather than
 * box-shadowed, but it is a television somebody drew on that wall with
 * markers: warm wood, a gold trim, an ink outline round every part of it,
 * and four sweets on the deck in front. Lit from the upper right, azimuth
 * 315, like every other object in the suite.
 *
 * The cabinet is in partials/tv-set.svg. This file positions the player
 * inside the hole it leaves, which is why the percentages under `.screen`
 * are not to be rounded: they are the glass rect from that file divided by
 * its viewBox.
 */

:root {
  /* straight from compact.band's palette. Changing one here and not there
     is how two sites stop looking like one network. */
  --ink:      #1b1530;
  --wall:     #2a1f4d;
  --paper:    #fff6e0;
  --paper-2:  #fff0c9;
  --pink:     #ff4f9a;
  --teal:     #19b3a6;
  --mustard:  #ffc83d;
  --tomato:   #ff5a36;
  --purple:   #6b3fd6;
  --gold:     #d4a53c;
  --mint:     #8dffbf;
  --sky:      #5b7fe8;

  /* the set's own materials, mixed to sit on that wall */
  --wood:      #8a5a33;
  --wood-dark: #4e2f18;
  --wood-lit:  #c08a52;
  --glass:     #171033;

  --shadow:    5px 6px 0 var(--ink);
  --shadow-sm: 3px 4px 0 var(--ink);
  --r-hand: 255px 18px 225px 18px / 18px 225px 18px 255px;

  --f-body: "Courier Prime", "Kiwi Maru", ui-monospace, monospace;
  --f-deco: Limelight, "Kiwi Maru", Georgia, serif;
  --f-marker: "Permanent Marker", "Kiwi Maru", cursive;
  --f-crt: VT323, "Courier Prime", monospace;
  --kana: "Kiwi Maru", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;

  --strip-h: 30%;
  color-scheme: dark;
}

/* Japanese has no glyphs in Limelight or Permanent Marker, and the band
   settled this question already: Kiwi Maru carries the kana and kanji. */
.lang-ja {
  --f-body: "Kiwi Maru", "Courier Prime", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --f-deco: Limelight, "Kiwi Maru", serif;
  --f-marker: "Kiwi Maru", "Permanent Marker", sans-serif;
  --f-crt: VT323, "Kiwi Maru", "Hiragino Sans", monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* the band's wall, and the same grain over it */
body {
  min-height: 100vh;
  background-color: var(--wall);
  /* The room the set stands in: a 1960s deco parlour, fluted walnut with a
     brass sunburst dead centre, graded toward --wall so the photograph and
     the drawn furniture belong to one place. The gradient on top of it is
     not decoration, it is the reason the copy lower down the page stays
     readable: nearly clear at the top where the television is, closing to
     almost solid by the foot of the page. */
  background-image:
    linear-gradient(180deg, rgba(22,15,48,.22) 0%, rgba(22,15,48,.50) 45%, rgba(22,15,48,.86) 100%),
    url("../img/room.webp"),
    linear-gradient(160deg, #2e1f57 0%, #1f1740 45%, #160f30 100%);
  background-size: cover, cover, cover;
  background-position: center top, center bottom, center top;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-attachment: fixed;
  color: var(--paper);
  font: 17px/1.6 var(--f-body);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

.lang-ja body, .lang-ja { font-family: var(--f-body); }

.room { max-width: 1080px; margin: 0 auto; padding: 18px 16px 64px; }

a { color: var(--mustard); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--pink); }
:focus-visible { outline: 3px dashed var(--mustard); outline-offset: 4px; }

/* ------------------------------------------------------------ the station */

.station-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

/* The badge and the channel it is showing read as one line, not as a
   caption stranded under the logo: "2 · Blues" was set to the badge's own
   width and left-aligned beneath it, which put it nowhere in particular.
   It sits beside the badge now, on the baseline, behind a rule. */
.station { margin: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* the badge, which is the logo everywhere else in the network */
.badge { display: block; width: clamp(190px, 26vw, 280px); height: auto; overflow: visible;
  filter: drop-shadow(3px 4px 0 var(--ink)); }
.station-badge { display: block; text-decoration: none; }
/* A tight ring, not a dashed box five pixels out: the badge is an octagon
   with bulbs around it and a dashed rectangle around that read as a
   selection marquee left on by accident. */
.station-badge:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
  border-radius: 10px;
}
.badge-a { fill: var(--mustard); }
.badge-b { fill: var(--pink); }

/* the chase: eight phases round 52 bulbs, so the light travels rather than
   blinking. One animation, eight negative delays, no script. */
  14%  { opacity: .62; fill: #fff3b0; }
  34%  { opacity: .34; fill: #e8d588; }
  100% { opacity: .34; fill: #e8d588; }
}

.station-name {
  font-family: var(--f-deco);
  font-size: clamp(22px, 3.6vw, 32px);
  letter-spacing: .18em;
  color: var(--paper);
  /* a hard offset, never a blur: the whole wall is drawn that way */
  text-shadow: 3px 4px 0 var(--ink);
}

.station-slogan {
  font-family: var(--f-crt);
  font-size: 16px;
  letter-spacing: .12em;
  color: var(--mustard);
}

/* the readout. A sticker, tilted, the way every small label on the band is. */
.on-air {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 8px 14px 6px;
  font-family: var(--f-marker);
  font-size: clamp(14px, 2vw, 18px);
  letter-spacing: .03em;
  color: var(--ink);
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transform: rotate(2deg);
}

.on-air-lamp {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #b9a9a0;
  border: 2px solid var(--ink);
}

.show-live .on-air,
.on-air-now { background: var(--tomato); }
.show-live .on-air-lamp,
.on-air-now .on-air-lamp { background: var(--mustard); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* The knob is a control, so it says so: a pointer, a focus ring it can
   actually show, and the cap turning about its own centre. */
.tv-dial { cursor: pointer; }
.tv-dial:focus { outline: none; }
.tv-dial:focus-visible > circle:first-of-type { stroke: var(--mustard); stroke-width: 7; }
.tv-dial-cap { transform-origin: 890px 618px; transform-box: view-box; }
.tv-dial:hover .tv-dial-cap { filter: brightness(1.08); }
.tv-dial:active .tv-dial-cap { filter: brightness(.94); }

/* the lamp drawn into the cabinet, lit by the same state */
.show-live .set-lamp-glow { opacity: .9; }
.show-live .set-lamp-bead { fill: #ff7a4d; }

/* ---------------------------------------------------------------- the set */

.hall { display: flex; flex-direction: column; gap: 22px; }

/* The cabinet's own proportions. aspect-ratio rather than a padding hack, so
   the percentages under .screen mean what they say. The shadow it throws is
   a hard offset in ink, like everything else on this wall. */
.set {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 780;
  filter: drop-shadow(7px 8px 0 var(--ink));
}

.set-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* The glass rect in tv-set.svg is x=56 y=44 w=888 h=500 of a 1000x780
   viewBox. Dividing gives these four numbers, and the radius is that rect's
   rx against the same two axes. Change the rect, change these. */
.screen {
  position: absolute;
  left: 5.6%;
  top: 5.641%;
  width: 88.8%;
  height: 64.103%;
  border-radius: 7.4% / 13.2%;
  overflow: hidden;
  background: var(--glass);
}

.screen-player {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; display: block; background: #000;
}

/* The glass in front of the picture.
 *
 * A 1962 tube is not flat, it is a bulb, and what tells you so is not the
 * outline but the way light behaves on it. Four things, in this order:
 *
 *   the bulge    a wide soft highlight off centre, where a curved face
 *                catches the room
 *   the corners  a hard vignette, because the curve turns away from you
 *                there and the phosphor behind it is further off
 *   the raster   the line structure, a 3px repeating gradient
 *   the static   a tile of noise, moved in steps
 *
 * **It has to stay cheap.** A filter that regenerates noise every frame,
 * or a backdrop warp, pins a laptop's GPU, and the people watching this are
 * on whatever is in the house. So the static is one 64px tile moved with
 * transform, which the compositor shifts without repainting anything, and
 * the rest is gradients that are painted once and never again.
 *
 * Nothing here takes a pointer event, or the picture could not be played.
 */
.glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(58% 42% at 30% 16%, rgba(255,246,224,.18), rgba(255,246,224,.05) 46%, rgba(255,246,224,0) 72%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, rgba(0,0,0,0) 1px 3px),
    radial-gradient(112% 118% at 50% 50%, rgba(0,0,0,0) 54%, rgba(8,4,24,.42) 82%, rgba(8,4,24,.8) 100%);
}

/* the bulge: an inset ring all round, which is what a curved face does to a
   flat picture behind it */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 26px 10px rgba(8,4,24,.5),
    inset 0 0 72px 26px rgba(8,4,24,.28),
    inset 0 3px 0 rgba(255,246,224,.12);
}

/* the static */
.glass::after {
  content: "";
  position: absolute;
  inset: -64px;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  will-change: transform;
  animation: tv-static .55s steps(6, end) infinite;
}

@keyframes tv-static {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-13px, 9px, 0); }
  40%  { transform: translate3d(7px, -17px, 0); }
  60%  { transform: translate3d(-21px, -5px, 0); }
  80%  { transform: translate3d(15px, 13px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* with nothing playing, the tube is mostly static with a slate over it */
.show-off .glass::after, .show-ended .glass::after { opacity: .12; }

/* ------------------------------------------------- the slate, when dark */

.slate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 5% 7% calc(var(--strip-h) + 3%);
  text-align: center;
  /* The glass is a fixed box. Japanese wraps to two lines where English
     takes one, and without this the top line climbs out through the bezel. */
  overflow: hidden;
}

.slate-big {
  margin: 0;
  font-family: var(--f-crt);
  font-size: clamp(15px, 4.3vw, 54px);
  letter-spacing: .08em;
  color: var(--mint);
  text-shadow: 0 0 18px rgba(141,255,191,.35);
  animation: flicker 7s steps(1, end) infinite;
}

.slate-small { margin: 0; max-width: 34ch; font-size: clamp(12px, 1.7vw, 16px);
  line-height: 1.5; color: var(--paper-2); opacity: .8; }

/* a test card, cut down to seven bars, in the band's colours rather than greys */
.slate-bars { display: flex; width: min(62%, 420px); height: 14px; margin-top: 6px;
  border: 2px solid var(--ink); }
.slate-bars .bar { flex: 1; }
.bar-1 { background: var(--paper); }  .bar-2 { background: var(--mustard); }
.bar-3 { background: var(--mint); }   .bar-4 { background: var(--teal); }
.bar-5 { background: var(--sky); }    .bar-6 { background: var(--purple); }
.bar-7 { background: var(--pink); }

@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: .74; } 98% { opacity: 1; } 99% { opacity: .86; }
}

/* --------------------------------------------------- the sing-along strip */

/* Inside the glass, at the bottom, where a subtitle belongs. Not under the
   television: a child looking at the screen must not have to look away to
   find the words they are singing. */
.strip {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  min-height: var(--strip-h);
  padding: 10px clamp(14px, 3vw, 34px) clamp(12px, 2.4vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  text-align: center;
  background: linear-gradient(to top, rgba(14,8,34,.88) 0%, rgba(14,8,34,.6) 62%, rgba(14,8,34,0) 100%);
}

.strip-title { margin: 0; font-family: var(--f-crt); font-size: clamp(12px, 1.8vw, 18px);
  letter-spacing: .14em; color: var(--mustard); }

.strip-now {
  margin: 0;
  font-family: var(--kana);
  font-weight: 700;
  font-size: clamp(22px, 4.6vw, 50px);
  line-height: 1.2;
  color: var(--paper);
  text-shadow: 3px 4px 0 var(--ink);
}

.strip-mean { margin: 0; font-family: var(--f-body); font-size: clamp(11px, 1.5vw, 15px);
  color: var(--mint); }
.strip-next { margin: 2px 0 0; font-family: var(--kana); font-size: clamp(14px, 2.2vw, 22px);
  color: rgba(255,246,224,.45); }

.strip-empty .strip-now, .strip-empty .strip-next, .strip-empty .strip-mean { display: none; }
.hide-meaning .strip-mean { display: none; }

/* the knobs under the set that pick the writing */

.script-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--purple);
  box-shadow: var(--shadow);
  transform: rotate(-.6deg);
}

.script-label { font-family: var(--f-marker); font-size: 17px; letter-spacing: .02em;
  color: var(--paper); margin-right: 4px; }

/* the band's own chip: dashed until it is on, then mustard with an ink edge */
.chip {
  font: 400 15px/1 var(--f-marker);
  padding: 10px 16px 8px;
  min-height: 44px;
  border-radius: 999px;
  border: 2px dashed rgba(255,246,224,.55);
  background: none;
  color: var(--paper);
  cursor: pointer;
}
.chip:hover, .chip.is-on {
  background: var(--mustard);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.chip:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* -------------------------------------------------------------- the deck */

/* A sheet of paper pinned to the wall with four sweets on it. */
.deck {
  padding: 22px clamp(14px, 3vw, 28px) 26px;
  border: 4px solid var(--ink);
  border-radius: 3px 8px 4px 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: rotate(.5deg);
}

.deck-title {
  margin: 0 0 4px;
  font-family: var(--f-marker);
  font-size: clamp(19px, 3vw, 28px);
  letter-spacing: .02em;
  color: var(--ink);
  text-align: center;
}

.deck-hint, .deck-closed { margin: 0 0 18px; text-align: center; font-size: 14px; color: #5c5544; }
.deck-closed { color: #9c2318; font-weight: 700; }

.jellies { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 2vw, 22px); }

/* The button is the whole column, art and words. A child aims at the sweet,
   so the sweet is large and the hit area is larger still. */
.jelly {
  -webkit-appearance: none; appearance: none;
  background: none; border: 0;
  padding: 6px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; border-radius: 16px; color: inherit; font: inherit;
}
.jelly:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }

.jelly-art { display: block; width: 100%; max-width: 168px; }
.jelly-svg { width: 100%; height: auto; display: block; overflow: visible;
  transition: transform 90ms ease-out; }

/* The idle wobble is on the inner group, never on the button or the svg. An
   animation on the element that carries the :active transform outranks that
   transform and the press stops being felt, which is exactly the trap the
   door lockset on compact.zone fell into. */
.jelly-body { transform-origin: 50% 62%; animation: jelly-idle 4.8s ease-in-out infinite; }
.jelly-yellow .jelly-body { animation-delay: .5s; }
.jelly-green  .jelly-body { animation-delay: 1s; }
.jelly-blue   .jelly-body { animation-delay: 1.5s; }

@keyframes jelly-idle {
  0%, 72%, 100% { transform: scale(1, 1); }
  78% { transform: scale(1.035, .965); }
  84% { transform: scale(.98, 1.02); }
  90% { transform: scale(1.012, .988); }
}

.jelly:active .jelly-svg { transform: translateY(5px) scale(.965, .93); }

.jelly.is-pop .jelly-body { animation: jelly-pop 620ms cubic-bezier(.22,1.4,.3,1) 1; }
@keyframes jelly-pop {
  0% { transform: scale(.9, 1.1); } 28% { transform: scale(1.09, .9); }
  52% { transform: scale(.96, 1.05); } 74% { transform: scale(1.03, .975); }
  100% { transform: scale(1, 1); }
}

/* no two of them were pressed the same way */
.jelly-hand { transform-origin: 50% 58%; }
.jelly-red .jelly-hand    { transform: rotate(-9deg) scale(.96); }
.jelly-yellow .jelly-hand { transform: rotate(7deg) scale(1.02) translateX(-3px); }
.jelly-green .jelly-hand  { transform: rotate(-19deg) scale(.92) translateX(4px); }
.jelly-blue .jelly-hand   { transform: rotate(14deg) scale(1) translateX(-2px); }
/* the darker edge sits a hair below the lighter patch, the way a print does */
.jelly-hand-edge { transform: translateY(1.5px) rotate(var(--r, 0deg)); }
.jelly-red .jelly-hand-edge    { transform: rotate(-9deg) scale(.985) translateY(1.5px); }
.jelly-yellow .jelly-hand-edge { transform: rotate(7deg) scale(1.045) translate(-3px, 1.5px); }
.jelly-green .jelly-hand-edge  { transform: rotate(-19deg) scale(.945) translate(4px, 1.5px); }
.jelly-blue .jelly-hand-edge   { transform: rotate(14deg) scale(1.025) translate(-2px, 1.5px); }

.jelly-text { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.jelly-main { font-family: var(--f-marker); font-size: clamp(14px, 1.9vw, 20px);
  line-height: 1.15; letter-spacing: .01em; color: var(--ink); }
.jelly-sub { font-size: clamp(11px, 1.3vw, 13px); color: #6b6453; line-height: 1.3; }

.deck.is-closed .jelly { pointer-events: none; }
.deck.is-closed .jelly-body { animation: none; }
.deck.is-closed .jelly-art { filter: grayscale(.8) opacity(.45); }

/* --------------------------------------------------- the question card */

.card {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 4px solid var(--ink);
  border-radius: 4px 10px 5px 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.card::backdrop { background: rgba(14,8,34,.76); }

.card-form { padding: 22px clamp(18px, 4vw, 30px) 20px; }

/* the colour that was pressed, so a child sees which button they are
   answering without reading a word */
.card-colour {
  width: 54px; height: 54px; margin: 0 0 12px;
  border: 3px solid var(--ink); border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.card-colour[data-colour="red"]    { background: var(--tomato); }
.card-colour[data-colour="yellow"] { background: var(--mustard); }
.card-colour[data-colour="green"]  { background: var(--teal); }
.card-colour[data-colour="blue"]   { background: var(--sky); }

.card-title { margin: 0 0 6px; font-family: var(--f-marker);
  font-size: clamp(21px, 3.4vw, 30px); letter-spacing: .01em; }

.card-label { display: block; font-size: 14px; color: #5c5544; margin: 10px 0 6px; }

.card-input {
  width: 100%; font: inherit; font-size: 19px; line-height: 1.45;
  padding: 12px 14px; border-radius: 6px 10px 6px 12px;
  border: 3px solid var(--ink); background: #fffdf7; color: var(--ink); resize: vertical;
}

.card-note { margin: 10px 0 0; min-height: 1.4em; font-size: 15px; color: #9c2318; }
.card-note.is-good { color: #0a6b4f; font-weight: 700; }

.card-buttons { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

/* the band's .btn, to the letter */
.card-send, .knob-button, .cta {
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 22px/1 var(--f-marker); letter-spacing: .03em; text-decoration: none;
  color: var(--ink); background: var(--mustard);
  border: 3px solid var(--ink); border-radius: var(--r-hand);
  padding: 16px 28px 14px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
}
.card-send:hover, .knob-button:hover, .cta:hover {
  color: var(--ink); transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 7px 8px 0 var(--ink);
}
.card-send:active, .knob-button:active, .cta:active {
  transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink);
}
.card-send { background: var(--mint); }

.card-cancel {
  font: inherit; font-size: 15px; background: none; border: 0;
  color: #6b6453; text-decoration: underline; cursor: pointer;
  min-height: 44px; padding: 0 6px;
}

/* ------------------------------------------------------------- the gate */

.is-gate .room { max-width: 760px; }
.gate { display: flex; flex-direction: column; gap: 20px; }
.is-gate .station { align-items: center; text-align: center; margin: 0 auto 6px; }
.is-gate .set { max-width: 560px; margin: 0 auto; }

/* The invitation: paper, torn, and pinned to the wall at an angle. */
.ticket {
  position: relative;
  margin: -6px auto 0;
  padding: 26px clamp(20px, 5vw, 36px) 30px;
  max-width: 520px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px 6px 4px 8px;
  box-shadow: var(--shadow);
  transform: rotate(-1.4deg);
  clip-path: polygon(0 6px, 4% 0, 9% 7px, 15% 1px, 22% 8px, 29% 2px, 36% 7px,
                     44% 0, 52% 6px, 60% 1px, 68% 8px, 76% 2px, 84% 7px, 92% 0,
                     100% 6px, 100% 100%, 0 100%);
}

.ticket-title { margin: 6px 0 8px; font-family: var(--f-deco);
  font-size: clamp(22px, 4.4vw, 34px); letter-spacing: .04em; }
.ticket-lede { margin: 0 0 18px; font-size: 15px; line-height: 1.6; color: #433f36; }

.code-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.code-label { font-family: var(--f-marker); font-size: 18px; color: #4b4535; }

/* Six characters, spaced like a cheque, in a field a child can hit. */
.code-input {
  font-family: var(--f-crt);
  font-size: clamp(30px, 7vw, 46px);
  letter-spacing: .34em; text-align: center; text-transform: uppercase;
  padding: 10px 6px; width: 100%;
  border: 3px solid var(--ink); border-radius: 6px 10px 6px 12px;
  background: #fffdf7; color: var(--ink);
}

.code-help { margin: 2px 0 0; font-size: 13px; color: #6d6757; }
.code-error { margin: 8px 0 0; font-size: 15px; font-weight: 700; color: #9c2318; }
.knob-button { margin-top: 18px; }

/* ----------------------------------------------------------- the lessons */

.is-lessons .room { max-width: 820px; }
.lesson-head { text-align: center; margin-bottom: 26px; }
.lesson-title { margin: 10px 0 8px; font-family: var(--f-deco);
  font-size: clamp(26px, 5.4vw, 42px); letter-spacing: .03em; color: var(--paper);
  text-shadow: 4px 5px 0 var(--ink); }
.lesson-lede { margin: 0 auto; max-width: 56ch; font-size: 16px; line-height: 1.7; color: var(--paper-2); }

/* paper, tilted the other way each time, as on the band's home page */
.panel {
  padding: 24px clamp(18px, 3.4vw, 28px) 20px;
  margin: 0 0 20px;
  border: 4px solid var(--ink);
  border-radius: 3px 8px 4px 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt, -.7deg));
}
.panel:nth-of-type(even) { --tilt: .8deg; background: var(--paper-2); }

.panel h2 { margin: 0 0 10px; font-family: var(--f-marker); font-size: 23px;
  letter-spacing: .01em; color: var(--ink); }
.panel p, .panel li { font-size: 15px; line-height: 1.7; color: #3b362b; }
.panel ol, .panel ul { margin: 0; padding-left: 1.3em; }

.song { padding: 14px 0; border-top: 2px dashed rgba(27,21,48,.25); }
.song:first-of-type { border-top: 0; }
.song-title { margin: 0 0 2px; font-family: var(--kana); font-weight: 700; font-size: 21px; color: var(--ink); }
.song-note { margin: 0 0 8px; font-size: 13px; color: #6b6453; }
.song-line { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 0; }
.song-kana { font-family: var(--kana); font-size: 20px; color: var(--ink); }
.song-roma { font-size: 14px; color: #4f6f68; align-self: center; }
.song-en   { font-size: 14px; color: #6b6453; align-self: center; }

.cta { margin: 10px 10px 0 0; font-size: 20px; }
.cta-quiet { background: var(--paper); }

/* -------------------------------------------------------------- the room */

.room-foot { margin-top: 28px; text-align: center; }
.privacy { margin: 0 auto 10px; max-width: 54ch; font-size: 13px; line-height: 1.6; color: rgba(255,246,224,.6); }
.room-nav { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.room-nav a {
  font: 400 15px/1 var(--f-marker); text-decoration: none; color: var(--paper);
  border: 2px dashed rgba(255,246,224,.5); border-radius: 999px; padding: 9px 15px 7px;
}
.room-nav a:hover { background: var(--mustard); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------ the desk */

/* The producer's page is a working surface, not an object: whoever is on it
   is running a live show from a laptop and wants density and labels. It
   still lives on the same wall. */
.is-host .room { max-width: 1180px; }
.desk-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.desk h1 { font-family: var(--f-deco); font-size: 26px; letter-spacing: .08em; margin: 0 0 4px;
  text-shadow: 3px 4px 0 var(--ink); }
.desk-sub { margin: 0 0 18px; color: var(--paper-2); font-size: 14px; }
.desk-panel {
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 3px 8px 4px 10px;
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.desk-panel h2 { margin: 0 0 12px; font-family: var(--f-marker); font-size: 20px; color: var(--ink); }
.desk-panel label { display: block; font-size: 13px; color: #5c5544; margin: 10px 0 4px; }
.desk-panel input[type=text], .desk-panel input[type=password], .desk-panel select {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 6px;
  border: 2px solid var(--ink); background: #fffdf7; color: var(--ink);
}
.desk-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.desk-btn {
  font: 400 15px/1 var(--f-marker); padding: 11px 15px 9px; min-height: 42px;
  border-radius: 999px; border: 2.5px solid var(--ink); cursor: pointer;
  color: var(--ink); background: var(--paper-2); box-shadow: var(--shadow-sm);
}
.desk-btn:hover { background: var(--mustard); }
.desk-btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.desk-btn.is-on { background: var(--mint); }
.desk-btn.is-live { background: var(--tomato); color: var(--paper); }
.desk-note { font-size: 12px; color: #6b6453; margin: 8px 0 0; line-height: 1.55; }
.desk-ok { color: #0a6b4f; } .desk-bad { color: #9c2318; }

.q { padding: 10px 12px; border-radius: 8px; background: #fffdf7; margin-bottom: 8px;
     border: 2px solid rgba(27,21,48,.25);
     display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; }
.q-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; border: 2px solid var(--ink); }
.q-dot[data-colour="red"] { background: var(--tomato); }
.q-dot[data-colour="yellow"] { background: var(--mustard); }
.q-dot[data-colour="green"] { background: var(--teal); }
.q-dot[data-colour="blue"] { background: var(--sky); }
.q-text { font-size: 16px; color: var(--ink); line-height: 1.45; }
.q-meta { font-size: 12px; color: #6b6453; margin-top: 3px; }
.q.is-answered { opacity: .5; }
.code-chip { font-family: var(--f-crt); font-size: 22px; letter-spacing: .18em; color: #9c2318; }

/* ----------------------------------------------------------- the phone */

@media (max-width: 760px) {
  .room { padding: 14px 12px 54px; }
  .station-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .script-picker { justify-content: center; }
  .script-label { width: 100%; text-align: center; margin: 0 0 2px; }
  .slate { gap: 4px; }
  .slate-small { font-size: 12px; }
  .slate-bars { height: 9px; }
  /* Two by two, not four across: a 92px sweet is the smallest a child
     actually hits, and four of those do not fit on a phone. */
  .jellies { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .jelly-art { max-width: 140px; }
  .desk-grid { grid-template-columns: 1fr; }
  :root { --strip-h: 34%; }
}

@media (max-width: 420px) {
  .jelly-main { font-size: 15px; }
  .strip { padding: 8px 10px 10px; }
}

/* Everything that moves, off. The flicker and the wobble are the two things
   on this page that could make a child feel sick, so they are the first to
   go. */
@media (prefers-reduced-motion: reduce) {
  .jelly-body, .slate-big, .on-air-lamp, .jelly.is-pop .jelly-body { animation: none; }
  .glass::after { animation: none; opacity: .04; }
  .jelly-svg { transition: none; }
  .card-send, .knob-button, .cta { transition: none; }
}

/* ---------------------------------------------------------- the dial */

/* The station's front door. The set stands with nothing in it and the dial
 * underneath is the thing to turn, because a channel is a programme rather
 * than a page of this site that happens to exist.
 *
 * The accent colours are classes rather than inline styles: style-src is
 * 'self' here and a style attribute is dropped on the floor. A channel made
 * on the desk gets the default until it is given a class of its own, which
 * is a fair trade for not loosening the policy.
 */
.dial { margin-top: 4px; }

.dial-title {
  margin: 0 0 12px;
  font-family: var(--f-marker);
  font-size: clamp(19px, 3vw, 26px);
  color: var(--paper);
  text-shadow: 2px 3px 0 var(--ink);
  text-align: center;
}

.dial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(12px, 2vw, 20px);
}

/* a channel card: the art, the number stamped on it, and what it is */
/* The card's own background is ink, not paper. The art sits on it and the
   text block carries the paper itself. The card is rotated a fraction of a
   degree, and a rotated box clipped to a radius leaves a sliver along its
   edges: against paper that sliver is a white line round every photograph,
   which is what it was. Against ink it is the border. */
.chan {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 4px solid var(--ink);
  border-radius: 3px 10px 4px 12px;
  background: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .14s ease-out, box-shadow .14s ease-out;
  transform: rotate(var(--tilt, -.5deg));
}
.chan:nth-child(even) { --tilt: .6deg; }
.chan:hover { transform: translate(-2px, -3px) rotate(0deg); box-shadow: 8px 9px 0 var(--ink); }
.chan:focus-visible { outline: 3px dashed var(--mustard); outline-offset: 4px; }

/* The picture fills the box absolutely rather than as a block inside it.
   As a block it left a hairline of the card's paper along the top and left
   on fractional widths, which is the white edge: a flex item rounded to a
   whole pixel inside a parent that was not. Absolute inset: 0 cannot leave
   a gap, and what shows through while the file is still arriving is the
   channel's own colour, not cream. */
.chan-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: linear-gradient(140deg, var(--accent, #6b3fd6), var(--ink));
  border-bottom: 4px solid var(--ink);
  overflow: hidden;
}
.chan-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* and a hairline of ink over the join, so a sub-pixel edge is never pale */
.chan-art::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px var(--ink);
  pointer-events: none;
}

/* the channel number, stamped into the corner like a dial position */
.chan-num {
  position: absolute;
  left: 10px; top: 10px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-family: var(--f-crt);
  font-size: 26px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.chan-text { display: block; padding: 14px 16px 16px; color: var(--ink); background: var(--paper); flex: 1; }
.chan-name { display: block; font-family: var(--f-marker); font-size: 21px; line-height: 1.15; }
.lang-ja .chan-name { font-family: var(--kana); font-weight: 700; }
.chan-blurb { display: block; margin-top: 4px; font-size: 14px; line-height: 1.5; color: #5c5544; }
.chan-state {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--f-crt);
  font-size: 15px;
  letter-spacing: .08em;
  color: #7a7466;
}
.lang-ja .chan-state { font-family: var(--kana); letter-spacing: 0; font-size: 13px; }

/* on air: the card says so before you click it */
.chan.is-live .chan-state { color: var(--tomato); font-weight: 700; }
.chan.is-live .chan-num { background: var(--tomato); color: var(--paper); }

/* the four that ship with the station */
.chan-minyo      { --accent: #d4552f; }
.chan-blues      { --accent: #2f6fb5; }
.chan-electronic { --accent: #19b3a6; }
.chan-school     { --accent: #ffc83d; }

/* the dial again, from inside a channel */
.dial-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.dial-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 15px/1 var(--f-marker);
  text-decoration: none; color: var(--paper);
  border: 2px dashed rgba(255,246,224,.5);
  border-radius: 999px; padding: 9px 15px 7px;
}
.dial-chip:hover { background: var(--mustard); color: var(--ink); border: 2px solid var(--ink); box-shadow: var(--shadow-sm); }
.dial-chip.is-live { border-color: var(--tomato); color: var(--tomato); }
.dial-num { font-family: var(--f-crt); font-size: 17px; }
.lang-ja .dial-chip { font-family: var(--kana); }

.station-chan {
  padding-left: 14px;
  border-left: 2px solid rgba(255, 246, 224, .28);
  font-family: var(--f-crt);
  font-size: 16px;
  letter-spacing: .1em;
  color: var(--mustard);
}
.lang-ja .station-chan {
  padding-left: 14px;
  border-left: 2px solid rgba(255, 246, 224, .28); font-family: var(--kana); letter-spacing: 0; }
/* the badge, which is the logo everywhere else in the network. It is
   smaller on a channel page than on the station: the show is the subject
   there, not the station. */
.badge { display: block; width: clamp(150px, 17vw, 196px); height: auto; overflow: visible;
  filter: drop-shadow(3px 4px 0 var(--ink)); }
.station-badge { display: block; text-decoration: none; }
/* A tight ring, not a dashed box five pixels out: the badge is an octagon
   with bulbs around it and a dashed rectangle around that read as a
   selection marquee left on by accident. */
.station-badge:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
  border-radius: 10px;
}
.badge-a { fill: var(--mustard); }
.badge-b { fill: var(--pink); }

/* the chase: eight phases round 52 bulbs, so the light travels rather than
   blinking. One animation, eight negative delays, no script. */
  14%  { opacity: .62; fill: #fff3b0; }
  34%  { opacity: .34; fill: #e8d588; }
  100% { opacity: .34; fill: #e8d588; }
}

.station-name { text-decoration: none; }

/* On the station the set is a sign, not the show: at full width its empty
   screen is six hundred pixels of nothing above the thing you came to use. */
.is-station .set { max-width: 680px; margin: 0 auto; }
.is-station .hall { gap: 26px; }
.is-station .ticket { margin-top: 4px; }
.is-station .slate { padding: 8% 10%; }

/* ------------------------------------------------- please stand by */

/* A channel with nothing on the strip is a set that has been taken over.
 * The Outer Limits did this with a band of noise and an instruction, and
 * the instruction is the whole trick: the screen is not broken, it is
 * being held. The words here are written rather than quoted, because the
 * 1963 narration is in copyright and a web page is publication.
 *
 * Cheap, like the tube's own static: one noise tile moved in steps and one
 * line swept with a transform. Nothing repaints.
 */
.strip-empty .strip-title {
  font-family: var(--f-crt);
  font-size: clamp(20px, 3.4vw, 40px);
  letter-spacing: .22em;
  color: var(--phosphor, #cfe4d6);
  text-shadow: 0 0 16px rgba(207, 228, 214, .5);
  animation: standby-flicker 5.5s steps(1, end) infinite;
}
.lang-ja .strip-empty .strip-title { font-family: var(--kana); letter-spacing: .12em; }

/* the band of noise behind the words, confined to the strip */
.standby { display: none; }
.strip-empty .standby {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}
.standby-noise {
  position: absolute;
  inset: -64px;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  will-change: transform;
  animation: tv-static .4s steps(5, end) infinite;
}
/* the sweep: one bright line crossing the band, the way a set searches */
.standby-sweep {
  position: absolute;
  left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(207,228,214,.55), transparent);
  box-shadow: 0 0 12px rgba(207, 228, 214, .5);
  will-change: transform;
  animation: standby-sweep 4.2s linear infinite;
}

@keyframes standby-sweep {
  0%   { transform: translateY(-10px); opacity: 0; }
  10%  { opacity: .9; }
  90%  { opacity: .9; }
  100% { transform: translateY(240px); opacity: 0; }
}
@keyframes standby-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: .55; } 94% { opacity: 1; } 96% { opacity: .78; }
}

/* a channel that is off gets more of the tube's own snow, not less */
.show-off .glass::after, .show-ended .glass::after { opacity: .16; }

@media (prefers-reduced-motion: reduce) {
  .standby-noise, .standby-sweep, .strip-empty .strip-title { animation: none; }
  .standby-sweep { opacity: .4; transform: translateY(96px); }
}

/* -------------------------------------------- asking for a code */

.said {
  margin: 0 0 14px;
  padding: 11px 14px 9px;
  border: 3px solid var(--ink);
  border-radius: 3px 8px 4px 10px;
  background: var(--mint);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.said-bad, .said-slow, .said-failed { background: #ffb4a3; }
.said-pending, .said-closed { background: var(--mustard); }

/* The second half of the panel: the way in for somebody who has no code.
   Set apart by a rule rather than a box, because it is the same errand. */
.ask {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed rgba(27, 21, 48, .3);
}
.ask-h { margin: 0 0 4px; font: 400 19px/1.2 var(--f-marker); color: var(--ink); }
.lang-ja .ask-h { font-family: var(--kana); font-weight: 700; }
.ask-hint { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #5c5544; }
.ask-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.ask-input {
  flex: 1 1 220px;
  font: inherit; font-size: 17px;
  padding: 11px 13px;
  border: 3px solid var(--ink);
  border-radius: 6px 10px 6px 12px;
  background: #fffdf7;
  color: var(--ink);
}
.ask-go {
  font: 400 17px/1 var(--f-marker);
  padding: 12px 20px 10px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.lang-ja .ask-go { font-family: var(--kana); font-weight: 700; }
.ask-go:hover { background: var(--mustard); }
.ask-go:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* ------------------------------------------------- the ticket and the popcorn */

.stub { position: relative; padding: 10px 0 6px; }

/* the popcorn sits in the purple behind the ticket, never on it */
.popcorn { position: absolute; inset: -18px -8px; pointer-events: none; z-index: 0; }
.popcorn-defs { position: absolute; width: 0; height: 0; }

.kernel {
  position: absolute;
  height: auto;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  filter: drop-shadow(3px 5px 4px rgba(10, 4, 26, .62));
  /* a piece of popcorn is not perfectly still on a table either */
  animation: pop-breathe 6s ease-in-out var(--fd, 0s) infinite;
}

@keyframes pop-breathe {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); }
  50%      { transform: translate(-50%, calc(-50% - 3px)) rotate(calc(var(--rot, 0deg) + 2deg)); }
}

.k0 { left: 4%; top: 12%; width: 73px; --rot: -20deg; --fd: 1.85s; --pd: 0.1s; --dx: 34px; }
.k1 { left: 11%; top: 42%; width: 76px; --rot: 41deg; --fd: 1.97s; --pd: 0.16s; --dx: 112px; }
.k2 { left: 6%; top: 74%; width: 59px; --rot: 40deg; --fd: 1.87s; --pd: 0.05s; --dx: 63px; }
.k3 { left: 15%; top: 92%; width: 72px; --rot: 40deg; --fd: 2.84s; --pd: 0.12s; --dx: 43px; }
.k4 { left: 26%; top: 6%; width: 58px; --rot: -42deg; --fd: 2.16s; --pd: 0.23s; --dx: 13px; }
.k5 { left: 38%; top: 96%; width: 80px; --rot: 19deg; --fd: 0.05s; --pd: 0.2s; --dx: -80px; }
.k6 { left: 52%; top: 3%; width: 49px; --rot: 71deg; --fd: 1.02s; --pd: 0.01s; --dx: 101px; }
.k7 { left: 63%; top: 97%; width: 69px; --rot: -12deg; --fd: 2.02s; --pd: 0.24s; --dx: -21px; }
.k8 { left: 74%; top: 8%; width: 65px; --rot: 29deg; --fd: 2.48s; --pd: 0.15s; --dx: 119px; }
.k9 { left: 86%; top: 38%; width: 88px; --rot: -46deg; --fd: 1.24s; --pd: 0.01s; --dx: 6px; }
.k10 { left: 93%; top: 70%; width: 59px; --rot: -25deg; --fd: 3.28s; --pd: 0.11s; --dx: 40px; }
.k11 { left: 88%; top: 92%; width: 66px; --rot: -3deg; --fd: 1.72s; --pd: 0.1s; --dx: -31px; }
.k12 { left: 96%; top: 18%; width: 73px; --rot: 56deg; --fd: 1.39s; --pd: 0.06s; --dx: -34px; }
.k13 { left: 2%; top: 56%; width: 86px; --rot: -73deg; --fd: 0.95s; --pd: 0.16s; --dx: 58px; }
.k14 { left: 80%; top: 66%; width: 79px; --rot: -39deg; --fd: 2.93s; --pd: 0.25s; --dx: 111px; }
.k15 { left: 24%; top: 99%; width: 73px; --rot: 66deg; --fd: 0.35s; --pd: 0.17s; --dx: 42px; }

/* The set is turned on and the popcorn goes with it: up, out, spinning, and
   off the top of the screen. Transform and opacity only, so it is one
   composited layer per piece and nothing repaints. */
.is-popping .kernel {
  animation: pop-fly .62s cubic-bezier(.22, .9, .3, 1) var(--pd, 0s) forwards;
}

@keyframes pop-fly {
  0%   { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); opacity: 1; }
  28%  { transform: translate(calc(-50% + calc(var(--dx, 0px) * .3)), -120%)
                    rotate(calc(var(--rot, 0deg) + 90deg)) scale(1.12); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), -620%)
                    rotate(calc(var(--rot, 0deg) + 420deg)) scale(.9); opacity: 0; }
}

/* ---------- the ticket ---------- */

/* Card stock, not paper: heavier, warmer, with the fibre showing and the
   two notches a ticket has where it was torn off the roll. The stub at the
   bottom is the part the usher keeps. */
/* The card is a photograph of one, not a gradient pretending to be one.
   Drawn card stock was four flat values and a turbulence filter, and it
   read as a rectangle of cream: real stock has a torn deckle, a shadow in
   the fibre and corners that have been in somebody's pocket.

   It is painted on ::before rather than on the card itself so the hard
   ink shadow can be a drop-shadow, which follows the torn edge. A
   box-shadow would draw a neat rectangle behind a ragged thing. The
   element's own geometry stays a plain box, so the text inside lays out
   the way it always did. */
.ticket-card {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  background: none;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: rotate(-.8deg);
  clip-path: none;
  overflow: visible;
}
.ticket-card::before {
  content: "";
  position: absolute;
  inset: -10px -8px;        /* the stock runs a little past the text block */
  z-index: -1;
  pointer-events: none;
  background: url("../img/ticket.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(5px 7px 0 rgba(27, 21, 48, .9));
}

/* Red stock, so everything loose on the card flips to cream. Scoped to
   .ticket-card on purpose: the same classes carry dark type on the cream
   cards elsewhere on the site, and those are not tickets.

   The inputs and the two buttons stay as they are. They were already
   cream fields with an ink border and a hard ink shadow, which is exactly
   what a printed form on a red ticket looks like, and the mustard button
   is louder against red than it ever was against cream. */
/* The stock has a printed keyline round it, about 6% in, and the copy has
   to sit inside that rule or the card reads as a rectangle with writing
   over the top of it. These paddings are the frame, not taste.

   The inset is a share of the card's height, and the card grows with its
   text, so the top and bottom have slack in them: enough that the kicker
   clears the rule on the tallest the card gets, which is Japanese with a
   status message showing. */
.ticket-card .ticket-body { padding: clamp(56px, 8.5vw, 84px) clamp(38px, 7.2vw, 64px) 18px; }
.ticket-card .ticket-tear { margin: 0 clamp(38px, 7.2vw, 64px); }
.ticket-card .ticket-stub { padding: 12px clamp(38px, 7.2vw, 64px) clamp(46px, 6.5vw, 76px); }

.ticket-card { color: var(--paper); }
.ticket-card .ticket-kicker { color: #f2d9a8; }
.ticket-card .ticket-title  { color: var(--paper); }
.ticket-card .ticket-lede,
.ticket-card .ask-hint      { color: rgba(255, 246, 224, .88); }
.ticket-card .code-label,
.ticket-card .ask-h         { color: var(--paper); }
.ticket-card .code-help     { color: rgba(255, 246, 224, .76); }
/* a dark red error on red stock is not an error anybody can read */
.ticket-card .code-error    { color: #ffd7cd; text-shadow: 0 1px 0 rgba(27,21,48,.5); }
.ticket-card .ticket-tear   { border-top-color: rgba(255, 246, 224, .5); }
.ticket-card .stub-word,
.ticket-card .stub-no       { color: #f2d9a8; }

.ticket-body { position: relative; padding: 26px clamp(20px, 5vw, 34px) 22px; }

/* The notches, where it came off the roll. They were two discs painted the
   colour of the wall, which read as dark lumps stuck on the edges: paint
   the background colour onto a thing and it is still a thing. A mask takes
   the card away instead, so what shows through the notch is whatever is
   behind the ticket, popcorn included. */
/* No CSS notches any more: the two the ticket was torn off the roll by
   are in the photograph, punched through the alpha, so what shows through
   them is the wall and the popcorn behind. */
.ticket-edge { display: none; }

.ticket-kicker {
  margin: 0 0 6px;
  font: 400 13px/1 var(--f-crt);
  letter-spacing: .28em;
  color: #8a6a3a;
}
.ticket-card .ticket-title {
  margin: 0 0 10px;
  font-family: var(--f-deco);
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: .02em;
}
.lang-ja .ticket-card .ticket-title { font-family: var(--kana); font-weight: 700; }

/* the tear line and the stub the usher keeps */
.ticket-tear {
  position: relative;
  height: 0;
  border-top: 3px dashed rgba(27, 21, 48, .45);
  margin: 0 14px;
}
.ticket-stub {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(20px, 5vw, 34px) 14px;
}
.stub-word {
  font: 400 17px/1 var(--f-crt);
  letter-spacing: .4em;
  color: #6b5330;
}
.stub-no { font: 400 15px/1 var(--f-crt); letter-spacing: .14em; color: #8a6a3a; }

@media (prefers-reduced-motion: reduce) {
  .kernel { animation: none; }
  .is-popping .kernel { animation: none; opacity: 0; transition: opacity .2s; }
}

/* ------------------------------------------------------------- the rug */

/* The set does not float on the wall: it stands on a shag rug, and the
   rug is the reason the legs look like legs. The pile is laid over the
   bottom of the cabinet so it closes round them, which is also why the
   cast shadow is painted on the rug rather than dropped under the set. */
.stage { position: relative; }
.is-station .stage { max-width: 680px; margin: 0 auto; }

.rug {
  display: block;
  width: 134%;              /* a rug the size of the furniture is a doormat */
  margin-left: -17%;
  height: auto;
  margin-top: -11.5%;       /* the legs sink into the pile */
  position: relative;
  z-index: -1;              /* and the pile closes behind them */
  pointer-events: none;
}

/* The set keeps its own 680 and the stage holds it: taking the cap off
   .set let the cabinet grow to the full column on the station page, which
   is the one page where the set is a sign and not the show. */
.is-station .set { max-width: 680px; }

@media (max-width: 620px) {
  /* the pile is deeper than the old drawn rug, so it needs less width and
     more lift or it swallows the phone */
  .rug { width: 126%; margin-left: -13%; margin-top: -10%; }
}

/* ------------------------------------------------------ the marquee lamps
   The ring itself is generated by tools/marquee.py in compact-network;
   this is only the chase.

   Six phases, so the dark travels round the ring one lamp at a time
   rather than every third lamp blinking together. Each lamp is a single
   group, so this animates one element per bulb instead of six, and it
   moves opacity only, which the compositor does without repainting. */
.mb-lamp, .mb-halos circle { animation: mb-chase 1.9s linear infinite; }
.mb-p0 { animation-delay: 0s; }
.mb-p1 { animation-delay: -.317s; }
.mb-p2 { animation-delay: -.633s; }
.mb-p3 { animation-delay: -.95s; }
.mb-p4 { animation-delay: -1.267s; }
.mb-p5 { animation-delay: -1.583s; }

/* A filament has thermal lag: it does not snap off the way a neon tube
   does, so this ramps down and comes back, and never goes fully dark — a
   cold bulb on a lit sign reads as a dead bulb. */
@keyframes mb-chase {
  0%, 58%, 100% { opacity: 1; }
  72%           { opacity: .42; }
  86%           { opacity: .78; }
}

@media (prefers-reduced-motion: reduce) {
  .mb-lamp, .mb-halos circle { animation: none; opacity: 1; }
}
