:root {
    --store-bg: #f4f6f3;
    --store-surface: #ffffff;
    --store-ink: #17201f;
    --store-muted: #687370;
    --store-line: #d9dfdc;
    --store-brand: #0c665e;
    --store-brand-dark: #084b46;
    --store-accent: #b64e37;
    --store-soft: #e7efec;
    --store-page-gutter: clamp(16px, 2vw, 32px);
}

.afsim-storefront,
.afsim-storefront * {
    box-sizing: border-box;
}

.afsim-storefront [hidden] {
    display: none !important;
}

.store-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body {
    min-width: 320px;
    background: var(--store-bg);
    color: var(--store-ink);
    font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

.afsim-storefront {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--store-bg);
    color: var(--store-ink);
}

.store-header {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: 76px;
    display: grid;
    grid-template-columns: minmax(240px, auto) 1fr auto auto;
    align-items: center;
    gap: 24px;
    padding: 9px var(--store-page-gutter);
    border-bottom: 1px solid var(--store-line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}

.store-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--store-ink);
    text-decoration: none;
}

.store-brand:hover,
.store-brand:focus {
    color: var(--store-ink);
}

.store-brand__mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 2px solid var(--store-brand);
    border-radius: 5px;
    color: var(--store-brand);
    font-family: Bahnschrift, "Segoe UI", sans-serif;
    font-size: 18px;
    font-weight: 800;
}

.store-brand__copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.store-brand__kicker {
    color: var(--store-accent);
    font: 800 9px Bahnschrift, "Segoe UI", sans-serif;
    letter-spacing: 0;
    white-space: nowrap;
}

.store-brand__title {
    margin: 0;
    overflow: hidden;
    color: var(--store-ink);
    font: 750 20px/1.15 Bahnschrift, "Microsoft YaHei UI", sans-serif;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-brand__summary {
    overflow: hidden;
    color: var(--store-muted);
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.store-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.store-nav a,
.store-footer a {
    color: var(--store-muted);
    font-size: 14px;
    text-decoration: none;
}

.store-nav a:hover,
.store-nav a:focus,
.store-footer a:hover,
.store-footer a:focus {
    color: var(--store-brand);
}

.store-account {
    position: relative;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-self: end;
    overflow: visible;
    border: 1px solid #cbd5d1;
    border-radius: 6px;
    background: var(--store-surface);
    white-space: nowrap;
}

.store-account > * + * {
    border-left: 1px solid var(--store-line);
}

.store-account__loading,
.store-account__login,
.store-account__profile,
.store-account__credits,
.store-account__checkin,
.store-account__icon {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--store-ink);
    font-size: 13px;
    text-decoration: none;
}

.store-account__loading,
.store-account__login,
.store-account__profile,
.store-account__credits {
    padding: 0 12px;
}

.store-account__checkin {
    min-width: 78px;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    color: var(--store-brand-dark);
    cursor: pointer;
    font-weight: 700;
}

.store-account__checkin:hover,
.store-account__checkin:focus {
    background: var(--store-soft);
    color: var(--store-brand);
}

.store-account__checkin:disabled {
    cursor: default;
    color: var(--store-muted);
}

.store-account__checkin[aria-busy="true"] {
    cursor: wait;
}

.store-account__notice {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    max-width: min(280px, calc(100vw - 28px));
    padding: 7px 10px;
    border: 1px solid #9ac5b6;
    border-radius: 5px;
    background: #f2faf7;
    color: var(--store-brand-dark);
    font-size: 12px;
    font-weight: 650;
    white-space: normal;
}

.store-account__notice[data-error="true"] {
    border-color: #e5b1ad;
    background: #fff4f3;
    color: #9d2d25;
}

.store-account__login {
    gap: 7px;
    background: var(--store-brand);
    color: #ffffff;
    font-weight: 700;
}

.store-account__login:hover,
.store-account__login:focus {
    background: var(--store-brand-dark);
    color: #ffffff;
}

.store-account__profile {
    gap: 8px;
    max-width: 190px;
}

.store-account__avatar {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--store-brand);
    color: #ffffff;
    font-family: Bahnschrift, "Segoe UI", sans-serif;
    font-size: 11px;
    font-weight: 800;
}

