*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f3f6fb;
  line-height: 1.6;
}

a,
button {
  color: inherit;
}

code,
pre {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid #dbe3ee;
  background: #ffffff;
}

.brand-wrap,
.topbar-actions {
  display: flex;
  align-items: center;
}

.brand {
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.topbar-link {
  text-decoration: none;
  color: #2563eb;
}

.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 240px;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}

.page-layout > * {
  min-width: 0;
}

.sidebar,
.content,
.rightbar-card {
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
}

.sidebar,
.rightbar {
  align-self: start;
  position: sticky;
  top: 24px;
}

.sidebar {
  padding: 20px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-nav a {
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #4b5563;
  transition: background-color 160ms ease, color 160ms ease;
}

.sidebar-nav a:hover {
  background: #eef4ff;
  color: #1d4ed8;
}

.sidebar-nav a:focus-visible,
.copy-button:focus-visible,
.quick-action:focus-visible,
.topbar-link:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.sidebar-nav a.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.content {
  padding: 32px;
}

.content-section + .content-section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid #e5ebf3;
}

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

.notice-card,
.surface-card,
.code-card,
.code-sample {
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #f9fbff;
}

.notice-card,
.surface-card {
  padding: 18px 20px;
}

.notice-card strong,
.surface-card h3 {
  display: block;
  margin-bottom: 8px;
}

.step-list,
.info-list,
.error-list {
  margin: 0;
  padding-left: 20px;
}

.muted-text {
  color: #6b7280;
}

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

.code-card,
.code-sample {
  overflow: hidden;
}

.code-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #dbe3ee;
  background: #eef4ff;
  font-size: 0.95rem;
  font-weight: 600;
}

.code-card code,
.code-sample pre {
  display: block;
  margin: 0;
  padding: 18px 16px;
  font-size: 0.95rem;
  overflow-x: auto;
}

.copy-button,
.quick-action {
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.copy-button {
  padding: 8px 14px;
}

.copy-button:hover,
.quick-action:hover {
  transform: translateY(-1px);
  background: #1d4ed8;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.copy-button.is-copied {
  background: #0f766e;
}

.copy-button.is-error {
  background: #b91c1c;
}

.rightbar {
  display: grid;
  gap: 16px;
}

.rightbar-card {
  padding: 20px;
}

.rightbar-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1rem;
}

.quick-action-list {
  display: grid;
  gap: 10px;
}

.quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

.error-list li + li,
.info-list li + li,
.step-list li + li {
  margin-top: 8px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 8px 24px 32px;
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .rightbar {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .page-layout,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .two-column-grid {
    grid-template-columns: 1fr;
  }

  .code-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-card code,
  .code-sample pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
