.playground-shell {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(38px, 6vw, 76px) var(--pad) clamp(72px, 9vw, 112px);
}

.playground-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  margin-bottom: 38px;
}

.playground-intro h1 {
  max-width: 820px;
  font-size: clamp(38px, 5vw, 58px);
  margin-bottom: 18px;
}

.playground-intro > div > p:last-child {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 17px;
}

.playground-intro code,
.playground-proof code,
.editor-note code {
  color: var(--seal);
  background: var(--seal-tint);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.92em;
}

.runtime-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11px;
}

.runtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8862f;
}

.runtime-status.ready .runtime-dot { background: var(--ok); }
.runtime-status.error .runtime-dot { background: var(--seal); }

.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
}

.play-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 2px 4px rgba(11, 16, 32, 0.04), 0 34px 70px -56px rgba(11, 16, 32, 0.5);
}

.panel-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}

.panel-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--seal);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panel-head h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.agent-state,
.receipt-verdict {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}

.agent-state.running { color: #b07820; }
.agent-state.allowed { color: var(--ok); }
.agent-state.blocked { color: var(--seal); }

.conversation {
  height: 330px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(242, 240, 232, 0.5), transparent 35%);
}

.message {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.message.customer { align-self: flex-end; background: var(--ink); border-color: var(--ink); color: #fff; }
.message.agent { align-self: flex-start; }
.message.allowed { border-color: rgba(31, 107, 74, 0.28); background: var(--ok-tint); }
.message.blocked { border-color: var(--seal-line); background: var(--seal-tint); }

.message > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message.customer > span { color: rgba(255, 255, 255, 0.56); }
.message p { font-size: 13.5px; line-height: 1.5; }
.message code { font-size: 0.88em; }

.agent-controls { padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.amount-control > span { display: block; margin-bottom: 8px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.amount-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.amount-buttons button,
.approval-actions button,
.reset-policy {
  cursor: pointer;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
}

.amount-buttons button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.amount-buttons button:disabled { cursor: not-allowed; opacity: 0.55; }

.run-agent {
  width: 100%;
  margin-top: 12px;
  cursor: pointer;
  border: 1px solid var(--seal);
  border-radius: 9px;
  background: var(--seal);
  color: #fff;
  padding: 11px 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.run-agent:hover { background: var(--seal-deep); }
.run-agent:disabled { cursor: not-allowed; opacity: 0.5; }

.approval-prompt {
  margin: 0 18px 18px;
  padding: 13px;
  border: 1px solid var(--seal-line);
  border-radius: 10px;
  background: var(--seal-tint);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.approval-prompt span { display: block; color: var(--seal); font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; }
.approval-prompt strong { display: block; margin: 3px 0 1px; font-size: 13.5px; }
.approval-prompt small { color: var(--muted); font-size: 11.5px; }
.approval-actions { display: flex; gap: 7px; }
.approval-actions [data-approve] { border-color: var(--ok); background: var(--ok); color: #fff; }

.code-panel { background: var(--code-bg); border-color: var(--code-line); }
.code-panel .panel-head { background: #11172d; border-color: var(--code-line); }
.code-panel .panel-head h2 { color: #fff; font-family: var(--mono); font-size: 14px; }
.code-panel .reset-policy { border-color: var(--code-line); background: transparent; color: var(--code-dim); }

#policy-editor {
  display: block;
  width: 100%;
  min-height: 430px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 20px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  tab-size: 2;
}

#policy-editor:disabled { opacity: 0.7; }
.editor-note { padding: 13px 18px 16px; border-top: 1px solid var(--code-line); color: var(--code-dim); font-size: 12px; }

.receipts-panel { grid-column: 1 / -1; }
.receipts-head { min-height: 64px; }
.receipt-verdict.ok { color: var(--ok); }
.receipt-verdict.bad { color: var(--seal); }
.receipt-list { list-style: none; padding: 0; max-height: 300px; overflow-y: auto; }
.receipt-list li { display: grid; grid-template-columns: 42px minmax(150px, 1fr) minmax(120px, 0.8fr) auto; gap: 12px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11px; }
.receipt-list li:first-child { border-top: 0; }
.receipt-seq, .receipt-hash { color: var(--muted); }
.receipt-event { color: var(--ink-soft); }
.receipt-effect.allow, .receipt-effect.succeeded, .receipt-effect.approved { color: var(--ok); }
.receipt-effect.ask { color: #a06a1a; }
.receipt-effect.deny, .receipt-effect.denied, .receipt-effect.failed { color: var(--seal); }
.receipt-empty { display: block !important; color: var(--muted); padding: 20px !important; }

.playground-proof {
  margin-top: 18px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  background: var(--paper-2);
}

.playground-proof strong { display: block; margin-bottom: 3px; font-size: 14px; }
.playground-proof p { max-width: 780px; color: var(--ink-soft); font-size: 13px; }
.playground-proof a { flex: none; color: var(--seal); font-family: var(--mono); font-size: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .playground-intro { grid-template-columns: 1fr; align-items: start; }
  .runtime-status { justify-self: start; }
  .playground-grid { grid-template-columns: 1fr; }
  .receipts-panel { grid-column: auto; }
}

@media (max-width: 560px) {
  .playground-shell { padding-top: 30px; }
  .playground-intro h1 { font-size: 38px; }
  .conversation { height: 300px; }
  .approval-prompt { grid-template-columns: 1fr; }
  .approval-actions button { flex: 1; }
  #policy-editor { min-height: 390px; font-size: 11.5px; padding: 16px; }
  .receipt-list li { grid-template-columns: 34px 1fr auto; }
  .receipt-list .receipt-tool { display: none; }
  .playground-proof { align-items: flex-start; flex-direction: column; }
}
