/* 开源游戏 — 列表页样式
 * 颜色 / 圆角 / 阴影全部走核心 --mn-* 变量，跟随主题与圆角设置。
 */

.og-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 24px;
}

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

.og-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
    color: var(--mn-text);
}

.og-sub {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--mn-text-muted);
}

.og-badge {
    flex: 0 0 auto;
    padding: 4px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--mn-primary);
    background: var(--mn-primary-subtle);
    border-radius: 999px;
    white-space: nowrap;
}

.og-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.og-search {
    width: 100%;
    max-width: 360px;
}

.og-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.og-tab {
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--mn-text);
    background: var(--mn-bg-card);
    border: 1px solid var(--mn-border);
    border-radius: 999px;
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.og-tab:hover {
    color: var(--mn-primary);
    border-color: var(--mn-primary);
}

.og-tab.is-active {
    color: #fff;
    background: var(--mn-primary);
    border-color: var(--mn-primary);
}

.og-tab:focus-visible {
    outline: 2px solid var(--mn-primary);
    outline-offset: 2px;
}

.og-count {
    margin: 14px 0 10px;
    font-size: 13px;
    color: var(--mn-text-muted);
}

.og-count b {
    color: var(--mn-text);
}

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

.og-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    color: var(--mn-text);
    background: var(--mn-bg-card);
    border: 1px solid var(--mn-border);
    border-radius: var(--mn-radius-lg, 10px);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.og-card:hover {
    color: var(--mn-text);
    border-color: var(--mn-primary);
    box-shadow: var(--mn-shadow-sm);
    transform: translateY(-2px);
}

.og-card:focus-visible {
    outline: 2px solid var(--mn-primary);
    outline-offset: 2px;
}

.og-card[hidden] {
    display: none;
}

.og-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--mn-bg-body);
}

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

.og-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    font-size: 16px;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    border-radius: 50%;
    opacity: 0;
    transition: opacity .16s ease;
}

.og-card:hover .og-play,
.og-card:focus-visible .og-play {
    opacity: 1;
}

.og-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 12px;
}

.og-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.og-desc {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--mn-text-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.og-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}

.og-tags > span {
    padding: 1px 7px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--mn-text-muted);
    border: 1px solid var(--mn-border-light);
    border-radius: 999px;
}

.og-empty {
    padding: 24px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--mn-text-muted);
    text-align: center;
    border: 1px dashed var(--mn-border);
    border-radius: var(--mn-radius-lg, 10px);
}

.og-foot {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--mn-text-muted);
}

@media (max-width: 860px) {
    .og-wrap {
        padding: 14px 14px 18px;
    }

    .og-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 560px) {
    .og-title {
        font-size: 20px;
    }

    .og-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .og-body {
        padding: 9px;
    }

    .og-desc {
        display: none;
    }
}

/* ---------- 页内游戏容器 ---------- */

body.og-modal-open {
    overflow: hidden;
}

.og-modal {
    width: min(1200px, 96vw);
    height: min(820px, 92vh);
    height: min(820px, 92dvh);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
    color: #fff;
    background: #000;
    border: 1px solid var(--mn-border);
    border-radius: var(--mn-radius-lg, 10px);
}

.og-modal[open] {
    display: flex;
    flex-direction: column;
}

.og-modal::backdrop {
    background: rgba(0, 0, 0, .66);
}

.og-modal:fullscreen {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
}

.og-modal-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: #14161a;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.og-modal-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.og-modal-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.og-modal-btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: var(--mn-radius, 8px);
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease;
}

.og-modal-btn:hover {
    background: rgba(255, 255, 255, .18);
}

.og-modal-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.og-modal-close {
    background: #d64545;
    border-color: #d64545;
}

.og-modal-close:hover {
    background: #c03a3a;
    border-color: #c03a3a;
}

.og-modal-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #000;
}

.og-frame {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
    border: 0;
}

.og-modal-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #bbb;
    background: #000;
    pointer-events: none;
}

.og-modal-stage.is-loaded .og-modal-loading {
    display: none;
}

/* 浏览器不支持 Fullscreen API 时的页内沉浸模式 */
.og-modal.is-immersive {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
}

.og-modal.is-immersive .og-modal-bar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0));
    border-bottom: 0;
}

@media (max-width: 720px) {
    .og-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .og-modal-bar {
        padding-right: max(10px, env(safe-area-inset-right));
        padding-left: max(10px, env(safe-area-inset-left));
    }

    .og-modal-title {
        font-size: 13px;
    }

    .og-modal-btn {
        min-height: 38px;
        padding: 0 10px;
    }
}
