:root {
  --bg: #f7f5f2;
  --bg-alt: #ffffff;
  --bg-elev: rgba(255, 255, 255, 0.72);
  --text: #1d1b26;
  --text-soft: #5a5566;
  --text-mute: #8a8496;
  --brand: #1a1a2e;
  --brand-2: #2d2b4e;
  --accent: #fb8500;
  --accent-2: #ffb703;
  --line: rgba(26, 26, 46, 0.1);
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 12px 30px rgba(26, 26, 46, 0.1);
  --shadow-lg: 0 24px 60px rgba(26, 26, 46, 0.16);
  --grad-hero: linear-gradient(135deg, #1a1a2e 0%, #3a2d5e 45%, #fb8500 130%);
  --grad-accent: linear-gradient(135deg, #ffb703 0%, #fb8500 100%);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.dark,
html.dark body {
  --bg: #0f0f1a;
  --bg-alt: #171726;
  --bg-elev: rgba(30, 30, 50, 0.62);
  --text: #f2f0f7;
  --text-soft: #b9b4c8;
  --text-mute: #8b86a0;
  --brand: #f2f0f7;
  --line: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 26px 64px rgba(0, 0, 0, 0.6);
  --grad-hero: linear-gradient(135deg, #0b0b16 0%, #241d3d 45%, #7a3d00 130%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 88% -8%, rgba(251, 133, 0, 0.1), transparent 60%),
    radial-gradient(900px 460px at -6% 12%, rgba(58, 45, 94, 0.1), transparent 62%);
  background-attachment: fixed;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s var(--ease), opacity 0.25s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--accent-2);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

h1, h2, h3, h4 {
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.7rem, 4.2vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 2.8vw, 2rem); font-weight: 800; }
h3 { font-size: clamp(1.08rem, 1.8vw, 1.3rem); font-weight: 700; }

p {
  margin: 0 0 1em;
  color: var(--text-soft);
}

ul, ol {
  padding-left: 1.4em;
  color: var(--text-soft);
}

li {
  margin-bottom: 0.35em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============ HEADER ============ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elev);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.3s var(--ease), background 0.4s var(--ease);
}

#site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease);
}

.brand:hover .logo {
  transform: rotate(-6deg) scale(1.06);
}

.brand-name {
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  white-space: nowrap;
}

#main-nav {
  margin-left: auto;
}

#main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

#main-nav a {
  display: block;
  padding: 7px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: 999px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}

#main-nav a:hover,
#main-nav a:focus-visible {
  color: var(--text);
  background: rgba(251, 133, 0, 0.12);
  transform: translateY(-1px);
}

#site-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

#site-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(251, 133, 0, 0.14);
}

#search-input {
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 6px 0;
  width: 150px;
  outline: none;
}

#search-input::placeholder {
  color: var(--text-mute);
}

#site-search button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a1a2e;
  background: var(--grad-accent);
  padding: 7px 16px;
  border-radius: 999px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
}

#site-search button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(251, 133, 0, 0.36);
  filter: brightness(1.05);
}

#theme-toggle,
#menu-toggle {
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

#theme-toggle:hover,
#menu-toggle:hover {
  transform: translateY(-2px) rotate(6deg);
  box-shadow: var(--shadow-sm);
}

#menu-toggle {
  display: none;
}

/* ============ BREADCRUMB ============ */
.breadcrumb {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-mute);
}

.breadcrumb li {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--text-mute);
  opacity: 0.6;
}

.breadcrumb a {
  color: var(--text-soft);
}

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

/* ============ MAIN LAYOUT ============ */
#main-content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 60px;
}

#main-content > section {
  margin-bottom: 30px;
  padding: clamp(22px, 3.4vw, 40px);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 96px;
  transition: box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background 0.4s var(--ease), transform 0.35s var(--ease);
  animation: fadeUp 0.7s var(--ease) both;
}

#main-content > section:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(251, 133, 0, 0.28);
}

#main-content > section:nth-of-type(even) {
  background: linear-gradient(180deg, var(--bg-alt), rgba(251, 133, 0, 0.03));
}

/* ============ HERO / CAROUSEL ============ */
#hero {
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  margin-bottom: 34px !important;
}

.carousel {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--grad-hero);
  color: #fff;
  padding: clamp(34px, 6vw, 74px) clamp(24px, 5vw, 64px) clamp(60px, 7vw, 90px);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}

