:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e6ebf2;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --accent: #7c3aed;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 22px 48px rgba(15, 23, 42, 0.16), 0 8px 18px rgba(37, 99, 235, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

button, input, a {
  font: inherit;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 14px;
  color: #0f172a;
}

.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;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(245, 247, 251, 0.88);
  border-bottom: 1px solid rgba(230, 235, 242, 0.9);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}

.brand__name {
  font-size: 20px;
}

.brand__sub {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__link {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
}

.topbar__link:hover,
.topbar__link.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.topbar__user {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.topbar__logout-form {
  margin: 0;
}

.topbar__logout {
  min-height: 38px;
  padding: 0 14px;
}

.section,
.hero {
  padding: 32px 0 40px;
}

.section--compact {
  padding-top: 28px;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero__content,
.profile-card,
.search-panel,
.empty-state,
.detail-hero,
.detail-card {
  padding: 28px;
}

.hero__badge,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 13px;
  font-weight: 600;
}

.hero__title,
.section__title {
  margin: 14px 0 10px;
  line-height: 1.2;
}

.hero__title {
  font-size: clamp(32px, 5vw, 44px);
}

.hero__desc,
.profile-card__body p,
.api-card__desc,
.empty-state p,
.detail-hero__desc {
  margin: 0;
  color: var(--muted);
}

.hero__actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--primary {
  color: #fff;
  background: var(--primary);
}

.btn--primary:hover {
  background: #1d4ed8;
}

.btn--ghost {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.search-form {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.search-form__input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 0 16px;
  outline: none;
}

.search-form__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-form__button {
  min-width: 110px;
}

.hint-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hint-text span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  margin: 4px 6px 0 0;
}

.profile-card {
  display: flex;
  gap: 18px;
  align-items: center;
}

.profile-card__avatar-wrap {
  flex: 0 0 auto;
}

.profile-card__avatar {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  object-fit: cover;
  background: #e5e7eb;
}

.profile-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.metric-list div {
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
}

.metric-list dt {
  color: var(--muted);
  font-size: 12px;
}

.metric-list dd {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section__header--detail {
  align-items: flex-start;
}

.section__link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.api-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.api-grid--search {
  margin-top: 20px;
}

.api-grid--layer {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.api-layer-stack {
  display: grid;
  gap: 22px;
}

.api-layer {
  padding: 24px;
}

.api-layer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.api-layer__head h3 {
  margin: 0;
  font-size: 24px;
}

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

.api-card {
  padding: 22px;
  position: relative;
  display: block;
  min-height: 100%;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.api-card--clickable:hover,
.api-card--clickable:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: var(--shadow-strong);
  outline: none;
}

.api-card--clickable::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.api-card--flat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.fun-api-card {
  display: flex;
  flex-direction: column;
}

.fun-api-card__preview {
  width: 100%;
  margin-top: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f8fafc;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.fun-api-card__sample {
  margin-top: 16px;
}

.image-gallery-card {
  margin-top: 18px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.image-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.image-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #fff;
}

.image-item p,
.image-item code {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.inline-input {
  width: 96px;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: #f8fafc;
}

.api-card__head,
.api-card__foot,
.api-card__search-meta,
.detail-hero__meta,
.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.api-card__id,
.api-card__path,
.detail-hero__path,
.search-panel__meta span {
  color: var(--muted);
  font-size: 13px;
}

.api-card__title {
  margin: 14px 0 10px;
  font-size: 20px;
}

.api-card__foot {
  margin-top: 18px;
}

.api-card__link,
.detail-nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-tag--active {
  background: var(--success-soft);
  color: var(--success);
}

.status-tag--unstable {
  background: #fff7ed;
  color: #c2410c;
}

.status-tag--blocked {
  background: #fef2f2;
  color: #b91c1c;
}

.status-tag--migrated {
  background: #ecfdf5;
  color: #047857;
}

.status-tag--pending {
  background: #eff6ff;
  color: #1d4ed8;
}

.search-panel__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.detail-layout {
  display: grid;
  gap: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.detail-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.detail-card pre {
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
}

.detail-card--accent {
  border-color: rgba(124, 58, 237, 0.2);
}

.detail-card--accent pre {
  background: #faf5ff;
}

.detail-card--raw pre {
  background: #0f172a;
  color: #e2e8f0;
}

.detail-card--preview {
  grid-column: 1 / -1;
}

.api-preview-image {
  width: min(760px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #f8fafc;
  box-shadow: var(--shadow-strong);
}

.api-preview-image--inline {
  display: block;
  overflow: hidden;
  padding: 0;
}

.api-preview-image--inline svg {
  display: block;
  width: 100%;
  height: auto;
}

.flash-stack {
  display: grid;
  gap: 10px;
  padding-top: 18px;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.flash--success {
  border-color: rgba(22, 163, 74, 0.2);
  background: #f0fdf4;
  color: #166534;
}

.flash--error {
  border-color: rgba(185, 28, 28, 0.2);
  background: #fef2f2;
  color: #991b1b;
}

.flash--info {
  border-color: rgba(37, 99, 235, 0.18);
  background: #eff6ff;
  color: #1d4ed8;
}

.login-shell {
  width: min(720px, 100%);
}

.login-card {
  padding: 28px;
}

.login-card__desc {
  margin: 0;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  padding: 22px;
  display: grid;
  gap: 8px;
}

.metric-card__label,
.helper-text,
.list-compact li p {
  color: var(--muted);
}

.metric-card__value {
  font-size: 32px;
  line-height: 1;
}

.metric-card__hint {
  font-size: 13px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.form-field span {
  font-size: 14px;
  font-weight: 600;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  margin: 10px 0;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.email-submit-card {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-select {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 0 16px;
  outline: none;
  font: inherit;
  color: var(--text);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(160px, 0.8fr)) auto;
  gap: 14px;
  align-items: end;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.helper-box {
  margin-top: 22px;
  padding: 18px;
  border-radius: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.helper-box h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.helper-box p {
  margin: 0;
}

.helper-box p + p {
  margin-top: 8px;
}

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

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

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}

.data-table code,
.helper-box code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
}

.data-table__link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.data-table__link:hover {
  color: var(--primary);
}

.list-compact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.list-compact li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
}

.list-compact li strong,
.list-compact li p {
  display: block;
}

.list-compact li p {
  margin: 6px 0 0;
}

.list-compact li a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
}

.footer__meta p {
  margin: 0;
}

.footer__sub {
  color: var(--muted);
  font-size: 14px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__links a {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 960px) {
  .hero__grid,
  .api-grid,
  .detail-grid,
  .admin-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    align-items: flex-start;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar__inner,
  .section__header,
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-form,
  .hero__actions,
  .detail-actions {
    flex-direction: column;
  }

  .topbar__auth {
    width: 100%;
    justify-content: space-between;
  }

  .search-form__button,
  .btn {
    width: 100%;
  }

  .metric-list {
    grid-template-columns: 1fr;
  }

  .hero__content,
  .profile-card,
  .search-panel,
  .empty-state,
  .detail-hero,
  .detail-card,
  .login-card,
  .metric-card {
    padding: 20px;
  }

  .list-compact li {
    flex-direction: column;
  }
}
