:root {
    --ink: #050911;
    --muted: #666d7a;
    --line: #e8ebf0;
    --panel: #ffffff;
    --soft: #f6f7f9;
    --blue: #0b5cff;
    --red: #ff3e45;
    --gold: #f6c343;
    --navy: #020b1b;
    --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    background: #fff;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    letter-spacing: 0;
}

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

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

img {
    display: block;
    max-width: 100%;
}

.app-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, #fff 0, #f8f9fb 50%, #fff 100%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 5.5rem;
    padding: 0 clamp(1.25rem, 5vw, 2.2rem);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(232, 235, 240, .74);
}

.brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 950;
    line-height: 1;
}

.brand img {
    display: block;
    width: auto;
    max-width: 12rem;
    max-height: 2.7rem;
}

.icon-btn,
.favorite-toggle {
    width: 3.25rem;
    height: 3.25rem;
    border: 0;
    border-radius: 1rem;
    background: transparent;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn i,
.favorite-toggle i {
    font-size: 1.65rem;
}

.favorite-toggle .solid-star {
    display: none;
}

.favorite-toggle span {
    display: none;
}

.favorite-toggle.is-favorited {
    color: var(--gold);
}

.favorite-toggle.is-favorited .regular-star {
    display: none;
}

.favorite-toggle.is-favorited .solid-star {
    display: inline-block;
}

.favorite-toggle.is-favorited span {
    display: none;
}

.favorite-link {
    min-width: 11.9rem;
    height: 3.4rem;
    padding: 0 1.3rem;
    border-radius: .9rem;
    background: var(--navy);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: none;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 17rem;
    padding: 3.2rem clamp(1.5rem, 5vw, 3rem);
    background: #f4f5f7;
    overflow: hidden;
}

.hero h1 {
    margin: 2rem 0 1.2rem;
    font-size: clamp(2.25rem, 7vw, 3.7rem);
    line-height: 1.08;
}

.hero p {
    margin: 0;
    color: #454b55;
    font-size: clamp(1.05rem, 3.4vw, 1.45rem);
    line-height: 1.7;
}

.hero-visual {
    position: relative;
    min-height: 14rem;
}

.hero-panel {
    position: absolute;
    width: 15rem;
    aspect-ratio: 1.48;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid rgba(7, 12, 23, .08);
    box-shadow: 0 20px 38px rgba(15, 23, 42, .14);
    background: #fff;
}

.hero-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-panel:nth-child(1) {
    right: 0;
    top: .2rem;
    transform: rotate(8deg);
}

.hero-panel:nth-child(2) {
    right: 5rem;
    top: 2rem;
    transform: rotate(3deg);
}

.hero-panel:nth-child(3) {
    right: 10.5rem;
    top: 4.2rem;
}

.content {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 2.7rem clamp(1rem, 4vw, 2rem) 7.5rem;
}

.filter-stack {
    display: grid;
    gap: .85rem;
    margin-bottom: 1.4rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-title {
    flex: 0 0 auto;
    padding: 0 .25rem;
    font-size: 1.05rem;
    font-weight: 900;
}

.pill {
    flex: 0 0 auto;
    min-width: 7.3rem;
    height: 4.1rem;
    padding: 0 1.2rem;
    border: 1px solid var(--line);
    border-radius: .72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 1.08rem;
    font-weight: 850;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.pill.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.filter-dropdowns {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.filter-menu {
    min-width: 0;
}

.filter-menu summary {
    height: 3.75rem;
    padding: 0 1.15rem;
    border: 1.5px solid #161b24;
    border-radius: .55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    background: #fff;
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 900;
    list-style: none;
    cursor: pointer;
    box-shadow: 0 6px 13px rgba(15, 23, 42, .08);
}

.filter-menu summary::-webkit-details-marker {
    display: none;
}

.filter-menu summary i {
    font-size: .9rem;
    transition: transform .18s ease;
}

.filter-menu summary span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-menu summary .sort-direction-icon {
    flex: 0 0 auto;
    font-size: .82rem;
    transition: none;
}

.filter-menu[open] summary .summary-chevron {
    transform: rotate(180deg);
}

.filter-options {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + .7rem);
    z-index: 15;
    padding: .65rem 0;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 15px 28px rgba(15, 23, 42, .14);
}

.filter-options a {
    min-height: 3rem;
    padding: 0 1.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #111827;
    font-size: 1rem;
    font-weight: 750;
}

.filter-options a.selected {
    color: #504bff;
}

.filter-options i {
    color: #504bff;
}

.filter-backdrop {
    display: none;
}

.filter-favorite-link {
    display: none;
}

.template-list {
    display: grid;
    gap: 1rem;
}

.template-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.36fr) minmax(16rem, .82fr);
    gap: 1.8rem;
    padding: 1.25rem 1.35rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.template-cover {
    position: relative;
    align-self: stretch;
    min-height: 15.5rem;
    border-radius: .55rem;
    overflow: hidden;
    background: #eef0f4;
}

.template-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-tag {
    display: none;
}

.template-info {
    min-width: 0;
    padding: .9rem 3.6rem .9rem 0;
}

.template-info h2 {
    margin: 1.15rem 0 .7rem;
    font-size: clamp(1.6rem, 5vw, 2.05rem);
    line-height: 1.18;
}

.template-info p {
    min-height: 4.8rem;
    margin: 0 0 1.35rem;
    color: #4d5561;
    font-size: 1.08rem;
    line-height: 1.72;
}

.template-info .template-price {
    display: block;
    margin-bottom: 1.2rem;
    font-size: clamp(2rem, 6vw, 2.7rem);
    line-height: 1;
}

.template-price span {
    font-size: 1em;
}

.template-price {
    color: var(--ink);
}

.template-info small {
    margin-left: .35rem;
    font-size: 1.05rem;
}

.template-card .favorite-toggle {
    position: absolute;
    right: 1.2rem;
    top: 1.35rem;
}

.tag-row {
    display: flex;
    gap: .7rem;
    flex-wrap: wrap;
}

.tag {
    min-height: 2rem;
    padding: .32rem .68rem;
    border-radius: .5rem;
    display: inline-flex;
    align-items: center;
    background: #e8edff;
    color: #164bff;
    font-size: .95rem;
    font-weight: 850;
}

.tag-hot {
    background: #ffe9eb;
    color: #ff3038;
}

.tag-green {
    background: #e5f8e8;
    color: #169127;
}

.primary-btn {
    min-height: 3.55rem;
    border: 0;
    border-radius: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: 0 1.6rem;
    background: var(--navy);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(2, 11, 27, .12);
}

.primary-btn.small {
    min-height: 3.1rem;
    min-width: 10rem;
}

.empty-state {
    padding: 3rem 1rem;
    border: 1px dashed #d8dde6;
    border-radius: 1rem;
    text-align: center;
    color: var(--muted);
    background: #fff;
}

.list-end {
    padding: 1.35rem 0 0;
    color: #9aa0aa;
    text-align: center;
    font-size: .95rem;
    font-weight: 750;
}

.detail-preview {
    padding: 2.8rem clamp(1.4rem, 5vw, 4rem) 1.7rem;
    background: #f4f5f7;
}

.detail-preview-card {
    width: min(100%, 860px);
    margin: 0 auto;
    padding: .35rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 1.2rem;
    background: #fff;
    box-shadow: var(--shadow);
}

.detail-preview-card img {
    width: 100%;
    border-radius: 1rem;
}

.detail-title-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: end;
    margin: 1.6rem 0 1.7rem;
}

.detail-title-row h1 {
    margin: .9rem 0 .8rem;
    font-size: clamp(2.3rem, 8vw, 3.45rem);
    line-height: 1.08;
}

.detail-title-row p {
    margin: 0;
    color: #343b46;
    font-size: 1.25rem;
    line-height: 1.6;
}

.detail-price {
    white-space: nowrap;
    font-size: clamp(3.4rem, 10vw, 4.6rem);
    font-weight: 950;
    line-height: 1;
}

.detail-price small {
    font-size: 1.25rem;
    font-weight: 850;
}

.info-panel {
    margin-bottom: 1.35rem;
    padding: 2rem clamp(1.35rem, 4vw, 2.35rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}

.info-panel h2 {
    margin: 0 0 1.35rem;
    font-size: 1.65rem;
}

.info-panel p {
    margin: 0;
    color: #1e2734;
    font-size: 1.2rem;
    line-height: 1.95;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: .95rem;
}

.feature-icon {
    width: 3.7rem;
    height: 3.7rem;
    flex: 0 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: #fff;
    font-size: 1.45rem;
}

.feature-item strong {
    display: block;
    margin-bottom: .24rem;
    font-size: 1.1rem;
}

.feature-item span {
    color: #596272;
    font-size: .98rem;
}

.bottom-action {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr 5.6rem 5.6rem;
    gap: 1rem;
    padding: 1rem clamp(1.2rem, 4vw, 2.2rem);
    background: rgba(255, 255, 255, .94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.bottom-action .primary-btn {
    min-height: 4.15rem;
    border-radius: .9rem;
    font-size: 1.45rem;
}

.bottom-action .icon-btn,
.bottom-action .favorite-toggle {
    width: 5.6rem;
    height: 4.15rem;
    border: 1px solid var(--line);
    border-radius: .9rem;
    background: #fff;
}

.remove-btn {
    border: 0;
    background: transparent;
    color: #d72f3b;
}

.remove-btn i {
    font-size: 1.1rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 6.6rem;
    z-index: 60;
    transform: translate(-50%, 1rem);
    padding: .8rem 1.15rem;
    border-radius: 999px;
    background: rgba(2, 11, 27, .92);
    color: #fff;
    font-weight: 850;
    opacity: 0;
    pointer-events: none;
    transition: .2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 720px) {
    html {
        font-size: 14px;
    }

    .topbar {
        height: 4.45rem;
        padding-inline: 1rem;
    }

    body.filter-is-stuck .topbar:not(.detail-topbar) {
        opacity: 0;
        transform: translateY(-100%);
        pointer-events: none;
    }

    .brand {
        font-size: 1.8rem;
    }

    .icon-btn,
    .favorite-toggle {
        width: 2.8rem;
        height: 2.8rem;
        border-radius: .8rem;
    }

    .icon-btn i,
    .favorite-toggle i {
        font-size: 1.25rem;
    }

    .favorite-link {
        min-width: 0;
        width: 4.7rem;
        height: 2.7rem;
        padding: .28rem .42rem;
        border-radius: .42rem;
        flex-direction: column;
        gap: .12rem;
        font-size: .72rem;
    }

    .favorite-link i {
        font-size: .95rem;
        line-height: 1;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(10rem, .95fr);
        column-gap: .75rem;
        min-height: 14rem;
        padding: 1.75rem 1rem 1.55rem;
    }

    .hero h1 {
        margin: 1.15rem 0 .75rem;
        font-size: 2.15rem;
        line-height: 1.12;
    }

    .hero p {
        font-size: 1rem;
        line-height: 1.55;
    }

    .hero-visual {
        min-height: 10.8rem;
        margin-top: 0;
    }

    .hero-panel {
        width: 10.4rem;
    }

    .hero-panel:nth-child(1) {
        right: -1.1rem;
        top: .1rem;
    }

    .hero-panel:nth-child(2) {
        right: 2.15rem;
        top: 1.55rem;
    }

    .hero-panel:nth-child(3) {
        right: 5.3rem;
        top: 3rem;
    }

    .content {
        padding-inline: 1rem;
        padding-top: 1.55rem;
    }

    .pill {
        min-width: 5.8rem;
        height: 2.85rem;
        padding: 0 1rem;
        border-radius: .62rem;
        font-size: .95rem;
    }

    .filter-dropdowns {
        position: sticky;
        top: 0;
        z-index: 45;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .55rem;
        margin-bottom: 1rem;
        margin-inline: -1rem;
        padding: .55rem 1rem;
        border: 1px solid transparent;
        border-radius: 0 0 .55rem .55rem;
        background: #fff;
        transition: padding-right .2s ease, border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
    }

    .filter-dropdowns.is-stuck {
        gap: .45rem;
        margin: 0 -1rem 1rem;
        padding: .55rem 6.25rem .55rem 1rem;
        border-color: rgba(232, 235, 240, .9);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 9px 24px rgba(15, 23, 42, .14);
        backdrop-filter: blur(16px);
    }

    .filter-menu summary {
        height: 3.05rem;
        padding: 0 .6rem;
        border-radius: .45rem;
        font-size: 1rem;
        gap: .45rem;
        transition: height .2s ease, padding .2s ease, border-color .2s ease, border-radius .2s ease, font-size .2s ease, box-shadow .2s ease;
    }

    .filter-dropdowns.is-stuck .filter-menu summary {
        height: 2.7rem;
        padding: 0 .55rem;
        border-color: #d5dae3;
        border-radius: .38rem;
        font-size: .9rem;
        box-shadow: none;
    }

    .filter-dropdowns.is-stuck .filter-menu summary i {
        font-size: .78rem;
    }

    .filter-dropdowns.is-stuck .filter-menu summary .sort-direction-icon {
        font-size: .75rem;
    }

    .filter-favorite-link {
        position: absolute;
        right: 1rem;
        top: .55rem;
        width: 4.7rem;
        height: 2.7rem;
        padding: .28rem .42rem;
        border-radius: .42rem;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .12rem;
        background: var(--navy);
        color: #fff;
        white-space: nowrap;
        font-size: .72rem;
        font-weight: 850;
        opacity: 0;
        pointer-events: none;
        transform: translateX(.35rem) scale(.96);
        transition: opacity .18s ease, transform .18s ease;
        box-shadow: none;
    }

    .filter-favorite-link i {
        font-size: .95rem;
        line-height: 1;
    }

    .filter-dropdowns.is-stuck .filter-favorite-link {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0) scale(1);
    }

    .filter-options {
        top: calc(100% + .55rem);
        border-radius: .62rem;
    }

    .filter-options a {
        min-height: 2.75rem;
        padding: 0 1.25rem;
        font-size: .95rem;
    }

    .filter-backdrop {
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(0, 0, 0, .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    body.filter-open .filter-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .template-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "cover"
            "info";
        gap: 0;
        padding: .65rem;
        border-radius: .6rem;
        box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
    }

    .template-cover {
        grid-area: cover;
        min-height: auto;
        aspect-ratio: 100 / 75;
        border-radius: .48rem;
    }

    .cover-tag {
        position: absolute;
        left: .5rem;
        top: .5rem;
        z-index: 2;
        display: inline-flex;
        min-width: 3.25rem;
        height: 1.85rem;
        padding: 0 .65rem;
        border-radius: .24rem;
        align-items: center;
        justify-content: center;
        background: rgba(5, 8, 13, .82);
        color: #fff;
        font-size: 1rem;
        font-weight: 850;
    }

    .template-info {
        grid-area: info;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: .72rem .85rem;
        align-items: center;
        padding: .95rem .25rem .25rem;
        display: grid;
        min-width: 0;
    }

    .template-info h2 {
        grid-column: 1;
        grid-row: 1;
        margin: 0;
        font-size: 18px;
        line-height: 1.2;
    }

    .template-info .tag-row,
    .template-info p {
        display: none;
    }

    .template-info .template-price {
        grid-column: 1;
        grid-row: 2;
        margin-bottom: 0;
        color: var(--ink);
        font-size: 24px;
        font-weight: 950;
        line-height: 1.05;
    }

    .template-info small {
        display: inline-block;
        margin-left: .2rem;
        color: inherit;
        font-size: .82rem;
        font-weight: 800;
    }

    .tag {
        min-height: 1.75rem;
        padding: .24rem .55rem;
        font-size: .82rem;
    }

    .template-info .primary-btn {
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
        min-width: 8.5rem;
        min-height: 2.35rem;
        border: 1.5px solid var(--ink);
        border-radius: .42rem;
        padding: 0 1rem;
        background: #fff;
        color: var(--ink);
        font-size: .94rem;
        box-shadow: none;
    }

    .template-card .favorite-toggle {
        position: static;
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        justify-self: end;
        width: auto;
        min-width: 4.2rem;
        height: 2.55rem;
        gap: .22rem;
        color: #a6aab2;
    }

    .template-card .favorite-toggle span {
        display: inline;
        font-size: .82rem;
        font-weight: 850;
    }

    .template-card .favorite-toggle.is-favorited {
        min-width: 2.55rem;
        color: var(--gold);
    }

    .template-card .favorite-toggle.is-favorited span {
        display: none;
    }

    .template-card .favorite-toggle i {
        font-size: 1.55rem;
    }

    .template-card .remove-btn {
        min-width: 2.55rem;
        gap: 0;
    }

    .detail-title-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: .75rem;
        align-items: end;
    }

    .detail-title-row h1 {
        font-size: 1.8rem;
    }

    .detail-title-row p {
        font-size: 1rem;
    }

    .detail-price {
        font-size: 2.35rem;
    }

    .detail-price small {
        font-size: .98rem;
    }

    .info-panel {
        padding: 1.35rem 1.15rem;
    }

    .info-panel h2 {
        margin-bottom: .9rem;
        font-size: 1.25rem;
    }

    .info-panel p {
        font-size: 1rem;
        line-height: 1.78;
    }

    .feature-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .7rem;
    }

    .feature-icon {
        width: 2.7rem;
        height: 2.7rem;
        font-size: 1.15rem;
    }

    .feature-item {
        gap: .55rem;
    }

    .feature-item strong {
        font-size: 1rem;
    }

    .feature-item span {
        font-size: .78rem;
    }

    .bottom-action {
        grid-template-columns: 1fr 4.4rem 4.4rem;
        gap: .7rem;
    }

    .bottom-action .primary-btn {
        min-height: 3.55rem;
        font-size: 1.05rem;
    }

    .bottom-action .icon-btn,
    .bottom-action .favorite-toggle {
        width: 4.4rem;
        height: 3.55rem;
    }
}
