/* =========================================================
   战斗吧！精灵 · Pokédex OS 设计系统
   纯本地样式：不依赖 Bootstrap / Tailwind / 网络字体
   风格：掌机游戏 UI + 图鉴机身 + 精灵属性色
   ========================================================= */

/* ---------- 1. 令牌 ---------- */
:root {
    /* 机身与纸面 */
    --ink: #14162E;
    --ink-2: #232848;
    --ink-3: #3B416B;
    --paper: #FFFDF6;
    --cream: #FFF3D4;
    --cream-2: #FFE7A8;
    --white: #FFFFFF;

    /* 品牌 */
    --red: #EE1515;
    --red-d: #B41010;
    --yellow: #FFCB05;
    --yellow-d: #D19E00;
    --blue: #3B4CCA;
    --cyan: #21CFCF;
    --pink: #FF5C8A;

    /* 属性色 */
    --t-grass: #7AC74C;
    --t-fire: #FF7A3C;
    --t-water: #4F8EF7;
    --t-electric: #F7C325;
    --t-psychic: #FF5C8A;
    --t-ghost: #7B62C9;
    --t-dragon: #6F35FC;
    --t-fairy: #F2A1C0;
    --t-steel: #9AA6C4;
    --t-ice: #7FD8D0;
    --t-rock: #C6A96B;
    --t-poison: #B14FA8;
    --t-ground: #E0B36A;
    --t-flying: #8FA8F0;
    --t-bug: #A6B91A;
    --t-dark: #6B6152;
    --t-normal: #A8A77A;

    /* 字体（全部系统字体，无外链） */
    --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
    --font-display: "Arial Black", "Impact", "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "Consolas", "SFMono-Regular", "Courier New", monospace;

    /* 结构 */
    --bd: 3px solid var(--ink);
    --sh-sm: 4px 4px 0 var(--ink);
    --sh: 6px 6px 0 var(--ink);
    --sh-lg: 10px 10px 0 var(--ink);
    --r: 18px;
    --r-sm: 12px;
    --r-lg: 26px;
    --wrap: 1180px;
    --head-h: 74px;
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    padding-top: var(--head-h);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.01em;
    margin: 0 0 0.6em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- 3. 布局原子 ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sec { padding: 76px 0; position: relative; }
.sec--tight { padding: 52px 0; }
.sec--paper { background: var(--paper); }
.sec--cream { background: linear-gradient(180deg, var(--cream) 0%, var(--paper) 100%); }
.sec--ink { background-color: var(--ink); background-image: none; color: #E9ECFF; }
.sec--red {
    background-color: var(--red-d);
    background-image: linear-gradient(160deg, var(--red) 0%, var(--red-d) 100%);
    color: #fff;
}

.dots {
    background-image: radial-gradient(rgba(20,22,46,0.14) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
}
.sec--ink.dots {
    background-image: radial-gradient(rgba(255,255,255,0.13) 1.5px, transparent 1.5px);
    background-size: 20px 20px;
}
.stripes {
    background-image: repeating-linear-gradient(45deg,
        rgba(255,203,5,0.22) 0 16px, transparent 16px 32px);
}
.sec--red.stripes {
    background-color: var(--red-d);
    background-image: repeating-linear-gradient(45deg,
        rgba(255,203,5,0.20) 0 16px, transparent 16px 32px),
        linear-gradient(160deg, var(--red) 0%, var(--red-d) 100%);
    color: #fff;
}

.grid { display: grid; gap: 22px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

@media (max-width: 1000px) {
    .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 660px) {
    .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
    .sec { padding: 54px 0; }
}

/* ---------- 4. 标题组 ---------- */
.sec-head { margin-bottom: 40px; }
.sec-head--center { text-align: center; }
.sec-head__tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--red);
    background: rgba(238,21,21,0.10);
    border: 2px solid var(--red);
    border-radius: 999px;
    padding: 3px 14px;
    margin-bottom: 14px;
}
.sec--ink .sec-head__tag { color: var(--yellow); background: rgba(255,203,5,0.12); border-color: var(--yellow); }

.sec-head__title {
    font-size: clamp(1.7rem, 4.2vw, 2.6rem);
    margin: 0 0 10px;
    position: relative;
    display: inline-block;
}
.sec-head__title mark {
    background: linear-gradient(180deg, transparent 58%, var(--yellow) 58%);
    color: inherit;
    padding: 0 2px;
}
.sec-head__sub { color: var(--ink-3); margin: 0; font-size: 1.02rem; }
.sec--ink .sec-head__sub { color: #AEB6E0; }

/* 图鉴式标签头（章节小标题） */
.tab-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--red);
    color: #fff;
    border: var(--bd);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 8px 20px 10px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    box-shadow: 4px -4px 0 rgba(20,22,46,0.12);
}
.tab-title + * { margin-top: 0; }

/* ---------- 5. 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 900;
    padding: 13px 28px;
    border: var(--bd);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
    box-shadow: var(--sh-sm);
    transition: transform .14s ease, box-shadow .14s ease, background .2s ease;
    white-space: nowrap;
}
.btn:hover { transform: translate(-2px,-2px); box-shadow: var(--sh); }
.btn:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }

.btn--red { background: var(--red); color: #fff; }
.btn--yellow { background: var(--yellow); color: var(--ink); }
.btn--blue { background: var(--blue); color: #fff; }
.btn--ink { background: var(--ink); color: #fff; }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--cream); box-shadow: var(--sh-sm); }
.btn--sm { padding: 9px 20px; font-size: 0.9rem; }
.btn--lg { padding: 16px 38px; font-size: 1.12rem; }
.btn--block { width: 100%; }

/* ---------- 6. 顶栏导航 ---------- */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 90;
    height: var(--head-h);
    background: var(--paper);
    border-bottom: var(--bd);
    transition: box-shadow .25s ease, background .25s ease;
}
.site-header.is-scrolled { box-shadow: 0 8px 0 rgba(20,22,46,0.10); }
.site-header__inner {
    height: var(--head-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand__logo {
    width: 42px; height: 42px;
    border: var(--bd);
    border-radius: 12px;
    object-fit: cover;
    background: var(--cream);
    box-shadow: 3px 3px 0 var(--ink);
}
.brand__name {
    font-family: var(--font-display);
    font-size: 1.28rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.01em;
}
.brand__tag {
    display: inline-block;
    margin-left: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    vertical-align: 3px;
    background: var(--yellow);
    color: var(--ink);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 1px 8px;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
    padding: 8px 15px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.96rem;
    border: 2px solid transparent;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.nav a:hover { background: var(--cream); transform: translateY(-2px); }
.nav a.is-active {
    background: var(--yellow);
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
}

.nav-toggle {
    display: none;
    width: 46px; height: 46px;
    border: var(--bd);
    border-radius: 12px;
    background: var(--yellow);
    box-shadow: var(--sh-sm);
    font-size: 1.15rem;
    color: var(--ink);
}

.mobile-nav {
    display: none;
    border-bottom: var(--bd);
    background: var(--paper);
    padding: 14px 0 20px;
}
.mobile-nav.is-open { display: block; }
.mobile-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    background: var(--white);
    font-weight: 700;
    margin-bottom: 10px;
    box-shadow: 3px 3px 0 var(--ink);
}
.mobile-nav a.is-active { background: var(--yellow); }
.mobile-nav a i { width: 20px; text-align: center; color: var(--red); }

@media (max-width: 1000px) {
    .nav { display: none; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
}
@media (min-width: 1001px) {
    .mobile-nav { display: none !important; }
}

/* ---------- 7. 精灵球 ---------- */
.pokeball {
    position: relative;
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 3px solid var(--ink);
    background: linear-gradient(180deg, var(--red) 0 46%, #fff 46% 54%, #fff 54% 100%);
    overflow: hidden;
    flex: none;
}
.pokeball::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 14px; height: 14px;
    background: #fff;
    border: 3px solid var(--ink);
    border-radius: 50%;
}
.pokeball--lg { width: 74px; height: 74px; }
.pokeball--sm { width: 30px; height: 30px; border-width: 2px; }
.pokeball--sm::after { width: 8px; height: 8px; border-width: 2px; }
.pokeball--float { animation: float 3.4s ease-in-out infinite; }
.pokeball--spin::after { animation: none; }
.pokeball--spin { animation: spin 6s linear infinite; }

@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 8. 首屏 ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--ink);
    color: #fff;
    padding: 66px 0 78px;
}
.hero__deco { position: absolute; inset: 0; pointer-events: none; }
.hero__deco .dots-layer {
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.10) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
}
.hero__deco .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.5;
}
.hero__deco .blob.b1 { width: 320px; height: 320px; background: radial-gradient(circle, rgba(238,21,21,0.55), transparent 68%); top: -120px; right: -60px; }
.hero__deco .blob.b2 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(59,76,202,0.5), transparent 68%); bottom: -120px; left: -80px; }
.hero__deco .blob.b3 { width: 220px; height: 220px; background: radial-gradient(circle, rgba(255,203,5,0.4), transparent 68%); top: 42%; left: 44%; }
.hero__deco .ball-ghost {
    position: absolute; right: 6%; top: 12%;
    opacity: 0.14; transform: rotate(-12deg);
}
.hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.06fr 0.94fr;
    gap: 46px;
    align-items: center;
}
@media (max-width: 940px) {
    .hero__inner { grid-template-columns: 1fr; gap: 34px; }
}

