/* ==========================================================================
   Public game library - gallery, vendor space, vendor directory.
   Shared by /public/games, /v/:vendor and /public/spaces. Dark Signal Horizon.
   ========================================================================== */

body {
    min-height: 100dvh;
}

/* ---------- Page head ---------- */
.header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 72px 32px 24px;
    text-align: left;
}
.header h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 3rem);
}
.header p {
    margin: 0;
    color: var(--text-soft);
    font-size: var(--fs-small);
}
.header::after {
    content: "";
    display: block;
    height: 1px;
    margin-top: 28px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(134, 215, 255, 0.35) 30%,
        #86d7ff 50%,
        rgba(134, 215, 255, 0.35) 70%,
        transparent
    );
}

/* language switch floats top-right */
.lang-switch {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 60;
    background: rgba(6, 13, 23, 0.72);
}

/* ---------- Filters ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 32px 8px;
}
.filters select,
.filters input {
    width: auto;
    min-width: 180px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--bg-1);
    color: var(--text);
    font-size: var(--fs-small);
}
.filters input {
    flex: 0 1 260px;
}
.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 2px rgba(134, 215, 255, 0.2);
}

/* ---------- Card grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px 32px 72px;
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--bg-2);
    box-shadow: var(--shadow-1);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-2);
}

.card-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: cover;
    background: var(--bg-0);
    border-bottom: 1px solid var(--line);
}
.card-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
    padding: 16px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-body h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-body .meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.card-body .desc {
    margin: 0;
    font-size: var(--fs-small);
    color: var(--text-soft);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.55em;
}
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}
.card-actions .btn {
    flex: 1;
    padding-left: 10px;
    padding-right: 10px;
}

/* provider label: restrained mono tag */
.provider-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.lock-badge {
    display: inline-flex;
    align-items: center;
    color: var(--text-dim);
}

/* ---------- Buttons (library-specific) ---------- */
.btn-play {
    background: linear-gradient(135deg, #9edfff, #6ec6f5);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-cta);
}
.btn-play:hover {
    color: var(--text-on-accent);
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.btn-play.disabled {
    background: rgba(233, 243, 255, 0.05);
    border: 1px solid var(--line);
    color: var(--text-dim);
    box-shadow: none;
    cursor: not-allowed;
}
.btn-detail {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text-soft);
}
.btn-detail:hover {
    background: var(--accent-dim);
    color: var(--text);
}
.btn-go {
    flex: 0 0 auto;
    width: 42px;
    min-width: 42px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text-soft);
}
.btn-go:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ---------- States ---------- */
.empty-state,
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 16px;
    color: var(--text-dim);
    font-size: var(--fs-small);
}
.empty-state::before {
    content: "";
    display: block;
    width: 26px;
    height: 1px;
    margin: 0 auto 14px;
    background: var(--line-strong);
}

/* ---------- Vendor password modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 8, 14, 0.72);
}
.modal-overlay.show {
    display: flex;
}
.modal {
    width: min(92vw, 380px);
    padding: 28px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line-strong);
    background: var(--bg-1);
    box-shadow: var(--shadow-2);
    text-align: center;
}
.modal h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}
.modal p {
    margin: 0 0 18px;
    color: var(--text-soft);
    font-size: var(--fs-small);
}
.modal input {
    width: 100%;
    margin-bottom: 12px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--bg-0);
    color: var(--text);
}
.modal input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 2px rgba(134, 215, 255, 0.2);
}
.modal-actions {
    display: flex;
    gap: 8px;
}
.modal-actions .btn {
    flex: 1;
}
.modal-error {
    min-height: 1.2em;
    margin-bottom: 8px;
    color: var(--danger);
    font-size: var(--fs-small);
}

/* vendor directory card */
.grid > a.card {
    gap: 10px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
}
.grid > a.card .name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.grid > a.card .meta {
    font-size: var(--fs-small);
    color: var(--text-dim);
}
.grid > a.card .go {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: var(--fs-small);
    font-weight: 600;
}

@media (max-width: 640px) {
    .header,
    .filters,
    .grid {
        padding-left: 20px;
        padding-right: 20px;
    }
    .header {
        padding-top: 48px;
    }
    .filters input {
        flex: 1 1 100%;
    }
}
