:root {
    --rg-green: #52c900;
    --rg-green-dark: #3a9e00;
    --rg-green-darker: #2c7a00;
    --rg-charcoal: #1b1b1f;
    --rg-charcoal-soft: #2a2a30;
    --rg-ink: #14140f;
    --rg-surface: #ffffff;
    --rg-bg: #f4f7ef;
    --rg-muted: #6b7280;
    --rg-border: #e3e8da;
    --rg-radius: 14px;
    --rg-shadow: 0 6px 20px rgba(27, 27, 31, 0.08);
    --rg-shadow-lg: 0 14px 40px rgba(27, 27, 31, 0.16);
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    background-color: var(--rg-bg);
    color: var(--rg-charcoal);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

a {
    color: var(--rg-green-dark);
    text-decoration: none;
}

a:hover {
    color: var(--rg-green-darker);
    text-decoration: underline;
}

h1, h2, h3 {
    color: var(--rg-charcoal);
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* ---------- Focus ---------- */
.btn:focus, .btn:active:focus, a:focus, button:focus, input:focus, textarea:focus, .form-control:focus {
    outline: 3px solid rgba(82, 201, 0, 0.35);
    outline-offset: 2px;
    box-shadow: none;
}

/* ---------- Navbar ---------- */
.site-navbar {
    background: var(--rg-surface);
    border-bottom: 3px solid var(--rg-green);
    box-shadow: var(--rg-shadow);
    padding: 0.5rem 0;
    margin-bottom: 0;
}

.site-logo {
    height: 44px;
    width: auto;
    display: block;
}

.site-navbar .nav-link {
    color: var(--rg-charcoal) !important;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
}

.site-navbar .nav-link:hover {
    color: var(--rg-green-darker) !important;
    background: rgba(82, 201, 0, 0.1);
    text-decoration: none;
}

/* Account area (Sign in / Create account / Log out) */
.navbar-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-account .nav-item {
    display: flex;
    align-items: center;
}

.navbar-account .account-greeting {
    font-weight: 600;
}

.navbar-account .account-logout {
    margin: 0;
}

.navbar-account .btn {
    text-decoration: none;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 999px;
    font-weight: 700;
    padding: 0.5rem 1.25rem;
    border: 2px solid transparent;
    transition: transform 0.05s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.btn:active {
    transform: translateY(1px);
}

.btn-lg {
    padding: 0.7rem 1.6rem;
    font-size: 1.05rem;
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}

.btn-play {
    background: var(--rg-green);
    color: var(--rg-ink);
    box-shadow: 0 4px 0 var(--rg-green-darker);
}

.btn-play:hover {
    background: var(--rg-green-dark);
    color: var(--rg-ink);
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--rg-charcoal);
    border-color: var(--rg-border);
}

.btn-ghost:hover {
    background: rgba(27, 27, 31, 0.05);
    color: var(--rg-charcoal);
    text-decoration: none;
}

.btn-danger {
    background: #e23b3b;
    color: #fff;
    box-shadow: 0 4px 0 #a82626;
}

.btn-danger:hover {
    background: #c93030;
    color: #fff;
}

/* ---------- Status banner ---------- */
.status-banner {
    background: rgba(82, 201, 0, 0.15);
    border: 1px solid var(--rg-green);
    color: var(--rg-green-darker);
    border-radius: var(--rg-radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-weight: 600;
}

/* ---------- Hero ---------- */
.hero {
    background: radial-gradient(circle at 20% 0%, rgba(82, 201, 0, 0.18), transparent 55%),
                linear-gradient(135deg, var(--rg-charcoal), var(--rg-charcoal-soft));
    color: #fff;
    border-radius: var(--rg-radius);
    padding: 3rem 1.5rem;
    margin: 1.5rem 0 2.5rem;
    text-align: center;
}

.hero__inner {
    max-width: 640px;
    margin: 0 auto;
}

.hero__logo {
    height: 72px;
    width: auto;
    background: #fff;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    box-shadow: var(--rg-shadow-lg);
    margin-bottom: 1.5rem;
}

.hero__title {
    color: #fff;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin: 0 0 0.75rem;
}

.hero__subtitle {
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.1rem;
    margin: 0 0 1.75rem;
}

.hero__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Directory ---------- */
.directory {
    margin-bottom: 3rem;
}

.directory__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.directory__header h1,
.directory__header h2 {
    margin: 0;
}

.empty-state {
    background: var(--rg-surface);
    border: 2px dashed var(--rg-border);
    border-radius: var(--rg-radius);
    padding: 2.5rem;
    text-align: center;
    color: var(--rg-muted);
    font-size: 1.1rem;
}

/* ---------- Game grid & cards ---------- */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: var(--rg-surface);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--rg-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rg-shadow-lg);
}

.game-card__media {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--rg-charcoal);
    overflow: hidden;
}

