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

@keyframes fadeInCard {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

::selection {
    background-color: rgb(115, 0, 255);
    color: white;
}

:root {
    --bg: #0e0e10;
    --bg-2: #18181c;
    --bg-3: #222228;
    --border: rgba(255, 255, 255, 0.07);
    --border-2: rgba(255, 255, 255, 0.13);
    --text: #f0eff4;
    --text-2: #9997a8;
    --text-3: #5c5a6e;
    --accent: #7c6af7;
    --accent-2: #a594ff;
    --accent-bg: rgba(124, 106, 247, 0.12);
    --danger: #e05555;
    --success: #47c27b;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --nav-w: 54px;
    --sidebar-w: 270px;
    --header-h: 52px;
    --transition: 0.18s ease;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

body {
    background: url("/images/background2.png");
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

/* ── Desktop Container ─────────────────────────────────────────── */
.desktop-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* ── Header ────────────────────────────────────────────────────── */
#header-window {
    height: var(--header-h);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px 0 0;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Logo area — sits in the same width as the icon rail */
.header-title {
    flex-shrink: 0;
    padding: 0 18px;
    font-size: 18px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: -0.5px;
    color: var(--text);
    border-right: 1px solid var(--border);
    height: var(--header-h);
    user-select: none;
}

.search-bar {
    flex: 1;
    max-width: 380px;
    height: 34px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}

.search-bar::placeholder {
    color: var(--text-3);
}

.search-bar:focus {
    border-color: var(--accent);
}

.status-bar {
    display: none;
}

body::after {
    display: none;
}

.desktop-container {
    display: grid;
    grid-template-rows: var(--header-h) 1fr auto;
    grid-template-columns: 1fr;
    height: 100vh;
    overflow: hidden;
}

/* ── Games Section (main content area) ────────────────────────── */
.games-section {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 28px;
    background: none;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-3) transparent;
    overflow-x: hidden;
}

.games-section::-webkit-scrollbar {
    width: 6px;
}

.games-section::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 3px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 16px;
}

/* ── Games Grid ────────────────────────────────────────────────── */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 14px;
}

/* ── Game Card ─────────────────────────────────────────────────── */
.game-card {
    background: rgba(24, 24, 28, 0.4);
    backdrop-filter: blur(2px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color var(--transition), transform var(--transition);
    outline: none;
}

.game-card:hover,
.game-card:focus-visible {
    border-color: var(--border-2);
    transform: scale(120%);
    z-index: 999;
    animation: none;
}

.game-card:active {
    transform: translateY(0);
}

.game-card img {
    width: 100%;
    height: 148px;
    object-fit: cover;
    aspect-ratio: 1;
    display: block;
    background: var(--bg-3);
}

.game-info {
    padding: 10px 12px 13px;
}

.game-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-desc {
    font-size: 11px;
    color: var(--text-3);
    line-height: 1.45;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Favorite Button ───────────────────────────────────────────── */
.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(14, 14, 16, 0.72);
    border: 1px solid var(--border);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-2);
    transition: color var(--transition), background var(--transition);
    z-index: 2;
}

.favorite-btn:hover,
.favorite-btn.favorited {
    color: #f5c842;
    background: rgba(245, 200, 66, 0.15);
    border-color: rgba(245, 200, 66, 0.3);
}

/* ── Banner Game ───────────────────────────────────────────────── */
.banner-game {
    grid-column: 1 / -1;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition);
    position: relative;
}

.banner-game:hover {
    border-color: var(--border-2);
}

.banner-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent-bg);
    color: var(--accent-2);
    border: 1px solid rgba(124, 106, 247, 0.25);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 10px;
    margin: 16px 0 8px 16px;
    width: fit-content;
}

.banner-game .game-title {
    font-size: 20px !important;
    color: var(--text) !important;
    padding: 0 16px 6px;
    white-space: normal;
}

.banner-game img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 0;
    margin-top: 0;
    display: block;
}

.banner-game p {
    padding: 12px 16px 16px;
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.55;
}

/* ── Popup (Game Viewer) ───────────────────────────────────────── */
.popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
}

