:root{
  --apple-red:#c8102e;
  --apple-red-dark:#9c0b23;
  --apple-red-light:#ff4d67;
  --gold:#ffd166;
  --navy:#1f3b73;
  --teal:#0f7b6c;
  --bg:#f6f7fb;
  --bg-alt:#ffffff;
  --bg-soft:#eef1f7;
  --text:#1c2230;
  --text-soft:#4a5265;
  --text-mute:#7a8396;
  --border:rgba(28,34,48,.1);
  --card-bg:rgba(255,255,255,.72);
  --glass-bg:rgba(255,255,255,.55);
  --glass-border:rgba(255,255,255,.6);
  --shadow-sm:0 2px 8px rgba(28,34,48,.06);
  --shadow-md:0 8px 28px rgba(28,34,48,.1);
  --shadow-lg:0 18px 50px rgba(28,34,48,.16);
  --radius-sm:10px;
  --radius-md:16px;
  --radius-lg:24px;
  --radius-pill:999px;
  --header-h:72px;
  --grad-hero:linear-gradient(135deg,#c8102e 0%,#e63950 45%,#ff7a59 100%);
  --grad-brand:linear-gradient(135deg,#c8102e 0%,#ff4d67 100%);
  --grad-soft:linear-gradient(135deg,rgba(200,16,46,.08),rgba(255,122,89,.08));
  --font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
}

[data-theme="dark"]{
  --bg:#0e1117;
  --bg-alt:#161b24;
  --bg-soft:#1b212c;
  --text:#e8ecf4;
  --text-soft:#b3bccd;
  --text-mute:#8a94a8;
  --border:rgba(255,255,255,.1);
  --card-bg:rgba(30,37,49,.7);
  --glass-bg:rgba(22,27,36,.6);
  --glass-border:rgba(255,255,255,.08);
  --shadow-sm:0 2px 8px rgba(0,0,0,.4);
  --shadow-md:0 8px 28px rgba(0,0,0,.45);
  --shadow-lg:0 18px 50px rgba(0,0,0,.55);
  --grad-soft:linear-gradient(135deg,rgba(200,16,46,.18),rgba(255,122,89,.1));
}

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

html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}

body{
  font-family:var(--font-sans);
  background:var(--bg);
  color:var(--text);
  line-height:1.75;
  font-size:16px;
  min-height:100vh;
  overflow-x:hidden;
  transition:background .35s ease,color .35s ease;
  background-image:radial-gradient(circle at 12% 0%,rgba(200,16,46,.06),transparent 42%),radial-gradient(circle at 88% 8%,rgba(31,59,115,.06),transparent 40%);
}

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

a{color:var(--apple-red);text-decoration:none;transition:color .25s ease,opacity .25s ease}
a:hover{color:var(--apple-red-light)}

ul,ol{list-style:none}

.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;
}

h1,h2,h3,h4{line-height:1.35;font-weight:800;letter-spacing:-.01em;color:var(--text)}

h1{font-size:clamp(1.7rem,4vw,2.6rem);margin-bottom:1.1rem}
h2{font-size:clamp(1.35rem,3vw,1.9rem);margin:2.4rem 0 1rem;position:relative;padding-left:1rem}
h2::before{
  content:"";position:absolute;left:0;top:.18em;bottom:.18em;width:5px;border-radius:4px;
  background:var(--grad-brand);
}
h3{font-size:clamp(1.1rem,2.2vw,1.35rem);margin:1.6rem 0 .7rem;color:var(--text)}
p{margin-bottom:1rem;color:var(--text-soft)}

/* ============ Header ============ */
#site-header{
  position:sticky;top:0;z-index:100;
  background:var(--glass-bg);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
  backdrop-filter:blur(18px) saturate(160%);
  border-bottom:1px solid var(--glass-border);
  box-shadow:var(--shadow-sm);
  transition:background .35s ease,box-shadow .3s ease;
}