.store-account__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.store-account__name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-account__credits {
    background: #eef5f2;
    color: var(--store-brand-dark);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.store-account form {
    margin: 0;
}

.store-account__icon {
    width: 38px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    cursor: pointer;
}

.store-account__icon:hover,
.store-account__icon:focus {
    background: var(--store-soft);
    color: var(--store-brand);
}

.store-account__icon[aria-disabled="true"] {
    cursor: wait;
    opacity: 0.55;
    pointer-events: none;
}

.store-main {
    width: calc(100% - (var(--store-page-gutter) * 2));
    margin: 0 auto;
}

.store-publish {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 0 16px;
    border: 1px solid var(--store-brand);
    border-radius: 5px;
    background: var(--store-brand);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.store-publish:hover,
.store-publish:focus {
    background: var(--store-brand-dark);
    color: #ffffff;
}

.store-resources {
    scroll-margin-top: 92px;
    padding: 32px 0 64px;
}

.store-resources__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.store-resources__header p {
    margin: 0 0 3px;
    color: var(--store-muted);
    font-size: 12px;
}

.store-preview-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    margin-left: 7px;
    padding: 0 7px;
    border: 1px solid rgba(182, 78, 55, 0.28);
    border-radius: 4px;
    background: #f7ece9;
    color: var(--store-accent);
    font-size: 11px;
    font-weight: 700;
}

.store-resources__header h2 {
    margin: 0;
    color: var(--store-ink);
    font-size: 22px;
    font-weight: 750;
    letter-spacing: 0;
}

.store-resources__tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.store-ranking,
.store-order {
    min-height: 40px;
    display: inline-grid;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--store-line);
    border-radius: 5px;
    background: var(--store-surface);
}

.store-ranking {
    grid-template-columns: repeat(3, auto);
}

.store-order {
    grid-template-columns: repeat(2, auto);
}

.store-ranking a,
.store-order a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-right: 1px solid var(--store-line);
    color: var(--store-muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.store-ranking a {
    min-width: 82px;
}

.store-order a {
    min-width: 52px;
}

.store-ranking a:last-child,
.store-order a:last-child {
    border-right: 0;
}

.store-ranking a:hover,
.store-ranking a:focus-visible,
.store-order a:hover,
.store-order a:focus-visible {
    background: var(--store-soft);
    color: var(--store-brand-dark);
}

.store-ranking a[aria-current="page"],
.store-order a[aria-current="true"] {
    background: var(--store-brand);
    color: #ffffff;
}

.store-search {
    width: min(320px, 42vw);
    height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--store-line);
    border-radius: 5px;
    background: var(--store-surface);
    color: var(--store-muted);
}

.store-search:focus-within {
    border-color: var(--store-brand);
    box-shadow: 0 0 0 3px rgba(12, 102, 94, 0.12);
}

.store-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--store-ink);
    font: inherit;
}

.store-search input::placeholder {
    color: #8b9592;
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 18px;
}

.resource-card {
    width: 100%;
    max-width: 460px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--store-line);
    border-radius: 6px;
    background: var(--store-surface);
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.resource-card:hover {
    transform: translateY(-2px);
    border-color: #aebcb7;
    box-shadow: 0 12px 28px rgba(30, 44, 40, 0.08);
}

.resource-card__media {
    aspect-ratio: 16 / 9;
    display: block;
    overflow: hidden;
    border-bottom: 1px solid var(--store-line);
    background: #dfe6e3;
}

.resource-card__media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.resource-card__placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    align-content: center;
    justify-items: center;
    background:
        linear-gradient(135deg, transparent 0 44%, rgba(12, 102, 94, 0.12) 44% 56%, transparent 56% 100%),
        #e8edeb;
    color: var(--store-brand-dark);
    font-family: Bahnschrift, "Segoe UI", sans-serif;
}

.resource-card__placeholder b {
    font-size: 22px;
}

.resource-card__placeholder small {
    margin-top: 2px;
    color: var(--store-muted);
    font-size: 9px;
}

