/* =============================================
   GAME GURUJI - Modern Gaming UI
   ============================================= */

/* Variables */
:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-hover: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --primary: #58a6ff;
    --primary-hover: #79b8ff;
    --accent: #39d353;
    --warning: #f0883e;
    --danger: #f85149;
    --purple: #a371f7;
    --pink: #db61a2;
    --cyan: #3fb6dc;
    --yellow: #d9a600;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    /* Gaming Fonts */
    --font: 'Chakra Petch', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Orbitron', sans-serif;
    --font-retro: 'Press Start 2P', monospace;
    /* Theme-driven backgrounds */
    --page-bg: var(--bg-dark);
    --page-bg-2: #0a0f17;
    --page-glow-1: rgba(88, 166, 255, 0.18);
    --page-glow-2: rgba(57, 211, 83, 0.12);
    --grid-line: rgba(88, 166, 255, 0.10);
    --noise: rgba(255, 255, 255, 0.03);
}

/* Light (whitish gray) theme */
body[data-theme="light"] {
    --bg-dark: #f2f4f7;
    --bg-card: #ffffff;
    --bg-hover: #eef2f7;
    --border: #d0d7de;
    --text: #0b1220;
    --text-muted: #4b5563;
    --primary: #2563eb;
    --primary-hover: #3b82f6;
    --accent: #16a34a;
    --warning: #b45309;
    --danger: #dc2626;
    --purple: #7c3aed;
    --pink: #db2777;
    --cyan: #0891b2;
    --yellow: #ca8a04;
    --shadow: 0 10px 28px rgba(15, 23, 42, 0.12);

    --page-bg: #f1f3f6;
    --page-bg-2: #e7ebf0;
    --page-glow-1: rgba(37, 99, 235, 0.14);
    --page-glow-2: rgba(22, 163, 74, 0.10);
    --grid-line: rgba(37, 99, 235, 0.10);
    --noise: rgba(0, 0, 0, 0.03);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

.app {
    position: relative;
    z-index: 1;
}

/* Animated background (both themes) */
body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Soft moving gradients */
body::before {
    background:
        radial-gradient(900px 600px at 15% 20%, var(--page-glow-1), transparent 60%),
        radial-gradient(900px 600px at 85% 30%, var(--page-glow-2), transparent 60%),
        linear-gradient(180deg, var(--page-bg) 0%, var(--page-bg-2) 100%);
    filter: saturate(1.1);
    animation: ggBgFloat 16s ease-in-out infinite alternate;
}

/* Animated grid + noise */
body::after {
    background:
        repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 48px),
        repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 48px),
        radial-gradient(circle at 50% 50%, transparent 0 60%, rgba(0, 0, 0, 0.08) 100%),
        linear-gradient(0deg, var(--noise), var(--noise));
    opacity: 0.55;
    mix-blend-mode: overlay;
    animation: ggGridDrift 22s linear infinite;
}

@keyframes ggBgFloat {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(0, -18px, 0) scale(1.02); }
}

@keyframes ggGridDrift {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-48px, -48px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after {
        animation: none !important;
    }
}

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

/* =============================================
   HEADER
   ============================================= */
.header {
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

body[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1px;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 120;
}

.logo-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 10px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
    transition: transform 0.25s ease, filter 0.25s ease;
    transform-origin: left center;
    will-change: transform, filter;
    position: relative;
    z-index: 2;
}

.logo:hover .logo-image {
    transform: translateY(-10px) scale(3);
    filter:
        drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45))
        drop-shadow(0 0 26px rgba(88, 166, 255, 0.45))
        drop-shadow(0 0 46px rgba(57, 211, 83, 0.25));
    animation: logoPowerUp 1.15s ease-in-out infinite;
}

/* Glow blob behind the logo when hovered */
.logo::after {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    width: 140px;
    height: 140px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, rgba(88, 166, 255, 0.45), transparent 60%),
                radial-gradient(circle at 65% 70%, rgba(57, 211, 83, 0.35), transparent 60%);
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.25s ease;
    z-index: 1;
}

.logo:hover::after {
    opacity: 1;
    animation: logoGlow 1.15s ease-in-out infinite;
}

@keyframes logoPowerUp {
    0%, 100% { transform: translateY(-10px) scale(3) rotate(-2deg); }
    50% { transform: translateY(-14px) scale(3.05) rotate(3deg); }
}

