:root {
  --nav-height: 52px;
  --color-nav-bg: #12121e;
  --color-nav-active: #f0d060;
  --color-text: #333;
  --color-text-muted: #999;
  --container-max: 720px;
  --space-xs: clamp(0.5rem, 1.5vw, 0.75rem);
  --space-sm: clamp(0.75rem, 2vw, 1rem);
  --space-md: clamp(1rem, 3vw, 1.75rem);
  --space-lg: clamp(1.25rem, 4vw, 2rem);
  --font-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --font-sm: clamp(0.8125rem, 0.75rem + 0.25vw, 0.875rem);
  --font-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1rem);
  --font-md: clamp(1.0625rem, 1rem + 0.35vw, 1.125rem);
  --font-lg: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --font-xl: clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
  --font-2xl: clamp(1.375rem, 1.2rem + 1vw, 1.75rem);
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--font-base);
  min-height: 100vh;
  min-height: 100dvh;
  background: #1a2744 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%232a3a5c' stroke-width='0.5' opacity='0.3'/%3E%3C/svg%3E");
  background-size: cover;
  color: var(--color-text);
  position: relative;
  line-height: 1.6;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(26, 39, 68, 0.95) 0%, rgba(15, 25, 50, 0.98) 100%);
  z-index: 0;
}

/* 置顶导航 */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  padding-top: env(safe-area-inset-top, 0);
}

.top-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  padding: 0 var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.75rem);
  color: #fff;
  text-decoration: none;
  font-size: var(--font-md);
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  border-bottom: 3px solid transparent;
  min-height: var(--nav-height);
}

.nav-link:hover {
  color: var(--color-nav-active);
}

.nav-link.active {
  color: var(--color-nav-active);
  border-bottom-color: var(--color-nav-active);
}

.nav-link-back {
  color: #fde68a;
}

.nav-link-back:hover {
  color: #fef3c7;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: calc(var(--nav-height) + var(--space-md)) var(--space-sm) clamp(2.5rem, 6vw, 3.75rem);
  padding-left: max(var(--space-sm), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-sm), env(safe-area-inset-right, 0px));
}

.breadcrumb {
  font-size: var(--font-xs);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 0.35em;
}

.article-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: var(--space-lg) clamp(1.125rem, 4vw, 1.75rem);
  box-shadow: var(--shadow-card);
}

.article-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  text-align: center;
  color: #222;
  margin-bottom: var(--space-sm);
  line-height: 1.4;
  word-break: break-word;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid #f0f0f0;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-xs);
  color: var(--color-text-muted);
}

.article-content {
  font-size: var(--font-base);
  line-height: 1.9;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.article-content p {
  margin-bottom: 0.5em;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  font-weight: 700;
  line-height: 1.4;
  margin: 0.75em 0 0.5em;
  color: #222;
}

.article-content h1 { font-size: 1.5em; }
.article-content h2 { font-size: 1.3em; }
.article-content h3 { font-size: 1.15em; }

.article-content ul,
.article-content ol {
  margin: 0.5em 0 0.75em;
  padding-left: 1.5em;
}

.article-content li {
  margin-bottom: 0.35em;
}

.article-content a {
  color: #2563eb;
  text-decoration: underline;
}

.article-content blockquote {
  margin: 0.75em 0;
  padding: 0.5em 1em;
  border-left: 4px solid #e5e7eb;
  color: #666;
  background: #f9fafb;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.95em;
}

.article-content th,
.article-content table td {
  border: 1px solid #e5e7eb;
  padding: 0.5em 0.75em;
}

.article-content strong,
.article-content b {
  font-weight: 700;
}

.article-content .text-red {
  color: #e53e3e;
}

.article-content .text-orange {
  color: #d97706;
  font-weight: 600;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.75em 0;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-md) var(--space-sm);
  padding-bottom: max(var(--space-md), env(safe-area-inset-bottom, 0px));
}

.footer a {
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--font-xs);
  text-decoration: none;
}

.footer a:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* 平板竖屏 */
@media (max-width: 768px) {
  :root {
    --container-max: 100%;
  }

  .top-nav-inner {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-nav-inner::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex-shrink: 0;
    padding-left: 1.125rem;
    padding-right: 1.125rem;
    font-size: var(--font-sm);
  }
}

/* 手机 */
@media (max-width: 576px) {
  .article-meta {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}

/* 小屏手机 */
@media (max-width: 400px) {
  .nav-link {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    font-size: var(--font-xs);
    border-bottom-width: 2px;
  }
}

/* 大屏 */
@media (min-width: 1200px) {
  .container {
    max-width: 800px;
  }
}
