:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --primary: #7c8cf8;
    --primary-hover: #6877f0;
    --secondary: #9ca3af;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --text: #1f2937;
    --text-soft: #6b7280;

    --border: #e5e7eb;

    --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,.08);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.10);

    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;

    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* =========================================
   TOPBAR
========================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;

    background: rgba(255,255,255,.9);
    backdrop-filter: blur(12px);

    border-bottom: 1px solid var(--border);

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 1rem 2rem;
}

.topbar h1 {
    font-size: 1.5rem;
}

.topbar span {
    color: var(--text-soft);
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: .2s;
}

.topbar nav a:hover {
    color: var(--primary);
}

/* =========================================
   LAYOUT
========================================= */

.container {
    max-width: 1400px;
    margin: auto;
    padding: 2rem;
}

.hero {
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: .5rem;
}

.hero p {
    color: var(--text-soft);
}

/* =========================================
   STATS
========================================= */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap: 1rem;

    margin-bottom: 2rem;
}

.stats div {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;

    box-shadow: var(--shadow-sm);
}

.stats strong {
    display: block;
    font-size: 2rem;
    color: var(--primary);
}

.stats span {
    color: var(--text-soft);
}

/* =========================================
   GAMES GRID
========================================= */

.games {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(450px,1fr));
    gap: 1.5rem;
}

/* =========================================
   CARD
========================================= */

.card {
    background: var(--card);
    border-radius: var(--radius);

    padding: 1.5rem;

    box-shadow: var(--shadow-md);

    transition: .25s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    margin-bottom: .25rem;
}

.system {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* =========================================
   BADGES
========================================= */

.card-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.badge,
.level,
.tags span {
    display: inline-flex;
    align-items: center;

    padding: .35rem .8rem;
    border-radius: 999px;

    font-size: .85rem;
}

.badge.open {
    background: #dcfce7;
    color: #166534;
}

.badge.last {
    background: #fef3c7;
    color: #92400e;
}

.badge.full {
    background: #fee2e2;
    color: #991b1b;
}

.level {
    background: #eef2ff;
    color: #4f46e5;
}

/* =========================================
   META
========================================= */

.meta {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: .75rem;

    margin-top: 1rem;
    margin-bottom: 1rem;
}

.meta span {
    background: #f8fafc;
    border: 1px solid var(--border);

    border-radius: 12px;

    padding: .75rem;
}

/* =========================================
   TAGS
========================================= */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;

    margin-top: 1rem;
    margin-bottom: 1rem;
}

.tags span {
    background: #eef2ff;
    color: #4338ca;
}

/* =========================================
   SEATS
========================================= */

.seat-row {
    display: flex;
    justify-content: space-between;

    margin-top: 1rem;
    margin-bottom: .75rem;
}

.bar {
    height: 10px;
    background: #e5e7eb;

    border-radius: 999px;
    overflow: hidden;

    margin-bottom: 1rem;
}

.bar div {
    height: 100%;
    transition: .5s;
}

.bar .open {
    background: var(--success);
}

.bar .last {
    background: var(--warning);
}

.bar .full {
    background: var(--danger);
}

/* =========================================
   FORMS
========================================= */

.signup-form {
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
}

label {
    display: block;
    margin-top: .75rem;
    margin-bottom: .35rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;

    padding: .85rem 1rem;

    border: 1px solid var(--border);
    border-radius: 12px;

    font-size: .95rem;

    background: white;

    transition: .2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124,140,248,.15);
}

/* =========================================
   BUTTONS
========================================= */

.btn,
button {
    border: none;

    padding: .9rem 1.25rem;

    border-radius: 12px;

    cursor: pointer;

    font-weight: 600;

    transition: .2s;
}

.btn.primary,
button {
    background: var(--primary);
    color: white;
}

.btn.primary:hover,
button:hover {
    background: var(--primary-hover);
}

.btn.danger {
    background: var(--danger);
    color: white;
}

/* =========================================
   ALERTS
========================================= */

.notice,
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.notice.ok {
    background: #dcfce7;
    color: #166534;
}

.notice.error,
.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================================
   AUTH
========================================= */

.auth-box {
    max-width: 500px;
    margin: 80px auto;
    padding: 2rem;

    background: white;

    border-radius: var(--radius);

    box-shadow: var(--shadow-lg);
}

/* =========================================
   ADMIN
========================================= */

.admin-list {
    display: grid;
    gap: 1rem;
}

.admin-row {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.row-actions {
    display: flex;
    gap: .5rem;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 900px) {

    .games {
        grid-template-columns: 1fr;
    }

    .meta {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.game-thumbnail {
    width: 100%;
    margin: 0 0 1rem;
    overflow: hidden;
    border-radius: 12px;
    background: #6ab4fd;
    aspect-ratio: 16 / 9;
}

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

