:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f5f9;
  color: #182033;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #8fb5ff;
  outline-offset: 2px;
}

#demo-app {
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(26rem, 1fr) minmax(20rem, 27rem);
  grid-template-areas:
    "header header header"
    "navigation request response";
  gap: 1rem;
  width: min(100%, 112rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem;
}

.panel,
.feature-card {
  min-width: 0;
  border: 1px solid #dce2ee;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 .5rem 1.5rem rgb(27 40 72 / 7%);
}

.panel {
  padding: 1rem;
}

.app-header {
  grid-area: header;
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) auto minmax(24rem, 1.3fr);
  align-items: start;
  gap: 1rem;
}

.endpoint-nav {
  grid-area: navigation;
}

.request-panel {
  grid-area: request;
}

.response-panel {
  grid-area: response;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  margin-bottom: .35rem;
  line-height: 1.2;
}

.eyebrow {
  margin-bottom: .25rem;
  color: #52617d;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.muted {
  color: #66728a;
}

.warning-text {
  margin-bottom: .5rem;
  color: #8d4d00;
  font-size: .85rem;
}

.badge-row,
.key-input-row,
.inline-controls,
.request-actions,
.history-actions,
.response-heading-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.badge-row {
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  background: #edf2ff;
  color: #234a97;
  font-size: .8rem;
  font-weight: 700;
}

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  border: 1px solid #cbd3e2;
  border-radius: 999px;
  padding: .2rem .65rem;
  background: #fff;
  color: #234a97;
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
}

.header-link:hover {
  background: #edf2ff;
}

.key-console {
  min-width: 0;
}

.key-input-row input {
  flex: 1;
  min-width: 8rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd3e2;
  border-radius: .55rem;
  padding: .65rem .75rem;
  background: #fff;
  color: inherit;
}

textarea {
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .88rem;
}

button {
  min-height: 2.35rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  padding: .5rem .8rem;
  background: #eef2fa;
  color: #26344f;
  font-weight: 700;
}

.button-primary {
  background: #315fdb;
  color: #fff;
}

.button-secondary {
  border-color: #cbd3e2;
  background: #fff;
}

.button-danger {
  border-color: #f0bdc2;
  background: #fff4f5;
  color: #a21d2d;
}

details {
  margin-top: .75rem;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.specialized-key-grid,
.form-grid {
  display: grid;
  gap: .75rem;
  margin-top: .75rem;
}

.field-help {
  margin: .35rem 0 0;
  font-size: .82rem;
}

.checkbox-group-field {
  display: grid;
  gap: .85rem;
}

.checkbox-option-group {
  margin: 0;
  border: 1px solid #dce2ee;
  border-radius: .75rem;
  padding: .75rem;
}

.checkbox-option-group legend {
  padding: 0 .35rem;
  color: #52617d;
  font-size: .86rem;
  font-weight: 700;
}

.checkbox-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .45rem .75rem;
}

.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  min-width: 0;
  border: 1px solid #edf1f7;
  border-radius: .55rem;
  padding: .45rem .55rem;
  background: #fff;
  font-size: .86rem;
  line-height: 1.35;
}

.checkbox-option input {
  width: auto;
  margin-top: .15rem;
}

.selected-options-summary {
  margin-top: .65rem;
  border: 1px dashed #cbd3e2;
  border-radius: .65rem;
  padding: .65rem;
  background: #f8fafd;
  font-size: .86rem;
}

.selected-option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
}

.selected-option-pill {
  border-radius: 999px;
  padding: .25rem .55rem;
  background: #eaf0ff;
  color: #173f99;
  font-size: .78rem;
}

.checkbox-empty-message {
  margin: 0;
  border: 1px dashed #cbd3e2;
  border-radius: .65rem;
  padding: .65rem;
  background: #f8fafd;
}

.identity-preview {
  margin-top: .65rem;
  border: 1px solid #dce2ee;
  border-radius: .75rem;
  padding: .75rem;
  background: #f8fafd;
  color: #52617d;
  font-size: .86rem;
}

.identity-preview-title {
  margin: 0 0 .6rem;
  color: #1f2b45;
  font-weight: 700;
}

.identity-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: .55rem;
}

.identity-preview-card {
  display: grid;
  gap: .4rem;
  margin: 0;
  border: 1px solid #edf1f7;
  border-radius: .65rem;
  padding: .5rem;
  background: #fff;
}

.identity-preview-card strong {
  font-size: .8rem;
  color: #52617d;
}

.identity-preview-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: .5rem;
  object-fit: cover;
  background: #edf1f7;
}

.endpoint-groups {
  display: grid;
  gap: 1rem;
}

.endpoint-group h3 {
  margin-bottom: .45rem;
  color: #52617d;
  font-size: .82rem;
  text-transform: uppercase;
}

