/* =========================
   Moss 角色图库
   配色走 style.css 的主题变量，夜 / 樱 / nyaneko / 海 / 昼 都能跟
========================= */

.moss-page {
    min-height: 100svh;
    background: var(--bg-gradient);
    color: var(--text);
}

.moss-main {
    width: min(1480px, calc(100% - 40px));
    margin: 0 auto;
    padding: 34px 0 60px;
    display: grid;
    align-content: start;
    gap: 18px;
}

/* ---------- 顶部 ---------- */

.moss-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.moss-kicker {
    margin: 0 0 6px;
    color: var(--pink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
}

.moss-head h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0.4px;
}

.moss-sub {
    margin: 8px 0 0;
    color: var(--text-sub);
    font-size: 13px;
    line-height: 1.6;
}

.moss-head-stat {
    display: flex;
    gap: 18px;
    color: var(--text-sub);
    font-size: 12px;
}

.moss-head-stat b {
    margin-right: 3px;
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}

/* ---------- 筛选条 ---------- */

.moss-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    backdrop-filter: blur(14px);
}

.moss-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.moss-chip {
    width: auto;
    margin: 0;
    min-height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--tint);
    color: var(--text-sub);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.moss-chip em {
    color: var(--text-sub);
    font-size: 11px;
    font-style: normal;
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.moss-chip:hover {
    color: var(--text);
    border-color: rgba(216, 154, 199, 0.4);
    transform: none;
    box-shadow: none;
}

.moss-chip.is-active {
    color: #fff;
    border-color: rgba(216, 154, 199, 0.6);
    background: linear-gradient(135deg, rgba(139, 127, 209, 0.5), rgba(216, 154, 199, 0.42));
}

.moss-chip.is-active em {
    color: #fff;
    opacity: 0.9;
}

.moss-search {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 280px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--sunken-soft);
}

.moss-search > span {
    color: var(--text-sub);
    font-size: 19px;
    line-height: 1;
}

.moss-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
}

.moss-search input::placeholder {
    color: var(--text-sub);
}

.moss-hint {
    margin: 0;
    color: var(--text-sub);
    font-size: 12px;
}

/* ---------- 卡片网格 ---------- */

.moss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.moss-card {
    margin: 0;
    display: grid;
    gap: 9px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.moss-card:hover,
.moss-card:focus-visible {
    outline: none;
    border-color: rgba(216, 154, 199, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 16px 34px var(--soft-shadow);
}

/* display:grid 会盖掉 hidden 属性自带的 display:none，筛选必须显式关掉 */
.moss-card[hidden] {
    display: none;
}

.moss-thumb {
    position: relative;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    aspect-ratio: 832 / 1216;
}

.moss-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moss-game-tag {
    position: absolute;
    left: 7px;
    top: 7px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(10, 12, 18, 0.66);
    color: #fff;
    font-size: 10.5px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(6px);
}

.moss-card figcaption {
    display: grid;
    gap: 5px;
    padding: 0 3px 3px;
    min-width: 0;
}

.moss-name {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.moss-name b {
    color: var(--text);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.moss-name span {
    color: var(--text-sub);
    font-size: 10.5px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.moss-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.moss-tags span {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--tint);
    color: var(--text-sub);
    font-size: 10px;
    line-height: 1.6;
}

.moss-empty {
    margin: 0;
    padding: 40px 0;
    color: var(--text-sub);
    font-size: 13px;
    text-align: center;
}

.moss-empty code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--tint);
    font-size: 12px;
}

/* ---------- 详情弹窗 ---------- */

.moss-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
}

.moss-modal[hidden] {
    display: none;
}

.moss-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 7, 12, 0.72);
    backdrop-filter: blur(6px);
}

.moss-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 0;
    width: min(1000px, 100%);
    max-height: min(86svh, 900px);
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    backdrop-filter: blur(18px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.moss-modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 3;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(10, 12, 18, 0.6);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.moss-modal-close:hover {
    background: rgba(40, 20, 32, 0.86);
    transform: none;
    box-shadow: none;
}

.moss-modal-media {
    min-width: 0;
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.moss-modal-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: min(86svh, 900px);
    object-fit: contain;
}

.moss-modal-copy {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 22px 20px;
    overflow-y: auto;
}

.moss-modal-copy h2 {
    margin: 0;
    font-size: 22px;
}

.moss-modal-en {
    margin: -8px 0 0;
    color: var(--text-sub);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.moss-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.moss-modal-tags span {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--tint);
    color: var(--text-sub);
    font-size: 11px;
}

.moss-block-label {
    margin: 0 0 6px;
    color: var(--pink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.moss-modal-desc p:last-child {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.75;
    word-break: break-word;
}

.moss-modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.moss-btn {
    width: auto;
    margin: 0;
    min-height: 38px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--tint);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.moss-btn:hover {
    border-color: rgba(216, 154, 199, 0.45);
    background: rgba(216, 154, 199, 0.12);
    color: var(--pink);
    transform: none;
    box-shadow: none;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 900px) {
    .moss-main {
        width: calc(100% - 24px);
        padding: 20px 0 40px;
    }

    .moss-head h1 {
        font-size: 24px;
    }

    .moss-search {
        width: 100%;
    }

    .moss-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .moss-dialog {
        grid-template-columns: 1fr;
        max-height: 88svh;
    }

    .moss-modal-media img {
        max-height: 52svh;
    }
}
