:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(14, 24, 42, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(6, 15, 28, 0.88);
  --border: rgba(147, 197, 253, 0.14);
  --text: #edf5ff;
  --muted: #90a9c8;
  --blue: #67a3ff;
  --cyan: #7de2ff;
  --mint: #89f5d1;
  --amber: #ffcc7a;
  --danger: #ff8f8f;
  --shadow: 0 24px 90px rgba(4, 10, 20, 0.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(77, 120, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(76, 228, 211, 0.16), transparent 26%),
    linear-gradient(180deg, #08111e 0%, #050b15 100%);
  color: var(--text);
}

.shell {
  width: min(1760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.topbar,
.service-sidebar,
.request-panel,
.response-panel,
.request-card,
.response-card {
  background: linear-gradient(180deg, rgba(16, 28, 49, 0.94), rgba(9, 18, 32, 0.92));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: grid;
  grid-template-columns: 1.6fr auto;
  gap: 24px;
  align-items: end;
  border-radius: 28px;
  padding: 28px 32px;
}

.eyebrow,
.panel-label {
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cyan);
  margin-bottom: 12px;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.1rem, 3.4vw, 3.5rem);
  line-height: 1;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.05rem;
}

.hero-text,
.muted {
  color: var(--muted);
}

.hero-text {
  max-width: 760px;
  margin-top: 14px;
  line-height: 1.75;
}

.top-actions,
.panel-head,
.section-head,
.provider-tab {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 18px;
}

.stat-card,
.meta-card,
.service-button,
.live-scenario-card,
.audit-item {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--panel-soft);
}

.stat-card,
.meta-card {
  padding: 18px;
}

.stat-card .label,
.meta-card .label,
.mini-metric .label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.stat-card .value,
.meta-card .value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.playground-shell {
  display: grid;
  grid-template-columns: minmax(280px, 300px) minmax(300px, 340px) minmax(780px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.service-sidebar,
.request-panel,
.response-panel {
  border-radius: 28px;
  padding: 18px;
  min-width: 0;
  display: grid;
  gap: 18px;
}

.service-sidebar,
.request-panel {
  position: sticky;
  top: 16px;
}

.panel-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin-bottom: 4px;
}

.runner-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.compact-section {
  gap: 10px;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
}

.provider-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.provider-tab {
  justify-content: center;
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(103, 163, 255, 0.1);
  border: 1px solid rgba(103, 163, 255, 0.12);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.provider-tab.active {
  background: linear-gradient(135deg, rgba(125, 226, 255, 0.22), rgba(103, 163, 255, 0.18));
  border-color: rgba(125, 226, 255, 0.4);
  color: #fff;
}

.provider-summary-list,
.meta-list {
  display: grid;
  gap: 12px;
}

.meta-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(4, 16, 31, 0.52);
}

.meta-item-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.meta-item-value {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 700;
  word-break: break-word;
}

.meta-item-value.is-link {
  color: var(--cyan);
  text-decoration: none;
}

.meta-item-value.is-link:hover {
  text-decoration: underline;
}

.provider-summary-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(4, 16, 31, 0.52);
}

.provider-summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.provider-summary-row + .provider-summary-row {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.provider-summary-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  flex: 0 0 120px;
}

.provider-summary-value {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.45;
  font-weight: 700;
  min-width: 0;
  text-align: right;
  word-break: break-word;
}

.provider-summary-value a {
  color: var(--cyan);
  text-decoration: none;
}

.provider-summary-value a:hover {
  text-decoration: underline;
}

.live-scenario-card {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.scenario-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.service-button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.service-button.active {
  border-color: rgba(125, 226, 255, 0.38);
  background: linear-gradient(135deg, rgba(103, 163, 255, 0.16), rgba(125, 226, 255, 0.08));
}

.service-button:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 226, 255, 0.22);
}

.service-button.is-running {
  border-color: rgba(125, 226, 255, 0.42);
  background: linear-gradient(135deg, rgba(103, 163, 255, 0.18), rgba(125, 226, 255, 0.12));
}

