/* ============================================================
   GameShelf 前台
   所有选择器都在 .gsh 内，容器透明，宽度跟着主题正文走
   ============================================================ */

.gsh {
    --gsh-text: var(--auo-text, #1f2937);
    --gsh-text-2: var(--auo-text-2, #6b7280);
    --gsh-text-3: var(--auo-text-3, #9aa4b2);
    --gsh-surface: var(--auo-surface, #ffffff);
    --gsh-surface-2: var(--auo-surface-2, #f6f8fb);
    --gsh-border: var(--auo-border, #e6eaf1);
    --gsh-accent: var(--auo-accent, #3b82f6);
    --gsh-star: #f5b301;

    position: relative;
    margin: 0 auto;
    padding: 0;
    max-width: 100%;
    color: var(--gsh-text);
    background: transparent;
    word-break: normal;
    overflow-wrap: break-word;
    -webkit-tap-highlight-color: transparent;
}

.gsh *,
.gsh *::before,
.gsh *::after {
    box-sizing: border-box;
}

/* 主题常给正文 a / img / p 加东西，这里统一复位 */
.gsh a {
    color: inherit;
    text-decoration: none !important;
}

.gsh p {
    margin: 0 !important;
}

.gsh img {
    display: block !important;
    max-width: 100%;
    height: auto;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: none !important;
}


/* ---------------- 游戏 / 异色图鉴 切换 ---------------- */

.gsh-archive {
    --gsh-text: var(--auo-text, #1f2937);
    --gsh-text-2: var(--auo-text-2, #6b7280);
    --gsh-text-3: var(--auo-text-3, #9aa4b2);
    --gsh-surface: var(--auo-surface, #ffffff);
    --gsh-surface-2: var(--auo-surface-2, #f6f8fb);
    --gsh-border: var(--auo-border, #e6eaf1);
    --gsh-accent: var(--auo-accent, #3b82f6);

    position: relative;
    margin: 0 auto;
    padding: 0;
    max-width: 100%;
    color: var(--gsh-text);
    background: transparent;
    word-break: normal;
    overflow-wrap: break-word;
    -webkit-tap-highlight-color: transparent;
}

.gsh-archive *,
.gsh-archive *::before,
.gsh-archive *::after {
    box-sizing: border-box;
}

.gsh-archive a {
    color: inherit;
    text-decoration: none !important;
}

.gsh-archive p {
    margin: 0 !important;
}

.gsh-pane[hidden] {
    display: none !important;
}

/* 切换按钮和「推荐游戏」同一行，切到图鉴时顶部不会少一块 */
.gsh-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 16px;
}

.gsh-topbar .gsh-switch {
    margin: 0;
}

.gsh-topbar .gsh-suggest-open {
    margin-left: auto;
}

.gsh-switch {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0 0 16px;
    padding: 3px;
    border: 1px solid var(--gsh-border);
    border-radius: 99px;
    background: var(--gsh-surface-2);
    vertical-align: middle;
}

.gsh-archive .gsh-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gsh-text-2);
    white-space: nowrap;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.gsh-archive .gsh-switch-btn:hover {
    color: var(--gsh-text);
}

.gsh-archive .gsh-switch-btn.is-on {
    background: var(--gsh-surface);
    color: var(--gsh-text);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

@media (max-width: 400px) {
    .gsh-archive .gsh-switch-btn {
        padding: 6px 12px;
        font-size: 12.5px;
    }
}

/* ---------------- 推荐游戏 ---------------- */

.gsh-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 12px;
}

.gsh-suggest-open {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--gsh-border);
    border-radius: 99px;
    background: var(--gsh-surface);
    color: var(--gsh-text-2);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.gsh-suggest-open:hover {
    border-color: #cbd5e1;
    color: var(--gsh-text);
    background: var(--gsh-surface-2);
}

.gsh-note {
    margin: 0 0 14px;
    padding: 9px 14px;
    border-radius: 9px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 12.5px;
}

.gsh-suggest {
    margin: 0 0 16px;
    padding: 14px 16px 16px;
    border: 1px solid var(--gsh-border);
    border-radius: 12px;
    background: var(--gsh-surface-2);
}

.gsh-suggest-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.gsh-suggest label {
    display: block;
    min-width: 0;
}

.gsh-suggest label > span {
    display: block;
    margin-bottom: 5px;
    font-size: 11.5px;
    color: var(--gsh-text-3);
}

.gsh-suggest input[type="text"],
.gsh-suggest input[type="url"],
.gsh-suggest textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gsh-border);
    border-radius: 8px;
    background: var(--gsh-surface);
    color: var(--gsh-text);
    font-size: 13px;
    line-height: 1.5;
    box-shadow: none !important;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.gsh-suggest input:focus,
.gsh-suggest textarea:focus {
    outline: 0;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .14) !important;
}

.gsh-suggest textarea {
    resize: vertical;
    min-height: 70px;
}

.gsh-suggest-wide {
    display: block;
    margin-top: 10px;
}

.gsh-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none;
}

.gsh-suggest-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.gsh-submit {
    padding: 8px 18px;
    border: 0;
    border-radius: 99px;
    background: var(--gsh-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gsh-submit:disabled {
    opacity: .6;
    cursor: default;
}

.gsh-cancel {
    padding: 8px 14px;
    border: 1px solid var(--gsh-border);
    border-radius: 99px;
    background: transparent;
    color: var(--gsh-text-3);
    font-size: 13px;
    cursor: pointer;
}

.gsh-suggest-msg {
    font-size: 12px;
    color: var(--gsh-text-3);
}

.gsh-suggest-msg.is-error {
    color: #dc2626;
}

.gsh-suggest-msg.is-ok {
    color: #047857;
}

/* ---------------- 网格 ---------------- */

.gsh-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (min-width: 400px) {
    .gsh-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 600px) {
    .gsh-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (min-width: 900px) {
    .gsh-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.gsh-grid[hidden],
.gsh-detail[hidden] {
    display: none !important;
}

.gsh-empty {
    grid-column: 1 / -1;
    padding: 26px 0;
    color: var(--gsh-text-3);
    font-size: 13px;
    text-align: center;
}

.gsh-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--gsh-border);
    border-radius: 14px;
    background: var(--gsh-surface);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.gsh-card:hover {
    transform: translateY(-3px);
    border-color: #d7deea;
    box-shadow: 0 14px 28px -20px rgba(15, 23, 42, .45);
}

.gsh-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--gsh-surface-2);
}

.gsh-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform .3s ease;
    /* 让点击落在卡片链接上，别被主题的图片灯箱截走 */
    pointer-events: none;
}

.gsh-card:hover .gsh-cover img {
    transform: scale(1.03);
}

.gsh-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(150deg,
        hsl(var(--gsh-h, 210), 72%, 66%),
        hsl(calc(var(--gsh-h, 210) + 26), 66%, 48%));
}

.gsh-card-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 11px 12px;
    min-width: 0;
}

.gsh-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--gsh-text);
}

.gsh-card-meta {
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--gsh-text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------- 星星 ---------------- */

.gsh-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.gsh-stars.is-empty {
    font-size: 11px;
    color: var(--gsh-text-3);
}

.gsh-star {
    position: relative;
    display: inline-block;
    width: 12px;
    height: 12px;
    background: rgba(148, 163, 184, .35);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.gsh-star-fill {
    position: absolute;
    inset: 0 auto 0 0;
    display: block;
    background: var(--gsh-star);
}

.gsh-score {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 800;
    color: var(--gsh-text);
}

.gsh-score-max {
    margin-left: 1px;
    font-style: normal;
    font-size: 11px;
    color: var(--gsh-text-3);
}

/* ---------------- 详情 ---------------- */

.gsh-detail-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.gsh-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px 6px 9px;
    border: 1px solid var(--gsh-border);
    border-radius: 99px;
    background: var(--gsh-surface);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gsh-text-2);
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.gsh-back:hover {
    border-color: #cbd5e1;
    background: var(--gsh-surface-2);
    color: var(--gsh-text);
}

.gsh-arrows {
    display: flex;
    gap: 6px;
}

.gsh-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--gsh-border);
    border-radius: 50%;
    background: var(--gsh-surface);
    font-size: 16px;
    line-height: 1;
    color: var(--gsh-text-2);
}

.gsh-arrow:hover {
    border-color: #cbd5e1;
    color: var(--gsh-text);
}

.gsh-game {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.gsh-poster {
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--gsh-border);
    background: var(--gsh-surface-2);
}

.gsh-poster > img,
.gsh-poster > .gsh-placeholder {
    pointer-events: none;
    width: 100% !important;
    aspect-ratio: 3 / 4;
    object-fit: cover !important;
    display: block;
    font-size: 40px;
}

.gsh-info {
    min-width: 0;
}

.gsh-title {
    font-size: 21px;
    font-weight: 800;
    line-height: 1.35;
    color: var(--gsh-text);
}

.gsh-sub {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--gsh-text-3);
}

.gsh-rate {
    margin-top: 12px;
}

.gsh-rate .gsh-star {
    width: 15px;
    height: 15px;
}

.gsh-rate .gsh-score {
    font-size: 16px;
}

.gsh-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin: 16px 0 0;
}

.gsh-facts > div {
    min-width: 92px;
}

.gsh-facts dt {
    margin: 0 0 3px;
    font-size: 11px;
    color: var(--gsh-text-3);
}

.gsh-facts dd {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--gsh-text);
}

.gsh-review {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--gsh-border);
    font-size: 13.5px;
    line-height: 1.85;
    color: var(--gsh-text-2);
}