.popup-active {
    display: flex;
}

.popup-window {
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: #0a0a0c;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popup-header {
    background: var(--bg-2);
    padding: 0 16px;
    height: 48px;
    display: none;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#popup-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.close-popup-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.close-popup-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.popup-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
}

.popup-content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #000;
    position: relative;
}

#game-iframe {
    flex: 1;
    border: none;
    background: #000;
}

/* ── Sidebar (in popup) ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: width var(--transition), padding var(--transition);
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-3) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 2px;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-toggle {
    position: absolute;
    top: 16px;
    right: 0;
    width: 22px;
    height: 44px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    font-size: 11px;
    transition: background var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-2);
}

.close-game-btn {
    background: rgba(224, 85, 85, 0.12);
    color: var(--danger);
    border: 1px solid rgba(224, 85, 85, 0.25);
    border-radius: var(--radius);
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: background var(--transition), border-color var(--transition);
}

.close-game-btn:hover {
    background: rgba(224, 85, 85, 0.22);
    border-color: var(--danger);
}

.sidebar-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--bg-3);
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-desc {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.55;
}

.similar-games-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-top: 4px;
}

.similar-game-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-3);
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: border-color var(--transition), background var(--transition);
}

.similar-game-item:hover {
    border-color: var(--border-2);
    background: var(--bg-2);
}

.similar-game-item img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-2);
}

/* fullscreen btn (inside sidebar) */
.fullscreen-btn {
    background: var(--accent-bg);
    border: 1px solid rgba(124, 106, 247, 0.3);
    color: var(--accent-2);
    padding: 8px 14px;
    margin: 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background var(--transition);
    align-self: flex-start;
}

.fullscreen-btn:hover {
    background: rgba(124, 106, 247, 0.22);
}

/* ── Disclosure ────────────────────────────────────────────────── */
.disclosure {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-top: 20px;
    max-width: 820px;
}

.disclosure h1 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.disclosure h2 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 18px 0 7px;
}

.disclosure h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin: 12px 0 5px;
}

.disclosure p {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.7;
    margin-bottom: 8px;
}

.disclosure ul {
    padding-left: 16px;
    margin-bottom: 8px;
}

.disclosure ul li {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.7;
    margin-bottom: 4px;
}

.disclosure ul ul {
    margin-top: 4px;
    margin-bottom: 0;
}

.disclosure hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.disclosure a {
    color: var(--accent-2);
    text-decoration: none;
}

.disclosure a:hover {
    color: #c4b8ff;
    text-decoration: underline;
}

.disclosure strong {
    color: var(--text-2);
    font-weight: 600;
}

.disclosure em {
    color: var(--text-3);
    font-style: italic;
}

.disclosure .highlight {
    background: var(--accent-bg);
    color: var(--accent-2);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
}

.disclosure .data-box {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 12px 0;
}

.disclosure .data-box h3 {
    margin-top: 0;
    color: var(--text-2);
}

/* ── Scrollbar global ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-2);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --nav-w: 0px;
    }

    .header-title {
        width: auto;
        padding: 0 14px;
        border-right: none;
        font-size: 16px;
    }

    .search-bar {
        max-width: 100%;
    }

    .games-section {
        padding: 16px;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .game-card img {
        height: 120px;
    }

    .sidebar {
        display: none !important;
    }

    .disclosure {
        padding: 16px;
    }
}

/* ── Wii-Style Game Launch Effect ──────────────────────────────── */

/* ── Flash overlay (white burst on click) ─────────────────────── */
.card-flash-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: normal;
}

.card-flash-overlay.flash-active {
    animation: wii-flash 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes wii-flash {
    0% {
        opacity: 0.95;
    }

    35% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
    }
}

/* ── Card "selected" white pulse ──────────────────────────────── */
.game-card.launching,
.banner-game.launching {
    animation: card-select-pulse 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 9000;
    position: relative;
}

