/* ============================================================
   StudioGame — public site
   Dark immersive gaming design: #0f0505 bg, #d60000 red, glass
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');

:root {
    --bg: #0f0505;
    --red: #d60000;
    --red-hover: #ff1f1f;
    --red-soft: rgba(214, 0, 0, 0.15);
    --text: #fff;
    --text-dim: #aaa;
    --text-faint: #888;
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(20, 10, 10, 0.8);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    color: rgba(255, 255, 255, 0.87);
    background: var(--bg);
    color-scheme: dark;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: inherit; }

::selection { background: var(--red); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1a0a0a; }
::-webkit-scrollbar-thumb { background: #d60000; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ff1f1f; }

.text-gradient {
    background: linear-gradient(to right, #ff4d4d, #d60000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ Background layers (fixed) ============ */
.bg-manager {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #4a0404;
    overflow: hidden;
    pointer-events: none;
}
.bg-flowing {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, #220202, #4a0404, #750000, #220202);
    background-size: 400% 400%;
    animation: gradientFlow 15s ease infinite;
}
.bg-texture {
    position: absolute;
    inset: 0;
    background-image: url('../img/back.png');
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    mix-blend-mode: screen;
}
.bg-scanlines {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: repeating-linear-gradient(transparent, transparent 2px, #000 3px);
    background-size: 100% 4px;
    animation: scanlines 0.2s linear infinite;
}
.bg-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 40%, #000 120%);
}
@keyframes gradientFlow {
    0% { background-position: 0% 50%; transform: rotate(0deg); }
    50% { background-position: 100% 50%; transform: rotate(5deg); }
    100% { background-position: 0% 50%; transform: rotate(0deg); }
}
@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

/* ============ Page shell ============ */
.site-wrap {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top-left actions */
.top-actions {
    position: absolute;
    top: 2rem;
    left: 3rem;
    z-index: 20;
    display: flex;
    gap: 1rem;
    align-items: center;
}
.top-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    color: #fff;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    border: none;
}
.top-actions .btn-donate {
    background: rgba(214, 0, 0, 0.1);
    border: 1px solid #d60000;
    box-shadow: 0 0 15px rgba(214, 0, 0, 0.2);
    animation: heartPulse 1.5s ease-in-out infinite;
}
.top-actions .btn-donate:hover {
    background: rgba(214, 0, 0, 0.3);
    box-shadow: 0 0 25px rgba(214, 0, 0, 0.5);
    transform: scale(1.05);
}
.top-actions .btn-about {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.top-actions .btn-about:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    transform: scale(1.05);
}
.top-actions .btn:active { transform: scale(0.95); }
@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Logo top-right */
.site-logo {
    position: absolute;
    top: 2rem;
    right: 3rem;
    z-index: 20;
    text-align: right;
    pointer-events: none;
}
.site-logo h1 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 2rem;
    font-weight: 900;
}
.site-logo p {
    margin: 0;
    font-size: 0.9rem;
    color: #aaa;
    letter-spacing: 6px;
}
.site-logo a { pointer-events: auto; text-decoration: none; }