.game-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 3.5rem;
}

.game-card__body {
    padding: 1.1rem 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.game-card__title {
    margin: 0;
    font-size: 1.2rem;
}

.game-card__title a {
    color: var(--rg-charcoal);
}

.game-card__title a:hover {
    color: var(--rg-green-darker);
    text-decoration: none;
}

.game-card__desc {
    margin: 0;
    color: var(--rg-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-card__actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-card__admin {
    display: inline-flex;
    gap: 0.4rem;
}

/* ---------- Game detail ---------- */
.game-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 2rem;
    background: var(--rg-surface);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius);
    padding: 1.5rem;
    box-shadow: var(--rg-shadow);
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .game-detail {
        grid-template-columns: 1fr;
    }
}

.game-detail--compact {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
}

.game-detail__media {
    border-radius: var(--rg-radius);
    overflow: hidden;
    background: var(--rg-charcoal);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-detail__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-detail__desc {
    color: var(--rg-charcoal);
    font-size: 1.05rem;
    line-height: 1.6;
    white-space: pre-line;
}

.game-detail__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

/* ---------- Forms ---------- */
.form-page {
    max-width: 640px;
    margin: 1.5rem auto;
    background: var(--rg-surface);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius);
    padding: 1.75rem;
    box-shadow: var(--rg-shadow);
}

.form-page h1 {
    margin-top: 0;
}

.game-form .form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: block;
}

.form-control {
    width: 100%;
    border: 1px solid var(--rg-border);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--rg-green);
}

.form-hint {
    display: block;
    color: var(--rg-muted);
    margin-top: 0.35rem;
}

.form-preview {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--rg-border);
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.confirm-text {
    font-size: 1.1rem;
}

.text-danger {
    color: #c93030 !important;
}

/* ---------- Legal pages (Privacy / Terms) ---------- */
.legal {
    max-width: 800px;
    margin: 1.5rem auto 2.5rem;
    background: var(--rg-surface);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius);
    padding: 2rem 2.25rem;
    box-shadow: var(--rg-shadow);
    line-height: 1.7;
}

.legal h1 {
    margin-top: 0;
}

.legal h2 {
    font-size: 1.25rem;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

.legal ul {
    padding-left: 1.25rem;
}

.legal li {
    margin-bottom: 0.4rem;
}

.legal__updated {
    color: var(--rg-muted);
    font-size: 0.9rem;
    margin-top: -0.4rem;
}

.legal__disclaimer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rg-border);
    color: var(--rg-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* ---------- Footer ---------- */
.site-footer {
    flex-shrink: 0;
    background: var(--rg-charcoal);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.25rem 0;
    margin-top: 2rem;
}

.site-footer .container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer__logo {
    height: 32px;
    width: auto;
    background: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.site-footer__links {
    display: inline-flex;
    gap: 1rem;
    margin-left: auto;
}

.site-footer a {
    color: var(--rg-green);
}