.carousel::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.4), transparent 68%);
  filter: blur(10px);
  z-index: -1;
  animation: floaty 12s ease-in-out infinite;
}

.carousel::after {
  content: "";
  position: absolute;
  inset: auto auto -50% -15%;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 90, 220, 0.36), transparent 70%);
  filter: blur(14px);
  z-index: -1;
  animation: floaty 16s ease-in-out infinite reverse;
}

.slide {
  display: none;
  max-width: 820px;
  animation: fadeUp 0.6s var(--ease) both;
}

.slide.active {
  display: block;
}

.slide h1,
.slide h2 {
  color: #fff;
  margin-bottom: 0.55em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.28);
}

.slide h1 {
  background: linear-gradient(120deg, #ffffff 30%, #ffd79a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.slide p {
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(0.95rem, 1.6vw, 1.06rem);
  max-width: 720px;
  margin-bottom: 1.3em;
}

.slide .cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1a1a2e;
  background: var(--grad-accent);
  box-shadow: 0 10px 26px rgba(251, 133, 0, 0.4);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
}

.slide .cta:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 36px rgba(251, 133, 0, 0.5);
  filter: brightness(1.06);
  color: #1a1a2e;
}

.carousel-controls {
  position: absolute;
  right: clamp(18px, 4vw, 40px);
  bottom: clamp(18px, 4vw, 32px);
  display: flex;
  gap: 10px;
  z-index: 2;
}

.carousel-controls button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

.carousel-controls button:hover {
  background: rgba(255, 183, 3, 0.9);
  border-color: transparent;
  color: #1a1a2e;
  transform: scale(1.08);
}

/* ============ TOC ============ */
#toc {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(251, 133, 0, 0.06)) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line) !important;
}

#toc h2 {
  font-size: 1.05rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

#toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#toc li {
  margin: 0;
}

#toc a {
  display: inline-block;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  transition: all 0.25s var(--ease);
}

#toc a:hover {
  color: #1a1a2e;
  background: var(--grad-accent);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(251, 133, 0, 0.3);
}

/* ============ ARTICLES / NEWS CARDS ============ */
#news article,
#articles article {
  position: relative;
  padding: 22px 24px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
  overflow: hidden;
}

#news article::before,
#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-accent);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

#news article:hover,
#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(251, 133, 0, 0.3);
}

#news article:hover::before,
#articles article:hover::before {
  opacity: 1;
}

#news article h3,
#articles article h3 {
  margin-bottom: 0.4em;
  font-size: 1.08rem;
}

#news time,
#articles time {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(251, 133, 0, 0.1);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent);
}

#articles article a::after {
  content: "→";
  transition: transform 0.25s var(--ease);
}

#articles article a:hover::after {
  transform: translateX(4px);
}

/* ============ TESTIMONIALS ============ */
#testimonials blockquote {
  margin: 0 0 16px;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

#testimonials blockquote::before {
  content: "“";
  position: absolute;
  top: -6px;
  right: 18px;
  font-size: 4rem;
  line-height: 1;
  color: rgba(251, 133, 0, 0.18);
  font-family: Georgia, serif;
}

#testimonials blockquote:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

#testimonials blockquote p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-soft);
  font-style: italic;
}

/* ============ FAQ ============ */
#faq details {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}

#faq details[open] {
  border-color: rgba(251, 133, 0, 0.35);
  box-shadow: var(--shadow-md);
}

#faq details:hover {
  border-color: rgba(251, 133, 0, 0.28);
}

#faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 52px 18px 22px;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}

#faq summary::-webkit-details-marker {
  display: none;
}

#faq summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.3s var(--ease);
  line-height: 1;
}

#faq details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
}

#faq summary:hover {
  color: var(--accent);
  background: rgba(251, 133, 0, 0.05);
}

#faq details p {
  padding: 0 22px 20px;
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-soft);
  animation: fadeUp 0.35s var(--ease) both;
}

/* ============ HOWTO ============ */
#howto ol {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

#howto ol li {
  counter-increment: step;
  position: relative;
  padding: 14px 18px 14px 58px;
  margin-bottom: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

#howto ol li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-accent);
  color: #1a1a2e;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(251, 133, 0, 0.35);
}

#howto ol li:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(251, 133, 0, 0.3);
}

/* ============ CONTACT ============ */
#contact address {
  font-style: normal;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 18px 0 26px;
}