.hero__kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--yellow);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 4px 14px;
    box-shadow: 3px 3px 0 rgba(255,255,255,0.35);
    margin-bottom: 20px;
}
.hero__title {
    font-size: clamp(2.3rem, 6.4vw, 4.3rem);
    line-height: 1.04;
    margin: 0 0 16px;
    color: #fff;
    text-shadow: 4px 4px 0 var(--red-d), 8px 8px 0 rgba(0,0,0,0.28);
}
.hero__title span { color: var(--yellow); }
.hero__sub { font-size: clamp(1rem, 2.2vw, 1.16rem); color: #C9CFF2; max-width: 560px; margin-bottom: 20px; }
.hero__chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.hero__btns { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.hero__meta {
    display: flex; flex-wrap: wrap; gap: 22px;
    font-size: 0.9rem; color: #9AA3D6;
    font-family: var(--font-mono);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero__meta i { color: var(--yellow); }

/* 掌机机身 */
.device {
    background: var(--paper);
    border: var(--bd);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.42);
    transform: rotate(1.4deg);
}
.device__top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 6px 12px;
}
.device__lamp { display: flex; gap: 6px; }
.device__lamp i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); display: block; }
.device__lamp i:nth-child(1) { background: var(--red); }
.device__lamp i:nth-child(2) { background: var(--yellow); }
.device__lamp i:nth-child(3) { background: var(--t-grass); }
.device__name { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--ink-3); }
.device__screen {
    position: relative;
    border: var(--bd);
    border-radius: 14px;
    overflow: hidden;
    background: var(--ink);
    aspect-ratio: 16 / 10;
}
.device__screen img { width: 100%; height: 100%; object-fit: cover; }
.device__screen::after {
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
    pointer-events: none;
    mix-blend-mode: multiply;
}
.device__foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 6px 0;
    font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
}
.device__keys { display: flex; gap: 6px; }
.device__keys i { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-2); display: block; }