.gsh-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    padding: 8px 16px;
    border-radius: 99px;
    background: var(--gsh-accent);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    transition: opacity .18s ease, transform .18s ease;
}

.gsh-link:hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* 换一个 */

.gsh-more {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--gsh-border);
}

.gsh-more-title {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gsh-text-3);
    letter-spacing: .04em;
}

.gsh-more-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.gsh-more-item {
    flex: none;
    width: 62px;
    text-align: center;
}

.gsh-more-cover {
    display: block;
    width: 62px;
    height: 82px;
    overflow: hidden;
    border: 1px solid var(--gsh-border);
    border-radius: 8px;
    background: var(--gsh-surface-2);
    transition: border-color .18s ease, transform .18s ease;
}

.gsh-more-item:hover .gsh-more-cover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.gsh-more-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.gsh-more-cover .gsh-placeholder {
    font-size: 18px;
}

.gsh-more-name {
    display: block;
    margin-top: 5px;
    font-size: 10.5px;
    line-height: 1.3;
    color: var(--gsh-text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

@media (max-width: 640px) {
    .gsh-grid {
        gap: 10px;
    }

    .gsh-card {
        border-radius: 12px;
    }

    .gsh-card-body {
        padding: 8px 9px 10px;
    }

    .gsh-card-title {
        font-size: 12.5px;
    }

    .gsh-card-meta {
        font-size: 11px;
    }

    .gsh-game {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .gsh-poster {
        max-width: 190px;
    }

    .gsh-title {
        font-size: 18px;
    }

    .gsh-facts {
        gap: 10px 20px;
    }

    .gsh-more-item,
    .gsh-more-cover {
        width: 54px;
    }

    .gsh-more-cover {
        height: 72px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gsh-card,
    .gsh-cover img,
    .gsh-more-cover,
    .gsh-link {
        transition: none;
    }
}