/* ============ Dashboard / home ============ */
.dashboard {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
    padding-bottom: 0;
    flex: 1;
    justify-content: flex-end;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 30px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    direction: rtl;
    max-width: 90%;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
    position: relative;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 1rem;
    cursor: pointer;
    font-weight: normal;
    font-family: inherit;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 20px;
    transition: color 0.2s;
}
.filter-btn.active { color: #fff; font-weight: bold; }
.filter-btn .pill {
    position: absolute;
    inset: 0;
    background: #d60000;
    border-radius: 20px;
    z-index: -1;
}

/* Game grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    padding: 30px 20px 100px 20px;
    direction: rtl;
    justify-items: center;
}

/* Game card */
.game-card {
    width: 100%;
    height: 340px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #fff;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    will-change: transform;
}
.game-card img.cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}
.game-card .hover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(214, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    text-align: center;
    padding: 0 20px;
}
.game-card .hover-overlay h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(214, 0, 0, 0.8);
}
.game-card .hover-overlay .badge {
    padding: 8px 20px;
    background: rgba(214, 0, 0, 0.8);
    border-radius: 20px;
    font-size: 0.9rem;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(214, 0, 0, 0.5);
}
.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, #0f0505 0%, transparent 100%);
}
.card-overlay h3 { margin: 0; font-size: 1.1rem; color: #fff; }
.card-overlay span { font-size: 0.8rem; color: #d60000; }

@media (hover: hover) {
    .game-card:hover {
        transform: translateY(-5px);
        border-color: #ff0000;
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
        z-index: 100;
    }
    .game-card:hover img.cover {
        filter: blur(8px) brightness(0.5);
    }
    .game-card:hover .hover-overlay { opacity: 1; }
}

/* ============ Footer ============ */
.site-footer {
    position: relative;
    z-index: 10;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-align: center;
}
.site-footer .socials {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}
.site-footer .social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s;
    width: 44px;
    height: 44px;
    justify-content: center;
}
.site-footer .social-link:hover { color: #d60000; transform: scale(1.15); }
.site-footer .copyright { color: #888; font-size: 0.85rem; }

/* ============ Game detail ============ */
.game-detail {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: #0f0505;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
.detail-hero {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow: hidden;
}
.detail-hero .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease, transform 1s ease;
    transform: scale(1.1);
}
.detail-hero .slide.active { opacity: 0.6; transform: scale(1); }
.btn-back {
    position: absolute;
    top: 2rem;
    left: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    padding: 1rem;
    cursor: pointer;
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    transition: background 0.2s;
}
.btn-back:hover { background: rgba(255, 255, 255, 0.2); }
.thumbnails {
    position: absolute;
    bottom: 120px;
    right: 5%;
    display: flex;
    gap: 10px;
    z-index: 10;
}
.thumbnails button {
    width: 60px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s;
    background: none;
}
.thumbnails button.active { border-color: #d60000; opacity: 1; }
.thumbnails img { width: 100%; height: 100%; object-fit: cover; }
.btn-zoom {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    backdrop-filter: blur(5px);
    display: flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
}
.detail-title-wrap {
    position: absolute;
    bottom: 2rem;
    left: 5%;
    right: 5%;
    z-index: 20;
    pointer-events: none;
}
.detail-title-wrap h1 {
    font-size: 4rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -2px;
    color: #fff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
}
.detail-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
    flex-wrap: wrap;
}
.detail-meta .dub-badge {
    background: #d60000;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}
.detail-meta .genre {
    color: #aaa;
    font-size: 1rem;
}

/* Detail content */
.detail-content {
    padding: 4rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    direction: rtl;
}
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
}
.detail-about h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-right: 4px solid #d60000;
    padding-right: 1rem;
}
.detail-about p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #ccc;
    word-wrap: break-word;
}
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #d60000;
    color: white;
    padding: 1rem 3rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 0 20px rgba(214, 0, 0, 0.4);
    margin-top: 3rem;
    white-space: nowrap;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-download:hover { background: #ff1f1f; transform: translateY(-2px); }
.tech-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: right;
    align-self: start;
}
.tech-card h3 { margin-top: 0; font-size: 1.5rem; }
.tech-card ul {
    list-style: none;
    padding: 0;
    color: #aaa;
    line-height: 2;
    font-size: 1rem;
    margin: 0;
}
.tech-card li { display: flex; justify-content: space-between; gap: 1rem; }
.tech-card .stars {
    display: flex;
    gap: 5px;
    color: #d60000;
    direction: ltr;
    justify-content: flex-end;
}
.stars svg { flex: none; }

/* Extra sections (streams / reviews / trusted sites) */
.extra-sections { margin-top: 4rem; }
.extra-section { margin-bottom: 3rem; }
.extra-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
    border-right: 4px solid #d60000;
    padding-right: 1rem;
}
.link-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.link-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    text-decoration: none;
    color: #ddd;
    transition: all 0.2s;
    font-size: 0.95rem;
    min-height: 48px;
}
.link-list a:hover {
    background: rgba(214, 0, 0, 0.1);
    border-color: #d60000;
    color: #fff;
}
.link-list svg { flex: none; color: #d60000; }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox img {
    max-height: 90vh;
    max-width: 90vw;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}
