:root {
    --bg-main: #0f111a;
    --bg-card: #1e2130;
    --bg-nav: #161925;
    --text-primary: #ffffff;
    --text-secondary: #9499b7;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --neutral-bg: rgba(148, 153, 183, 0.15);
    --border-color: #2a2e42;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Navigation */
.top-nav {
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* logo left, links right */
}

/* Logo in the top nav: fixed height, width follows the image so it never stretches */
.nav-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logo img {
    display: block;
    height: 56px;
    width: auto;
}

.nav-logo:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.nav-links a.active {
    color: var(--text-primary);
    position: relative;
}

/* The Log out form from the site header, styled as a nav link */
.nav-links form {
    display: flex;
    margin: 0;
}

.nav-links form button,
.nav-links form input[type="submit"] {
    all: unset;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    transition: color 0.2s ease;
}

.nav-links form button:hover,
.nav-links form input[type="submit"]:hover {
    color: var(--text-primary);
}

.nav-links form button:focus-visible,
.nav-links form input[type="submit"]:focus-visible,
.nav-links a:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 2px;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -25px; /* sits on the nav's bottom border (72px nav) */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
}

/* Dashboard Header */
.dashboard-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.dashboard-header {
    margin-bottom: 3rem;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.user-info .account {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.user-info .account strong {
    color: var(--text-primary);
}

.status-alert {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-alert.success {
    background-color: var(--success-bg);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-alert.neutral {
    background-color: var(--neutral-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.status-alert .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

/* Game Card */
.game-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.card-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9; /* matches the thumbnails, so nothing gets cropped */
    position: relative;
    background-color: #232738;
    text-decoration: none;
}

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

.placeholder-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2a2e42 0%, #1e2130 100%);
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-header {
    margin-bottom: 0.75rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.success {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.badge.neutral {
    background-color: var(--neutral-bg);
    color: var(--text-secondary);
}

.badge.demo {
    background-color: rgba(99, 102, 241, 0.15);
    color: #a5a8fb;
}

.badge.locked {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f5b544;
}

.description {
    white-space: pre-line; /* line breaks typed into games.description show as line breaks */
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.btn-play {
    margin-top: auto;
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-play:hover {
    background-color: var(--accent-hover);
}

.btn-play.subscribe {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--accent-color);
}

.btn-play.subscribe:hover {
    background-color: rgba(99, 102, 241, 0.15);
}

.btn-play:focus-visible,
.dashboard-container a:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Links in text and the notices under the grid */
.status-alert a,
.notice a {
    color: #a5a8fb;
    font-weight: 600;
}

.status-alert a:hover,
.notice a:hover {
    color: var(--text-primary);
}

.notice {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 2rem;
}

.notice + .notice {
    margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 1rem;
    }
    .nav-logo img {
        height: 44px;
    }
    .nav-links {
        gap: 1.25rem;
    }
    .dashboard-header h1 {
        font-size: 2rem;
    }
    .dashboard-container {
        margin: 2rem auto;
        padding: 0 1rem;
    }
    .games-grid {
        grid-template-columns: 1fr;
    }
}

/* Featured slider: the welcome header is slide 1, featured games follow */
.featured {
    margin-bottom: 3rem;
}

.featured-track {
    position: relative; /* slides measure their offsetLeft from here */
    display: flex;
    align-items: center;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.featured-track::-webkit-scrollbar {
    display: none;
}

.slide {
    flex: 0 0 100%;
    min-width: 0;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.featured .dashboard-header {
    margin-bottom: 0;
}

.header-image img {
    display: block;
    width: 100%;
    height: auto;
}

.slide-image {
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background-color: #232738;
    text-decoration: none;
}

.slide-image img,
.slide-image .placeholder-bg {
    display: flex;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-label {
    color: #a5a8fb;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.slide-text h2 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.slide-text .badges {
    margin-bottom: 1rem;
}

.slide-text .description {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.slide-text .btn-play {
    display: inline-block;
    width: auto;
    padding: 0.75rem 2.5rem;
}

.featured-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.featured-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.featured-arrow:hover {
    border-color: var(--accent-color);
    background-color: rgba(99, 102, 241, 0.15);
}

.featured-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease, width 0.2s ease;
}

.featured-dot:hover {
    background-color: var(--text-secondary);
}

.featured-dot[aria-current="true"] {
    width: 24px;
    border-radius: 5px;
    background-color: var(--accent-color);
}

.featured-arrow:focus-visible,
.featured-dot:focus-visible,
.category-tab:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Category filter tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-tab {
    padding: 0.5rem 1.1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.category-tab:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.category-tab[aria-pressed="true"] {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.game-card[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .slide {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .slide-text h2 {
        font-size: 1.75rem;
    }
}

/* ---------------- Login page (login.php) ---------------- */

/* Login box under the slider. scroll-margin keeps it clear of the sticky nav when a link jumps to #login. */
.login-panel {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    scroll-margin-top: 96px;
}

.login-panel h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.login-intro {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.error {
    color: #f87171;
    margin-bottom: 1rem;
}

/* Provider buttons (oauth_buttons() wraps each one in a <p>) */
.login-buttons p {
    margin-bottom: 0.75rem;
}

.login-buttons p:last-child {
    margin-bottom: 0;
}

.login-buttons .btn {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: filter 0.2s ease, background-color 0.2s ease;
}

.login-buttons .btn:hover {
    filter: brightness(1.15);
}

.login-buttons .btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.btn-google { background-color: #4285F4; }
.btn-microsoft { background-color: #2F2F2F; border: 1px solid #4a4a4a; }
.btn-facebook { background-color: #1877F2; }
.btn-steam { background-color: #171a21; border: 1px solid #2a475e; }
.btn-steam:hover { background-color: #2a475e; filter: none; }

/* Login lightbox opened from a featured game */
.login-dialog {
    margin: auto;
    padding: 0;
    width: min(92vw, 440px);
    max-height: 90vh;
    overflow: auto;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.login-dialog::backdrop {
    background-color: rgba(5, 6, 12, 0.75);
}

.dialog-inner {
    position: relative;
}

.dialog-image {
    aspect-ratio: 16 / 9;
    background-color: #232738;
}

.dialog-image img,
.dialog-image .placeholder-bg {
    display: flex;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dialog-image [hidden] {
    display: none;
}

.dialog-body {
    padding: 1.5rem;
}

.dialog-body .slide-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.9rem;
}

.dialog-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.dialog-body .badges {
    margin-bottom: 1.25rem;
}

.dialog-close {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: rgba(15, 17, 26, 0.85);
    color: var(--text-primary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.dialog-close:hover {
    border-color: var(--accent-color);
}

.dialog-close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    .login-dialog[open] {
        animation: dialog-in 0.18s ease-out;
    }
    @keyframes dialog-in {
        from { opacity: 0; transform: translateY(8px) scale(0.98); }
        to { opacity: 1; transform: none; }
    }
}

/* Welcome slide on the login page */
.header-text .description {
    margin-bottom: 1.5rem;
}

.header-text .btn-play {
    display: inline-block;
    width: auto;
    padding: 0.75rem 2.5rem;
}

/* Login page extras: LinkedIn button, DF logo, account-deleted message, intro offer */
.btn-linkedin { background-color: #0a66c2; }
.btn-linkedin:hover { background-color: #004182; filter: none; }

.df-logo {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 2rem;
}

.ok {
    color: var(--success-color);
    margin-bottom: 1rem;
}

.login-note a {
    color: #a5a8fb;
    font-weight: 600;
}

.login-note a:hover {
    color: var(--text-primary);
}

.offer {
    max-width: 640px;
    margin: 3rem auto 0;
    text-align: center;
}

.offer-kicker {
    color: #a5a8fb;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.offer h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.offer-main {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.offer-small {
    color: var(--text-secondary);
}

/* Game votes: buttons for players, weighted totals for the admin */
.vote-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.vote-btn {
    flex: 1 1 auto;
    padding: 0.4rem 0.7rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.vote-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.vote-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.vote-group[data-busy] .vote-btn {
    cursor: wait;
}

.vote-like[aria-pressed="true"] {
    background-color: var(--success-bg);
    border-color: var(--success-color);
    color: var(--success-color);
}

.vote-needs_work[aria-pressed="true"] {
    background-color: rgba(250, 204, 21, 0.15);
    border-color: #facc15;
    color: #facc15;
}

.vote-dislike[aria-pressed="true"] {
    background-color: rgba(248, 113, 113, 0.15);
    border-color: #f87171;
    color: #f87171;
}

.vote-totals {
    margin-top: 0.9rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.vt-like { color: var(--success-color); }
.vt-work { color: #facc15; }
.vt-dislike { color: #f87171; }