@keyframes logoGlow {
    0%, 100% { transform: translateY(-50%) scale(1); opacity: 0.85; }
    50% { transform: translateY(-50%) scale(1.12); opacity: 1; }
}

.logo-icon {
    font-size: 1.8rem;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-3px) rotate(5deg); }
}

.logo-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

.header-tagline {
    font-family: var(--font-retro);
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    padding: 6px 16px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 20px;
    animation: pulse 2s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(88, 166, 255, 0.3);
        border-color: rgba(88, 166, 255, 0.3);
    }
    50% { 
        box-shadow: 0 0 20px rgba(88, 166, 255, 0.6);
        border-color: rgba(88, 166, 255, 0.6);
    }
}

body[data-theme="light"] .header-tagline {
    background: rgba(88, 166, 255, 0.15);
    color: var(--primary);
}

.nav {
    display: flex;
    gap: 8px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    background: rgba(88, 166, 255, 0.10);
    border-color: var(--primary);
}

.theme-toggle:focus-visible {
    outline: 2px solid rgba(88, 166, 255, 0.95);
    outline-offset: 3px;
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle-icon {
    font-size: 1rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(88, 166, 255, 0.15);
}

.nav-link:focus-visible {
    outline: 2px solid rgba(88, 166, 255, 0.95);
    outline-offset: 3px;
}

.btn:focus-visible {
    outline: 2px solid rgba(88, 166, 255, 0.95);
    outline-offset: 3px;
}

/* =============================================
   MOBILE TOUCH CONTROLS
   ============================================= */
.touch-controls {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 2500;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    pointer-events: none; /* allow clicks only on buttons */
}

.touch-controls .tc-dpad {
    display: grid;
    grid-template-columns: 64px 64px 64px;
    grid-template-rows: 64px 64px 64px;
    gap: 10px;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
}

.touch-controls .tc-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tc-btn {
    pointer-events: auto;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.tc-btn:active {
    transform: scale(0.96);
}

.tc-btn:hover {
    border-color: rgba(88, 166, 255, 0.5);
}

.tc-up { grid-area: up; }
.tc-left { grid-area: left; }
.tc-right { grid-area: right; }
.tc-down { grid-area: down; }

.tc-action,
.tc-enter,
.tc-esc {
    width: 84px;
}

body[data-theme="light"] .tc-btn {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(17, 24, 39, 0.12);
    color: #111827;
}

@media (max-width: 768px) {
    body.in-game .touch-controls {
        display: flex;
    }
}

/* =============================================
   MAIN
   ============================================= */
.main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* =============================================
   HERO
   ============================================= */
.hero {
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 50px;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.05) 0%, transparent 100%);
    border-radius: var(--radius);
}

.hero-tag {
    display: inline-block;
    background: linear-gradient(135deg, rgba(57, 211, 83, 0.2), rgba(88, 166, 255, 0.2));
    color: var(--accent);
    padding: 10px 24px;
    border-radius: 50px;
    font-family: var(--font-retro);
    font-size: 0.65rem;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 28px;
    border: 1px solid rgba(57, 211, 83, 0.3);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(88, 166, 255, 0.3);
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 550px;
    margin: 0 auto 36px;
}

.hero-buttons {
    margin-bottom: 50px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.hero-stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4090e0);
    color: #fff;
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.4);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    border-color: rgba(88, 166, 255, 0.6);
    box-shadow: 0 0 24px rgba(88, 166, 255, 0.18);
}

body[data-theme="light"] .btn-secondary {
    background: rgba(17, 24, 39, 0.04);
}

.btn-large {
    padding: 18px 36px;
    font-size: 1.1rem;
    width: 100%;
    justify-content: center;
}

.btn-icon {
    font-size: 1.3rem;
}

/* Screen-reader only */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =============================================
   GAMES SECTION
   ============================================= */
