/* only for "Nine clocks and a bird". Other posts never load this. */

.prose pre .s { color: #b8d98a; } /* string */

/* ---------- the bird demo ---------- */
.phx-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }

/* the stage is the game's own background in both themes. 8× integer scale so every pixel stays a square */
.phx-stage {
  position: relative; display: grid; place-items: center; width: 432px; height: 456px;
  background: #111012; border: 2px solid var(--line); border-radius: 14px;
}
.phx-stage svg { width: 384px; height: 416px; display: block; }
.phx-stage .t { fill: var(--tint); }
.phx-stage g { transition: opacity .3s; }
.phx-stage.ghost [data-layer="body"], .phx-stage.ghost [data-layer="tailFixed"] { opacity: .15; }
.phx-stage .phx-empty { display: none; position: absolute; inset: 0; place-content: center; padding: 24px; text-align: center; font-size: 13px; color: #8a847c; }
.phx-stage.empty svg { visibility: hidden; }
.phx-stage.empty .phx-empty { display: grid; }

.phx-repeat { margin-top: 14px; font-size: 15px; line-height: 1.4; max-width: 432px; min-height: 2.8em; }
.phx-repeat b { color: var(--orange); font-variant-numeric: tabular-nums; }

.phx-controls { display: grid; gap: 16px; margin-top: 10px; max-width: 432px; }
.phx-row { display: flex; flex-wrap: wrap; gap: 8px; }
.phx .btn { min-height: 44px; }
.phx-label, .seg legend { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: block; padding: 0; }

.seg { border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seg legend { width: 100%; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 99px;
  font: 600 13px "JetBrains Mono", ui-monospace, monospace; cursor: pointer; transition: background .15s, color .15s;
}
.seg input:checked + span { background: var(--fg); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.seg label:hover span { border-color: var(--orange); }

.phx-forms { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--line); cursor: pointer;
  background: var(--sw, repeating-linear-gradient(45deg, transparent 0 5px, var(--muted) 5px 6px)); /* form 1: no colour */
  font: 600 12px "JetBrains Mono", ui-monospace, monospace; color: #0d0d0d;
}
.swatch:not([style]) { color: var(--fg); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--orange); }
.swatch:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

/* ---------- the lanes ---------- */
.phx-lanes { list-style: none; padding: 0; display: grid; gap: 6px; }
.lane {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 6.5em; gap: 12px; align-items: center;
  padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg);
  font: inherit; text-align: left; cursor: pointer; transition: opacity .2s, border-color .15s;
}
.lane:hover { border-color: var(--orange); }
.lane:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.lane-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.lane-name small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.lane-track { display: block; }
.lane-bar { position: relative; display: block; height: 16px; border: 1.5px solid var(--line); border-radius: 4px; overflow: hidden; }
.lane-bar i { position: absolute; top: 0; bottom: 0; }
.lane-bar .s1 { background: color-mix(in srgb, var(--orange) 45%, transparent); }
.lane-bar .s2 { background: var(--orange); }
.lane-bar .ph { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--fg); }
.lane-state { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane[aria-pressed="false"] { opacity: .45; border-style: dashed; }
.lane[aria-pressed="false"] .lane-name { text-decoration: line-through; text-decoration-thickness: 2px; }

/* ---------- every pose ---------- */
.pg-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.pg-gridwrap { min-width: 0; }
.pg-gridwrap canvas { display: block; cursor: crosshair; image-rendering: pixelated; }
.pg-big { font-size: clamp(36px, 6vw, 60px); font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.pg-of { color: var(--muted); font-size: .45em; letter-spacing: 0; }
.pg-sub { font-size: 13px; color: var(--muted); margin-top: 8px; }
.pg-sub b { color: var(--fg); font-variant-numeric: tabular-nums; }
.pg-slider { display: block; margin-top: 18px; }
.pg-slider span { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.pg-slider input { width: 100%; min-height: 44px; accent-color: var(--orange); }
.pg-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.poses .btn { min-height: 44px; }
.poses .btn:disabled, .pg-slider input:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.pg-key { font-size: 12px; color: var(--fg); margin-top: 18px; }
.pg-legend { list-style: none; padding: 0; margin-top: 8px; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pg-legend b { color: var(--fg); font-weight: 600; }
.pg-legend .k0 { background: color-mix(in srgb, var(--muted) 12%, transparent); outline: 1px solid color-mix(in srgb, var(--muted) 35%, transparent); }
.prose .pg-legend { padding-left: 0; }
.prose .pg-legend li::marker { content: none; }
.prose .pg-legend li + li { margin-top: 0; }
.pg-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.pg-legend .k1 { background: var(--muted); }
.pg-legend .k2 { background: var(--fg); }
.pg-legend .k3 { background: var(--orange); }
.pg-pick { display: flex; gap: 14px; align-items: center; margin-top: 18px; }
.phx-stage.mini { width: 164px; height: 176px; flex: none; border-radius: 10px; }
.phx-stage.mini svg { width: 144px; height: 156px; }
.pg-cap { font-size: 12px; line-height: 1.5; color: var(--muted); }
.pg-cap b { color: var(--orange); }
.pg-cap span { color: var(--fg); }
.pg-status { font-size: 13px; color: var(--muted); margin-top: 12px; min-height: 1.5em; }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .phx-body, .pg-body { grid-template-columns: minmax(0, 1fr); }
  .phx-side { justify-self: center; }
}
@media (max-width: 760px) {
  /* 5× on phones: 240 × 260 */
  .phx-stage { width: 272px; height: 292px; margin: 0 auto; }
  .phx-stage svg { width: 240px; height: 260px; }
  .phx-side { justify-self: stretch; }
  .phx-stage.mini { width: 116px; height: 124px; }
  .phx-stage.mini svg { width: 96px; height: 104px; }
  .lane {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "bar bar";
    gap: 6px 10px; padding: 8px 12px;
  }
  .lane-name { grid-area: name; } .lane-state { grid-area: state; text-align: right; }
  .lane-track { grid-area: bar; }
  .lane-name small { white-space: normal; }
}
