:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #155eef;
  --primary-dark: #0f47bc;
  --success: #027a48;
  --warning: #b54708;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(21, 94, 239, 0.18), transparent 32rem),
    linear-gradient(135deg, #eef4ff 0%, var(--bg) 48%, #f8fbff 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero__content,
.search-card,
.state-card,
.results {
  border: 1px solid rgba(226, 232, 240, 0.86);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero__content {
  position: relative;
  overflow: hidden;
  padding: 42px;
  border-radius: var(--radius-lg);
}

.hero__content::after {
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: rgba(21, 94, 239, 0.12);
  content: "";
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  letter-spacing: -0.04em;
}

.hero p,
.state-card p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.search-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  border-radius: var(--radius-lg);
}

.search-card label {
  margin-bottom: 10px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.14);
}

.search-card button,
.secondary-button {
  min-height: 54px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.search-card button {
  position: relative;
  min-width: 132px;
  padding: 0 22px;
  background: var(--primary);
  color: #fff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.search-card button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.search-card button:disabled {
  cursor: not-allowed;
  opacity: 0.76;
  transform: none;
}

.button-loader {
  display: none;
  width: 18px;
  height: 18px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.is-loading .button-text {
  display: none;
}

.is-loading .button-loader {
  display: block;
}

.search-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.error-message {
  min-height: 20px;
  color: var(--danger) !important;
  font-weight: 700;
}

.state-card {
  display: none;
  padding: 44px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.state-card.is-visible {
  display: block;
}

.state-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 18px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 1.7rem;
  font-weight: 900;
}

.results {
  padding: 28px;
  border-radius: var(--radius-lg);
}

.results-header,
.section-heading {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.counter-card {
  min-width: 150px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-soft);
  text-align: right;
}

.counter-card span {
  display: block;
  color: var(--primary);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.counter-card small {
  color: var(--muted);
  font-weight: 700;
}

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

.summary-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.summary-card--wide {
  grid-column: span 2;
}

.summary-card span,
.field-key {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-card strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: #f1f5f9;
}

.status-pill.is-active {
  background: #ecfdf3;
  color: var(--success);
}

.status-pill.is-warning {
  background: #fffaeb;
  color: var(--warning);
}

.status-pill.is-danger {
  background: #fef3f2;
  color: var(--danger);
}

.details-section {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.secondary-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.secondary-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.raw-json {
  max-height: 520px;
  margin: 0 0 18px;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #dbeafe;
  font-size: 0.88rem;
  line-height: 1.55;
}

.dynamic-data {
  display: grid;
  gap: 10px;
}

.data-node {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.data-node summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.data-node summary::-webkit-details-marker {
  display: none;
}

.data-node summary::after {
  color: var(--primary);
  content: "+";
  font-size: 1.1rem;
  font-weight: 900;
}

.data-node[open] > summary::after {
  content: "-";
}

.node-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.node-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.node-body > .data-node {
  grid-column: 1 / -1;
  box-shadow: none;
}

.field-row {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: var(--card-soft);
}

.field-key {
  margin-bottom: 0;
  font-size: 0.7rem;
  line-height: 1.25;
}

.field-value {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 650;
  line-height: 1.35;
  font-size: 0.92rem;
}

.field-value.is-empty {
  color: var(--muted);
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100% - 40px));
  padding: 14px 16px;
  border-radius: 14px;
  background: #101828;
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .hero__content,
  .search-card,
  .state-card,
  .results {
    padding: 22px;
    border-radius: 22px;
  }

  .input-row,
  .results-header,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .results-header,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-card--wide {
    grid-column: auto;
  }

  .counter-card,
  .actions {
    justify-content: stretch;
    text-align: left;
  }

  .actions,
  .actions button {
    width: 100%;
  }
}
