/* Общие карточки каталога модулей для главной страницы и /games. */
.module-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin: 0.6rem 0 1.2rem;
}

.modules-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 0 0 1.8rem;
    padding: 0;
}

.modules-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 14px 8px 16px;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-left: 2px solid var(--brass);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.modules-stat-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brass);
}

.modules-stat-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.modules-stat-ready { border-left-color: var(--status-ready); }
.modules-stat-ready .modules-stat-value { color: var(--status-ready); }
.modules-stat-testing { border-left-color: var(--status-testing); }
.modules-stat-testing .modules-stat-value { color: var(--status-testing); }
.modules-stat-dev { border-left-color: var(--status-dev); }
.modules-stat-dev .modules-stat-value { color: var(--status-dev); }

.module-grid .dash-game {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
    min-width: 0;
    transition: transform 0.18s ease, border-color 0.18s ease,
                box-shadow 0.18s ease, background 0.18s ease;
}

.module-grid .dash-game::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--line-brass);
    border-right: 1px solid var(--line-brass);
    opacity: 0.75;
    pointer-events: none;
    z-index: 3;
}

.module-grid .dash-game:hover,
.module-grid .dash-game:focus-visible {
    background: var(--panel-raised);
    border-color: var(--line-brass);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    color: var(--ink);
}

.module-grid .dash-game:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
}

.module-grid .dash-game-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background:
        radial-gradient(circle at 50% 40%, rgba(198, 162, 89, 0.15), transparent 60%),
        linear-gradient(135deg, var(--bg) 0%, var(--panel) 100%);
    border-bottom: 1px solid var(--line-brass);
    overflow: hidden;
    box-sizing: border-box;
}

@supports not (aspect-ratio: 1 / 1) {
    .module-grid .dash-game-cover { height: 280px; }
}

.module-grid .dash-game-cover-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.module-grid .dash-game-cover-inner img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease;
}

.module-grid .dash-game:hover .dash-game-cover-inner img,
.module-grid .dash-game:focus-visible .dash-game-cover-inner img { transform: scale(1.04); }

.module-grid .dash-game-cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brass);
    font-size: 3rem;
    opacity: 0.85;
}

.module-grid .dash-game-cover-emoji {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    background: rgba(20, 18, 14, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid var(--line-brass);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    line-height: 1;
}

.module-grid .dash-game-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 1rem 0.95rem;
    min-width: 0;
    flex: 1 1 auto;
}

.module-grid .dash-game-name {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--ink);
    text-transform: uppercase;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.6em;
}

.module-grid .dash-game-desc {
    font-family: var(--font-body);
    font-size: 0.84rem;
    color: var(--ink-dim);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.9em;
}

.module-grid .dash-game-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.15rem 0 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    line-height: 1.4;
    color: var(--ink-faint);
}
.module-grid .dash-game-last,
.module-grid .dash-game-next {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
}
.module-grid .dash-game-schedule i {
    width: 12px;
    flex: 0 0 12px;
    margin-top: 2px;
    color: var(--brass-dim);
    text-align: center;
}
.module-grid .dash-game-next.is-active { color: var(--status-ready); }
.module-grid .dash-game-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: auto;
    padding: 0.55rem 2.25rem 0 0;
    border-top: 1px dashed var(--line);
    flex-wrap: wrap;
}

.module-grid .dash-game-badge-wrap { display: inline-flex; }

.module-grid .dash-game-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.module-grid .dash-game-id,
.module-grid .dash-game-ver {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    color: var(--ink-faint);
    text-transform: uppercase;
    white-space: nowrap;
}

.module-grid .dash-game-arrow {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(20, 18, 14, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid var(--line-brass);
    color: var(--brass);
    font-size: 0.75rem;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s ease, color 0.2s ease;
    pointer-events: none;
    text-decoration: none;
}

.module-grid .dash-game:hover .dash-game-arrow,
.module-grid .dash-game:focus-visible .dash-game-arrow {
    opacity: 1;
    transform: translateX(0);
    background: var(--brass);
    color: var(--bg);
}

@media (max-width: 1200px) {
    .module-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
    .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-grid .dash-game-name { font-size: 1rem; }
    .module-grid .dash-game-body { padding: 0.75rem 0.9rem 0.85rem; }
}

@media (max-width: 576px) {
    .modules-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .modules-stat { justify-content: center; }
}

@media (max-width: 480px) {
    .module-grid { grid-template-columns: 1fr; }
    .module-grid .dash-game-desc { -webkit-line-clamp: 3; max-height: 4.35em; }
}