/* ---------- 9. 属性色片 ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 5px 13px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
}
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; border: 2px solid var(--ink); }
.chip--grass { background: var(--t-grass); color: var(--ink); }
.chip--fire { background: var(--t-fire); color: var(--ink); }
.chip--water { background: var(--t-water); color: #fff; }
.chip--electric { background: var(--t-electric); color: var(--ink); }
.chip--psychic { background: var(--t-psychic); color: #fff; }
.chip--ghost { background: var(--t-ghost); color: #fff; }
.chip--dragon { background: var(--t-dragon); color: #fff; }
.chip--fairy { background: var(--t-fairy); color: var(--ink); }
.chip--steel { background: var(--t-steel); color: var(--ink); }
.chip--ice { background: var(--t-ice); color: var(--ink); }
.chip--rock { background: var(--t-rock); color: var(--ink); }
.chip--poison { background: var(--t-poison); color: #fff; }

/* ---------- 10. 卡片 ---------- */
.card {
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r);
    box-shadow: var(--sh);
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translate(-3px,-3px); box-shadow: var(--sh-lg); }
.card__pad { padding: 26px 24px; }
.card__icon {
    width: 62px; height: 62px;
    display: grid; place-items: center;
    font-size: 1.5rem;
    border: var(--bd);
    border-radius: 16px;
    background: var(--cream);
    box-shadow: 4px 4px 0 var(--ink);
    margin-bottom: 16px;
}
.card__title { font-size: 1.18rem; margin: 0 0 8px; }
.card__text { color: var(--ink-3); margin: 0; font-size: 0.96rem; }

