/* 社区 / 书库 首页：新中式极简 App 风（仅作用于首页，不改详情页） */
:root {
    --app-bg: #F7F6F3;
    --app-ink: #292622;
    --app-muted: #8C857C;
    --app-line: #ECE8E1;
    --app-main: #A33B32;
    --app-main-deep: #8B2C25;
    --app-card: #FFFFFF;
}

body.community-v3,
body.books-v3 {
    background: var(--app-bg);
    padding-top: 0 !important;
    margin: 0;
    overflow-x: clip !important;
    overflow-y: visible !important;
}

body.community-v3 .navbar,
body.books-v3 .navbar,
body.community-v3 .site-watermark,
body.books-v3 .site-watermark {
    display: none !important;
}

body.community-v3 .content,
body.books-v3 .content {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

body.community-v3 .footer,
body.books-v3 .footer {
    margin-top: 0 !important;
}

.sq-community-home,
.sq-books-home {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 0 14px 96px;
    box-sizing: border-box;
    min-height: 100vh;
    color: var(--app-ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- 沉浸式顶部 ---------- */
.sq-community-home .sq-hero,
.sq-books-home .sq-hero {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 -14px;
    padding: 18px 16px 17px;
    border-radius: 0 0 20px 20px;
    color: #fff;
    background: linear-gradient(135deg, #A33B32 0%, #8B2C25 58%, #7B2621 100%);
    box-shadow: 0 8px 24px rgba(85, 35, 28, .16);
    overflow: hidden;
}

.sq-community-home .sq-hero::before,
.sq-books-home .sq-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .09;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='120'%3E%3Cg fill='none' stroke='%23fff' stroke-width='.8'%3E%3Ccircle cx='30' cy='38' r='18'/%3E%3Ccircle cx='30' cy='38' r='26'/%3E%3Cpath d='M0 75 Q45 54 90 75 T180 75'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 180px 120px;
}

.sq-community-home .sq-hero > *,
.sq-books-home .sq-hero > * {
    position: relative;
    z-index: 1;
}

.sq-community-home .hero-title,
.sq-books-home .hero-title {
    margin: 0 0 4px;
    font-size: 23px;
    line-height: 1.25;
    letter-spacing: 1px;
    font-weight: 700;
    color: #fff;
}

.sq-community-home .hero-sub,
.sq-books-home .hero-sub {
    margin: 0;
    font-size: 10.5px;
    line-height: 1.45;
    letter-spacing: .35px;
    color: rgba(255, 247, 235, .72);
}

.sq-community-home .hero-score,
.sq-books-home .hero-score {
    min-width: 0;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    text-decoration: none;
}

.sq-community-home .hero-score b,
.sq-books-home .hero-score b {
    display: inline;
    font-size: 15px;
    line-height: 1;
    color: #FFF3D8;
}

.sq-community-home .hero-score span,
.sq-books-home .hero-score span {
    font-size: 10px;
    line-height: 1;
    color: rgba(255, 247, 235, .72);
    white-space: nowrap;
}

.sq-community-home .sq-hero .hero-score a {
    color: #8B2C25 !important;
    background: #FFF8F0;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-decoration: none;
}

.sq-books-home .hero-score .coin {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #E9C98F;
    color: #8B2C25;
    font-size: 10px;
    font-weight: 700;
}

/* ---------- 签到条 ---------- */
.sq-community-home .sq-checkin {
    margin: 14px 0 0;
    padding: 12px 13px;
    border: 0;
    border-radius: 16px;
    background: #FFF9EE;
    box-shadow: 0 3px 12px rgba(87, 57, 32, .05);
}

.sq-community-home .sq-checkin b {
    margin-bottom: 2px;
    font-size: 13.5px;
    color: var(--app-main);
}

.sq-community-home .sq-checkin span {
    font-size: 10.5px;
    line-height: 1.5;
    color: #91877A;
}

.sq-community-home .ck-btn {
    flex: none;
    padding: 8px 13px;
    border-radius: 999px;
    background: var(--app-main);
    color: #fff;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(163, 59, 50, .18);
}

.sq-community-home .ck-btn:disabled {
    background: #E9E3D9;
    color: #9B9286;
    box-shadow: none;
}

.sq-community-home .sq-notice {
    margin-top: 10px;
    border: 0;
    border-radius: 12px;
    background: #FFF6E2;
    color: #8E6A30;
    font-size: 11px;
    padding: 8px 11px;
}

/* ---------- 分类 ---------- */
.sq-community-home .sq-cats,
.sq-books-home .sq-cats {
    display: flex;
    gap: 8px;
    margin: 13px -14px 0;
    padding: 0 14px 3px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.sq-community-home .sq-cats::-webkit-scrollbar,
.sq-books-home .sq-cats::-webkit-scrollbar {
    display: none;
}

.sq-community-home .sq-cats .cat,
.sq-books-home .sq-cats .cat {
    flex: none;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--app-line);
    background: #fff;
    color: #81786D;
    font-size: 12px;
    line-height: 18px;
    text-decoration: none;
    white-space: nowrap;
}

.sq-community-home .sq-cats .cat.on,
.sq-books-home .sq-cats .cat.on {
    border-color: var(--app-main);
    background: var(--app-main);
    color: #fff;
    font-weight: 600;
}

/* ---------- 工具条 / FAB ---------- */
.sq-community-home .sq-tools {
    position: relative;
    margin: 15px 0 11px;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
}

.sq-community-home .sq-tools .sorts {
    display: flex;
    gap: 19px;
    font-size: 12px;
}

.sq-community-home .sq-tools .sorts a {
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    color: #8C857C;
    text-decoration: none;
}

.sq-community-home .sq-tools .sorts a.on {
    border-color: var(--app-main);
    color: var(--app-main);
    font-weight: 600;
}

.sq-community-home .btn-publish {
    position: fixed;
    right: max(18px, calc((100vw - 430px) / 2 + 18px));
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 80;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-main);
    color: #fff !important;
    font-size: 27px;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(163, 59, 50, .3);
    text-decoration: none;
}

.sq-community-home .btn-publish:active {
    transform: scale(.94);
}

.sq-community-home .btn-publish .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- 帖子卡片 ---------- */
.sq-community-home .post-card {
    display: block;
    margin: 0 0 12px;
    padding: 14px 14px 12px;
    border: 0;
    border-radius: 18px;
    background: var(--app-card);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(53, 44, 34, .055);
}

.sq-community-home .post-card:active {
    background: #FDFCFA;
}

.sq-community-home .post-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.sq-community-home .post-head .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #F0EBE4;
}

.sq-community-home .post-head .nick {
    font-size: 12px;
    color: #5E5851;
    font-weight: 500;
}

.sq-community-home .post-head .time {
    margin-left: auto;
    font-size: 10px;
    color: #A8A198;
}

.sq-community-home .post-card > div:nth-child(2) {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 1px;
}

.sq-community-home .chip {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 18px;
}

.sq-community-home .chip-cat {
    background: #F4EFE8;
    color: #80654B;
}

.sq-community-home .chip-bounty {
    border: 0;
    background: #FFF0EE;
    color: var(--app-main);
}

.sq-community-home .chip-chart {
    background: #EEF4FA;
    color: #46749A;
}

.sq-community-home .post-title {
    margin: 7px 0 5px;
    font-size: 15px;
    line-height: 1.48;
    font-weight: 700;
    color: #2D2924;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sq-community-home .post-excerpt {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.65;
    color: #817A72;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sq-community-home .post-foot {
    display: flex;
    gap: 18px;
    margin: 0;
    padding-top: 9px;
    border-top: 1px solid #F4F1EC;
    color: #A49D94;
    font-size: 10px;
}

.sq-community-home .post-foot span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sq-community-home .post-foot svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sq-community-home .empty-box {
    margin-top: 14px;
    padding: 44px 0;
    border-radius: 18px;
    background: #fff;
    color: #A69E93;
    font-size: 12px;
    box-shadow: 0 4px 16px rgba(53, 44, 34, .04);
}

.sq-community-home .sq-pager {
    margin: 15px 0 6px;
    font-size: 11px;
}

.sq-community-home .sq-pager a,
.sq-community-home .sq-pager span {
    margin: 0 3px;
    padding: 5px 10px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: #fff;
    color: #8C857C;
    text-decoration: none;
}

.sq-community-home .sq-pager .cur {
    border-color: var(--app-main);
    background: var(--app-main);
    color: #fff;
}

/* ---------- 书库 ---------- */
.sq-books-home .book-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    margin: 14px 0 0;
}