.games {
    margin-bottom: 60px;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.section-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.games-controls {
    max-width: 900px;
    margin: 0 auto 24px;
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.games-search {
    flex: 1 1 360px;
    min-width: 260px;
}

.games-search-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    letter-spacing: 0.5px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.games-search-input::placeholder {
    color: var(--text-muted);
}

.games-search-input:focus {
    border-color: rgba(88, 166, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18);
}

.games-filter-select {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    outline: none;
}

body[data-theme="light"] .games-search-input,
body[data-theme="light"] .games-filter-select {
    background: rgba(17, 24, 39, 0.04);
}

.games-empty {
    text-align: center;
    color: var(--text-muted);
    margin: 18px 0 0;
    font-family: var(--font);
}

.game-card.is-hidden {
    display: none !important;
}

.category-section.is-empty {
    display: none;
}

/* =============================================
   GAME CATEGORIES - Horizontal Rows
   ============================================= */
.games {
    padding-bottom: 60px;
    overflow-x: hidden;
}

.category-section {
    margin-bottom: 50px;
}

.category-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-left: 20px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
    margin-left: 20px;
    opacity: 0.5;
}

.games-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 40px; /* Increased padding to prevent clipping */
    /* Remove horizontal scroll behaviors */
    overflow: visible; 
}

/* Hide scrollbar styles no longer needed */
.games-row::-webkit-scrollbar { display: none; }

.games-row .game-card {
    min-width: 0; /* Allow shrinking */
    width: auto;
    flex-shrink: 1;
}

/* Update hover effect for grid */
.games-row:has(.game-card:hover) .game-card:not(:hover) {
    opacity: 0.3;
    filter: blur(2px);
    transform: scale(0.95);
}

/* Ensure hover scaling z-index */
.games-row .game-card:hover {
    z-index: 1000;
    position: relative;
    /* Transform remains defined in main game-card rule */
}

/* =============================================
   GAME CARDS - Pro Design
   ============================================= */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    /* Sharper "tech" corners */
    border-radius: 8px;
    padding: 28px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
    /* Center align content */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Subtle tech grid background */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    clip-path: polygon(
        0 0, 
        100% 0, 
        100% calc(100% - 15px), 
        calc(100% - 15px) 100%, 
        0 100%
    );
}

/* (intentionally no .game-card::after here; it is defined later for hover accents) */

/* Game screen animated background (stronger, but still subtle) */
.game-screen {
    position: relative;
}

.game-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    background:
        radial-gradient(600px 400px at 20% 10%, var(--page-glow-1), transparent 60%),
        radial-gradient(600px 400px at 80% 20%, var(--page-glow-2), transparent 60%),
        repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 32px),
        repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 32px);
    animation: ggGameBg 14s ease-in-out infinite alternate;
}

.game-screen > * {
    position: relative;
    z-index: 1;
}

@keyframes ggGameBg {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.28; }
    100% { transform: translate3d(0, -12px, 0) scale(1.02); opacity: 0.40; }
}