.lightbox .lb-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox .lb-nav {
    position: absolute;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox .lb-prev { left: 2rem; }
.lightbox .lb-next { right: 2rem; }
.lightbox .lb-count { position: absolute; bottom: 2rem; color: #aaa; }

/* ============ About page ============ */
.about-page {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    background: rgba(10, 5, 5, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}
.about-card {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: rgba(30, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}
.about-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(214, 0, 0, 0.05);
}
.about-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 20px rgba(214, 0, 0, 0.5);
}
.about-header .btn-x {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s;
    width: 44px;
    height: 44px;
}
.about-header .btn-x:hover { background: rgba(255, 255, 255, 0.1); }
.about-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    direction: rtl;
    text-align: right;
}
.about-body h3 { font-size: 2rem; font-weight: 900; margin-bottom: 1rem; line-height: 1.2; }
.about-body p { font-size: 1.1rem; color: #ccc; line-height: 1.8; margin: 0; }
.about-block {
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 16px;
}
.about-block.bordered { border-right: 4px solid #d60000; }
.about-block.red { background: rgba(214, 0, 0, 0.1); }
.about-block.center p { text-align: center; font-weight: 600; color: #fff; font-size: 1.1rem; }
.about-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.about-footer .socials { display: flex; gap: 2rem; }
.about-footer .social-link {
    color: #ccc;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: all 0.3s;
    width: 44px;
    height: 44px;
}
.about-footer .social-link:hover { color: #d60000; transform: scale(1.2); }

/* ============ Loading screen ============ */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0f0505;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}
.loading-screen.hidden { opacity: 0; pointer-events: none; }
.loading-screen .glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(214, 0, 0, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}
.loading-screen img { width: 250px; height: auto; z-index: 10; position: relative; }
.loading-screen .bar {
    margin-top: 40px;
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    z-index: 10;
}
.loading-screen .bar i {
    display: block;
    height: 100%;
    background: #d60000;
    box-shadow: 0 0 10px #d60000;
    animation: loadBar 2.5s ease-in-out forwards;
    width: 0;
}
@keyframes loadBar {
    from { width: 0; }
    to { width: 100%; }
}
.loading-screen p {
    margin-top: 10px;
    color: #fff;
    opacity: 0.7;
    font-size: 0.8rem;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ============ 404 ============ */
.notfound {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    padding: 2rem;
}
.notfound h1 { font-size: 4rem; margin: 0; color: #d60000; }
.notfound a { color: #d60000; font-weight: bold; }

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .top-actions { top: 1rem; left: 1rem; gap: 0.5rem; }
    .top-actions .btn { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
    .top-actions .btn .btn-label { display: none; }
    .site-logo { top: 1rem; right: 1rem; }
    .site-logo h1 { font-size: 1.2rem; letter-spacing: 2px; }
    .site-logo p { font-size: 0.7rem; letter-spacing: 2px; }
    .game-grid { grid-template-columns: 1fr; max-width: 90%; padding: 20px 50px 100px 50px; }
    .game-card { height: 340px; }
    .detail-hero { height: 40vh; }
    .detail-title-wrap h1 { font-size: 1.8rem; letter-spacing: -1px; }
    .detail-meta { gap: 0.5rem; }
    .detail-meta .dub-badge { font-size: 0.7rem; padding: 3px 8px; }
    .detail-meta .genre { font-size: 0.8rem; }
    .detail-content { padding: 2rem 6%; }
    .detail-grid { grid-template-columns: 1fr; gap: 2rem; }
    .detail-about h2 { font-size: 1.5rem; padding-right: 0.8rem; }
    .detail-about p { font-size: 1rem; }
    .btn-download { padding: 0.8rem 2rem; font-size: 1rem; }
    .tech-card { padding: 1.5rem; }
    .tech-card h3 { font-size: 1.2rem; }
    .thumbnails { display: none; }
    .btn-back { top: 1rem; left: 1rem; width: 44px; height: 44px; padding: 0.7rem; }
    .btn-zoom { top: 1rem; right: 1rem; width: 44px; height: 44px; padding: 0.6rem; }
    .about-card { width: 100%; max-height: 85vh; border-radius: 0; }
    .about-header { padding: 1rem; }
    .about-header h2 { font-size: 1.4rem; }
    .about-body { padding: 1.2rem; }
    .about-footer { padding: 1rem; }
    .about-footer .socials { gap: 1rem; }
    .site-footer { padding: 1rem; }
    .filter-btn { padding: 10px 16px; font-size: 0.9rem; }
    .game-grid { padding-left: 20px; padding-right: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}