.sq-books-home .book-card {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(53, 44, 34, .06);
}

.sq-books-home .book-card .cover {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: #EFE6D9;
}

.sq-books-home .book-card .cover-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    padding: 16px;
    box-sizing: border-box;
    background: linear-gradient(145deg, #A33B32 0%, #8B2C25 62%, #77251F 100%);
    color: #F9EAD4;
    font-family: "Songti SC", "STSong", serif;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    letter-spacing: 1.5px;
}

.sq-books-home .book-card .info {
    padding: 10px 10px 11px;
}

.sq-books-home .book-card .t {
    margin: 0 0 3px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 700;
    color: #2D2924;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sq-books-home .book-card .a {
    margin: 0;
    min-height: 28px;
    font-size: 10.5px;
    line-height: 1.5;
    color: #9B9388;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sq-books-home .book-card .cost {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 7px;
    font-size: 10px;
    line-height: 1.35;
    color: var(--app-main);
    white-space: nowrap;
}

.sq-books-home .book-card .cost svg {
    width: 12px;
    height: 12px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sq-books-home .empty-box {
    grid-column: 1 / -1;
    margin-top: 2px;
    padding: 54px 0;
    border-radius: 16px;
    background: #fff;
    color: #A69E93;
    font-size: 12px;
    text-align: center;
}

.sq-books-home .sq-pager {
    margin: 17px 0 4px;
    font-size: 11px;
}

.sq-books-home .sq-pager a,
.sq-books-home .sq-pager span {
    margin: 0 3px;
    padding: 5px 10px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: #fff;
    color: #8C857C;
    text-decoration: none;
}

.sq-books-home .sq-pager .cur {
    border-color: var(--app-main);
    background: var(--app-main);
    color: #fff;
}


/* 书库补齐用的“整理中”经典书目卡片 */
.sq-books-home .book-card.demo {
    position: relative;
}

.sq-books-home .book-card.demo .cover-ph.demo-cover {
    position: relative;
    display: block;
    padding: 0;
    background-color: #8B2C25;
    background-size: cover;
    background-position: center;
}

.sq-books-home .book-card.demo .cover-ph.demo-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(39, 22, 17, .06) 0%, rgba(39, 22, 17, 0) 38%, rgba(39, 22, 17, .16) 100%);
}