@media (prefers-reduced-motion: reduce) {
    .game-screen::before {
        animation: none !important;
    }
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover {
    transform: scaleX(1.25) scaleY(1.1) translateY(-10px);
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(88, 166, 255, 0.4),
        0 0 120px rgba(88, 166, 255, 0.2),
        inset 0 0 40px rgba(88, 166, 255, 0.08);
    z-index: 100;
    background: linear-gradient(145deg, #1a2235, #0d1520);
    /* Glitch/Tech scanline effect on hover */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(88, 166, 255, 0.05) 3px,
        rgba(88, 166, 255, 0.05) 4px
    );
}

.game-card:focus-visible {
    outline: 2px solid rgba(88, 166, 255, 0.95);
    outline-offset: 6px;
}

.game-card:hover::before {
    opacity: 1;
}

/* Animated corner accents on hover */
.game-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--primary) 0%, 
        transparent 40%, 
        transparent 60%, 
        var(--accent) 100%);
    z-index: -1;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.game-card:hover::after {
    opacity: 1;
    animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Hover overlay effect on games grid */
/* Glowing ring animation */
.game-card:hover .game-card-icon::after {
    content: '';
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: ringPulse 1.5s ease-out infinite;
}

@keyframes ringPulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Color variants */
.game-card[data-color="green"]::before { background: var(--accent); }
.game-card[data-color="green"]:hover { border-color: var(--accent); }

.game-card[data-color="purple"]::before { background: var(--purple); }
.game-card[data-color="purple"]:hover { border-color: var(--purple); }

.game-card[data-color="red"]::before { background: var(--danger); }
.game-card[data-color="red"]:hover { border-color: var(--danger); }

.game-card[data-color="blue"]::before { background: var(--primary); }
.game-card[data-color="blue"]:hover { border-color: var(--primary); }

.game-card[data-color="cyan"]::before { background: var(--cyan); }
.game-card[data-color="cyan"]:hover { border-color: var(--cyan); }

.game-card[data-color="orange"]::before { background: var(--warning); }
.game-card[data-color="orange"]:hover { border-color: var(--warning); }

.game-card[data-color="gray"]::before { background: #6e7681; }
.game-card[data-color="gray"]:hover { border-color: #6e7681; }

.game-card[data-color="yellow"]::before { background: var(--yellow); }
.game-card[data-color="yellow"]:hover { border-color: var(--yellow); }

.game-card[data-color="pink"]::before { background: var(--pink); }
.game-card[data-color="pink"]:hover { border-color: var(--pink); }

.game-card[data-color="teal"]::before { background: #2ea98f; }
body[data-theme="light"] .game-card:hover {
    background: linear-gradient(145deg, #ffffff, #f0f2f5);
    border-color: var(--primary);
}

body[data-theme="light"] .game-card:hover .game-card-title {
    color: var(--primary);
    text-shadow: none;
    -webkit-text-fill-color: var(--primary);
}

body[data-theme="light"] .game-card:hover .game-card-desc {
    color: #1f2937;
}

body[data-theme="light"] .game-card:hover .game-card-badge {
    color: #fff;
    text-shadow: none;
}

body[data-theme="light"] .footer-tagline {
    background: linear-gradient(135deg, #e63946, #f4a261, #2a9d8f, #457b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-card-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--bg-hover);
    padding: 6px 16px;
    /* Angled badge */
    clip-path: polygon(15px 0, 100% 0, 100% 100%, 0 100%);
    font-family: var(--font-retro);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.game-card-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 20px;
    display: block;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-card:hover .game-card-icon {
    transform: scale(1.3) rotate(10deg);
    animation: iconBounce 0.6s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1.3) rotate(10deg) translateY(0); }
    50% { transform: scale(1.35) rotate(10deg) translateY(-5px); }
}

.game-card-title {
    font-family: var(--font-retro);
    font-size: 0.98rem;
    font-weight: 400;
    margin-bottom: 10px;
    color: var(--text);
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.4;
}

.game-card-desc {
    font-family: var(--font-retro);
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-bottom: 20px;
    line-height: 1.8;
    transition: all 0.3s ease;
}

/* Glitch text effect on hover title */
.game-card:hover .game-card-title {
    color: var(--primary);
    text-shadow: 2px 0 var(--danger), -2px 0 var(--accent);
    animation: glitchText 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
}

@keyframes glitchText {
    0% { transform: translate(0) }
    20% { transform: translate(-2px, 2px) }
    40% { transform: translate(-2px, -2px) }
    60% { transform: translate(2px, 2px) }
    80% { transform: translate(2px, -2px) }
    100% { transform: translate(0) }
}

.game-card:hover .game-card-desc {
    color: var(--text);
    position: relative;
    z-index: 10;
}

.game-card:hover .game-card-badge {
    background: var(--primary);
    color: #000;
    animation: badgeGlow 1.5s ease-in-out infinite;
}

@keyframes badgeGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(88, 166, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(88, 166, 255, 0.8); }
}

.game-card-footer {
    width: 100%;
    align-self: stretch;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: auto;
}

.difficulty {
    font-family: var(--font-retro);
    font-size: 0.58rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0;
    position: relative;
}

/* Rank-style bars for difficulty */
.difficulty::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: currentColor;
    margin-right: 6px;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.difficulty.easy {
    background: rgba(57, 211, 83, 0.15);
    color: var(--accent);
}

.difficulty.medium {
    background: rgba(240, 136, 62, 0.15);
    color: var(--warning);
}

.difficulty.hard {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
}

.play-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-retro);
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.game-card:hover .play-btn {
    background: linear-gradient(135deg, var(--primary-hover), var(--accent));
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.5);
    animation: playPulse 1s ease-in-out infinite;
}

@keyframes playPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(88, 166, 255, 0.5); }
    50% { box-shadow: 0 0 35px rgba(88, 166, 255, 0.8), 0 0 50px rgba(57, 211, 83, 0.4); }
}

