/* ============================================================
   GryZaDarmo — Design tokens
   Palette:  bg-deep #120F1D | bg-panel #1C1830 | bg-raised #262045
             accent-violet #7C5CFF | accent-gold #FFC857
             text-hi #F5F3FF | text-mid #B6ADD1 | text-low #756B99
   Type:     Display  "Space Grotesk"  (headings, scores, badges)
              Body     "Inter"          (paragraphs, UI labels)
              Mono     "JetBrains Mono" (stat counters — views/likes)
   Signature: cards glow with a violet scan-line seam on hover, like
              a cartridge waking up; stat numbers render in mono type
              like an arcade scoreboard.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --bg-deep: #120F1D;
    --bg-panel: #1C1830;
    --bg-raised: #262045;
    --accent-violet: #7C5CFF;
    --accent-violet-dim: #5A3FD9;
    --accent-gold: #FFC857;
    --text-hi: #F5F3FF;
    --text-mid: #B6ADD1;
    --text-low: #756B99;
    --danger: #FF6B7A;
    --success: #5FDBA0;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow-card: 0 10px 30px -12px rgba(0,0,0,0.6);
    --container: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    margin: 0;
    overflow-x: hidden;
    background: var(--bg-deep);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(124,92,255,0.14), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(255,200,87,0.08), transparent 40%);
    background-attachment: fixed;
    color: var(--text-hi);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

h1, h2, h3, .font-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }

:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(18, 15, 29, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(124,92,255,0.18);
}
.header-inner {
    display: flex; align-items: center; gap: 24px;
    padding: 14px 0;
}
.logo {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700; color: var(--text-hi);
    display: flex; align-items: center; gap: 2px; white-space: nowrap;
}
.logo img { height: 36px; width: auto; display: block; }
.logo span { color: var(--accent-gold); }

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
    padding: 8px 14px; border-radius: 999px;
    font-size: 14px; font-weight: 500; color: var(--text-mid);
    transition: background 0.15s, color 0.15s;
}
.main-nav a:hover, .main-nav a.active { background: var(--bg-raised); color: var(--text-hi); }

.search-form { margin-left: auto; display: flex; }
.search-form input {
    background: var(--bg-panel); border: 1px solid rgba(124,92,255,0.25);
    color: var(--text-hi); padding: 9px 14px; border-radius: 999px 0 0 999px;
    font-size: 14px; width: 200px; border-right: none;
}
.search-form button {
    background: var(--accent-violet); border: none; color: white;
    padding: 0 16px; border-radius: 0 999px 999px 0; font-weight: 600;
}
.search-form button:hover { background: var(--accent-violet-dim); }

/* ---------- Hero ---------- */
.hero {
    padding: 40px 0 8px;
}
.hero h1 {
    font-size: clamp(28px, 4vw, 42px);
    margin: 0 0 6px;
}
.hero p { color: var(--text-mid); margin: 0; font-size: 15px; }

/* ---------- Section headers ---------- */
.section { padding: 32px 0; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 16px;
}
.section-head h2 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-head .see-all { font-size: 13px; color: var(--accent-gold); font-weight: 600; }

/* ---------- Game grid & cards ---------- */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.game-card {
    position: relative;
    background: var(--bg-panel);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(124,92,255,0.12);
    transition: transform 0.18s ease, border-color 0.18s ease;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent-violet); }

/* signature scan-line seam that lights up on hover */
.game-card::after {
    content: '';
    position: absolute; left: 0; right: 0; top: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-violet), var(--accent-gold), transparent);
    opacity: 0; transition: opacity 0.18s ease;
}
.game-card:hover::after { opacity: 1; }

