:root {
  --ink: #102126;
  --ink-soft: #48646b;
  --navy: #082835;
  --navy-deep: #041820;
  --teal: #00a7a0;
  --teal-dark: #087a76;
  --mint: #d9f7ef;
  --paper: #ffffff;
  --panel: #f5f8f8;
  --line: #d8e3e3;
  --amber-bg: #fff2cc;
  --amber-text: #8c6600;
  --green: #188553;
  --code: #071f27;
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 0 24px 70px rgba(6, 32, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(217, 247, 239, 0.34), rgba(255, 255, 255, 0) 24rem),
    #eef5f4;
  font-family: var(--font-sans);
  line-height: 1.5;
}

a {
  color: inherit;
}

.sandbox-shell {
  min-height: 100vh;
}

.sandbox-header,
.brand,
.site-nav,
.header-signin,
.console-hero,
.environment-badge,
.endpoint-button,
.endpoint-url-block,
.panel-heading,
.response-heading,
.method-pill,
.status-pill,
.send-button,
.field-label-row {
  display: flex;
  align-items: center;
}

.sandbox-header {
  position: sticky;
  top: 0;
  z-index: 20;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 72px;
  padding: 0 5vw;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(216, 227, 227, 0.9);
  backdrop-filter: blur(14px);
}

.brand {
  flex: none;
  gap: 0.65rem;
  min-width: max-content;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--paper);
  background: var(--navy);
  border: 2px solid rgba(0, 167, 160, 0.32);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(8, 40, 53, 0.16);
}

.site-nav {
  justify-content: center;
  gap: clamp(1rem, 3vw, 2.4rem);
  color: var(--ink-soft);
  font-size: 0.94rem;
  font-weight: 600;
}

.site-nav a,
.header-signin {
  text-decoration: none;
}

.site-nav a:hover,
.header-signin:hover {
  color: var(--teal-dark);
}

.header-signin {
  flex: none;
  min-height: 2.5rem;
  padding: 0.66rem 1.05rem;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.94rem;
  font-weight: 700;
  background: var(--paper);
}

.sandbox-main {
  padding: clamp(2rem, 4vw, 3.5rem) 5vw clamp(3rem, 5vw, 4.5rem);
}