/* =============================================
   ABOUT SECTION
   ============================================= */
.about {
    margin-bottom: 50px;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: all 0.3s;
}

.about-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.about-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 16px;
}

.about-card h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.about-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =============================================
   GAME SCREEN - Redesigned
   ============================================= */
.game-screen {
    animation: fadeIn 0.4s ease-out;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 40px;
}

.game-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
    gap: 16px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-3px);
    border-color: var(--primary);
    color: var(--primary);
}

.game-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 15px rgba(88, 166, 255, 0.4);
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-score {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 18px;
    border-radius: 6px;
    font-family: var(--font-retro);
    font-size: 0.8rem;
    color: var(--accent);
    border: 1px solid rgba(57, 211, 83, 0.3);
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(57, 211, 83, 0.1);
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

canvas {
    background: #000;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 30px rgba(88, 166, 255, 0.1);
    transition: box-shadow 0.3s ease;
}

canvas:focus, canvas:hover {
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.6),
        0 0 0 2px var(--primary),
        0 0 40px rgba(88, 166, 255, 0.25);
    outline: none;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 280px;
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(12px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-info {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.control-text {
    color: var(--text-muted);
    font-family: var(--font-retro);
    font-size: 0.6rem;
    line-height: 1.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.high-score-box {
    background: linear-gradient(135deg, rgba(240, 136, 62, 0.1), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(240, 136, 62, 0.2);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.high-score-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.hs-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--warning);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.hs-value {
    font-family: var(--font-retro);
    font-size: 1.4rem;
    font-weight: 400;
    color: #fff;
    text-shadow: 0 0 10px rgba(240, 136, 62, 0.6);
}

.next-piece-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.np-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#nextPieceCanvas {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 36px 24px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.footer-brand .logo-image {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
}

.footer-tagline {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    margin-bottom: 12px;
    text-shadow: 0 0 30px rgba(255, 217, 61, 0.3);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.footer-text {
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.footer-nostalgia {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    font-size: 1.8rem;
}

.footer-nostalgia span {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
    cursor: default;
    transition: transform 0.3s ease;
}

.footer-nostalgia span:nth-child(1) { animation-delay: 0s; }
.footer-nostalgia span:nth-child(2) { animation-delay: 0.2s; }
.footer-nostalgia span:nth-child(3) { animation-delay: 0.4s; }
.footer-nostalgia span:nth-child(4) { animation-delay: 0.6s; }
.footer-nostalgia span:nth-child(5) { animation-delay: 0.8s; }
.footer-nostalgia span:nth-child(6) { animation-delay: 1s; }

.footer-nostalgia span:hover {
    transform: scale(1.5) rotate(15deg);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .games-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-card:hover {
        transform: scaleX(1.25) scaleY(1.1) translateY(-8px);
    }
}

@media (max-width: 768px) {
    .games-row {
        grid-template-columns: 1fr;
    }
    
    /* ... existing mobile styles ... */
    .header-inner {
        flex-direction: column;
        gap: 16px;
    }

    .header-tagline {
        display: none;
    }

    .logo-image {
        width: 72px;
        height: 72px;
    }

    /* No huge hover on mobile/tablet; keep it subtle */
    .logo:hover .logo-image {
        transform: translateY(-2px) scale(1.08);
        animation: none;
    }

    .logo:hover::after {
        opacity: 0;
        animation: none;
    }

    .hero {
        padding: 40px 16px;
    }

    .hero-stats {
        gap: 30px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    /* .games-grid no longer used, but keeping cleanup */
    .games-row {
        gap: 16px;
        padding: 20px 10px 30px 10px;
    }

    /* Reduced scale on mobile */
    .game-card:hover {
        transform: scale(1.05) translateY(-5px);
    }

    /* Hover overlay effect on games row */
    .games-row:has(.game-card:hover) .game-card:not(:hover) {
        opacity: 1;
        filter: none;
        transform: none;
    }

    .game-nav {
        flex-direction: column;
        text-align: center;
    }

    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    canvas {
        max-width: 100%;
        height: auto;
    }

    .game-sidebar {
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 16px;
    }

    .logo-image {
        width: 56px;
        height: 56px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .games-row {
        gap: 16px;
    }

    .game-card {
        padding: 20px;
    }

    .game-card-icon {
        font-size: 3rem;
    }
}
