:root {
            --bg-dark: #0a0c16;
            --panel-bg: #141829;
            --accent-pink: #ff2a75;
            --accent-cyan: #00f0ff;
            --accent-yellow: #ffc800;
            --accent-green: #00e676;
            --text-light: #ffffff;
            --text-dim: #8e9bb0;
            --font-heading: 'Luckiest Guy', 'Impact', 'Arial Black', sans-serif;
            --font-body: 'Fredoka', 'Segoe UI', 'Trebuchet MS', sans-serif;
        }

        @font-face {
            font-family: 'Luckiest Guy';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url(https://fonts.gstatic.com/s/luckiestguy/v23/_97oEAo3gDG-5aGhN262UR34.woff2) format('woff2');
        }

        @font-face {
            font-family: 'Fredoka';
            font-style: normal;
            font-weight: 400 700;
            font-display: swap;
            src: url(https://fonts.gstatic.com/s/fredoka/v14/u44nYB641L1mcgM5bD33wA.woff2) format('woff2');
        }

        * {
            box-sizing: border-box;
            user-select: none;
            -webkit-user-select: none;
            margin: 0;
            padding: 0;
        }

        body {
            background-color: var(--bg-dark);
            color: var(--text-light);
            font-family: var(--font-body);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            overflow-x: hidden;
            background-image: 
                radial-gradient(circle at 10% 20%, rgba(255, 42, 117, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(0, 240, 255, 0.15) 0%, transparent 40%);
        }

        /* HEADER */
        header {
            width: 100%;
            max-width: 1040px;
            padding: 12px 20px;
            background: var(--panel-bg);
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 3px solid var(--accent-pink);
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
            z-index: 100;
        }

        .brand-box {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
        }

        .brand-logo { font-size: 2rem; filter: drop-shadow(0 0 5px var(--accent-pink)); }
        .brand-title {
            font-family: var(--font-heading);
            font-size: 1.4rem;
            letter-spacing: 1px;
            background: linear-gradient(180deg, #fff 30%, var(--accent-pink) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .stats-group { display: flex; gap: 10px; }
        .stat-pill {
            background: rgba(0,0,0,0.4);
            border: 2px solid var(--accent-cyan);
            border-radius: 20px;
            padding: 4px 12px;
            font-size: 0.9rem;
            font-weight: 700;
            color: var(--accent-cyan);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .stat-pill.coins { border-color: var(--accent-yellow); color: var(--accent-yellow); }
        button.stat-pill { cursor: pointer; font: inherit; font-size: 0.75rem; border: 2px solid var(--accent-green); color: var(--accent-green); white-space: nowrap; }
        @media (max-width: 420px) {
            header { padding: 10px; }
            .brand-title { font-size: 1rem; }
            .brand-logo { font-size: 1.5rem; }
            .stats-group { gap: 4px; }
            .stat-pill { padding: 3px 6px; font-size: 0.7rem; }
            button.stat-pill { font-size: 0.65rem; padding: 3px 5px; }
        }

        /* MAIN CONTAINER */
        main {
            width: 100%;
            max-width: 1040px;
            padding: 15px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .screen {
            width: 100%;
            display: none;
            flex-direction: column;
            align-items: center;
            animation: fadeIn 0.25s ease-in-out;
        }
        .screen.active { display: flex; }

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

        /* PORTAL LIBRARY */
        .portal-title {
            font-family: var(--font-heading);
            font-size: 1.8rem;
            margin: 10px 0;
            text-align: center;
            color: var(--accent-yellow);
            text-shadow: 0 3px 0 #000;
        }

        .filter-bar {
            display: flex;
            gap: 8px;
            margin-bottom: 15px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .filter-btn {
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.2);
            color: #fff;
            padding: 5px 12px;
            border-radius: 12px;
            font-size: 0.8rem;
            cursor: pointer;
            font-family: var(--font-body);
            font-weight: 600;
        }
        .filter-btn.active {
            background: var(--accent-pink);
            border-color: var(--accent-pink);
        }

        .games-grid {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
            gap: 12px;
        }

        .game-card {
            background: var(--panel-bg);
            border: 2px solid #2a324d;
            border-radius: 14px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
        }
        .game-card:hover {
            transform: translateY(-4px);
            border-color: var(--accent-cyan);
            box-shadow: 0 6px 20px rgba(0, 240, 255, 0.25);
        }
        .game-card-icon { font-size: 3rem; margin-bottom: 6px; }
        .game-card-title { font-family: var(--font-heading); font-size: 1rem; text-align: center; margin-bottom: 4px; }
        .game-card-desc { font-size: 0.7rem; color: var(--text-dim); text-align: center; line-height: 1.1; }

        /* BUTTON SYSTEM */
        .btn {
            font-family: var(--font-heading);
            background: linear-gradient(180deg, var(--accent-pink) 0%, #d00050 100%);
            color: #fff;
            border: none;
            padding: 8px 16px;
            font-size: 0.95rem;
            border-radius: 10px;
            cursor: pointer;
            box-shadow: 0 4px 0 #800030;
            transition: transform 0.1s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            text-shadow: 0 1px 0 #000;
        }
        .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #800030; }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(0.8); }
        .btn-cyan { background: linear-gradient(180deg, var(--accent-cyan) 0%, #00a0b0 100%); box-shadow: 0 4px 0 #006070; }
        .btn-yellow { background: linear-gradient(180deg, var(--accent-yellow) 0%, #c09000 100%); color:#000; text-shadow:none; box-shadow:0 4px 0 #806000; }
        .btn-back { align-self: flex-start; margin-bottom: 12px; font-size: 0.8rem; padding: 4px 10px; }

        /* GAME HEADERS & INSTRUCTIONS */
        .game-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
        .game-title-text { font-family: var(--font-heading); font-size: 1.4rem; color: var(--accent-yellow); }
        .how-to-play-box {
            background: rgba(0,0,0,0.3);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 10px;
            padding: 8px 12px;
            font-size: 0.75rem;
            color: var(--text-dim);
            margin-bottom: 10px;
            width: 100%;
        }


        /* PIXELCAT DASH: original endless runner */
        .pcd-wrap { width:100%; display:flex; flex-direction:column; align-items:center; gap:10px; }
        .pcd-canvas-wrap { width:100%; max-width:420px; position:relative; overflow:hidden; border:3px solid var(--accent-cyan); border-radius:14px; background:#101b2a; box-shadow:0 0 24px rgba(0,240,255,.12); }
        #pcd-canvas { display:block; width:100%; height:auto; aspect-ratio:3/4; touch-action:pan-y; }
        .pcd-stats { width:100%; max-width:420px; display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:.85rem; font-weight:700; }
        .pcd-controls { display:grid; grid-template-columns:repeat(3,minmax(68px,1fr)); gap:8px; width:100%; max-width:300px; }
        .pcd-controls .btn { padding:8px 4px; }
        .pcd-help { color:var(--text-dim); font-size:.75rem; text-align:center; }

        /* GAME 1: SLIME TRAIL */
        .sl-board {
            width: 100%; max-width: 420px; aspect-ratio: 1;
            background: #0d111a; border: 3px solid var(--accent-pink); border-radius: 14px;
            position: relative; display: grid; grid-template-columns: repeat(10, 10%); grid-template-rows: repeat(10, 10%);
        }
        .sl-cell { border: 1px solid rgba(255,255,255,0.03); font-size: 0.6rem; color: rgba(255,255,255,0.3); padding: 2px; }
        #sl-svg { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:5; }
        .sl-token {
            width: 8%; height: 8%; border-radius: 50%; position: absolute; z-index: 10;
            transition: all 0.2s linear; display: flex; align-items: center; justify-content: center;
            font-size: 0.7rem; border: 2px solid #fff;
        }

        /* GAME 2: ELEMENT CLASH */
        .ec-arena { width: 100%; max-width: 450px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
        .ec-card-row { display: flex; gap: 8px; overflow-x: auto; width: 100%; padding: 6px; justify-content: center; }
        .ec-card {
            width: 60px; height: 90px; border-radius: 8px; border: 2px solid #fff;
            display: flex; flex-direction: column; align-items: center; justify-content: space-between;
            padding: 4px; font-family: var(--font-heading); font-size: 0.75rem; cursor: pointer; flex-shrink: 0;
            background: #222;
        }
        .ec-card.Fire { background: linear-gradient(135deg, #ff2a4b, #800010); }
        .ec-card.Water { background: linear-gradient(135deg, #0099ff, #004080); }
        .ec-card.Earth { background: linear-gradient(135deg, #00cc66, #005020); }
        .ec-card.Wind { background: linear-gradient(135deg, #ffcc00, #806000); color: #000; }

        /* GAME 3: CHROMALINK */
        .flow-container { width: 100%; max-width: 380px; aspect-ratio: 1; position: relative; touch-action: none; }

        /* GAME 4: TRIPLE TACTICS */
        .tt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 260px; height: 260px; }
        .tt-cell {
            background: var(--panel-bg); border: 2px solid #2a324d; border-radius: 12px;
            display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
            cursor: pointer; font-family: var(--font-heading);
        }

        /* GAME 5: MEMORY VAULT */
        .mv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 360px; }
        .mv-card {
            aspect-ratio: 1; background: var(--panel-bg); border: 2px solid #2a324d; border-radius: 10px;
            display: flex; align-items: center; justify-content: center; font-size: 1.8rem; cursor: pointer;
            perspective: 1000px;
        }

        /* GAME 6: SHAPE DROP */
        .sd-canvas-wrap { border: 3px solid var(--accent-cyan); border-radius: 10px; overflow: hidden; }

        /* GAME 7: BOUNCE FORGE */
        .bf-canvas-wrap { border: 3px solid var(--accent-yellow); border-radius: 10px; overflow: hidden; touch-action: none; }

        /* GAME 8: NUMBER BLOOM */
        .nb-grid {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 280px; height: 280px;
            background: #101424; padding: 6px; border-radius: 12px; border: 2px solid #2a324d;
        }
        .nb-cell {
            background: rgba(255,255,255,0.05); border-radius: 8px; display: flex; align-items: center;
            justify-content: center; font-family: var(--font-heading); font-size: 1.2rem;
        }

        /* GAME 9: MAZE RUNNER */
        .mr-canvas-wrap { border: 3px solid var(--accent-green); border-radius: 10px; overflow: hidden; }

        /* GAME 10: POP PANIC */
        .pp-arena {
            width: 100%; max-width: 360px; aspect-ratio: 1; background: #101424; border-radius: 14px;
            border: 3px solid var(--accent-pink); position: relative; overflow: hidden;
        }
        .pp-target {
            width: 50px; height: 50px; border-radius: 50%; position: absolute; display: flex;
            align-items: center; justify-content: center; font-size: 1.8rem; cursor: pointer;
            animation: popIn 0.15s ease-out;
        }
        @keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }

        /* In-game announcements replace native browser alert popups. */
        #game-announcement-overlay { position:fixed; inset:0; z-index:10000; display:none; align-items:center; justify-content:center; padding:20px; background:rgba(3,5,14,.78); backdrop-filter:blur(5px); }
        #game-announcement-overlay.is-visible { display:flex; }
        .game-announcement-card { width:min(100%,390px); padding:24px 22px 20px; text-align:center; background:linear-gradient(145deg,#1b2340,#101525); border:2px solid var(--accent-cyan); border-radius:18px; box-shadow:0 0 0 4px rgba(0,240,255,.08),0 16px 55px rgba(0,0,0,.65); animation:announcementPop .18s ease-out; }
        .game-announcement-icon { font-size:2.4rem; margin-bottom:10px; }
        .game-announcement-title { color:var(--accent-yellow); font-family:var(--font-heading); font-size:1.45rem; margin-bottom:12px; letter-spacing:.5px; }
        .game-announcement-message { color:var(--text-light); font-size:1rem; line-height:1.5; overflow-wrap:anywhere; margin-bottom:20px; user-select:text; -webkit-user-select:text; }
        .game-announcement-ok { min-width:120px; border:0; border-radius:10px; padding:10px 24px; color:#081018; background:var(--accent-cyan); font:700 1rem var(--font-body); cursor:pointer; box-shadow:0 4px 0 #008d99; }
        .game-announcement-ok:active { transform:translateY(2px); box-shadow:0 2px 0 #008d99; }
        @keyframes announcementPop { from { opacity:0; transform:translateY(8px) scale(.96); } to { opacity:1; transform:translateY(0) scale(1); } }
        @media (prefers-reduced-motion:reduce) { .game-announcement-card { animation:none; } }



        /* SITE PAGES, FOOTER, AND DESKTOP RESPONSIVENESS */
        .home-intro { width:100%; max-width:780px; margin:0 auto 18px; color:var(--text-dim); text-align:center; line-height:1.6; font-size:.95rem; }
        .site-footer { width:100%; max-width:1040px; padding:18px 20px 24px; margin-top:auto; border-top:1px solid #2a324d; background:rgba(20,24,41,.82); text-align:center; }
        .footer-brand { color:var(--accent-yellow); font-family:var(--font-heading); margin-bottom:8px; font-size:1.05rem; }
        .footer-links { display:flex; justify-content:center; flex-wrap:wrap; gap:8px 18px; margin:8px 0; }
        .footer-links button { border:0; background:none; color:var(--accent-cyan); font:600 .85rem var(--font-body); cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
        .footer-links button:hover { color:var(--accent-yellow); }
        .footer-note { color:var(--text-dim); font-size:.75rem; line-height:1.5; }
        .site-page { width:100%; max-width:820px; align-items:stretch; }
        .site-page h1 { font-family:var(--font-heading); color:var(--accent-yellow); font-size:1.8rem; margin:4px 0 14px; }
        .site-page h2 { color:var(--accent-cyan); font-size:1.05rem; margin:20px 0 7px; }
        .site-page p, .site-page li { color:#d9e1ef; font-size:.92rem; line-height:1.7; margin-bottom:10px; user-select:text; -webkit-user-select:text; }
        .site-page ul { padding-left:22px; margin-bottom:10px; }
        .site-page a { color:var(--accent-cyan); overflow-wrap:anywhere; }
        .site-page .updated-date { color:var(--text-dim); font-size:.8rem; margin-bottom:16px; }
        @media (min-width: 900px) {
            header { padding:16px 24px; }
            main { padding:24px; }
            .portal-title { font-size:2.25rem; }
            .games-grid { gap:16px; }
            .game-card { padding:16px; min-height:150px; }
            .game-card-icon { font-size:3.4rem; }
        }
        @media (max-width: 600px) {
            .site-footer { padding:16px 12px 22px; }
            .site-page h1 { font-size:1.5rem; }
            .site-page p, .site-page li { font-size:.88rem; }
        }


/* Optional original WebP art: gracefully falls back to existing emoji when absent. */
.game-card-icon img {
  background: #000;
  border-radius: 8px;
 display:block; width:100%; height:100%; max-width:76px; max-height:76px; object-fit:contain; margin:auto; image-rendering:auto; }
.game-card-icon.has-image {
  background: #000;
  border-radius: 10px;
  overflow: hidden;
 display:flex; align-items:center; justify-content:center; }
.brand-mascot-image { display:block; width:1.8em; height:1.8em; object-fit:contain; }
