:root {
    color-scheme: dark;
    --bg: #0f172a;
    --card: #111827;
    --accent: #22d3ee;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --danger: #f87171;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1.25rem 2rem;
    background: rgba(15, 23, 42, 0.9);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.site-header .game-header-toggle {
    display: none;
    position: absolute;
    right: 12px;
    bottom: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 50;
}

.gameplay-view .site-header {
    padding-bottom: 18px;
}

.gameplay-view .site-header .game-header-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gameplay-view .page {
    padding-top: 0;
}

.gameplay-view.header-collapsed .site-header {
    height: 8px;
    padding: 0;
    overflow: hidden;
}

.gameplay-view.header-collapsed .site-header .game-header-toggle {
    bottom: auto;
    top: -6px;
    transform: rotate(180deg);
}

.header-banner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.header-space-image {
    height: 54px;
    width: 360px;
    max-width: 45vw;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.35);
}

.header-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #000;
    animation: headerTitleGlow 7.5s linear infinite;
    padding-left: 1rem;
}

@keyframes headerTitleGlow {
    0% {
        color: #000;
    }
    20% {
        color: #1f2937;
    }
    40% {
        color: #0ea5e9;
    }
    60% {
        color: #22c55e;
    }
    80% {
        color: #f97316;
    }
    100% {
        color: #000;
    }
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.user-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--muted);
}

.balance {
    font-weight: 600;
}

.balance-form {
    display: flex;
    gap: 0.5rem;
}

.balance-form input {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: var(--text);
}

button {
    background: var(--accent);
    color: #0f172a;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

button.ghost,
.ghost {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
}

.page {
    padding: 2rem;
}

.hero {
    margin-bottom: 2rem;
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
}

.game-search {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.game-search-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.game-search input {
    min-width: 220px;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
}

.game-search input::placeholder {
    color: var(--muted);
}

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

.game-card {
    background: var(--card);
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
}

.game-title {
    font-weight: 600;
    text-align: center;
}

.game-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-frame {
    width: 100%;
    height: 75vh;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.game-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--card);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-form input {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: var(--text);
}

.error-box {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.5);
    padding: 0.75rem;
    border-radius: 10px;
    color: #fecaca;
}

.muted {
    color: var(--muted);
}

.admin-hero {
    margin-bottom: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
}

.admin-table th {
    background: rgba(15, 23, 42, 0.6);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--card);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: var(--text);
}

.admin-form textarea {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.admin-form.inline {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 0;
    border: none;
    background: transparent;
}

.admin-form.inline input,
.admin-form.inline select {
    min-width: 140px;
}

.site-footer {
    margin-top: 2rem;
    padding: 1.25rem 2rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
}

.admin-icon-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 0;
}

.admin-icon-preview {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.admin-icon-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.admin-file-input {
    display: none;
}

.admin-panel {
    margin-top: 1.5rem;
    background: var(--card);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}
