:root {
    --bg-dark: #120b08;
    --gold-primary: #ffd166;
    --gold-secondary: #f4a261;
    --green-accent: #2ecc71;
    --vol1-color: #e76f51;
    --vol2-color: #2a9d8f;
    --glass-bg: rgba(26, 16, 12, 0.85);
    --glass-border: rgba(255, 209, 102, 0.25);
    --text-color: #ffffff;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background: var(--bg-dark);
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
}

#appContainer {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#mainHeader {
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    font-size: 2.2rem;
}

.brand-text h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    color: var(--gold-primary);
    letter-spacing: 1px;
}

.brand-text .tagline {
    font-size: 0.75rem;
    color: #e2a065;
    font-weight: 600;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--gold-primary);
    color: #000;
}

/* Hub View */
.hub-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1.5rem;
    background: radial-gradient(circle at center, #2e1a12 0%, #0d0705 100%);
}

.hub-hero {
    text-align: center;
    max-width: 650px;
    margin-bottom: 3rem;
}

.hub-hero h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    background: linear-gradient(to right, #ffd166, #f4a261);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.hub-hero p {
    font-size: 1.05rem;
    color: #d1b199;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 900px;
}

.game-card {
    background: rgba(35, 20, 14, 0.9);
    border: 2px solid rgba(255, 209, 102, 0.3);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 209, 102, 0.3);
}

.card-vol1:hover {
    border-color: var(--vol1-color);
}

.card-vol2:hover {
    border-color: var(--vol2-color);
}

.card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--gold-primary);
    color: #000;
    font-weight: 900;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
}

.card-media {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.lex-avatar {
    font-size: 4.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 209, 102, 0.4));
}

.card-content h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--gold-secondary);
    font-weight: 600;
    margin-bottom: 1.2rem;
}

.card-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.8rem;
    font-size: 0.9rem;
    color: #d1c0b3;
}

.play-btn {
    width: 100%;
    background: linear-gradient(135deg, #e76f51, #f4a261);
    color: #fff;
    border: none;
    padding: 0.9rem;
    font-size: 1.1rem;
    font-weight: 900;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(231, 111, 81, 0.4);
    transition: all 0.2s;
}

.play-btn-v2 {
    background: linear-gradient(135deg, #2a9d8f, #2ecc71);
    box-shadow: 0 4px 15px rgba(42, 157, 143, 0.4);
}

.play-btn:hover {
    filter: brightness(1.15);
}

/* Viewport / WASM Container */
.game-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 70px);
    background: #000;
}

.viewport-toolbar {
    height: 45px;
    background: #1a100c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.active-title {
    font-weight: 800;
    color: var(--gold-primary);
}

.toolbar-controls {
    display: flex;
    gap: 0.8rem;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tool-btn.danger-btn {
    background: rgba(231, 111, 81, 0.4);
    color: #ff8b7b;
}

.player-container {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hidden {
    display: none !important;
}
