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

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 28%),
    radial-gradient(circle at top left, rgba(190, 146, 70, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f4ea 0%, #f1ece2 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: 1 1 180px;
}

.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 {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
}

input: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;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
  margin-top: 24px;
  min-width: 0;
}

.card {
  padding: clamp(20px, 2.6vw, 24px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

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

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

.card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.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: 16px 0 0;
  color: var(--muted);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

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

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

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

.code-block {
  margin: 0;
  min-height: 92px;
  max-width: 100%;
  padding: 16px;
  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-wrap;
  word-break: break-word;
  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: 12px;
}

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

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

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

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

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

  .copy-button,
  .actions button,
  .api-key-actions button {
    width: 100%;
  }
}

@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 {
    flex-direction: column;
    align-items: stretch;
  }

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

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

@media (max-width: 480px) {
  body {
    background:
      radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 30%),
      linear-gradient(180deg, #f8f4ea 0%, #f1ece2 100%);
  }

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

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

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