/* Base */
:root {
    /* Colors from design system */
    --primary: #F5A623;
    --secondary: #1C1F2A;
    --bg: #10131A;
    --text: #FFFFFF;
    --muted: #CCCCCC;
    --buttonText: #000000;
    --accent: #FFD700;
    --border: #2a2a2f;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: url('images/fon.jpg') center / cover no-repeat fixed, var(--bg);
    color: var(--text);
    line-height: 1.6;
    opacity: 0;
    animation: pageFadeIn 0.5s ease-in forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Let background be visible under hero across pages */
.hero { background: transparent; }

.container {
    width: 100%;
    max-width: 1200px;
    padding: 0 16px;
    margin: 0 auto;
}

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus { left: 8px; top: 8px; background: #fff; color: #000; padding: 8px 12px; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: url('images/header.jpg') center / cover no-repeat, transparent;
    border-bottom: 1px solid var(--border);
}
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: relative;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.brand-logo { 
    width: 28px; height: 28px; 
    background: #222; 
    border: 1px solid var(--border);
    border-radius: 4px;
    object-fit: cover;
}
.brand-name { font-weight: 600; letter-spacing: 0.2px; }

.nav-toggle { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    height: 36px; 
    padding: 0 16px; 
    background: rgba(255,255,255,0.1); 
    color: var(--text); 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    cursor: pointer;
    transition: all .3s ease;
    font-weight: 500;
    position: relative;
    z-index: 100;
}
.nav-toggle:hover {
    background: rgba(255,255,255,0.15);
    border-color: var(--primary);
}
.nav-toggle:active {
    transform: scale(0.98);
}

.site-nav { 
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--secondary);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
    z-index: 99;
}
.site-nav.active {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
}
.site-nav ul { 
    list-style: none; 
    margin: 0; 
    padding: 12px 0; 
    display: flex; 
    flex-direction: column;
    gap: 0;
}
.site-nav li {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.site-nav.active li {
    opacity: 1;
    transform: translateY(0);
}
.site-nav.active li:nth-child(1) { transition-delay: 0.05s; }
.site-nav.active li:nth-child(2) { transition-delay: 0.1s; }
.site-nav.active li:nth-child(3) { transition-delay: 0.15s; }
.site-nav.active li:nth-child(4) { transition-delay: 0.2s; }
.site-nav.active li:nth-child(5) { transition-delay: 0.25s; }
.site-nav a { 
    display: block;
    color: var(--text); 
    text-decoration: none; 
    padding: 12px 20px; 
    border-radius: 0;
    transition: all .2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}
.site-nav a:hover, .site-nav a:focus { 
    background: rgba(245,166,35,0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    padding-left: 24px;
}
.site-nav a[aria-current="page"], .site-nav a.active { 
    color: var(--primary);
    background: rgba(245,166,35,0.15);
    border-left-color: var(--primary);
}

@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .site-nav { 
        position: static;
        display: block;
        max-height: none;
        opacity: 1;
        box-shadow: none;
        border-bottom: none;
        background: transparent;
    }
    .site-nav ul { 
        flex-direction: row;
        gap: 8px;
        padding: 0;
    }
    .site-nav li {
        opacity: 1;
        transform: none;
    }
    .site-nav a {
        padding: 6px 12px;
        border-left: none;
        border-radius: 6px;
    }
    .site-nav a:hover {
        padding-left: 12px;
    }
}

.user-meta { display: none; align-items: center; gap: 6px; margin-left: 8px; }
.user-score-label { color: var(--muted); font-size: 13px; }
.user-score-value { background: #222735; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
@media (min-width: 768px){ .user-meta { display: inline-flex; } }

/* Hero */
.hero { padding: 80px 0; background: transparent; }
.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}
.hero-content h1 { margin: 0 0 10px; font-size: 32px; font-weight: 700; color: var(--text); }
.lead { color: var(--muted); margin: 0 0 16px; }
.hero-actions { display: flex; gap: 10px; }
.btn {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 24px;
    border: none;
    color: var(--buttonText);
    text-decoration: none;
    border-radius: 40px;
    background: var(--primary);
    font-weight: 600;
    transition: all .3s ease;
}
.btn.primary { background: var(--primary); color: var(--buttonText); }
.btn:hover { background: var(--accent); }

.hero-media { border: 1px solid var(--border); border-radius: 12px; background: #131316; min-height: 220px; display: grid; place-items: center; }
.media-img { 
    width: 100%; 
    height: 100%; 
    max-height: 420px; 
    object-fit: cover; 
    border-radius: 12px; 
    transition: transform .35s ease; 
}
.hero:hover .media-img { transform: scale(1.02); }

@media (min-width: 900px){
    .hero { padding: 80px 0; }
    .hero-grid { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 28px; }
    .hero-content h1 { font-size: 44px; }
}

/* Hero title underline reveal */
.hero-content h1::after { content: ""; display: block; width: 0; height: 3px; background: var(--primary); border-radius: 3px; margin-top: 8px; animation: heroLine .5s ease .15s both; }
@keyframes heroLine { from { width: 0; } to { width: 64px; } }

/* Teasers */
.teasers { padding: 80px 0; }
.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px){ .cards { grid-template-columns: repeat(3, 1fr); } }
.card { border: 1px solid var(--border); border-radius: 12px; background: var(--secondary); overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.2); transition: transform .2s ease, box-shadow .2s ease, outline-color .2s ease; outline: 1px solid transparent; }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.28); outline-color: var(--primary); }
.card:focus-within { outline-color: var(--primary); }
.card-img { width: 100%; height: 140px; object-fit: cover; display: block; background: #222; }
.card-body { padding: 12px; }
.card-title { margin: 0 0 6px; font-size: 18px; }
.card-text { margin: 0; color: var(--muted); }

/* Subtle entrance animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.hero-content { animation: fadeUp .4s ease both; }

/* Page load animations */
main {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header {
    animation: slideDown 0.5s ease-out both;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-footer {
    animation: fadeIn 0.6s ease-out 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Section animations */
.section {
    animation: fadeInUp 0.5s ease-out both;
}

.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.2s; }
.section:nth-child(3) { animation-delay: 0.3s; }
.section:nth-child(4) { animation-delay: 0.4s; }

/* Card animations */
.card {
    animation: fadeInScale 0.5s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Game items animation */
.game-item {
    animation: fadeInLeft 0.5s ease-out both;
}

.game-item:nth-child(1) { animation-delay: 0.1s; }
.game-item:nth-child(2) { animation-delay: 0.15s; }
.game-item:nth-child(3) { animation-delay: 0.2s; }
.game-item:nth-child(4) { animation-delay: 0.25s; }

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    body, main, .site-header, .site-footer, .section, .card, .game-item {
        animation: none;
        opacity: 1;
    }
}
.hero-media { animation: fadeUp .5s ease .05s both; }
.cards > .card:nth-child(1) { animation: fadeUp .35s ease .05s both; }
.cards > .card:nth-child(2) { animation: fadeUp .35s ease .1s both; }
.cards > .card:nth-child(3) { animation: fadeUp .35s ease .15s both; }

@media (prefers-reduced-motion: reduce){
    .card, .hero-content, .hero-media, .cards > .card { animation: none !important; transition: none !important; }
}

/* Our Games */
.our-games { padding: 80px 0; border-top: 1px solid var(--border); }
.our-games h2 { margin: 0 0 8px; font-size: 26px; font-weight: 700; }
.games-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
.game-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--secondary); }
.game-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background:#222; }
.game-meta { display: grid; gap: 6px; }
.game-title { margin: 0; font-size: 18px; color: var(--text); font-weight: 600; }
.game-desc { margin: 0; color: var(--muted); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--muted); }