.header-inner{
  max-width:1200px;margin:0 auto;
  display:flex;align-items:center;gap:1rem;
  padding:.65rem 1.25rem;
  min-height:var(--header-h);
  flex-wrap:wrap;
}

.brand{display:flex;align-items:center;gap:.6rem;flex-shrink:0}
.brand-logo{
  border-radius:50%;
  box-shadow:0 4px 14px rgba(200,16,46,.35);
  transition:transform .4s cubic-bezier(.34,1.56,.64,1);
}
.brand:hover .brand-logo{transform:rotate(-12deg) scale(1.08)}
.brand-name{
  font-size:1.18rem;font-weight:800;letter-spacing:.02em;
  background:var(--grad-brand);
  -webkit-background-clip:text;background-clip:text;
  -webkit-text-fill-color:transparent;color:transparent;
  white-space:nowrap;
}

.main-nav{flex:1;min-width:0}
.main-nav ul{display:flex;flex-wrap:wrap;gap:.15rem;justify-content:center}
.main-nav a{
  display:block;padding:.45rem .7rem;border-radius:var(--radius-pill);
  font-size:.9rem;font-weight:600;color:var(--text-soft);
  position:relative;transition:all .25s ease;white-space:nowrap;
}
.main-nav a::after{
  content:"";position:absolute;left:50%;bottom:.15rem;width:0;height:2px;
  background:var(--grad-brand);border-radius:2px;
  transform:translateX(-50%);transition:width .3s ease;
}
.main-nav a:hover{color:var(--apple-red);background:var(--grad-soft)}
.main-nav a:hover::after{width:55%}

.header-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0}

.site-search{display:flex;align-items:center;gap:.35rem}
.site-search input{
  width:180px;padding:.5rem .9rem;font-size:.88rem;
  border:1px solid var(--border);border-radius:var(--radius-pill);
  background:var(--bg-alt);color:var(--text);
  outline:none;transition:all .3s ease;font-family:inherit;
}
.site-search input::placeholder{color:var(--text-mute)}
.site-search input:focus{
  width:220px;border-color:var(--apple-red);
  box-shadow:0 0 0 3px rgba(200,16,46,.14);
}
.site-search button{
  padding:.5rem 1rem;font-size:.85rem;font-weight:700;font-family:inherit;
  color:#fff;background:var(--grad-brand);border:none;border-radius:var(--radius-pill);
  cursor:pointer;transition:transform .25s ease,box-shadow .25s ease;white-space:nowrap;
}
.site-search button:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(200,16,46,.35)}

#theme-toggle,#menu-toggle{
  padding:.5rem .9rem;font-size:.82rem;font-weight:700;font-family:inherit;
  color:var(--text-soft);background:var(--bg-alt);
  border:1px solid var(--border);border-radius:var(--radius-pill);
  cursor:pointer;transition:all .25s ease;white-space:nowrap;
}
#theme-toggle:hover,#menu-toggle:hover{
  color:var(--apple-red);border-color:var(--apple-red);
  transform:translateY(-2px);box-shadow:var(--shadow-sm);
}
#menu-toggle{display:none}

/* ============ Breadcrumb ============ */
.breadcrumb{
  max-width:1200px;margin:0 auto;padding:1rem 1.25rem .25rem;
}
.breadcrumb ol{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;font-size:.85rem}
.breadcrumb li{color:var(--text-mute);display:flex;align-items:center;gap:.4rem}
.breadcrumb li+li::before{content:"/";color:var(--text-mute);opacity:.6}
.breadcrumb a{color:var(--text-soft);font-weight:600}
.breadcrumb a:hover{color:var(--apple-red)}
.breadcrumb [aria-current="page"]{color:var(--apple-red);font-weight:700}

/* ============ Main ============ */
main{max-width:1200px;margin:0 auto;padding:0 1.25rem 3rem}

section{margin-bottom:2.5rem}

