:root {
    --bg:           #0d1117;
    --surface:      #161b22;
    --surface2:     #21262d;
    --border:       #30363d;
    --text:         #e6edf3;
    --muted:        #8b949e;
    --accent:       #58a6ff;
    --green:        #3fb950;
    --red:          #f85149;
    --yellow:       #d29922;
    --radius:       10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 2rem;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.logo-icon { font-size: 1.6rem; }
.logo h1   { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.4px; }

.server-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    font-size: 0.82rem;
    color: var(--muted);
}
.webhost-link {
    color: var(--accent);
    text-decoration: none;
    margin-left: 0.3rem;
    white-space: nowrap;
}
.webhost-link:hover { text-decoration: underline; }

/* ── Status dots ─────────────────────────────────────────────────────── */
.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    background: var(--muted);
    transition: background 0.3s;
}
.dot.online  { background: var(--green); animation: pulse 2s ease-in-out infinite; }
.dot.offline { background: var(--red); }
.dot.idle,
.dot.degraded { background: var(--yellow); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(63, 185, 80, 0.50); }
    50%       { box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); }
}

/* ── Main ────────────────────────────────────────────────────────────── */
main {
    flex: 1;
    max-width: 1100px;
    margin: 2.5rem auto;
    padding: 0 2rem;
    width: 100%;
}

.section-title        { margin-bottom: 1.5rem; }
.section-title h2     { font-size: 1.2rem; font-weight: 600; }
.subtitle             { color: var(--muted); font-size: 0.82rem; margin-top: 0.25rem; }

/* ── Grid ────────────────────────────────────────────────────────────── */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

/* ── Room cards ──────────────────────────────────────────────────────── */
.room-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: border-color 0.2s, transform 0.15s;
}
.room-card:hover                { transform: translateY(-2px); border-color: #4d555e; }
.room-card.online               { border-left-color: var(--green); }
.room-card.offline, .room-card.error { border-left-color: var(--red); }
.room-card.idle                 { border-left-color: var(--yellow); }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-status {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}
.room-card.online  .card-status { color: var(--green); }
.room-card.offline .card-status,
.room-card.error   .card-status { color: var(--red); }
.room-card.idle    .card-status { color: var(--yellow); }

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
}
.card-meta span      { white-space: nowrap; }
.games-tag {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.72rem;
    color: var(--muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    margin-top: auto;
}
.card-link:hover { text-decoration: underline; }

/* ── Loading ─────────────────────────────────────────────────────────── */
.loading-card {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--muted);
    padding: 0.8rem 0.2rem;
    font-size: 0.9rem;
}
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────────── */
.no-rooms {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--muted);
}
.no-rooms p { margin-bottom: 1.2rem; font-size: 0.95rem; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #0d1117;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.88rem;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.2rem;
    font-size: 0.78rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}
footer a            { color: var(--accent); text-decoration: none; }
footer a:hover      { text-decoration: underline; }

/* ── Utilities ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    header { padding: 0.8rem 1rem; }
    main   { padding: 0 1rem; margin: 1.5rem auto; }
    .header-inner { flex-direction: column; align-items: flex-start; }
}
