/* Basic layout styling */
:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --accent: #2563eb;
    --text: #0f172a;
    --muted: #5b6474;
    --border: #e2e8f0;
    --shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
    --radius: 14px;
    --font-body: 'Sora', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-body);
    background:
        radial-gradient(900px circle at 15% -10%, rgba(219, 234, 254, 0.9), rgba(219, 234, 254, 0)),
        radial-gradient(800px circle at 95% 10%, rgba(254, 243, 199, 0.9), rgba(254, 243, 199, 0)),
        var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.admin-body {
    --bg: #0b0c10;
    --panel: #10131b;
    --accent: #38bdf8;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
    --shadow: 0 10px 30px rgba(0,0,0,0.4);
    background: var(--bg);
    color: var(--text);
}

.tavla-room,
.tavla-lobby {
    --bg: #0b0c10;
    --panel: #10131b;
    --accent: #38bdf8;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
    --shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.admin-sidebar {
    width: 240px;
    background: #0c0f17;
    border-right: 1px solid var(--border);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.admin-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-brand a {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.admin-brand span {
    font-size: 12px;
    color: var(--muted);
}

.admin-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-menu a {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #0f172a;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}

.admin-menu a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-sidebar-footer {
    margin-top: auto;
}

.admin-logout {
    font-size: 13px;
    color: var(--muted);
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 12, 16, 0.9);
    backdrop-filter: blur(8px);
}

.admin-topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-display);
}

.admin-content {
    padding: 24px;
}

.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-page-header h1 {
    margin: 0;
    font-size: 24px;
}

.admin-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 13px;
}

.admin-table th {
    color: var(--muted);
    font-weight: 600;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.inline-form {
    display: inline;
}

.container {
    width: min(1200px, 94vw);
    margin: 0 auto;
    padding: 0 12px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}
.logo {
    display: inline-flex;
    align-items: center;
}
.logo img {
    height: 36px;
    width: auto;
}
.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 14px;
}
.nav a {
    margin-left: 0;
    color: #5b6474;
    font-weight: 600;
}

.admin-bar {
    background: rgba(248, 250, 252, 0.9);
    border-bottom: 1px solid var(--border);
}
.admin-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    flex-wrap: wrap;
}
.admin-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--muted);
}
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-nav a {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text);
}
.admin-nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0 32px;
    margin-top: 40px;
    background: #f1f5f9;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}
.footer-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
}
.footer-links a:hover {
    color: var(--text);
}

.page-header {
    padding: 28px 0 8px;
}
.page-header h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.4px;
    font-family: var(--font-display);
}

h1, h2, h3 {
    font-family: var(--font-display);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 12px 0 24px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 120ms ease, border-color 120ms ease;
}
.card:hover {
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}
.card .card-body {
    padding: 12px 14px 16px;
}
.card h2 {
    font-size: 17px;
    margin: 0 0 6px;
}
.card p {
    margin: 0 0 4px;
}

.auth-card {
    padding: 18px;
    max-width: 520px;
}

.auth-page {
    max-width: 560px;
    margin: 0 auto 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-page .page-header {
    text-align: center;
}

.auth-page .page-header p {
    margin-left: auto;
    margin-right: auto;
}

.auth-page .auth-card {
    width: 100%;
    margin: 0 auto;
}

.label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin: 10px 0 6px;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin: 12px 0 10px;
}
.checkbox input {
    margin-top: 3px;
}

.input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
}

.btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.btn.primary {
    border-color: var(--accent);
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #ffffff;
}
.btn.ghost {
    background: transparent;
    border-color: #cbd5f5;
}

.error {
    color: #f87171;
    font-weight: 600;
}
.notice {
    color: #34d399;
    font-weight: 600;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--muted);
}
.pill.paid {
    color: #fcd34d;
    border-color: #f59e0b;
}
.pill.free {
    color: #a7f3d0;
    border-color: #10b981;
}

.thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #e2e8f0;
    display: grid;
    place-items: center;
}
.thumb img, .hero {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-placeholder {
    color: var(--muted);
    font-size: 14px;
}

.game-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    padding-bottom: 32px;
}
.player {
    padding: 0;
    overflow: hidden;
    min-height: 560px;
}
#swf-player {
    width: 100%;
    min-height: 560px;
    background: #0f172a;
}
.player .player-status {
    padding: 12px;
    color: var(--muted);
    font-size: 14px;
}
.player ruffle-player {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 560px;
}

.consent-banner {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(960px, 96vw);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    z-index: 1000;
    backdrop-filter: blur(8px);
}
.consent-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
}
.consent-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
.consent-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.consent-actions .btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}
.consent-actions .btn.primary {
    border-color: var(--accent);
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #ffffff;
}
.consent-actions .btn.ghost {
    background: transparent;
}
.consent-actions .btn:hover {
    opacity: 0.92;
}

.home-hero {
    padding: 30px 0 10px;
}
.hero-inner {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
    align-items: stretch;
}
.hero-content h1 {
    margin: 6px 0 10px;
    font-size: 34px;
    line-height: 1.1;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}
.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 6px;
}
.link-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 8px;
    color: var(--muted);
}
.hero-card {
    padding: 0;
}
.hero-card-inner {
    padding: 18px;
}
.ruleset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.ruleset-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.ruleset-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0c111a;
    color: var(--text);
    text-decoration: none;
    transition: border-color 120ms ease, transform 120ms ease;
}
.ruleset-mini:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.ruleset-mini-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ruleset-mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ruleset-mini-name {
    font-size: 13px;
    font-weight: 600;
}
.ruleset-mini-footer {
    margin-top: 10px;
    font-size: 13px;
}
.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #0c111a;
    color: var(--text);
}
.section {
    padding: 10px 0 16px;
}
.section-header h2 {
    margin: 0 0 4px;
}
.section-header .cta-row {
    margin: 12px 0 0;
}
.rulesets-preview {
    padding-top: 0;
}
.ruleset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.ruleset-card .card-body {
    padding: 14px 16px 18px;
}
.list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}
.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.list li:last-child {
    border-bottom: 0;
}
.actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 700px) {
    .consent-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .consent-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 900px) {
    .ruleset-mini-grid {
        grid-template-columns: 1fr;
    }
}
.game-main .hero {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: 420px;
}
.card.info, .card.side {
    padding: 16px;
}
.meta {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
}
.meta li { margin-bottom: 6px; }

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    .hero-inner {
        grid-template-columns: 1fr;
    }
    .nav {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
