/* =========================================
   1. VARIABLES & THEMES
========================================== */
:root {
    /* Sizes */
    --header-height: 48px; 
    --base-font: 16px; 
    
    /* Default Light Theme */
    --primary-color: #007aff;
    --primary-hover: #005ecb;
    --bg-color: #ffffff;
    --text-color: #1d1d1f;
    --card-bg: #f5f5f7;
    --nav-glass: rgba(255, 255, 255, 0.85);
    --sidebar-bg: #ffffff;
    --footer-bg: #f5f5f7;
    --border-color: #d2d2d7;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --float-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    --transition-speed: 0.3s;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: #000000; 
    --text-color: #f5f5f7; 
    --card-bg: #1c1c1e;
    --nav-glass: rgba(28, 28, 30, 0.85); 
    --sidebar-bg: #1c1c1e; 
    --footer-bg: #1d1d1f;
    --border-color: #38383a; 
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --float-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Text Sizing Logic */
html[data-text="small"] { font-size: 14px; }
html[data-text="normal"] { font-size: 16px; }
html[data-text="large"] { font-size: 19px; }

/* Reset & Basics */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
}

html { scroll-behavior: smooth; }

body { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    transition: background-color var(--transition-speed), color var(--transition-speed); 
    line-height: 1.6; 
    font-size: var(--base-font); 
    overflow-x: hidden; 
}

.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

a { transition: color var(--transition-speed); }

/* =========================================
   2. STATIC HEADER (Apple Thin)
========================================== */
.static-bar {
    position: absolute; 
    top: 0; left: 0; width: 100%; 
    height: var(--header-height);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 0 20px; 
    z-index: 900; 
    pointer-events: none;
    border-bottom: 1px solid transparent; 
}

.static-left { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.static-right { display: flex; align-items: center; gap: 15px; pointer-events: auto; padding-right: 50px; }

.space-icon { font-size: 1.2rem; color: var(--primary-color); }
.site-name { font-weight: 600; font-size: 1rem; color: var(--text-color); text-decoration: none; }

.search-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-color); font-size: 1.1rem; opacity: 0.8;
    padding: 8px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-speed);
}
.search-btn:hover { background: rgba(128,128,128, 0.1); opacity: 1; color: var(--primary-color); }

/* =========================================
   3. FLOATING DOCK (Menu Button)
========================================== */
.floating-dock {
    position: fixed; top: 0; left: 0; width: 100%; 
    height: var(--header-height);
    display: flex; justify-content: flex-end; align-items: center; padding: 0 20px;
    z-index: 1000; pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-container { pointer-events: auto; display: flex; align-items: center; }

.menu-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-color); 
    padding: 8px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-speed);
}

.menu-icon-svg {
    width: 26px; height: 26px;
    stroke: currentColor; stroke-width: 2.5; stroke-linecap: round;
}

/* --- SCROLL STATE FIX (No Dead Zones) --- */
.floating-dock.scrolled {
    top: auto; bottom: 30px; 
    justify-content: flex-end; padding-right: 30px;
}

/* Container is invisible, just a wrapper */
.floating-dock.scrolled .menu-container {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0; 
}

/* 100% of the visual shape is the clickable button */
.floating-dock.scrolled .menu-btn {
    background: var(--nav-glass);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--float-shadow);
    border-radius: 30px;
    padding: 12px 20px; /* This padding expands the hit area */
}

.floating-dock.scrolled .menu-btn:hover {
    transform: scale(1.05); /* Premium hover pop effect */
    background: var(--card-bg);
}

/* =========================================
   4. SIDEBAR (CARD STYLE) & CONTROLS
========================================== */
.sidebar {
    position: fixed; 
    top: 70px;
    right: 20px;
    width: 320px;
    max-width: 85vw;
    height: auto;
    max-height: 85vh;
    background-color: var(--sidebar-bg);
    z-index: 1100; 
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--float-shadow);
    transform: translateY(-20px) scale(0.95); opacity: 0; pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column; padding: 20px; overflow-y: auto;
}

.sidebar.active { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.2); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    z-index: 1090; opacity: 0; pointer-events: none; transition: 0.3s;
}
.overlay.active { opacity: 1; pointer-events: auto; }

.menu-header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 15px; 
}

