:root {
    color-scheme: dark;
    --bg: #0c0f14;
    --surface: #141922;
    --surface-2: #1b2230;
    --border: #2b3443;
    --text: #eef2f7;
    --muted: #9aa7b8;
    --accent: #7aa2ff;
    --accent-strong: #4f7ee8;
    --danger: #e05d67;
    --success: #54c28d;
    --warning: #e6b85c;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(122, 162, 255, .12), transparent 34rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

button,
input,
textarea {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 5vw;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(12, 15, 20, .86);
    backdrop-filter: blur(18px);
}

.brand {
    font-weight: 750;
    letter-spacing: .03em;
}

.site-header nav {
    display: flex;
    gap: 20px;
    color: var(--muted);
}

.site-header nav a:hover {
    color: var(--text);
}

.page {
    width: min(1320px, 92vw);
    margin: 0 auto;
    padding: 56px 0 80px;
}

.site-footer {
    padding: 28px 5vw;
    border-top: 1px solid rgba(255, 255, 255, .06);
    color: var(--muted);
    text-align: center;
    font-size: .9rem;
}

.hero,
.player-heading,
.admin-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 36px;
}

.hero h1,
.player-heading h1,
.admin-heading h1 {
    margin: 4px 0 10px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
}

.hero p,
.player-heading p,
.admin-heading p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--accent) !important;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .18em;
}

.search {
    width: min(420px, 100%);
}

.search > label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(122, 162, 255, .14);
}

input[type="checkbox"] {
    width: auto;
}

button {
    cursor: pointer;
}

.button,
.search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 9px 15px;
    color: var(--text);
    background: var(--surface-2);
    transition: 150ms ease;
}

.button:hover,
.search button:hover {
    transform: translateY(-1px);
    border-color: #48566d;
}

.button.primary,
.search button {
    border-color: transparent;
    color: #fff;
    background: var(--accent-strong);
}

.button.danger {
    color: #ffdce0;
    border-color: rgba(224, 93, 103, .45);
    background: rgba(224, 93, 103, .12);
}

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

.game-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(20, 25, 34, .86);
}

.game-cover {
    display: grid;
    min-height: 180px;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(122, 162, 255, .25), rgba(79, 126, 232, .06)),
        var(--surface-2);
}

.game-cover span {
    display: grid;
    width: 88px;
    height: 88px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 24px;
    font-size: 2.4rem;
    font-weight: 800;
    background: rgba(255, 255, 255, .06);
}

.game-card-body {
    padding: 20px;
}

.game-card h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.game-card p {
    min-height: 48px;
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.55;
}

.meta,
.player-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: .85rem;
}

.player-actions,
.form-actions,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.player-shell {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #07090d;
}

.game-container {
    position: relative;
    width: min(100%, 1180px);
    max-height: 78vh;
    margin: auto;
    overflow: hidden;
    border-radius: 12px;
    background: #101319;
}

.player-status {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
    background: #101319;
}

.player-info {
    margin: 14px 4px 0;
}

.notice {
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.notice.warning {
    color: #ffe4ad;
    border-color: rgba(230, 184, 92, .42);
    background: rgba(230, 184, 92, .10);
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(300px, 440px) 1fr;
    gap: 24px;
    align-items: start;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    background: rgba(20, 25, 34, .88);
}

.panel.narrow {
    width: min(720px, 100%);
}

.panel h2 {
    margin-top: 0;
}

.form-stack {
    display: grid;
    gap: 17px;
}

.form-stack label {
    display: grid;
    gap: 8px;
    color: #d8e0ea;
}

.form-stack small {
    color: var(--muted);
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.check-row {
    display: flex !important;
    align-items: center;
    gap: 10px !important;
}

.section-title,
.title-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title span {
    color: var(--muted);
}

.admin-game-list {
    display: grid;
    gap: 12px;
}

.admin-game {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    background: rgba(255, 255, 255, .018);
}

.admin-game h3 {
    margin: 0;
}

.admin-game p {
    margin: 6px 0;
    color: var(--muted);
}

.admin-game small {
    color: var(--muted);
}

.status {
    border-radius: 999px;
    padding: 4px 9px;
    font-size: .74rem;
}

.status.published {
    color: #baf1d2;
    background: rgba(84, 194, 141, .14);
}

.status.draft {
    color: #c5ceda;
    background: rgba(154, 167, 184, .13);
}

.empty {
    border: 1px dashed var(--border);
    border-radius: 20px;
    padding: 64px 24px;
    color: var(--muted);
    text-align: center;
}

.empty h2 {
    color: var(--text);
}

.empty.compact {
    padding: 30px 20px;
}

@media (max-width: 900px) {
    .hero,
    .player-heading,
    .admin-heading {
        align-items: start;
        flex-direction: column;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 580px) {
    .site-header {
        padding: 0 4vw;
    }

    .site-header nav {
        gap: 12px;
        font-size: .9rem;
    }

    .page {
        width: 92vw;
        padding-top: 34px;
    }

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

    .player-shell {
        padding: 7px;
        border-radius: 14px;
    }
}

.player-status[hidden] {
    display: none !important;
}

.player-status {
    pointer-events: none !important;
}

.player-status[hidden] {
    display: none !important;
}

.game-container ruffle-player {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: auto !important;
}
