:root {
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent: #6366f1;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --container: 1120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-strong);
}

.container {
  width: min(var(--container), calc(100% - 2rem));
  margin: 0 auto;
}

.main-content {
  padding: 2.5rem 0 4rem;
}

.hero {
  padding: 2.5rem;
  background: radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.12), transparent 40%), linear-gradient(120deg, #eef2ff 0%, #f8fafc 50%, #eff6ff 100%);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 3vw, 2.75rem);
  line-height: 1.2;
  font-weight: 600;
  color: var(--gray-900);
}

.hero p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 70ch;
}

.section-title {
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  line-height: 1.25;
  font-weight: 600;
  color: var(--gray-900);
}

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

.card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 600;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
}

.card .meta {
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-top: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 44px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
  color: #fff;
}

.btn-soft {
  background: #eef2ff;
  border-color: #dbeafe;
  color: var(--primary-strong);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
}

.note {
  border-left: 4px solid var(--warning);
  background: #fff7ed;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem;
  color: #7c2d12;
  margin-top: 1.1rem;
}

.footer {
  border-top: 1px solid var(--gray-200);
  padding: 1.5rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.25rem;
}

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

.article-shell {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.article-inner {
  padding: 1.5rem;
}

.breadcrumb {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.article-page h2 {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.65rem;
  line-height: 1.25;
}

.article-page h3 {
  margin: 1rem 0 0.45rem;
}

.article-page p,
.article-page li {
  color: var(--text-secondary);
}

.article-page ul,
.article-page ol {
  padding-left: 1.2rem;
}

.article-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.3rem;
}

.article-page th,
.article-page td {
  border: 1px solid var(--gray-200);
  text-align: left;
  padding: 0.55rem;
  font-size: 0.94rem;
}

.article-page th {
  background: #eff6ff;
  color: var(--gray-900);
}

.tip-box,
.warning-box,
.info-box {
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid;
}

.tip-box {
  background: #f0fdf4;
  border-left-color: var(--success);
}

.warning-box {
  background: #fef2f2;
  border-left-color: var(--error);
}

.info-box {
  background: #f0f9ff;
  border-left-color: var(--primary);
}

.toc {
  position: sticky;
  top: 88px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 0.9rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.toc h4 {
  margin: 0 0 0.4rem;
}

.toc ul {
  margin: 0;
  padding-left: 1rem;
}

.toc a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.share-rail {
  position: fixed;
  left: 14px;
  top: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 900;
}

.share-btn {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid #1e293b;
  background: #0f172a;
  color: #fff;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

details.faq {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  margin: 0.55rem 0;
}

details.faq summary {
  cursor: pointer;
  font-weight: 600;
}

.author-bio {
  margin-top: 1.3rem;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.9rem;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 0.8rem;
}

.author-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-green,
.badge-blue {
  font-size: 0.76rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-weight: 600;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.related-card {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fff;
}

#backToTop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  border: none;
  border-radius: 999px;
  min-height: 44px;
  padding: 0.6rem 0.95rem;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
  }

  .share-rail {
    display: none;
  }
}

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

  .toc {
    position: static;
    max-height: none;
  }

  .share-rail {
    display: none;
  }
}

@media (max-width: 768px) {
  .container {
    width: min(var(--container), calc(100% - 1rem));
  }

  .main-content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  .hero {
    padding: 1rem;
  }

  .hero h1 {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

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

  .article-inner {
    padding: 1rem;
  }

  .article-page h2 {
    font-size: 1.35rem;
    line-height: 1.3;
  }

  .article-page table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .author-bio {
    grid-template-columns: 1fr;
  }

  .author-avatar {
    width: 46px;
    height: 46px;
  }

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

  #backToTop {
    right: 14px;
    bottom: 14px;
    min-height: 40px;
    padding: 0.45rem 0.8rem;
  }
}

/* Footer Styles */
.footer {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
  border-top: 1px solid rgba(226, 232, 240, 0.1);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.footer-section p {
  margin: 0 0 1rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.6rem;
}

.footer-section a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.18s ease;
  font-size: 0.95rem;
}

.footer-section a:hover {
  color: #fff;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: rgba(226, 232, 240, 0.1);
  border-radius: 8px;
  transition: background-color 0.18s ease;
}

.social-link:hover {
  background: rgba(226, 232, 240, 0.2);
  color: #fff;
}

.social-link i {
  font-size: 1.1rem;
}

.footer-bottom {
  border-top: 1px solid rgba(226, 232, 240, 0.1);
  padding-top: 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}

.footer-bottom p {
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer {
    padding: 2rem 0 1rem;
    margin-top: 2rem;
  }
}