.tool-btn {
    background: var(--card-bg); border: 1px solid var(--border-color);
    width: 42px; height: 42px; border-radius: 50%;
    color: var(--text-color); cursor: pointer; 
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; transition: var(--transition-speed);
}
.tool-btn:hover { border-color: var(--primary-color); color: var(--primary-color); transform: scale(1.08); }

/* --- Search Modal --- */
.search-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 2000;
    display: none; align-items: flex-start; justify-content: center; padding-top: 100px;
}
.search-modal.active { display: flex; animation: fadeIn 0.2s; }
.search-box {
    background: var(--bg-color); width: 90%; max-width: 500px;
    border-radius: 16px; padding: 20px; box-shadow: var(--float-shadow);
    border: 1px solid var(--border-color);
}
.search-input {
    width: 100%; padding: 12px; font-size: 1.1rem; border: 1px solid var(--border-color);
    border-radius: 10px; outline: none; background: var(--card-bg); color: var(--text-color);
    transition: border-color var(--transition-speed);
}
.search-input:focus { border-color: var(--primary-color); }

.search-results { margin-top: 15px; max-height: 250px; overflow-y: auto; }
.search-item {
    display: block; padding: 10px; color: var(--text-color); text-decoration: none;
    border-bottom: 1px solid var(--border-color); font-size: 0.95rem; transition: background-color 0.2s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--card-bg); color: var(--primary-color); border-radius: 8px; }

/* General UI */
.profile-section { text-align: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.profile-icon { width: 70px; height: 70px; background: linear-gradient(135deg, var(--primary-color), #8b5cf6); border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 1.5rem; }
.profile-link { color: var(--primary-color); text-decoration: none; font-size: 0.95rem; font-weight: 500; }

.nav-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.nav-list a { text-decoration: none; color: var(--text-color); font-size: 1.05rem; font-weight: 500; padding: 12px; border-radius: 14px; display: block; transition: all var(--transition-speed); }
.nav-list a:hover { background: var(--card-bg); color: var(--primary-color); transform: translateX(5px); }

/* Main Layout */
main { padding-top: 80px; } 
.hero { padding: 50px 0; text-align: center; animation: fadeIn 1s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.hero h1 { font-size: 3.2rem; margin-bottom: 15px; background: linear-gradient(135deg, var(--text-color) 20%, var(--primary-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.2rem; opacity: 0.7; max-width: 600px; margin: 0 auto; }

/* PRODUCT CARD STYLE */
.game-card { background: var(--card-bg); border-radius: 24px; border: 1px solid var(--border-color); display: flex; flex-wrap: wrap; overflow: hidden; margin-bottom: 30px; transition: var(--transition-speed); }
.game-card:hover { border-color: var(--primary-color); box-shadow: var(--shadow); }

.game-image { flex: 1; min-width: 300px; display: flex; align-items: center; justify-content: center; font-size: 5rem; color: white; min-height: 300px; }
.game-content { flex: 1; padding: 40px; min-width: 300px; display: flex; flex-direction: column; justify-content: center;}

.play-btn { display: inline-block; padding: 12px 30px; background: var(--primary-color); color: white; text-decoration: none; border-radius: 40px; margin-top: 20px; font-weight: bold; font-size: 1rem; align-self: flex-start; transition: var(--transition-speed); }
.play-btn:hover { background: var(--primary-hover); transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3); }

/* Grid Info Cards */
.grid-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; padding: 60px 0; }
.info-card { background: var(--card-bg); padding: 25px; border-radius: 20px; border: 1px solid transparent; text-decoration: none; color: var(--text-color); display: block; transition: all var(--transition-speed); }
.info-card h3 i { margin-right: 8px; color: var(--primary-color); }
.info-card:hover { border-color: var(--border-color); box-shadow: var(--shadow); transform: translateY(-5px); }

.section-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 20px; }

/* Footer */
footer { background-color: var(--footer-bg); padding: 50px 0 30px; margin-top: 80px; border-top: 1px solid var(--border-color); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; }
.footer-links a { display: block; color: var(--text-color); opacity: 0.7; text-decoration: none; margin-bottom: 8px; font-size: 0.95rem; }
.footer-links a:hover { opacity: 1; color: var(--primary-color); }

@media (max-width: 768px) { 
    .hero h1 { font-size: 2.5rem; } 
    .game-content { padding: 30px; }
}