/* ============ Hero ============ */
.hero{
  position:relative;border-radius:var(--radius-lg);overflow:hidden;
  margin-top:.75rem;box-shadow:var(--shadow-lg);
  background:var(--grad-hero);
  isolation:isolate;
}
.hero::before{
  content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
  background:radial-gradient(circle at 78% 20%,rgba(255,255,255,.22),transparent 55%),
             radial-gradient(circle at 15% 85%,rgba(255,209,102,.18),transparent 50%);
}
.hero-slide{
  position:relative;z-index:2;
  animation:heroFade .8s ease both;
}
.hero-slide svg{display:block;width:100%;height:auto}
.hero-slide[hidden]{display:none}

@keyframes heroFade{
  from{opacity:0;transform:scale(1.04)}
  to{opacity:1;transform:scale(1)}
}

/* ============ Intro / Content Cards ============ */
#intro{
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:clamp(1.25rem,3vw,2.5rem);
  box-shadow:var(--shadow-md);
  margin-top:1.75rem;
}

#intro > h1{
  background:var(--grad-brand);
  -webkit-background-clip:text;background-clip:text;
  -webkit-text-fill-color:transparent;color:transparent;
  padding-bottom:.6rem;border-bottom:2px solid var(--border);
  margin-bottom:1.4rem;
}

#intro > h2:first-of-type{margin-top:1.4rem}

/* ============ Articles ============ */
#articles{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
  gap:1.1rem;
  margin-bottom:2rem;
}

#articles article{
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:1.3rem 1.4rem;
  box-shadow:var(--shadow-sm);
  position:relative;overflow:hidden;
  display:flex;flex-direction:column;
  transition:transform .35s cubic-bezier(.34,1.56,.64,1),box-shadow .35s ease,border-color .35s ease;
}
#articles article::before{
  content:"";position:absolute;top:0;left:0;right:0;height:4px;
  background:var(--grad-brand);transform:scaleX(0);transform-origin:left;
  transition:transform .4s ease;
}
#articles article:hover{
  transform:translateY(-6px);
  box-shadow:var(--shadow-lg);
  border-color:rgba(200,16,46,.35);
}
#articles article:hover::before{transform:scaleX(1)}

#articles h3{
  margin-top:0;font-size:1.08rem;line-height:1.45;
  color:var(--text);transition:color .3s ease;
}
#articles article:hover h3{color:var(--apple-red)}

#articles article p{
  font-size:.88rem;color:var(--text-mute);margin-bottom:.7rem;
}
#articles article p:first-of-type{
  font-size:.78rem;font-weight:600;color:var(--apple-red);
  opacity:.85;margin-bottom:.6rem;letter-spacing:.01em;
}

#articles article a{
  margin-top:auto;align-self:flex-start;
  display:inline-flex;align-items:center;gap:.35rem;
  font-size:.85rem;font-weight:700;
  padding:.42rem 1rem;border-radius:var(--radius-pill);
  background:var(--grad-soft);color:var(--apple-red);
  border:1px solid rgba(200,16,46,.2);
  transition:all .3s ease;
}
#articles article a::after{content:"→";transition:transform .3s ease}
#articles article a:hover{
  background:var(--grad-brand);color:#fff;border-color:transparent;
  box-shadow:0 6px 16px rgba(200,16,46,.32);
}
#articles article a:hover::after{transform:translateX(3px)}

/* ============ FAQ ============ */
#faq dl{
  display:grid;gap:.75rem;margin-top:1.2rem;
}
#faq dt{
  font-weight:800;font-size:1rem;color:var(--text);
  padding:1rem 1.2rem .5rem;
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  border:1px solid var(--border);border-bottom:none;
  border-radius:var(--radius-md) var(--radius-md) 0 0;
  position:relative;padding-left:2.4rem;
  cursor:default;transition:color .3s ease;
}
#faq dt::before{
  content:"Q";position:absolute;left:.9rem;top:1rem;
  width:1.2rem;height:1.2rem;line-height:1.2rem;text-align:center;
  font-size:.72rem;font-weight:900;color:#fff;
  background:var(--grad-brand);border-radius:50%;
}
#faq dd{
  margin:0 0 .5rem;padding:.5rem 1.2rem 1.1rem 2.4rem;
  font-size:.92rem;color:var(--text-soft);
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  border:1px solid var(--border);border-top:none;
  border-radius:0 0 var(--radius-md) var(--radius-md);
  position:relative;
  transition:box-shadow .3s ease,border-color .3s ease;
}
#faq dt:hover + dd{
  box-shadow:var(--shadow-md);
  border-color:rgba(200,16,46,.28);
}