.card--grass .card__icon { background: var(--t-grass); }
.card--fire .card__icon { background: var(--t-fire); }
.card--water .card__icon { background: var(--t-water); color: #fff; }
.card--electric .card__icon { background: var(--t-electric); }
.card--psychic .card__icon { background: var(--t-psychic); color: #fff; }
.card--ghost .card__icon { background: var(--t-ghost); color: #fff; }
.card--dragon .card__icon { background: var(--t-dragon); color: #fff; }
.card--fairy .card__icon { background: var(--t-fairy); }
.card--steel .card__icon { background: var(--t-steel); }
.card--ice .card__icon { background: var(--t-ice); }

.card__stripe { height: 8px; background: var(--red); border-bottom: var(--bd); }
.card--grass .card__stripe { background: var(--t-grass); }
.card--fire .card__stripe { background: var(--t-fire); }
.card--water .card__stripe { background: var(--t-water); }
.card--electric .card__stripe { background: var(--t-electric); }
.card--psychic .card__stripe { background: var(--t-psychic); }
.card--ghost .card__stripe { background: var(--t-ghost); }
.card--dragon .card__stripe { background: var(--t-dragon); }
.card--fairy .card__stripe { background: var(--t-fairy); }
.card--steel .card__stripe { background: var(--t-steel); }
.card--ice .card__stripe { background: var(--t-ice); }

/* ---------- 11. 数据 / HP 条 ---------- */
.stat-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 18px;
}
@media (max-width: 760px) { .stat-board { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.stat {
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r);
    box-shadow: var(--sh);
    padding: 20px 18px;
    text-align: center;
}
.stat__num {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1;
    color: var(--red);
}
.stat__label { font-size: 0.85rem; color: var(--ink-3); margin-top: 8px; font-weight: 700; }

.hp { display: flex; align-items: center; gap: 10px; }
.hp__track {
    flex: 1;
    height: 14px;
    background: var(--cream-2);
    border: 2px solid var(--ink);
    border-radius: 999px;
    overflow: hidden;
}
.hp__fill { height: 100%; background: var(--t-grass); }
.hp__fill--mid { background: var(--yellow); }
.hp__fill--low { background: var(--red); }
.hp__val { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; }

/* ---------- 12. 兑换码票券 ---------- */
.code-card {
    position: relative;
    border: var(--bd);
    border-radius: var(--r);
    background: var(--ink);
    color: #fff;
    box-shadow: var(--sh);
    overflow: hidden;
}
.code-card__top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(255,255,255,0.07);
    border-bottom: 2px dashed rgba(255,255,255,0.28);
}
.code-card__badge {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 11px;
    border-radius: 999px;
    border: 2px solid currentColor;
}
.code-card__date { font-family: var(--font-mono); font-size: 11px; color: #9BA2CE; }
.code-card__body { padding: 18px; text-align: center; }
.code-card__code {
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 3.4vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--yellow);
    user-select: all;
    word-break: break-all;
}
.code-card__meta { font-size: 0.85rem; color: #A8AFDA; margin: 10px 0 14px; }
.code-card__copy {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-display);
    padding: 10px 22px;
    border: 3px solid var(--ink);
    border-radius: 999px;
    background: var(--yellow);
    color: var(--ink);
    box-shadow: 4px 4px 0 rgba(255,255,255,0.28);
    font-size: 0.92rem;
    transition: transform .14s ease, box-shadow .14s ease;
}
.code-card__copy:hover { transform: translate(-2px,-2px); }
.code-card__copy:active { transform: translate(3px,3px); box-shadow: none; }
.code-card__copy.is-done { background: var(--t-grass); }

/* ---------- 13. 步骤 ---------- */
.steps { display: grid; gap: 16px; }
.step {
    display: flex; gap: 16px; align-items: flex-start;
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r-sm);
    padding: 18px 20px;
    box-shadow: var(--sh-sm);
}
.step__no {
    flex: none;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    font-family: var(--font-display);
    background: var(--red);
    color: #fff;
    border: var(--bd);
    border-radius: 50%;
}
.step p { margin: 0; padding-top: 4px; }

/* ---------- 14. 提示条 ---------- */
.notice {
    border: var(--bd);
    border-left-width: 9px;
    border-radius: var(--r-sm);
    background: var(--cream);
    color: var(--ink);
    padding: 18px 22px;
    box-shadow: var(--sh-sm);
}
.notice--warn { background: #FFF0C9; border-color: var(--ink); }
.notice--info { background: #E7F0FF; }
.notice h4 { margin: 0 0 8px; font-size: 1.02rem; }
.notice ul li { position: relative; padding-left: 20px; margin-bottom: 6px; }
.notice ul li::before { content: "▸"; position: absolute; left: 0; color: var(--red); font-weight: 900; }

/* ---------- 15. 图库 ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.gallery__item {
    border: var(--bd);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--sh);
    background: var(--ink);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
}
.gallery__item:hover { transform: translate(-3px,-3px) rotate(-1deg); box-shadow: var(--sh-lg); }
.gallery__item img { width: 100%; height: 168px; object-fit: cover; }

/* ---------- 16. 文章卡片 ---------- */
.art-card {
    display: flex; flex-direction: column;
    position: relative;
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--sh);
    height: 100%;
    transition: transform .16s ease, box-shadow .16s ease;
}
.art-card:hover { transform: translate(-3px,-3px); box-shadow: var(--sh-lg); }
.art-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.art-card__img { width: 100%; height: 190px; object-fit: cover; border-bottom: var(--bd); }
.art-card__body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.art-card__cat {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    background: var(--yellow);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 2px 10px;
    margin-bottom: 12px;
}
.art-card__title { font-size: 1.1rem; margin: 0 0 10px; }
.art-card__excerpt { color: var(--ink-3); font-size: 0.92rem; flex: 1; margin: 0 0 16px; }
.art-card__foot {
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
    border-top: 2px dashed var(--cream-2);
    padding-top: 12px;
}
.art-card__go { font-family: var(--font-display); color: var(--red); font-size: 0.88rem; }

/* ---------- 17. 文章正文页 ---------- */
.layout { display: grid; grid-template-columns: minmax(0,1fr) 336px; gap: 30px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.post {
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r);
    box-shadow: var(--sh);
    overflow: hidden;
}
.post__head { padding: 28px 30px 22px; border-bottom: 2px dashed var(--cream-2); background: linear-gradient(160deg, var(--cream) 0%, var(--paper) 100%); }
.post__title { font-size: clamp(1.5rem, 3.6vw, 2.05rem); margin: 0 0 14px; }
.post__meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.post__body { padding: 30px; }
.post__body > p { font-size: 1.02rem; color: #2A2E52; }
.post__lead { font-size: 1.08rem !important; color: var(--ink) !important; border-left: 6px solid var(--yellow); padding-left: 16px; }
.post__body h3 {
    display: inline-block;
    font-size: 1.16rem;
    margin: 34px 0 14px;
    padding: 6px 16px;
    background: var(--red);
    color: #fff;
    border: var(--bd);
    border-radius: 10px;
    box-shadow: 4px 4px 0 rgba(20,22,46,0.16);
}
.post__body h4 { font-size: 1.04rem; margin: 24px 0 10px; }
.post__body img { border: var(--bd); border-radius: var(--r-sm); box-shadow: var(--sh-sm); margin: 6px 0 20px; }
.post__body ul { margin: 0 0 18px; }
.post__body ul li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.post__body ul li::before { content: "●"; position: absolute; left: 2px; color: var(--red); font-size: 0.7rem; top: 0.45em; }
.post__body strong { background: linear-gradient(180deg, transparent 62%, var(--yellow) 62%); padding: 0 2px; }
.post__body a { color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.post__body .text-muted { color: var(--ink-3) !important; }
.post__body hr { border: none; border-top: 2px dashed var(--cream-2); margin: 26px 0; }
.post__sign { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); border-top: 2px dashed var(--cream-2); padding-top: 16px; margin-top: 26px; }
.post__foot { padding: 0 30px 26px; }

/* 侧栏 */
.aside { display: flex; flex-direction: column; gap: 22px; position: sticky; top: calc(var(--head-h) + 18px); }
@media (max-width: 980px) { .aside { position: static; } }
.widget {
    background: var(--white);
    color: var(--ink);
    border: var(--bd);
    border-radius: var(--r);
    box-shadow: var(--sh-sm);
    overflow: hidden;
}
.widget__title {
    display: flex; align-items: center; gap: 9px;
    font-family: var(--font-display);
    font-size: 1rem;
    margin: 0;
    padding: 13px 18px;
    background: var(--ink);
    color: #fff;
}
.widget__title i { color: var(--yellow); }
.widget__body { padding: 16px 18px; }
.widget__list li { margin-bottom: 12px; }
.widget__list li:last-child { margin-bottom: 0; }
.widget__list a {
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.5;
    padding-bottom: 12px;
    border-bottom: 2px dotted var(--cream-2);
}
.widget__list li:last-child a { border-bottom: none; padding-bottom: 0; }
.widget__list a::before { content: "▸"; color: var(--red); font-weight: 900; }
.widget__list a:hover { color: var(--red); }

.mini-code {
    background: var(--ink);
    border-radius: var(--r-sm);
    padding: 13px 15px;
    margin-bottom: 12px;
    border: 2px solid var(--ink);
}
.mini-code:last-child { margin-bottom: 0; }
.mini-code__code { font-family: var(--font-mono); font-weight: 700; color: var(--yellow); font-size: 1rem; letter-spacing: 0.08em; }
.mini-code__desc { font-size: 0.82rem; color: #A8AFDA; margin-top: 3px; }

.contact-line { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.contact-line:last-child { margin-bottom: 0; }
.contact-line i {
    flex: none;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 2px solid var(--ink);
    border-radius: 10px;
    background: var(--cream);
    color: var(--red);
}
.contact-line b { display: block; font-size: 0.88rem; }
.contact-line small { color: var(--ink-3); }

/* 面包屑 */
.crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-bottom: 18px; }
.crumbs a:hover { color: var(--red); }
.crumbs span { margin: 0 7px; opacity: 0.6; }

/* ---------- 18. 分页 ---------- */
.pager { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 40px; }
.pager a, .pager span {
    min-width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border: var(--bd);
    border-radius: 12px;
    background: var(--white);
    color: var(--ink);
    font-family: var(--font-display);
    box-shadow: 3px 3px 0 var(--ink);
    padding: 0 12px;
}
.pager a:hover { background: var(--cream); }
.pager .is-current { background: var(--red); color: #fff; }
.pager .is-disabled { opacity: 0.45; box-shadow: none; }

/* ---------- 19. 表格 ---------- */
.itable { width: 100%; border-collapse: separate; border-spacing: 0; border: var(--bd); border-radius: var(--r-sm); overflow: hidden; font-size: 0.94rem; color: var(--ink); }
.itable th, .itable td { padding: 12px 14px; text-align: left; border-bottom: 2px solid var(--cream-2); }
.itable th { background: var(--ink); color: #fff; font-family: var(--font-display); }
.itable tr:last-child td { border-bottom: none; }
.itable tbody tr:nth-child(even) { background: #FFFBF0; }

/* ---------- 20. 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 800; margin-bottom: 7px; font-size: 0.94rem; }
.field input, .field textarea, .field select {
    width: 100%;
    padding: 12px 15px;
    border: var(--bd);
    border-radius: var(--r-sm);
    background: var(--white);
    font-family: inherit;
    font-size: 0.98rem;
    color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,76,202,0.18); }
.field textarea { min-height: 140px; resize: vertical; }

/* ---------- 21. 底栏 ---------- */
.site-footer { background: var(--ink); color: #C7CDF0; border-top: var(--bd); padding: 58px 0 0; position: relative; overflow: hidden; }
.site-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.15fr; gap: 34px; }
@media (max-width: 1000px) { .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 30px; } }
@media (max-width: 620px) { .site-footer__grid { grid-template-columns: 1fr; gap: 26px; } }
.site-footer h5 { color: #fff; font-size: 1.02rem; margin: 0 0 16px; }
.site-footer a { color: #C7CDF0; }
.site-footer a:hover { color: var(--yellow); }
.fcol { display: flex; flex-direction: column; gap: 11px; }
.site-footer__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.site-footer__brand img { width: 44px; height: 44px; border: 3px solid #fff; border-radius: 12px; }
.site-footer__brand span { font-family: var(--font-display); font-size: 1.25rem; color: #fff; }
.site-footer__about { font-size: 0.92rem; color: #9BA2CE; max-width: 40ch; }
.footer-bar {
    margin-top: 44px;
    border-top: 2px solid rgba(255,255,255,0.12);
    padding: 20px 0;
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #8A91C4;
}

/* ---------- 22. 浮层 ---------- */
.toast {
    position: fixed;
    left: 50%; bottom: 28px;
    transform: translate(-50%, 130%);
    display: flex; align-items: center; gap: 10px;
    background: var(--ink);
    color: #fff;
    border: var(--bd);
    border-radius: 999px;
    padding: 12px 24px;
    box-shadow: var(--sh-sm);
    z-index: 400;
    transition: transform .32s cubic-bezier(.2,.9,.3,1.2);
    font-weight: 700;
    max-width: calc(100vw - 32px);
}
.toast.is-show { transform: translate(-50%, 0); }
.toast i { color: var(--t-grass); }

.lightbox {
    position: fixed; inset: 0;
    z-index: 500;
    display: grid; place-items: center;
    background: rgba(20,22,46,0.9);
    padding: 24px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img {
    max-width: min(1100px, 94vw);
    max-height: 86vh;
    border: var(--bd);
    border-radius: var(--r-sm);
    box-shadow: 10px 10px 0 rgba(0,0,0,0.5);
}
.lightbox__close {
    position: absolute; top: 20px; right: 22px;
    width: 50px; height: 50px;
    border: var(--bd);
    border-radius: 50%;
    background: var(--yellow);
    color: var(--ink);
    font-size: 1.3rem;
    box-shadow: var(--sh-sm);
}

.to-top {
    position: fixed; right: 22px; bottom: 26px;
    width: 50px; height: 50px;
    display: grid; place-items: center;
    border: var(--bd);
    border-radius: 14px;
    background: var(--yellow);
    color: var(--ink);
    box-shadow: var(--sh-sm);
    z-index: 300;
    opacity: 0; visibility: hidden;
    transform: translateY(14px);
    transition: all .25s ease;
}
.to-top.is-show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { transform: translate(-2px,-2px); }

/* ---------- 23. 滚动显隐 ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
.reveal[data-d="5"] { transition-delay: .40s; }

/* ---------- 24. 通用工具 ---------- */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 26px; }
.mb-2 { margin-bottom: 14px; }
.mb-3 { margin-bottom: 26px; }
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.mono { font-family: var(--font-mono); }
.tag-dot { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.tag-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--t-grass); }
.hr-dash { border: none; border-top: 2px dashed var(--cream-2); margin: 26px 0; }

/* ---------- 25. 无障碍 / 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; }
}
