:root {
    --bg: #f6f9fb;
    --ink: #182033;
    --muted: #667085;
    --line: #d9e2ec;
    --card: #ffffff;
    --accent: #00a874;
    --accent-2: #ffcb2f;
    --pop: #ff6b6b;
    --sky: #4dabf7;
    --grape: #8c6ff7;
    --shadow: 0 12px 26px rgba(20, 32, 45, .10);
}

* {
    box-sizing: border-box;
}

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

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    min-height: 76px;
    padding: 12px clamp(16px, 4vw, 48px);
    background: rgba(255, 255, 255, .95);
    border-bottom: 3px solid #b9e8d9;
    box-shadow: 0 8px 0 rgba(0, 168, 116, .10);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-weight: 900;
    font-size: clamp(20px, 2.2vw, 28px);
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 3px solid #202840;
    border-radius: 8px;
    color: #202840;
    background: var(--accent-2);
    box-shadow: 4px 4px 0 #202840;
    line-height: 1;
}

.nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.nav a,
.langs a {
    padding: 10px 13px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
    background: rgba(255, 255, 255, .64);
    border: 1px solid rgba(236, 225, 204, .8);
}

.langs {
    display: flex;
    gap: 4px;
}

.langs .active,
.nav a:hover {
    color: #172033;
    background: #dff8ee;
    border-color: #8fe8c6;
}

main {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 26px clamp(14px, 3vw, 34px) 52px;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 36%);
    gap: clamp(18px, 4vw, 46px);
    align-items: center;
    overflow: hidden;
    min-height: 300px;
    padding: clamp(24px, 5vw, 54px);
    color: #10182c;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, .18)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, .18) 0 12px, transparent 12px 24px),
        linear-gradient(135deg, #7de3c3 0%, #ffe36c 50%, #ff8c7a 100%);
    border-radius: 8px;
    border: 3px solid #202840;
    box-shadow: 8px 8px 0 #202840;
}

.hero h1 {
    max-width: 820px;
    margin: 8px 0 12px;
    font-size: clamp(38px, 7vw, 92px);
    line-height: .95;
    letter-spacing: 0;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 2px solid #202840;
    border-radius: 8px;
    color: #202840;
    background: #ffffff;
    box-shadow: 3px 3px 0 #202840;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.hero p,
.section-head p,
.content p {
    color: #4b5666;
    max-width: 780px;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 2px solid #202840;
    border-radius: 8px;
    color: #202840;
    background: #ffffff;
    box-shadow: 3px 3px 0 #202840;
    font-weight: 900;
}

.hero-actions a:first-child {
    background: var(--accent-2);
}

.hero-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(58px, 1fr));
    gap: 14px;
    transform: rotate(2deg);
}

.hero-board span {
    aspect-ratio: 1;
    border: 3px solid #202840;
    border-radius: 8px;
    box-shadow: 5px 5px 0 #202840;
    background: #ffffff;
}

.hero-board span:nth-child(1) {
    background: var(--accent-2);
}

.hero-board span:nth-child(2) {
    background: var(--sky);
}

.hero-board span:nth-child(3) {
    background: var(--pop);
}

.hero-board span:nth-child(4) {
    background: var(--grape);
}

.hero-board span:nth-child(5) {
    background: var(--accent);
}

.hero-board span:nth-child(6) {
    background: #ffffff;
}

.ad {
    display: grid;
    place-items: center;
    min-height: 92px;
    border: 2px dashed #e8b33d;
    border-radius: 8px;
    color: #8a631b;
    background: rgba(255, 255, 255, .72);
    font-weight: 800;
}

.ad-wide {
    margin: 20px 0;
}

.section-head {
    margin: 34px 0 18px;
}

.section-head h1,
.section-head h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 42px);
    letter-spacing: 0;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: clamp(14px, 2vw, 20px);
}

.empty-games {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 2px solid #cfe8df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.empty-games strong {
    color: #202840;
    font-size: 18px;
}

.empty-games span {
    color: #4b5666;
    line-height: 1.55;
}

.toc {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    align-items: center;
    margin: 22px 0;
    padding: 16px clamp(14px, 3vw, 22px);
    border: 2px solid #cfe8df;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.toc h2 {
    margin: 0;
    font-size: 18px;
}

.toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 8px;
    color: #245b4c;
    background: #e9f8f2;
    font-weight: 850;
}

.game-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    box-shadow: var(--shadow);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.game-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 2px solid #ffffff;
    border-radius: 8px;
    background: #dfe6ee;
    transition: transform .18s ease;
}

.game-card:hover {
    border-color: #202840;
    transform: translateY(-4px);
    box-shadow: 6px 6px 0 #202840;
}

.game-card:hover img {
    transform: scale(1.025);
}