.sq-books-home .book-card.demo .demo-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 2;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 248, 236, .9);
    color: #8B2C25;
    font-size: 9px;
    line-height: 16px;
    letter-spacing: .5px;
}

.sq-books-home .book-card.demo .cost {
    color: #9B9388;
}

/* ---------- 底部导航 ---------- */
body.community-v3 .tabbar,
body.books-v3 .tabbar {
    border-top: 1px solid #ECE8E1;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -6px 20px rgba(53, 44, 34, .04);
    backdrop-filter: blur(10px);
}

body.community-v3 .tabbar-table,
body.books-v3 .tabbar-table {
    max-width: 430px;
}

body.community-v3 .tabbar-table td,
body.books-v3 .tabbar-table td {
    padding: 8px 0 6px;
}

body.community-v3 .tabbar-table td a,
body.books-v3 .tabbar-table td a {
    font-size: 10.5px;
    line-height: 15px;
    color: #9A938A;
}

body.community-v3 .tabbar-table td.on a,
body.books-v3 .tabbar-table td.on a {
    color: var(--app-main);
}

body.community-v3 .tabbar-table .tbico,
body.books-v3 .tabbar-table .tbico {
    width: 21px;
    height: 21px;
    margin-bottom: 2px;
}

/* 小屏收一下间距，保证 375 不挤 */
@media (max-width: 360px) {
    .sq-community-home .hero-title,
    .sq-books-home .hero-title {
        font-size: 21px;
    }
    .sq-community-home .sq-checkin { padding: 11px; }
    .sq-community-home .sq-checkin span { font-size: 10px; }
    .sq-community-home .sq-tools .sorts { gap: 15px; }
    .sq-books-home .book-grid { gap: 10px 8px; }
}

/* 帖子整卡可点，避免文字/图标吞掉移动端 tap */
.sq-community-home .post-card {
  position: relative;
  z-index: 2;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background .12s ease;
}
.sq-community-home .post-card > * {
  pointer-events: none;
}
.sq-community-home .post-card:active {
  transform: scale(.985);
  background: #FBF7F0;
}