.console-hero {
  justify-content: space-between;
  gap: 2rem;
  max-width: 92rem;
  margin: 0 auto 1.5rem;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(4, 24, 32, 0.98), rgba(8, 40, 53, 0.98) 56%, rgba(8, 122, 118, 0.9)),
    var(--navy);
  border: 1px solid rgba(217, 247, 239, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.console-hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3.45rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.console-hero p:last-child {
  max-width: 50rem;
  margin: 0.85rem 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1rem;
}

.environment-badge {
  flex: none;
  gap: 0.45rem;
  padding: 0.62rem 0.8rem;
  color: var(--amber-text);
  background: var(--amber-bg);
  border: 1px solid rgba(140, 102, 0, 0.18);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.console-frame {
  display: grid;
  grid-template-columns: minmax(15rem, 17.5rem) minmax(24rem, 1fr) minmax(24rem, 27rem);
  max-width: 92rem;
  min-height: 38rem;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.endpoint-panel,
.request-panel,
.response-panel {
  min-width: 0;
}

.endpoint-panel,
.request-panel {
  border-right: 1px solid var(--line);
}

.endpoint-panel {
  background: #fbfdfd;
}

.panel-title {
  padding: 1rem 1rem 0.3rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-subtitle {
  margin: 0;
  padding: 0 1rem 0.7rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.4;
}

.endpoint-group + .endpoint-group {
  border-top: 1px solid var(--line);
}

.endpoint-group.is-submit .panel-title {
  color: var(--amber-text);
}

.amc-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 1rem 0.85rem;
  padding: 0.6rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.amc-session-status {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.amc-session-status.is-authenticated {
  color: var(--green);
}

.amc-auth-button {
  flex: none;
  padding: 0.4rem 0.65rem;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.amc-auth-button:hover {
  background: #f5f8f8;
}

.amc-auth-button.is-authenticated {
  color: var(--green);
  border-color: rgba(24, 133, 83, 0.32);
}

.endpoint-list {
  display: grid;
  gap: 0.45rem;
  padding: 0 0.75rem 1.1rem;
}

.endpoint-button {
  width: 100%;
  gap: 0.6rem;
  min-height: 3.2rem;
  padding: 0.68rem 0.75rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.endpoint-button:hover {
  background: #eff8f7;
  border-color: #d2ece9;
}

.endpoint-button.is-active {
  background: var(--mint);
  border-color: rgba(0, 167, 160, 0.34);
  box-shadow: 0 10px 24px rgba(0, 167, 160, 0.12);
}

.endpoint-button code {
  min-width: 0;
  overflow: hidden;
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method-pill,
.status-pill {
  flex: none;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.method-pill {
  padding: 0.28rem 0.5rem;
  color: #005b54;
  background: var(--mint);
}

.method-pill.is-post {
  color: var(--amber-text);
  background: var(--amber-bg);
}

.panel-heading-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audience-pill {
  flex: none;
  padding: 0.28rem 0.55rem;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.audience-pill.is-submit {
  color: var(--amber-text);
  background: var(--amber-bg);
  border-color: rgba(140, 102, 0, 0.18);
}

.request-panel {
  padding: clamp(1.1rem, 2vw, 1.5rem);
}

.panel-heading,
.response-heading {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-kicker {
  display: block;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-heading h2,
.response-heading h2,
.form-heading h3 {
  margin: 0.12rem 0 0;
  color: var(--navy);
  line-height: 1.2;
}

.panel-heading h2,
.response-heading h2 {
  font-size: 1.25rem;
}

.request-method {
  padding: 0.38rem 0.62rem;
  color: var(--paper);
  background: var(--navy);
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 800;
}

.endpoint-url-block {
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.endpoint-url-block code {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.35rem;
}

.form-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.form-heading h3 {
  font-size: 1rem;
}

.form-heading span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.parameter-fields {
  display: grid;
  gap: 0.85rem;
}

.field-group {
  display: grid;
  gap: 0.42rem;
}

.field-label-row {
  justify-content: space-between;
  gap: 0.75rem;
}

.field-label-row code {
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 800;
}

.field-label-row span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.field-group input,
.field-group select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.72rem 0.8rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}

.field-group select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal-dark) 50%),
    linear-gradient(135deg, var(--teal-dark) 50%, transparent 50%);
  background-position:
    calc(100% - 1.05rem) 1.18rem,
    calc(100% - 0.72rem) 1.18rem;
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
}

.field-group input:focus,
.field-group select:focus {
  outline: 3px solid rgba(0, 167, 160, 0.16);
  border-color: var(--teal);
}

.send-button {
  justify-content: center;
  gap: 0.55rem;
  width: max-content;
  min-height: 3rem;
  padding: 0.83rem 1.1rem;
  color: var(--paper);
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 4px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.send-button:hover {
  background: #0d3a4c;
  transform: translateY(-1px);
}

.send-button:disabled {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.auth-hint {
  margin: -0.4rem 0 0;
  color: var(--amber-text);
  font-size: 0.8rem;
  font-weight: 700;
}

.response-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(1.1rem, 2vw, 1.5rem);
  background: #f2f6f6;
}

.status-pill {
  padding: 0.3rem 0.58rem;
  color: #bcf7d7;
  background: rgba(24, 133, 83, 0.18);
}

.response-panel pre {
  flex: 1;
  min-height: 28rem;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  color: #dcf7f1;
  background: var(--code);
  border: 1px solid #132e35;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.58;
  white-space: pre;
}

@media (max-width: 1180px) {
  .console-frame {
    grid-template-columns: minmax(14rem, 16rem) minmax(0, 1fr);
  }

  .response-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .response-panel pre {
    min-height: 20rem;
  }
}

@media (max-width: 760px) {
  .sandbox-header {
    position: static;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem 1.25rem;
  }

  .site-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.86rem;
  }

  .sandbox-main {
    padding: 1.25rem;
  }

  .console-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .environment-badge {
    white-space: normal;
  }

  .console-frame {
    display: block;
    min-height: 0;
  }

  .endpoint-panel,
  .request-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .endpoint-list {
    grid-template-columns: 1fr;
  }

  .form-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .send-button {
    width: 100%;
  }
}