#contact address p {
  margin: 0;
  padding: 14px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-soft);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

#contact address p:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(251, 133, 0, 0.3);
}

/* ============ SITEMAP & LINKS ============ */
#sitemap ul,
#links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#sitemap li,
#links li {
  margin: 0;
}

#sitemap a,
#links a {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text-soft);
  transition: all 0.25s var(--ease);
}

#sitemap a:hover,
#links a:hover {
  color: #1a1a2e;
  background: var(--grad-accent);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(251, 133, 0, 0.3);
}

/* ============ LEGAL ============ */
#legal h3 {
  margin-top: 1.4em;
}

/* ============ FOOTER ============ */
footer {
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-top: 1px solid var(--line);
  padding: 44px 20px 60px;
  text-align: center;
  margin-top: 20px;
}

footer p {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--text-mute);
}

footer nav ul {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}

footer nav a {
  font-size: 0.84rem;
  color: var(--text-soft);
}

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

/* ============ BACK TO TOP ============ */
#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: var(--grad-accent);
  color: #1a1a2e;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(251, 133, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#back-to-top:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 18px 36px rgba(251, 133, 0, 0.55);
}

/* ============ ANIMATIONS ============ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floaty {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-24px, 30px, 0) scale(1.08);
  }
}

/* Scroll reveal (JS adds .revealed) */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1080px) {
  #main-nav a {
    padding: 6px 9px;
    font-size: 0.84rem;
  }
  #search-input {
    width: 120px;
  }
}

@media (max-width: 900px) {
  #menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  #main-nav {
    order: 5;
    flex-basis: 100%;
    margin-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease), opacity 0.3s var(--ease);
    opacity: 0;
  }

  #main-nav.open {
    max-height: 620px;
    opacity: 1;
  }

  #main-nav ul {
    flex-direction: column;
    gap: 4px;
    padding: 10px 0 4px;
  }

  #main-nav a {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-alt);
    border: 1px solid var(--line);
  }

  #site-search {
    order: 6;
    flex-basis: 100%;
    margin-top: 4px;
  }

  #search-input {
    flex: 1;
    width: auto;
  }

  #theme-toggle {
    order: 4;
    margin-left: 0;
  }

  .brand {
    order: 1;
  }

  #menu-toggle {
    order: 3;
  }

  #main-nav {
    order: 7;
  }
}

@media (max-width: 640px) {
  html {
    scroll-padding-top: 76px;
  }

  .header-inner {
    padding: 10px 14px;
    gap: 10px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .brand .logo {
    width: 38px;
    height: 38px;
  }

  #theme-toggle,
  #menu-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 0.95rem;
  }

  #main-content {
    padding: 16px 12px 44px;
  }

  #main-content > section {
    border-radius: var(--radius);
    padding: 20px 16px;
    margin-bottom: 20px;
  }

  .breadcrumb {
    padding: 10px 14px 0;
    font-size: 0.76rem;
  }

  .carousel {
    border-radius: var(--radius);
    padding: 30px 20px 74px;
  }

  .carousel-controls {
    right: 16px;
    bottom: 16px;
  }

  .carousel-controls button {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .slide .cta {
    padding: 10px 22px;
    font-size: 0.88rem;
  }

  #news article,
  #articles article {
    padding: 18px 16px;
  }

  #testimonials blockquote {
    padding: 18px 18px 18px 20px;
  }

  #faq summary {
    padding: 15px 46px 15px 16px;
    font-size: 0.92rem;
  }

  #faq details p {
    padding: 0 16px 16px;
    font-size: 0.88rem;
  }

  #howto ol li {
    padding: 12px 14px 12px 50px;
    font-size: 0.9rem;
  }

  #howto ol li::before {
    left: 12px;
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  #contact address {
    grid-template-columns: 1fr;
  }

  #back-to-top {
    right: 14px;
    bottom: 14px;
    width: 42px;
    height: 42px;
  }

  footer {
    padding: 32px 14px 48px;
  }

  footer nav ul {
    gap: 6px 14px;
  }
}

@media (max-width: 380px) {
  #site-search button {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
  .brand-name {
    font-size: 0.98rem;
  }
}

/* Print */
@media print {
  #site-header,
  #back-to-top,
  .carousel-controls,
  #toc,
  #links,
  #sitemap,
  footer nav {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  #main-content > section {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}