.resource-card__placeholder--jade { background-color: #e3ece8; color: #0c665e; }
.resource-card__placeholder--blue { background-color: #e4eaf2; color: #315d86; }
.resource-card__placeholder--gold { background-color: #f0eadc; color: #806321; }
.resource-card__placeholder--cyan { background-color: #e1edef; color: #236a74; }
.resource-card__placeholder--red { background-color: #f1e4e1; color: #9a4434; }
.resource-card__placeholder--violet { background-color: #eae5ef; color: #665078; }

.resource-card__body {
    padding: 16px;
}

.resource-card__meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    color: var(--store-muted);
    font-size: 11px;
}

.resource-card__rank {
    min-width: 28px;
    color: var(--store-brand);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.resource-card:nth-child(-n+3) .resource-card__rank {
    color: var(--store-accent);
}

.resource-card__author {
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-card h3 {
    margin: 10px 0 7px;
    font-size: 17px;
    line-height: 1.4;
    letter-spacing: 0;
}

.resource-card h3 a,
.resource-card h3 span {
    display: -webkit-box;
    overflow: hidden;
    color: var(--store-ink);
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.resource-card h3 a:hover,
.resource-card h3 a:focus {
    color: var(--store-brand);
}

.resource-card__body > p {
    min-height: 42px;
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--store-muted);
    font-size: 13px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.resource-card__stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: var(--store-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.resource-card__stats time {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid #e7ebe9;
}

.resource-card footer strong {
    color: var(--store-accent);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.resource-card__open {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--store-line);
    border-radius: 4px;
    color: var(--store-brand);
    text-decoration: none;
}

.resource-card__open:hover,
.resource-card__open:focus {
    border-color: var(--store-brand);
    background: var(--store-brand);
    color: #ffffff;
}

.resource-card__preview-label {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--store-line);
    border-radius: 4px;
    color: var(--store-muted);
    font-size: 11px;
    font-weight: 700;
}

.store-pagination {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.store-pagination button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--store-line);
    border-radius: 4px;
    background: var(--store-surface);
    color: var(--store-brand);
    cursor: pointer;
}

.store-pagination button:hover:not(:disabled),
.store-pagination button:focus-visible:not(:disabled) {
    border-color: var(--store-brand);
    background: var(--store-brand);
    color: #ffffff;
}

.store-pagination button:disabled {
    color: #aeb7b4;
    cursor: not-allowed;
}

.store-pagination > span {
    min-width: 72px;
    color: var(--store-muted);
    font-size: 13px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.store-pagination b {
    color: var(--store-ink);
}

.store-empty {
    margin: 28px 0;
    color: var(--store-muted);
    text-align: center;
}

.store-empty--initial {
    min-height: 260px;
    display: grid;
    place-content: center;
    justify-items: center;
    border-block: 1px solid var(--store-line);
}

.store-empty__mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    border: 2px solid #a9b7b2;
    border-radius: 6px;
    color: var(--store-brand);
    font: 800 24px Bahnschrift, "Segoe UI", sans-serif;
}

.store-empty h3 {
    margin: 0 0 10px;
    color: var(--store-ink);
    font-size: 18px;
}

.store-empty a {
    color: var(--store-brand);
}

.store-footer {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: auto;
    padding: 18px var(--store-page-gutter);
    border-top: 1px solid var(--store-line);
    background: #edf0ee;
    color: var(--store-muted);
    font: 700 12px Bahnschrift, "Segoe UI", sans-serif;
}

.store-footer nav {
    display: flex;
    gap: 20px;
}

.store-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .store-header {
        grid-template-columns: minmax(210px, auto) 1fr auto auto;
        gap: 16px;
    }

    .store-nav {
        gap: 16px;
    }

    .store-account__name {
        max-width: 88px;
    }

    .store-resources__header {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .store-resources__tools {
        justify-content: flex-start;
    }

}

@media (max-width: 640px) {
    .store-header {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 10px;
        min-height: 58px;
        padding: 7px 14px;
    }

    .store-nav,
    .store-account__name,
    .store-account__icon {
        display: none !important;
    }

    .store-brand__mark {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        font-size: 16px;
    }

    .store-brand__kicker,
    .store-brand__summary {
        display: none;
    }

    .store-brand__title {
        font-size: 16px;
    }

    .store-publish {
        width: 36px;
        min-height: 36px;
        padding: 0;
    }

    .store-publish span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .store-account {
        border: 0;
        background: transparent;
    }

    .store-account__profile,
    .store-account__login,
    .store-account__loading {
        min-height: 36px;
        border: 1px solid var(--store-line);
        border-radius: 5px;
        background: #ffffff;
        color: var(--store-ink);
    }

    .store-account__profile {
        padding: 0 6px;
        border-radius: 5px 0 0 5px;
    }

    .store-account__credits {
        min-height: 36px;
        padding: 0 9px;
        border-top: 1px solid var(--store-line);
        border-right: 1px solid var(--store-line);
        border-bottom: 1px solid var(--store-line);
        border-radius: 0 5px 5px 0;
        font-size: 12px;
    }

    .store-account__checkin {
        min-width: 68px;
        min-height: 36px;
        padding: 0 7px;
        border: 1px solid var(--store-line);
        border-left: 0;
        font-size: 12px;
    }

    .store-account__login {
        padding: 0 11px;
        border-color: var(--store-brand);
        background: var(--store-brand);
        color: #ffffff;
    }

    .store-main {
        width: calc(100% - 28px);
    }

    .store-resources {
        padding: 24px 0 48px;
    }

    .store-resources__tools {
        align-items: stretch;
        flex-direction: column;
    }

    .store-ranking,
    .store-order {
        width: 100%;
    }

    .store-ranking {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .store-order {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .store-ranking a,
    .store-order a {
        min-width: 0;
        padding-inline: 8px;
    }

    .store-search {
        width: 100%;
    }

    .store-grid {
        grid-template-columns: 1fr;
    }

    .store-footer {
        align-items: flex-start;
        flex-direction: column;
        padding-inline: 14px;
    }
}

@media (max-width: 380px) {
    .store-brand__mark {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .resource-card,
    .resource-card__media img {
        transition: none;
    }
}