.endpoint-list {
  display: grid;
  gap: .35rem;
}

.endpoint-button {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: .45rem;
  width: 100%;
  border-color: transparent;
  text-align: left;
}

.endpoint-button[aria-current="true"] {
  border-color: #8fb5ff;
  background: #eaf0ff;
  color: #173f99;
}

.endpoint-method {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .72rem;
}

.endpoint-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.endpoint-path {
  margin-bottom: .25rem;
  color: #315fdb;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .85rem;
  font-weight: 700;
}

.tab-list {
  display: flex;
  gap: .25rem;
  margin: 1rem 0;
  border-bottom: 1px solid #dce2ee;
}

.tab-list button[aria-selected="true"] {
  border-bottom-color: #315fdb;
  background: #edf2ff;
  color: #234a97;
}

.validation-message,
.guidance {
  min-height: 1.5rem;
  margin: .5rem 0;
  color: #a21d2d;
}

.badge[data-tone="error"],
#response-status[data-tone="error"] {
  background: #fff0f1;
  color: #a21d2d;
}

.badge[data-tone="success"],
#response-status[data-tone="success"] {
  background: #eaf8ef;
  color: #166534;
}

#response-status[data-tone="notice"] {
  background: #fff7df;
  color: #8d4d00;
}

.feature-card {
  margin-top: 1rem;
  padding: 1rem;
  box-shadow: none;
}

.avatar-source-frame {
  display: grid;
  place-items: center;
  min-height: 12rem;
  overflow: hidden;
  border: 1px dashed #b7c2d6;
  border-radius: .75rem;
  background: #f8faff;
}

.avatar-source-frame img {
  max-width: 100%;
  max-height: 22rem;
  object-fit: contain;
}

.inline-controls {
  margin-top: .75rem;
}

.inline-controls label {
  white-space: nowrap;
}

.avatar-results,
.diary-image-library-results,
.summary-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.diary-image-library-results {
  white-space: normal;
}

.diary-image-library-card img {
  max-height: 14rem;
}

.result-card {
  min-height: 8rem;
  padding: .75rem;
  border: 1px solid #dce2ee;
  border-radius: .75rem;
  background: #fbfcff;
}

.result-card img,
.result-card video {
  display: block;
  width: 100%;
  max-height: 18rem;
  border-radius: .6rem;
  object-fit: contain;
  background: #eef2f8;
}

.result-actions-full {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.pose-status,
.cost-notice {
  color: #52617d;
  font-size: .85rem;
}

.cost-notice[data-tone="warning"] {
  color: #8d4d00;
}

.cost-notice[data-tone="success"] {
  color: #166534;
}

.summary-card {
  display: grid;
  gap: .25rem;
  padding: .75rem;
  border: 1px solid #dce2ee;
  border-radius: .75rem;
  background: #f8faff;
}

.summary-label {
  color: #66728a;
  font-size: .78rem;
}

.summary-value {
  font-size: 1.2rem;
}

.request-actions {
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e4e8f0;
}

.response-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin: 1rem 0;
}

.response-meta div {
  min-width: 0;
  padding: .65rem;
  border-radius: .6rem;
  background: #f5f7fb;
}

.response-meta dt {
  color: #66728a;
  font-size: .75rem;
}

.response-meta dd {
  overflow: hidden;
  margin: .2rem 0 0;
  font-weight: 700;
  text-overflow: ellipsis;
}

#response-output {
  min-height: 18rem;
  max-height: 36rem;
  overflow: auto;
  padding: 1rem;
  border-radius: .75rem;
  background: #101827;
  color: #dce7ff;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-drawer {
  padding-top: 1rem;
  border-top: 1px solid #e4e8f0;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-top: .75rem;
}

.checkbox-row input {
  width: auto;
  margin-top: .3rem;
}

.history-list {
  padding-left: 1.25rem;
}

.history-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .5rem;
  margin: .5rem 0;
}

.history-record-meta {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #52617d;
  font-size: .85rem;
}

.history-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  min-width: 0;
}

.history-record-actions button {
  flex: 1 1 5.25rem;
  min-width: 0;
  padding-right: .55rem;
  padding-left: .55rem;
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: .55rem;
  border-bottom: 1px solid #e4e8f0;
  text-align: left;
  white-space: nowrap;
}

.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;
}

[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  #demo-app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "navigation"
      "request"
      "response";
  }

  .app-header {
    grid-template-columns: 1fr;
  }

  .endpoint-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #demo-app {
    padding: .5rem;
  }

  .key-input-row,
  .inline-controls,
  .request-actions,
  .history-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .avatar-results,
  .summary-cards,
  .response-meta,
  .endpoint-groups {
    grid-template-columns: 1fr;
  }
}