.game-card strong {
    overflow: hidden;
    color: #202840;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.play-shell,
.content {
    background: var(--card);
    border: 3px solid #202840;
    border-radius: 8px;
    padding: clamp(14px, 3vw, 24px);
    box-shadow: 7px 7px 0 #202840;
}

.game-titlebar {
    display: flex;
    gap: 14px;
    align-items: center;
}

.game-titlebar img {
    border: 3px solid #202840;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 4px 4px 0 #202840;
}

.game-titlebar h1 {
    margin: 0 0 6px;
    font-size: clamp(24px, 4vw, 42px);
}

.game-titlebar a {
    color: var(--accent);
    font-weight: 800;
}

.play-layout {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) minmax(120px, 180px);
    gap: 16px;
}

.game-frame {
    width: 100%;
    min-height: min(68vh, 720px);
    border: 3px solid #202840;
    border-radius: 8px;
    background: #111;
}

.content {
    margin-top: 18px;
}

.seo-content {
    display: grid;
    gap: 18px;
    margin-top: 34px;
}

.seo-content header,
.seo-content section {
    max-width: 980px;
}

.seo-content h2,
.faq h2 {
    margin: 6px 0 10px;
    font-size: clamp(26px, 4vw, 42px);
    letter-spacing: 0;
}

.seo-content h3 {
    margin: 0 0 8px;
    font-size: clamp(21px, 2.5vw, 29px);
    letter-spacing: 0;
}

.seo-content p {
    max-width: 940px;
    margin: 0 0 10px;
}

.eyebrow {
    display: inline-flex;
    color: #007f5a;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.faq {
    display: grid;
    gap: 10px;
}

.faq details {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.faq summary {
    min-height: 48px;
    padding: 13px 15px;
    color: #202840;
    font-weight: 900;
    cursor: pointer;
}

.faq details p {
    margin: 0;
    padding: 0 15px 15px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 28px clamp(16px, 4vw, 48px);
    color: #5b6472;
    font-weight: 800;
}

.admin-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.admin-flash,
.admin-import {
    margin: 18px 0;
    border: 2px solid #8fe8c6;
    border-radius: 8px;
    background: #e9f8f2;
    box-shadow: var(--shadow);
}

.admin-flash {
    padding: 14px 16px;
    color: #175944;
    font-weight: 900;
}

.admin-import {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    padding: 18px;
}

.admin-import h2,
.admin-import p {
    margin: 0;
}

.admin-import p {
    color: #4b5666;
    line-height: 1.55;
}

.admin-import form {
    display: flex;
    gap: 10px;
    align-items: end;
}

.admin-table {
    margin: 28px 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 190px);
}

.login-card {
    display: grid;
    gap: 14px;
    width: min(420px, 100%);
    padding: clamp(20px, 5vw, 34px);
    border: 3px solid #202840;
    border-radius: 8px;
    background: #fff;
    box-shadow: 7px 7px 0 #202840;
}

.login-card h1 {
    margin: 0;
    font-size: clamp(28px, 6vw, 44px);
}

.login-card label {
    display: grid;
    gap: 7px;
    color: #202840;
    font-weight: 900;
}

.login-card input {
    min-height: 46px;
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}

.login-card button,
.admin-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 2px solid #202840;
    border-radius: 8px;
    color: #202840;
    background: var(--accent-2);
    box-shadow: 3px 3px 0 #202840;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border: 2px solid #f2b4b4;
    border-radius: 8px;
    color: #8b1f1f;
    background: #fff1f1;
    font-weight: 800;
}

.seo-form {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 2px solid #202840;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 5px 5px 0 #202840;
}

.seo-form-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.seo-form-title strong {
    color: #202840;
    line-height: 1.25;
}

.seo-form-title span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.seo-form label,
.admin-import label {
    display: grid;
    gap: 6px;
    color: #202840;
    font-size: 13px;
    font-weight: 900;
}

.seo-form input,
.seo-form textarea,
.seo-form button,
.admin-import input,
.admin-import button {
    min-height: 40px;
    width: 100%;
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}

.seo-form textarea {
    resize: vertical;
}

.seo-inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}

.check-row {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 8px !important;
    align-items: center;
    min-height: 40px;
}

.check-row input {
    width: auto;
    min-height: 0;
}

.seo-form button,
.admin-import button {
    border-color: var(--accent);
    color: white;
    background: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 860px) {
    .topbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .hero {
        grid-template-columns: 1fr;
        box-shadow: 5px 5px 0 #202840;
    }

    .hero-board {
        grid-template-columns: repeat(6, minmax(34px, 1fr));
        gap: 8px;
        transform: none;
    }

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

    .seo-form {
        grid-template-columns: 1fr;
    }

    .admin-head,
    .admin-import,
    .admin-import form,
    .seo-inline-fields {
        grid-template-columns: 1fr;
    }

    .admin-import form {
        display: grid;
    }

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

    .ad-side {
        min-height: 72px;
    }
}

@media (max-width: 520px) {
    .game-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .brand-mark {
        width: 34px;
        height: 34px;
        box-shadow: 3px 3px 0 #202840;
    }
}