/* Mobile: Image fills card, text overlays */
@media (max-width: 767px) {
    .game-item { 
        position: relative; 
        min-height: 180px; 
        padding: 0; 
        overflow: hidden;
        align-items: flex-end;
        justify-content: flex-start;
    }
    .game-thumb { 
        position: absolute; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        object-fit: cover; 
        border: none; 
        border-radius: 12px; 
        z-index: 1;
    }
    .game-item::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.85) 100%);
        z-index: 2;
        pointer-events: none;
    }
    .game-meta { 
        position: relative; 
        z-index: 3; 
        padding: 16px; 
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .game-title { 
        color: var(--text); 
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
        font-size: 20px;
    }
    .game-desc { 
        color: rgba(255,255,255,0.9); 
        text-shadow: 0 1px 3px rgba(0,0,0,0.5);
        font-size: 14px;
        line-height: 1.5;
    }
    .tags { 
        margin-top: 4px;
    }
    .tag { 
        background: rgba(255,255,255,0.2); 
        border-color: rgba(255,255,255,0.3);
        color: rgba(255,255,255,0.95);
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }
    .game-item .btn {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 4;
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
}

@media (min-width: 800px){
    .games-list { grid-template-columns: 1fr 1fr; }
}
/* Leaderboard */
.section.leaderboard { padding: 80px 0; }
.leader { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--secondary); }
.leader table { width: 100%; border-collapse: collapse; }
.leader thead { background: #151519; }
.leader th, .leader td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; }
.leader tbody tr { transition: background .15s ease, transform .12s ease; }
.leader tbody tr:hover { background: rgba(255,255,255,0.04); }
.leader tbody tr:active { transform: scale(0.998); }
/* Utility */
.muted { color: var(--muted); }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.modal-content { position: relative; width: 90%; max-width: 900px; max-height: 85vh; background: var(--secondary); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; z-index: 1001; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border); background: #151519; }
.modal-header h2 { margin: 0; font-size: 22px; color: var(--text); }
.modal-close { background: transparent; border: none; color: var(--text); font-size: 28px; line-height: 1; cursor: pointer; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: background .2s ease; }
.modal-close:hover { background: rgba(255,255,255,0.1); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.genre-section { margin-bottom: 32px; }
.genre-title { margin: 0 0 16px; font-size: 18px; font-weight: 600; color: var(--primary); padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.game-link { display: block; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 6px; color: var(--muted); text-decoration: none; transition: all .2s ease; font-size: 14px; }
.game-link:hover { background: rgba(245,166,35,0.1); border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
@media (max-width: 600px) {
    .games-grid { grid-template-columns: 1fr; }
    .modal-content { width: 95%; max-height: 90vh; }
    .modal-header { padding: 16px; }
    .modal-body { padding: 16px; }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary);
    border-top: 2px solid var(--primary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 1000;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    padding: 20px 0;
}
.cookie-banner.show {
    transform: translateY(0);
    opacity: 1;
}
.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}
.cookie-banner-text h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.cookie-banner-text p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}
.cookie-banner-text a {
    color: var(--primary);
    text-decoration: underline;
}
.cookie-banner-text a:hover {
    color: var(--accent);
}
.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}
.cookie-banner-actions .btn {
    flex: 1;
    min-width: 120px;
    font-size: 14px;
    padding: 10px 16px;
}
@media (min-width: 768px) {
    .cookie-banner-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .cookie-banner-text {
        flex: 1;
        max-width: 70%;
    }
    .cookie-banner-actions {
        flex: 0 0 auto;
        width: auto;
    }
    .cookie-banner-actions .btn {
        flex: none;
    }
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 24px; color: var(--muted); background: #0e1118; }
.footer-row { display: grid; grid-template-columns: 1fr; gap: 24px; }
.footer-col { display: grid; gap: 12px; }
.footer-col h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--text); }
.footer-col p { margin: 0; color: var(--muted); line-height: 1.6; }
.footer-col address { margin: 0; font-style: normal; line-height: 1.6; }
.footer-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-nav a { color: var(--muted); text-decoration: none; transition: color .2s ease; }
.footer-nav a:hover { color: var(--primary); }
.footer-bottom { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; }
@media (min-width: 600px) {
    .footer-row { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (min-width: 900px) {
    .footer-row { grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px; }
}

/* Image placeholders when files are absent */
img:not([src]), img[src=""], img[src^="images/"] {
    background: #222;
}

/* Accessibility interactions */
a, button, [role="button"] { transition: all .3s ease; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

