:root {
  --bg: #f3efe6;
  --surface: rgba(255, 252, 247, 0.88);
  --surface-strong: #fffdf8;
  --border: rgba(30, 60, 67, 0.12);
  --text: #162127;
  --muted: #57656d;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.14);
  --shadow: 0 24px 60px rgba(22, 33, 39, 0.08);
  --code-bg: #0d1b1e;
  --code-text: #e8f2ef;
  --doc-card-width: 440px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.13) 0%, rgba(15, 118, 110, 0) 34%),
    linear-gradient(225deg, rgba(190, 146, 70, 0.11) 0%, rgba(190, 146, 70, 0) 32%),
    linear-gradient(180deg, #f8fbf8 0%, #eef4f1 48%, #f4efe6 100%);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  overflow-x: hidden;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 32px auto 48px;
}

.hero,
.card {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 380px);
  gap: 24px;
  padding: clamp(20px, 3vw, 30px);
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.lead {
  margin: 16px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.9;
}

.hero-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(15, 118, 110, 0.1);
  min-width: 0;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.94rem;
  color: var(--muted);
}

.api-key-help {
  display: grid;
  gap: 12px;
}

.meta-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.api-key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.api-key-actions button {
  flex: 0 1 220px;
  min-height: 56px;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.helper-text a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.helper-text a:hover {
  text-decoration: underline;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
}

select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-left: 48px;
  padding-right: 16px;
  direction: rtl;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  background-size: 18px 18px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  direction: ltr;
  text-align: left;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.35);
}

.meta-box {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.09), rgba(190, 146, 70, 0.11));
}

.meta-box span {
  color: var(--muted);
  font-size: 0.9rem;
}

.meta-box code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.docs-sections {
  display: grid;
  gap: 30px;
  margin-top: 26px;
}

.docs-section {
  min-width: 0;
}

.docs-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 0 4px;
  min-width: 0;
}

.docs-section-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.15rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.docs-section-text {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--doc-card-width)), var(--doc-card-width)));
  justify-content: start;
  gap: 18px;
  margin-top: 0;
  min-width: 0;
}

.card {
  display: grid;
  align-content: start;
  padding: clamp(18px, 2.4vw, 22px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

.endpoint-title-wrap {
  min-width: 0;
  flex: 1 1 260px;
  text-align: right;
}

.card-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.16em;
}

.endpoint-url-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  direction: ltr;
  width: 100%;
  min-width: 0;
}

.card h2,
.endpoint-path {
  margin: 0;
  font-size: clamp(0.78rem, 1vw, 0.96rem);
  line-height: 1.45;
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
  flex: 0 1 auto;
  max-width: calc(100% - 38px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
}

.endpoint-copy-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: none;
  direction: ltr;
  flex: 0 0 auto;
}

.endpoint-copy-button svg {
  width: 16px;
  height: 16px;
  grid-area: 1 / 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.endpoint-copy-button .copy-check-icon {
  opacity: 0;
  transform: scale(0.85);
}

.endpoint-copy-button.is-copied {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.endpoint-copy-button.is-copied .copy-icon {
  opacity: 0;
  transform: scale(0.85);
}

.endpoint-copy-button.is-copied .copy-check-icon {
  opacity: 1;
  transform: scale(1);
}

.endpoint-copy-button.is-error {
  color: #9f1239;
  border-color: rgba(159, 18, 57, 0.24);
  background: rgba(159, 18, 57, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.card-text {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.inline-field {
  margin-top: 18px;
}

.endpoint-fields,
.transaction-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.wide-field,
.transaction-fields .field:nth-child(3) {
  grid-column: 1 / -1;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
}

.check-field input {
  width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

.section-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.code-block + .section-title {
  margin-top: 24px;
}

.live-title {
  margin-top: 24px;
}

.section-head {
  margin-top: 16px;
  margin-bottom: 8px;
}

.code-block {
  margin: 0;
  min-height: 88px;
  max-width: 100%;
  padding: 14px;
  overflow: auto;
  border-radius: 20px;
  background: var(--code-bg);
  color: var(--code-text);
  line-height: 1.75;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-size: clamp(0.84rem, 1.6vw, 0.95rem);
}

.result-block {
  min-height: 180px;
}

.actions {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.search-actions {
  margin-top: 10px;
}

button {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f766e, #14532d);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 16px 32px rgba(15, 118, 110, 0.22);
}

button[hidden] {
  display: none !important;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.secondary-button {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.copy-button {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.link-button:hover {
  transform: translateY(-1px);
}

@media (max-width: 1180px) {
  .page-shell {
    width: min(100% - 24px, 100%);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .docs-section-head {
    align-items: stretch;
  }

  .api-key-actions {
    flex-direction: column;
  }

  .meta-head,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions button,
  .api-key-actions button {
    flex: 0 0 auto;
    width: 100%;
  }

  .endpoint-fields,
  .transaction-fields {
    grid-template-columns: 1fr;
  }

  .wide-field,
  .transaction-fields .field:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin-top: 20px;
    margin-bottom: 24px;
  }

  .hero,
  .card {
    border-radius: 22px;
    padding: 20px;
  }

  .card-head {
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .endpoint-title-wrap {
    flex: 1 1 220px;
  }

  .hero-panel,
  .meta-box {
    padding: 16px;
  }

  .badge {
    width: auto;
    max-width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  body {
    background:
      linear-gradient(145deg, rgba(15, 118, 110, 0.12) 0%, rgba(15, 118, 110, 0) 42%),
      linear-gradient(180deg, #f8fbf8 0%, #eef4f1 52%, #f4efe6 100%);
  }

  .page-shell {
    width: calc(100% - 16px);
    margin-top: 16px;
    margin-bottom: 18px;
  }

  .hero,
  .card {
    border-radius: 18px;
    padding: 16px;
  }

  .card-head {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .endpoint-title-wrap {
    flex: 0 1 auto;
  }

  .badge {
    align-self: flex-start;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head .copy-button {
    width: 100%;
  }

  input,
  button,
  .code-block {
    border-radius: 14px;
  }
}