/* ============ HowTo / Contact / Sitemap lists ============ */
#howto h3{
  color:var(--apple-red);
  padding-left:.85rem;border-left:4px solid var(--apple-red);
  border-radius:2px;
}
#howto p{
  background:var(--grad-soft);
  border-radius:var(--radius-sm);
  padding:.85rem 1.1rem;
  border:1px solid var(--border);
}

#contact p{
  background:var(--card-bg);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:.7rem 1.1rem;margin-bottom:.6rem;
  font-size:.92rem;
  transition:transform .25s ease,box-shadow .25s ease,border-color .25s ease;
}
#contact p:hover{
  transform:translateX(4px);
  box-shadow:var(--shadow-sm);
  border-color:rgba(200,16,46,.3);
}

#sitemap ul,#links ul{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:.6rem;margin-top:1rem;
}
#sitemap li a,#links li a{
  display:block;padding:.6rem .9rem;
  font-size:.88rem;font-weight:600;
  background:var(--card-bg);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  color:var(--text-soft);
  transition:all .28s ease;
}
#sitemap li a:hover,#links li a:hover{
  color:#fff;background:var(--grad-brand);
  border-color:transparent;transform:translateY(-3px);
  box-shadow:0 8px 20px rgba(200,16,46,.3);
}

/* ============ Legal ============ */
#legal h3{
  display:inline-block;
  font-size:.95rem;padding:.25rem .8rem;
  color:var(--apple-red);background:var(--grad-soft);
  border-radius:var(--radius-pill);
  border:1px solid rgba(200,16,46,.18);
  margin-top:1.2rem;
}

#author-info{
  background:var(--grad-soft);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:1.2rem 1.4rem;
}
#author-info p{font-size:.9rem;margin-bottom:.5rem}
#author-info p:last-child{
  margin-top:.8rem;padding-top:.8rem;
  border-top:1px dashed var(--border);
  font-weight:700;color:var(--apple-red);font-size:.85rem;
}

/* ============ Footer ============ */
footer{
  background:linear-gradient(180deg,var(--bg-alt),var(--bg-soft));
  border-top:1px solid var(--border);
  padding:2rem 1.25rem 2.5rem;
  text-align:center;
  margin-top:2rem;
}
footer p{
  font-size:.85rem;color:var(--text-mute);
  margin-bottom:.55rem;max-width:900px;margin-left:auto;margin-right:auto;
}
footer p:first-child{font-weight:700;color:var(--text-soft)}
footer a{font-weight:600;color:var(--text-soft)}
footer a:hover{color:var(--apple-red)}

/* ============ Back to top ============ */
#back-to-top{
  position:fixed;right:1.25rem;bottom:1.25rem;z-index:90;
  width:48px;height:48px;
  display:flex;align-items:center;justify-content:center;
  font-size:0;border:none;border-radius:50%;
  background:var(--grad-brand);color:#fff;cursor:pointer;
  box-shadow:0 8px 24px rgba(200,16,46,.4);
  opacity:.9;transition:all .3s ease;
}
#back-to-top::before{
  content:"↑";font-size:1.25rem;font-weight:900;line-height:1;
}
#back-to-top:hover{
  transform:translateY(-4px) scale(1.06);
  box-shadow:0 12px 30px rgba(200,16,46,.5);
  opacity:1;
}

