* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --accent-primary: #6c5ce7;
    --accent-secondary: #00cec9;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #00cec9);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: #2a2a40;
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(108, 92, 231, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 206, 201, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Header */
header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    padding: 1rem 2rem;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
}

.search-container {
    margin-left: auto;
    position: relative;
}

#searchInput {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 300px;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.8rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Filters */
.category-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

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

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.game-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--bg-secondary);
}

.game-info {
    padding: 0.8rem 1rem;
}

.game-info h3 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tag {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    background: rgba(0, 206, 201, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* Proxy Section */
.proxy-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.proxy-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.proxy-toolbar input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.proxy-toolbar input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.proxy-toolbar button {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.proxy-toolbar button[title] {
    padding: 0.6rem 0.8rem;
}

.proxy-body {
    flex: 1;
    position: relative;
    background: white;
}

.proxy-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #555;
}

.placeholder-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.proxy-placeholder h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.proxy-placeholder p {
    margin: 0.5rem 0;
    color: #777;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
    max-width: 500px;
}

.quick-link {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #333;
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.quick-link:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.proxy-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.proxy-frame.active {
    display: block;
}

/* Game Modal */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.game-modal.active {
    display: flex;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.game-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-title h2 {
    font-size: 1.1rem;
}

.game-controls {
    display: flex;
    gap: 0.5rem;
}

.game-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.game-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.game-iframe-container {
    flex: 1;
    background: #000;
}

.game-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
    }
    nav { order: 3; width: 100%; justify-content: center; }
    .search-container { order: 2; margin-left: 0; width: 100%; }
    #searchInput { width: 100%; }
    .games-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .quick-links-grid { grid-template-columns: repeat(2, 1fr); }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 4px; }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 15, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-box {
    text-align: center;
    color: var(--text-primary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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