.service-title-row,
.badge-row,
.meta-row,
.result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-title-row {
  justify-content: space-between;
  align-items: center;
}

.service-caption {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.service-button strong,
.live-scenario-card strong {
  font-size: 1rem;
  line-height: 1.25;
}

.request-card,
.response-card {
  border-radius: 24px;
  padding: 16px;
  min-width: 0;
}

.response-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.usage-card {
  min-width: 0;
  min-height: 560px;
}

.readback-card {
  min-width: 0;
}

.table-meta {
  margin-bottom: 12px;
  line-height: 1.55;
}

.flow-steps {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.flow-steps li strong {
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}

.result-summary {
  margin-bottom: 14px;
}

.result-narrative {
  margin-bottom: 12px;
}

.narrative-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(125, 226, 255, 0.12);
  background: rgba(7, 18, 32, 0.78);
}

.narrative-card strong {
  display: block;
  margin-bottom: 6px;
}

.narrative-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-panel {
  margin: 0;
  overflow: auto;
  max-height: 280px;
  border-radius: 20px;
  padding: 16px;
  background: #04101f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #bfe0ff;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.raw-response-details {
  margin-top: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(4, 16, 31, 0.52);
  overflow: hidden;
}

.raw-response-details summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  color: var(--muted);
  font-weight: 700;
}

.raw-response-details summary::-webkit-details-marker {
  display: none;
}

.raw-response-details[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.readback-note {
  margin-bottom: 12px;
}

.readback-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.readback-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(103, 163, 255, 0.12);
  color: var(--cyan);
}

.readback-pill.ok {
  color: var(--mint);
}

.readback-pill.warn {
  color: var(--amber);
}

.audit-panel {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.audit-item {
  padding: 14px;
}

.audit-item-match {
  border-color: rgba(125, 226, 255, 0.34);
  background: linear-gradient(135deg, rgba(103, 163, 255, 0.14), rgba(125, 226, 255, 0.08));
}

.audit-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.audit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.audit-method {
  color: var(--mint);
  font-weight: 700;
}

.audit-url {
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.usage-table-wrap {
  min-height: 560px;
  max-height: 760px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #04101f;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.usage-table th,
.usage-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.usage-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.03);
}

.usage-table tbody tr + tr td {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.usage-row-highlight td {
  background: rgba(125, 226, 255, 0.08);
}

.usage-secondary {
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-table {
  color: var(--muted);
}

.pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(103, 163, 255, 0.12);
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 0;
}

.pill-ok,
.status-ok {
  color: var(--mint);
}

.pill-running {
  color: var(--amber);
}

.pill-warn,
.status-warn {
  color: var(--amber);
}

.status-error {
  color: var(--danger);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-primary {
  color: #04111f;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}

.btn-secondary,
.btn-ghost {
  color: var(--text);
  background: rgba(103, 163, 255, 0.12);
  border: 1px solid rgba(103, 163, 255, 0.16);
}

.status-banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  line-height: 1.55;
}

.status-banner-running {
  color: var(--cyan);
  border-color: rgba(125, 226, 255, 0.2);
}

.status-banner-success {
  color: var(--mint);
  border-color: rgba(137, 245, 209, 0.16);
}

.status-banner-warn {
  color: var(--amber);
  border-color: rgba(255, 204, 122, 0.16);
}

.status-banner-error {
  color: var(--danger);
  border-color: rgba(255, 143, 143, 0.16);
}

@media (max-width: 1220px) {
  .playground-shell,
  .topbar,
  .service-sidebar,
  .request-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .shell {
    width: calc(100vw - 20px);
    padding-top: 12px;
  }

  .summary-strip,
  .provider-tabs,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .provider-summary-row {
    display: grid;
    gap: 6px;
  }

  .provider-summary-value {
    text-align: left;
  }

  .topbar,
  .service-sidebar,
  .request-panel,
  .response-panel,
  .request-card,
  .response-card {
    border-radius: 20px;
  }

  h1 {
    font-size: 2rem;
  }
}
