:root {
  --color-bg: #F8F1E3;
  --color-panel: #FFFCF6;
  --color-panel-soft: #F1E7D4;
  --color-border: #E6D9C4;
  --color-accent: #7A3E1F;
  --color-accent-dark: #5C2D14;
  --color-text: #2A1E16;
  --color-muted: #7A6A5C;
  --color-success: #3F8A57;
  --color-warning: #D99A1E;
  --color-error: #B8432F;
  --color-honey: #F2B84B;
  --color-white: #FFFFFF;
  --color-apricot: #F9D9CC;
  --color-mint: #D6EEDF;
  --color-mist: #D9E4F0;
  --color-lilac: #E7DDF2;
  --color-honey-soft: #FBE7B8;
  --color-veil: rgba(42, 30, 22, 0.28);
  --color-paper-glow: rgba(242, 184, 75, 0.2);
  --color-accent-shadow: rgba(122, 62, 31, 0.16);
  --color-accent-shadow-strong: rgba(122, 62, 31, 0.24);
  --font-display: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-card: 0 18px 40px -18px var(--color-accent-shadow), 0 2px 6px -2px var(--color-accent-shadow);
  --shadow-panel: 0 30px 70px -34px var(--color-accent-shadow-strong), inset 0 1px 0 var(--color-white);
  --shadow-button: 0 10px 22px -10px var(--color-accent-shadow-strong);
  --header-height: 64px;
  --content-width: 1200px;
  --reading-width: 760px;
  --gutter: 32px;
  --section-space: 104px;
  --focus-ring: 2px solid var(--color-accent);
  --motion-fast: 180ms;
  --motion-normal: 420ms;
}

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

html {
  margin: 0;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  background: var(--color-bg);
}

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 0;
  margin: 0;
  overflow-wrap: break-word;
  background:
    radial-gradient(circle at 38% 0%, var(--color-paper-glow), transparent 34rem),
    var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
section,
article,
aside,
header,
footer,
nav,
div {
  min-width: 0;
}

img,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  display: block;
  flex-shrink: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

a,
button,
summary,
[role="tab"],
select,
input,
textarea {
  border-radius: var(--radius-xs);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="tab"]:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

::selection {
  background: var(--color-honey-soft);
  color: var(--color-accent-dark);
}

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

h1,
h2,
h3,
h4 {
  color: var(--color-text);
  font-family: var(--font-display);
  text-wrap: balance;
}

h1 {
  margin-bottom: 24px;
  font-size: clamp(52px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 12px;
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 800;
  line-height: 1.28;
}

p {
  margin-bottom: 18px;
}

ul,
ol {
  padding-left: 1.25rem;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

code {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel-soft);
  -webkit-overflow-scrolling: touch;
}

small,
.text-muted {
  color: var(--color-muted);
}

.wrap {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.reading-wrap {
  width: 100%;
  max-width: calc(var(--reading-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
}

.section-soft {
  overflow-x: clip;
  background: var(--color-panel-soft);
}

.section-head {
  max-width: 720px;
  margin: 0 auto 44px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.no-break {
  white-space: nowrap;
}

.panel,
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
}

.card {
  transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

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

.badge,
.tag {
  display: inline-flex;
  min-height: 28px;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.badge--honey {
  border-color: var(--color-honey);
  background: var(--color-honey-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-mint);
}

.btn {
  display: inline-flex;
  min-width: 24px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 23px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: transform var(--motion-fast) ease, background var(--motion-fast) ease, border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-panel);
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
}

.btn-secondary {
  border-color: var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
}

.btn-small {
  min-height: 38px;
  padding: 8px 15px;
  font-size: 13px;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.reveal {
  transition: opacity var(--motion-normal) ease, transform var(--motion-normal) ease;
}

.reveal.pending {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.shown {
  opacity: 1;
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.header-shell {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 24px;
}

.site-brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.site-brand img {
  width: 30px;
  height: 30px;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand-zh {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 500;
}

.desktop-nav {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}

.nav-tab {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding-inline: 10px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}

.nav-tab:hover,
.nav-tab[aria-current="page"] {
  color: var(--color-text);
}

.nav-tab[aria-current="page"]::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  background: var(--color-accent);
  content: "";
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.header-login {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-panel);
  font-size: 13px;
  font-weight: 700;
}

.language-picker {
  position: relative;
}

.language-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-muted);
}

.language-toggle svg {
  width: 14px;
  height: 14px;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  display: none;
  width: 158px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
}

.language-picker.is-open .language-menu {
  display: block;
}

.language-menu a {
  display: flex;
  min-height: 40px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--color-muted);
}

.language-menu a:hover,
.language-menu a[aria-current="true"] {
  background: var(--color-panel-soft);
  color: var(--color-text);
}

.menu-button {
  display: none;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
}

.menu-button svg {
  width: 20px;
  height: 20px;
}

.mobile-nav {
  position: fixed;
  top: var(--header-height);
  right: 0;
  left: 0;
  z-index: 60;
  display: none;
  max-height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: 12px var(--gutter) 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-panel);
  box-shadow: var(--shadow-panel);
  overscroll-behavior: contain;
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav a {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.mobile-nav a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 800;
}

.mobile-language-label {
  margin: 15px 12px 4px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.07em;
}

.mobile-veil {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 40;
  display: none;
  border: 0;
  border-radius: 0;
  background: var(--color-veil);
}

.mobile-veil.is-open {
  display: block;
}

.site-footer {
  overflow-x: clip;
  border-top: 1px solid var(--color-border);
  background: var(--color-panel-soft);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.3fr 0.8fr;
  gap: 42px;
  padding-top: 64px;
  padding-bottom: 44px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer-brand img {
  width: 32px;
  height: 32px;
}

.footer-intro {
  max-width: 310px;
  color: var(--color-muted);
}

.footer-title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer-links a {
  min-height: 28px;
  color: var(--color-muted);
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-hot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-hot a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-muted);
  font-size: 12px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 20px;
  padding-bottom: 24px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

#server-status {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 32px;
  overflow: hidden;
}

#server-status + * {
  margin-top: 32px;
}

.counter-stat {
  display: inline-block;
  min-width: 3.5ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.prose {
  max-width: var(--reading-width);
}

.prose h2,
.prose h3 {
  scroll-margin-top: calc(var(--header-height) + 76px);
}

.prose a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose blockquote {
  margin: 26px 0;
}

.prose img {
  border-radius: var(--radius-md);
}

@media (max-width: 1040px) {
  .desktop-nav {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .menu-button {
    display: grid;
  }

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

@media (max-width: 768px) {
  :root {
    --gutter: 20px;
    --section-space: 76px;
  }

  h1 {
    font-size: clamp(34px, 9vw, 40px);
    line-height: 1.12;
  }

  h2 {
    font-size: clamp(28px, 7vw, 36px);
  }

  .language-picker {
    display: none;
  }

  .footer-main {
    gap: 30px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --section-space: 64px;
  }

  body {
    max-width: 100%;
    font-size: 14px;
  }

  .no-break {
    white-space: normal;
  }

  .wrap,
  .reading-wrap {
    padding-inline: var(--gutter);
  }

  .btn {
    max-width: 100%;
  }

  .tilt,
  [class*="tilt-"] {
    transform: none;
  }

  .decor,
  .hero-glow,
  .stripe-halo {
    max-width: 100%;
  }

  .header-shell {
    gap: 9px;
  }

  .brand-zh {
    display: none;
  }

  .header-login {
    min-height: 38px;
    padding-inline: 12px;
  }

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

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal.pending,
  .card,
  .btn {
    opacity: 1;
    transform: none;
    transition: none;
  }
}