.game-card .thumb-wrap { position: relative; aspect-ratio: 4/3; background: var(--bg-raised); }
.game-card img { width: 100%; height: 100%; object-fit: cover; }
.game-card .badge {
    position: absolute; top: 8px; left: 8px;
    font-family: var(--font-mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 3px 8px; border-radius: 6px;
    background: rgba(18,15,29,0.85); color: var(--accent-gold);
    border: 1px solid rgba(255,200,87,0.4);
}
.game-card .badge.hot { color: var(--danger); border-color: rgba(255,107,122,0.4); }

.game-card .info { padding: 10px 12px 12px; }
.game-card .title {
    font-size: 14px; font-weight: 600; color: var(--text-hi);
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.game-card .meta {
    margin-top: 4px; display: flex; align-items: center; gap: 8px;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-low);
}

/* ---------- Category chips ---------- */
.category-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.category-chips a {
    background: var(--bg-panel); border: 1px solid rgba(124,92,255,0.18);
    padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
    color: var(--text-mid);
}
.category-chips a:hover, .category-chips a.active { background: var(--accent-violet); color: white; border-color: var(--accent-violet); }

/* ---------- Game page ---------- */
.game-page-head { padding: 28px 0 0; display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.game-page-head h1 { font-size: 28px; margin: 0 0 6px; }
.provider-line { color: var(--text-mid); font-size: 14px; }
.provider-line a { color: var(--accent-gold); }

.stage {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-top: 20px;
    border: 1px solid rgba(124,92,255,0.2);
}
.stage .cover {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background-size: cover; background-position: center;
}
.stage .cover::before { content: ''; position: absolute; inset: 0; background: rgba(18,15,29,0.55); }
.stage .cover > * { position: relative; z-index: 1; }
.play-btn {
    background: var(--accent-violet); color: white; border: none;
    font-family: var(--font-display); font-size: 16px; font-weight: 700;
    padding: 14px 30px; border-radius: 999px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 24px rgba(124,92,255,0.45);
}
.play-btn:hover { background: var(--accent-violet-dim); }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; }

.stage.fake-fullscreen {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999;
    width: 100vw; height: 100dvh;
    border-radius: 0; margin: 0; aspect-ratio: unset;
}

/* Games that need landscape, viewed on a phone that stays physically portrait
   (this is the norm on iOS Safari, which never lets a webpage lock orientation):
   rotate the whole stage 90° with pure CSS so it renders like true landscape. */
.stage.fake-fullscreen.force-landscape {
    top: 0; left: 0; right: auto; bottom: auto;
    width: 100vh;
    height: 100vw;
    transform-origin: top left;
    transform: rotate(90deg) translateY(-100%);
}

.fake-fullscreen-close {
    position: absolute; top: 12px; right: 12px; z-index: 10000;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(18,15,29,0.75); color: #fff; border: 1px solid rgba(255,255,255,0.25);
    font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
}

.stage-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; font-size: 13px; color: var(--text-low);
}
.icon-btn {
    background: var(--bg-panel); border: 1px solid rgba(124,92,255,0.2);
    color: var(--text-mid); padding: 8px 12px; border-radius: var(--radius-sm);
    font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn:hover { color: var(--text-hi); border-color: var(--accent-violet); }

.vote-row { display: flex; gap: 10px; margin-top: 18px; }
.vote-btn {
    background: var(--bg-panel); border: 1px solid rgba(124,92,255,0.2);
    color: var(--text-mid); padding: 10px 18px; border-radius: 999px;
    font-family: var(--font-mono); font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
}
.vote-btn:hover { border-color: var(--accent-violet); color: var(--text-hi); }
.vote-btn.like.voted { background: var(--success); color: #0b1f16; border-color: var(--success); }
.vote-btn.dislike.voted { background: var(--danger); color: #2b0d10; border-color: var(--danger); }

.game-description { margin-top: 22px; color: var(--text-mid); max-width: 74ch; }
.game-description h2 { font-size: 16px; color: var(--text-hi); margin-bottom: 8px; margin-top: 28px; }
.game-description h3 { font-size: 14px; color: var(--text-hi); margin: 18px 0 6px; }
.game-description p { margin: 0 0 12px; line-height: 1.7; }
.game-description ul, .game-description ol { margin: 0 0 14px; padding-left: 22px; line-height: 1.7; }
.game-description li { margin-bottom: 4px; }
.game-description strong { color: var(--text-hi); }
.game-description a { color: var(--accent-gold); text-decoration: underline; text-underline-offset: 2px; }

.ad-slot {
    background: var(--bg-panel); border: 1px dashed rgba(124,92,255,0.3);
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    color: var(--text-low); font-size: 12px; font-family: var(--font-mono);
    min-height: 90px; margin: 20px 0;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid rgba(124,92,255,0.15); margin-top: 60px; padding: 30px 0; color: var(--text-low); font-size: 13px; }
.site-footer a { color: var(--text-mid); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Misc / utility ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-low); }
.skeleton { background: linear-gradient(90deg, var(--bg-panel) 25%, var(--bg-raised) 37%, var(--bg-panel) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 30px; }
.page-btn { background: var(--bg-panel); border: 1px solid rgba(124,92,255,0.2); padding: 8px 16px; border-radius: 999px; font-size: 13px; color: var(--text-mid); }
.page-btn:hover { color: var(--text-hi); border-color: var(--accent-violet); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }
.page-status { font-family: var(--font-mono); font-size: 12px; color: var(--text-low); }

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

@media (max-width: 720px) {
    .header-inner { flex-wrap: wrap; }
    .main-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .search-form { order: 2; margin-left: auto; }
    .search-form input { width: 140px; }
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}

@media (max-width: 420px) {
    .container { padding: 0 14px; }
    .search-form input { width: 110px; }
}