/* ============ Scroll Animation ============ */
@keyframes fadeUp{
  from{opacity:0;transform:translateY(28px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes fadeIn{
  from{opacity:0}
  to{opacity:1}
}

section{animation:fadeUp .7s cubic-bezier(.22,.61,.36,1) both}
section:nth-of-type(2){animation-delay:.08s}
section:nth-of-type(3){animation-delay:.16s}

#articles article{animation:fadeUp .6s ease both}
#articles article:nth-child(2){animation-delay:.05s}
#articles article:nth-child(3){animation-delay:.1s}
#articles article:nth-child(4){animation-delay:.15s}
#articles article:nth-child(5){animation-delay:.2s}
#articles article:nth-child(6){animation-delay:.25s}
#articles article:nth-child(7){animation-delay:.3s}
#articles article:nth-child(8){animation-delay:.35s}
#articles article:nth-child(9){animation-delay:.4s}
#articles article:nth-child(10){animation-delay:.45s}

@supports (animation-timeline:view()){
  #intro,#articles,#faq,#howto,#contact,#sitemap,#links,#legal,#author-info{
    animation:fadeUp linear both;
    animation-timeline:view();
    animation-range:entry 0% entry 28%;
  }
}

/* ============ Responsive ============ */
@media (max-width:1024px){
  .main-nav ul{gap:0}
  .main-nav a{padding:.4rem .55rem;font-size:.84rem}
  .site-search input{width:150px}
  .site-search input:focus{width:170px}
}

@media (max-width:860px){
  .header-inner{gap:.6rem}
  .main-nav{
    order:3;flex-basis:100%;
    max-height:0;overflow:hidden;
    transition:max-height .4s ease;
  }
  .main-nav.is-open{max-height:520px}
  .main-nav ul{justify-content:flex-start;padding-top:.4rem;gap:.2rem}
  .main-nav a{font-size:.88rem;padding:.5rem .8rem;background:var(--bg-soft);border-radius:var(--radius-sm)}
  .main-nav a::after{display:none}
  #menu-toggle{display:inline-block}
  .site-search{display:none}
  #articles{grid-template-columns:1fr}
}

@media (max-width:640px){
  body{font-size:15px}
  .header-inner{padding:.55rem .9rem}
  .brand-name{font-size:1.02rem}
  .brand-logo{width:34px;height:34px}
  #theme-toggle{padding:.45rem .7rem;font-size:.76rem}
  #menu-toggle{padding:.45rem .7rem;font-size:.76rem}
  .breadcrumb{padding:.8rem .9rem .2rem}
  main{padding:0 .9rem 2.5rem}
  .hero{border-radius:var(--radius-md)}
  #intro{padding:1.1rem;border-radius:var(--radius-md)}
  h2{padding-left:.75rem;margin-top:1.9rem}
  #faq dt{padding-left:2.1rem;font-size:.94rem}
  #faq dd{padding-left:1rem;font-size:.88rem}
  #sitemap ul,#links ul{grid-template-columns:repeat(2,1fr)}
  #back-to-top{width:42px;height:42px;right:.9rem;bottom:.9rem}
  footer{padding:1.6rem .9rem 2rem}
}

@media (max-width:400px){
  #sitemap ul,#links ul{grid-template-columns:1fr}
  .brand-name{font-size:.95rem}
}

/* ============ Accessibility / Motion / Print ============ */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms!important;
    animation-iteration-count:1!important;
    transition-duration:.001ms!important;
    scroll-behavior:auto!important;
  }
}

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

::selection{background:rgba(200,16,46,.2);color:var(--text)}

::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:var(--bg-soft)}
::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,var(--apple-red),var(--apple-red-light));
  border-radius:10px;border:2px solid var(--bg-soft);
}
::-webkit-scrollbar-thumb:hover{background:var(--apple-red-dark)}

@media print{
  #site-header,#back-to-top,.header-actions,.main-nav,footer{display:none!important}
  body{background:#fff;color:#000}
  #intro{box-shadow:none;border:1px solid #ddd}
  a{color:#000;text-decoration:underline}
}