@keyframes card-select-pulse {
    0% {
        filter: brightness(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        transform: scale(1);
    }

    20% {
        filter: brightness(3) saturate(0);
        box-shadow: 0 0 60px 30px rgba(255, 255, 255, 0.95);
        transform: scale(1.06);
    }

    60% {
        filter: brightness(2) saturate(0.3);
        box-shadow: 0 0 40px 20px rgba(255, 255, 255, 0.5);
        transform: scale(1.04);
    }

    100% {
        filter: brightness(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        transform: scale(1);
    }
}

/* ── Hero launcher: the card image expands to fill screen ─────── */
.game-launch-hero {
    position: fixed;
    z-index: 99995;
    border-radius: 16px;
    overflow: hidden;
    pointer-events: none;
    will-change: transform, border-radius, filter, opacity;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.6),
        0 30px 80px rgba(0, 0, 0, 0.8);
}

.game-launch-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    will-change: filter;
}

/* State: expanding */
.game-launch-hero.hero-expanding {
    animation: hero-expand 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* State: blurring while game loads */
.game-launch-hero.hero-blurring img {
    animation: hero-blur 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hero-blurring {
    filter: blur(40px) brightness(0.5);
    transition: filter 1.0s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* State: fade out once iframe is ready */
.game-launch-hero.hero-fadeout {
    animation: hero-fadeout 0.45s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* style.css */

/* 1. Use a more "organic" bezier curve (Quintic or Exponential) */
@keyframes hero-expand {
    0% {
        border-radius: 16px;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 30px 80px rgba(0, 0, 0, 0.8);
        filter: brightness(1);
    }

    15% {
        /* Initial "impact" brightness */
        filter: brightness(1.4);
    }

    100% {
        border-radius: 0px;
        box-shadow: 0 0 0 0px transparent, 0 0 0 transparent;
        filter: brightness(1);
    }
}

@keyframes hero-blur {
    0% {
        filter: blur(0px) brightness(1);
    }

    100% {
        filter: blur(40px) brightness(0.3) saturate(0.5);
    }
}

@keyframes hero-fadeout {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ── Loading shimmer overlay on hero ──────────────────────────── */
.game-launch-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg,
            transparent 0%,
            rgba(255, 255, 255, 0) 35%,
            rgba(255, 255, 255, 0.18) 50%,
            rgba(255, 255, 255, 0) 65%,
            transparent 100%);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-launch-hero.hero-blurring::after {
    opacity: 1;
    animation: hero-shimmer 1.6s ease-in-out infinite;
}

@keyframes hero-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ── Loading indicator ─────────────────────────────────────────── */
.launch-loading-ring {
    position: fixed;
    z-index: 99997;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.launch-loading-ring.ring-visible {
    animation: ring-appear 0.35s 0.5s ease forwards;
}

@keyframes ring-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.launch-loading-ring.ring-fadeout {
    animation: ring-fadeout 0.25s ease forwards;
}

@keyframes ring-fadeout {
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

/* Wii-style spinning ring */
.ring-spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    position: relative;
}

.ring-spinner::before,
.ring-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

.ring-spinner::before {
    inset: 0;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.3);
    animation: spin-outer 0.9s linear infinite;
}

.ring-spinner::after {
    inset: 8px;
    border-top-color: rgba(165, 148, 255, 0.9);
    border-left-color: rgba(165, 148, 255, 0.4);
    animation: spin-inner 0.65s linear infinite reverse;
}

@keyframes spin-outer {
    to {
        transform: rotate(360deg);
    }
}

@keyframes spin-inner {
    to {
        transform: rotate(360deg);
    }
}

.ring-label {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    animation: label-pulse 1.4s ease-in-out infinite;
}

@keyframes label-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* ── Dark vignette that grows behind hero during launch ────────── */
.launch-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99994;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.97) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.55s ease;
}

.launch-backdrop.backdrop-visible {
    opacity: 1;
}

.launch-backdrop.backdrop-hidden {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ── Ripple ring burst on card click origin ────────────────────── */
.click-ripple {
    position: fixed;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: 99996;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.9;
    animation: ripple-burst 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ripple-burst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.9;
    }

    60% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0.4;
    }

    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}