/* ---------- playground ---------- */
.pg {
  overflow-x: clip;
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.pg-intro { max-width: 720px; }
.pg h1 {
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 6px 0 14px;
}
.pg-lede { font-size: 17px; color: #cfc9bd; margin: 0 0 12px; }
.pg-note {
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 12px;
  margin: 0;
}
.pg-h2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 30px 0 12px;
}
.pg-load { margin-top: 8px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  color: #cfc9bd;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.chip:hover { border-color: var(--signal); color: var(--bone); }
.chip[aria-pressed="true"] {
  border-color: var(--signal);
  background: rgba(255, 92, 43, 0.09);
  color: var(--bone);
}
.chip b { display: block; font-weight: 500; font-size: 11.5px; }
.chip span { color: var(--dim); }

.pg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) { .pg-grid { grid-template-columns: 1fr; } }

.pg-controls, .pg-verdict {
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 18px 18px 22px;
}
.ctl { margin: 0 0 18px; }
.ctl label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: #cfc9bd;
  margin-bottom: 6px;
}
.ctl output { color: var(--signal); font-size: 12px; }
.ctl-help { font-size: 12px; color: var(--dim); margin: 6px 0 0; line-height: 1.45; }
.ctl-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .ctl-pair { grid-template-columns: 1fr; } }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8.5px;
  border-radius: 50%;
  background: var(--bone);
  border: 3px solid var(--ink-2);
  box-shadow: 0 0 0 1px var(--line);
}
input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--signal); }
input[type="range"]::-moz-range-track { height: 3px; background: var(--line); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bone); border: 3px solid var(--ink-2);
}

.btn-ghost {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 12px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--bone); border-color: var(--muted); }
.pg-reset { margin-top: 6px; }

/* verdict stamp */
.stamp-box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--srm);
  background: var(--ink-3);
  padding: 14px 16px;
  display: grid;
  gap: 3px;
}
.stamp-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}
.stamp-word {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--srm);
}
.stamp-reason { font-size: 13px; color: #cfc9bd; }
.stamp-box[data-state="guard"] { border-left-color: var(--guard); }
.stamp-box[data-state="guard"] .stamp-word { color: var(--guard); }
.stamp-box[data-state="ready"] { border-left-color: var(--ship); }
.stamp-box[data-state="ready"] .stamp-word { color: var(--ship); }
.stamp-box[data-state="wait"] { border-left-color: var(--collect); }
.stamp-box[data-state="wait"] .stamp-word { color: var(--collect); }
.stamp-box[data-state="shipped"] { border-left-color: var(--bone); }
.stamp-box[data-state="shipped"] .stamp-word { color: var(--bone); }

/* checks */
.checks { list-style: none; margin: 16px 0 0; padding: 0; }
.check-item {
  border-top: 1px solid var(--line-soft);
  padding: 12px 0 10px;
}
.check-item[data-state="fail"] { opacity: 1; }
.check-item[data-state="skip"] { opacity: 0.45; }
.check-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.check-n { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.check-name { flex: 1; color: var(--bone); }
.check-state {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.check-item[data-state="pass"] .check-state { color: var(--ship); border-color: rgba(78, 168, 122, 0.45); }
.check-item[data-state="fail"] .check-state { color: var(--srm); border-color: rgba(224, 87, 63, 0.45); }
.check-item[data-state="warn"] .check-state { color: var(--guard); border-color: rgba(217, 164, 65, 0.45); }
.check-nums {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0;
}
.check-nums div { min-width: 0; }
.check-nums dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.check-nums dd {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: #cfc9bd;
  overflow-wrap: anywhere;
}

/* ship */
.ship-row { margin-top: 18px; }
.btn-ship {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 13px 16px;
  border: 1px solid var(--ship);
  background: var(--ship);
  color: #08120d;
  cursor: pointer;
  transition: filter 120ms ease, opacity 120ms ease;
}
.btn-ship:hover:not(:disabled) { filter: brightness(1.1); }
.btn-ship:disabled,
.btn-ship[data-locked="true"] {
  background: transparent;
  border-color: var(--line);
  color: var(--dim);
  cursor: not-allowed;
}
.btn-ship[data-locked="true"]:hover { border-color: var(--srm); color: var(--srm); }
.ship-hint { font-size: 12px; color: var(--dim); margin: 8px 0 0; line-height: 1.45; }

/* flag state */
.flag-state { margin-top: 22px; }
.flag-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 8px;
}
.flag-title span { color: var(--bone); letter-spacing: 0; text-transform: none; }
.flag-bars { display: grid; gap: 6px; }
.fbar { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 8px; font-size: 12px; }
.fbar .fname { font-family: var(--mono); font-size: 11px; color: #cfc9bd; overflow-wrap: anywhere; }
.fbar .ftrack { height: 12px; background: var(--ink); border: 1px solid var(--line-soft); }
.fbar .ffill { height: 100%; background: var(--collect); transition: width 260ms ease; }
.fbar[data-win="true"] .ffill { background: var(--ship); }
.fbar[data-zero="true"] .ffill { background: var(--srm); }
.fbar .fpct { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; }

/* cli */
.cli {
  margin: 18px 0 0;
  padding: 12px 14px;
  background: var(--ink);
  border: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: #b9c2bd;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cli .ok { color: var(--ship); }
.cli .bad { color: var(--srm); }
.cli .warn { color: var(--guard); }

/* audit */
.audit-block { margin-top: 22px; }
.ledger { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 400;
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.ledger td {
  padding: 7px 8px 7px 0;
  border-bottom: 1px solid var(--line-soft);
  color: #cfc9bd;
  vertical-align: top;
}
.ledger td.mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ledger tr:first-child td { color: var(--bone); }
.ledger .act-ship { color: var(--ship); }
.ledger .act-pause { color: var(--guard); }
.ledger .act-refuse { color: var(--srm); }

/* footer bits */
.pg-next { max-width: 720px; margin-top: 40px; }
.pg-next p { color: #cfc9bd; font-size: 15px; }
.pg-links { display: flex; flex-wrap: wrap; gap: 16px; font-family: var(--mono); font-size: 11.5px; }
.pg-links a { color: var(--signal); text-decoration: none; border-bottom: 1px solid rgba(255, 92, 43, 0.3); }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  background: var(--bone);
  color: #0c0e0f;
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 16px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* keep headings clear of the sticky top bar when jumping */
.pg-verdict, .pg-load, .pg-next, .pg [id] { scroll-margin-top: 76px; }

/* phones: four statistic columns do not fit, and long numbers force the page wide */
@media (max-width: 620px) {
  .pg { padding: 24px 16px 64px; }
  .pg-grid { gap: 18px; }
  .pg-controls, .pg-verdict { padding: 14px 14px 18px; min-width: 0; }
  .check-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .check-nums dd { font-size: 12px; }
  .fbar { grid-template-columns: 78px 1fr 38px; gap: 6px; }
  .stamp-word { font-size: 19px; }
  .cli { font-size: 10.5px; padding: 10px 11px; }
  .ledger { font-size: 10.5px; }
  .ledger th, .ledger td { padding-right: 6px; }
  .chip { width: 100%; }
  .pg-chips { display: grid; gap: 6px; }
}
