/* ============================================================
   VikiGames — Design tokens
   Palette:  bg-deep #0B1220 (deep navy) | bg-panel #121B2E | bg-raised #1B2A44
             accent-cyan #00D9FF | accent-coral #FF5A5F
             text-hi #F0F6FF | text-mid #9FB3D1 | text-low #5C7599
   Type:     Display  "Sora"            (headings, badges)
              Body     "Inter"           (paragraphs, UI labels)
              Mono     "IBM Plex Mono"   (stat counters — views/likes)
   Signature: cards have a clipped top-right corner (HUD/gamer-panel look)
              that lights up with a cyan glow border on hover — distinct
              from a plain rectangle, evokes a game UI panel.
   ============================================================ */

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

:root {
    --bg-deep: #0B1220;
    --bg-panel: #121B2E;
    --bg-raised: #1B2A44;
    --accent-cyan: #00D9FF;
    --accent-cyan-dim: #00A8C7;
    --accent-coral: #FF5A5F;
    --text-hi: #F0F6FF;
    --text-mid: #9FB3D1;
    --text-low: #5C7599;
    --danger: #FF5A5F;
    --success: #3DDC97;

    --font-display: 'Sora', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --radius: 14px;
    --radius-sm: 8px;
    --clip: 18px; /* corner-clip size for the signature HUD-panel look */
    --shadow-card: 0 10px 30px -12px rgba(0,0,0,0.65);
    --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 85% 0%, rgba(0,217,255,0.12), transparent 45%),
        radial-gradient(circle at 10% 25%, rgba(255,90,95,0.07), 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-cyan);
    outline-offset: 2px;
}

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

.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(0,217,255,0.22);
    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-cyan); border: none; color: #06141f;
    padding: 0 16px; border-radius: 0 999px 999px 0; font-weight: 700;
}
.search-form button:hover { background: var(--accent-cyan-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-cyan); font-weight: 700; }

/* ---------- 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);
    clip-path: polygon(0 0, calc(100% - var(--clip)) 0, 100% var(--clip), 100% 100%, 0 100%);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,217,255,0.12);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-cyan) 35%, transparent), var(--shadow-card);
}

.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(11,18,32,0.85); color: var(--accent-cyan);
    border: 1px solid rgba(0,217,255,0.4);
}
.game-card .badge.hot { color: var(--accent-coral); border-color: rgba(255,90,95,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(0,217,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-cyan); color: #06141f; border-color: var(--accent-cyan); }

/* ---------- Quick-access featured category cards (homepage) ---------- */
.quick-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 6px 0 30px;
}
.quick-category-card {
    --qc-primary: var(--accent-cyan);
    --qc-secondary: var(--accent-coral);
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px;
    padding: 26px 16px;
    border-radius: var(--radius);
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.quick-category-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(160deg, var(--qc-primary) 0%, var(--qc-secondary) 100%);
    opacity: 0.14;
    transition: opacity 0.2s ease;
}
.quick-category-card:hover {
    transform: translateY(-5px);
    border-color: var(--qc-primary);
    box-shadow: 0 12px 32px -10px color-mix(in srgb, var(--qc-primary) 55%, transparent);
}
.quick-category-card:hover::before { opacity: 0.26; }
.quick-category-icon {
    position: relative;
    font-size: 34px; line-height: 1;
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--qc-primary) 0%, var(--qc-secondary) 100%);
    box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--qc-primary) 70%, transparent);
}
.quick-category-name {
    position: relative;
    font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text-hi);
}

@media (max-width: 720px) {
    .quick-category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Themed category banner (Kids / Quiz / Cards / 2 Player) ---------- */
.category-banner {
    padding: 44px 0;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}
.category-banner-inner {
    display: flex; align-items: center; gap: 22px;
}
.category-banner-icon {
    font-size: 46px; line-height: 1;
    width: 84px; height: 84px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(4px);
}
.category-banner h1 { margin: 0 0 4px; font-size: clamp(24px, 3.4vw, 34px); color: inherit; }
.category-banner p { margin: 0; opacity: 0.85; font-size: 15px; color: inherit; }

@media (max-width: 560px) {
    .category-banner-inner { gap: 14px; }
    .category-banner-icon { width: 64px; height: 64px; font-size: 32px; }
}

/* ---------- 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-cyan); }

.stage {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-top: 20px;
    border: 1px solid rgba(0,217,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(11,18,32,0.55); }
.stage .cover > * { position: relative; z-index: 1; }
.play-btn {
    background: var(--accent-cyan); color: #06141f; 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(0,217,255,0.4);
}
.play-btn:hover { background: var(--accent-cyan-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;
}
.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(11,18,32,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(0,217,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-cyan); }

.vote-row { display: flex; gap: 10px; margin-top: 18px; }
.vote-btn {
    background: var(--bg-panel); border: 1px solid rgba(0,217,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-cyan); color: var(--text-hi); }
.vote-btn.like.voted { background: var(--success); color: #04231a; border-color: var(--success); }
.vote-btn.dislike.voted { background: var(--danger); color: #2b0d0e; 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-cyan); text-decoration: underline; text-underline-offset: 2px; }

.ad-slot {
    background: var(--bg-panel); border: 1px dashed rgba(0,217,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(0,217,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(0,217,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-cyan); }
.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; }
}
