/* ===== Public Instances ===== */

.instances-wrap {
    max-width: 850px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Dark card look */
.world-card {
    background-color: var(--card-bg, #1f1f1f);
    color: var(--card-fg, #f5f5f5);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Two-column grid (image left, list right) with a full-width header row */
.world-grid {
    display: grid;
    grid-template-columns: 240px 1fr; /* ← change 240px to shrink/grow image area */
    column-gap: 1.25rem;
    row-gap: 0.75rem;
    align-items: start;
}

/* Header spans both columns and never wraps */
.world-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 0.25rem;
}

.world-title {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
}

.world-total {
    font-weight: 700;
    color: #d9d9d9;
    opacity: 0.95;
    margin-left: 1rem;
    white-space: nowrap;
}

/* Body: force image left, instances right */
.world-thumb {
    grid-column: 1;
    grid-row: 2;
    background: #2a2a2a;
    border-radius: 0.85rem;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* clip rounded corners */
}
.world-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

/* Instance list (right column) */
.instances-stack {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Instance pill */
.instance-pill {
    display: block;
    text-decoration: none;
    background: #2d2d2d;
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    color: #f5f5f5;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
    transition: background .15s ease-in-out, transform .05s ease;
}

.instance-pill:hover { background: #383838; }
.instance-pill:active { transform: translateY(1px); }

/* flex layout for the pill contents */
.instance-pill-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* left mini pill for player counts */
.player-pill {
    flex-shrink: 0;
    background: #444;
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    min-width: 3.2rem;
    text-align: center;
}

.instance-pill .line1 {
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
}
.instance-pill .line2 {
    font-size: 0.925rem;
    opacity: 0.85;
    line-height: 1.25;
    margin-top: 0.2rem;
}

/* Utilities */
.placeholder { color: #999; }
.muted { opacity: 0.8; }

/* Responsive: stack on small screens */
@media (max-width: 900px) {
    .world-grid {
        grid-template-columns: 1fr;
        row-gap: 0.75rem;
    }
    .world-header { margin-bottom: 0; }
    .world-total { justify-self: start; margin-top: -0.3rem; }
    .world-thumb  { grid-column: 1; grid-row: 2; }
    .instances-stack { grid-column: 1; grid-row: 3; }
}

/* ===== Top info pill (above all worlds) ===== */
.info-pill {
    background: #2a2a2a;
    border-radius: 0.6rem;
    padding: 1rem 1.25rem;
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
    margin-bottom: 1.25rem; /* spacing from first world card */
}

/* ===== Fade transition for auto-refresh ===== */
#instances-container {
    transition: opacity 0.4s ease-in-out;
}

.fade-out {
    opacity: 0;
}

.fade-in {
    opacity: 1;
}
