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

:root {
    --accent-gold: #FFC300;
    --accent-orange: #FF5733;
    --dark-bg: rgba(0, 0, 0, 0.85);
    --fab-blue: #1a1a2e;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    transition: background 0.4s ease;
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    z-index: 10;
}

.title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    color: #1a1a2e;
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);
    letter-spacing: -1px;
}

.subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #2d2d2d;
    margin-top: 8px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    display: inline-block;
}

.character-container {
    position: relative;
    margin: 20px 0;
}

.character-display {
    width: min(300px, 80vw);
    height: min(300px, 80vw);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    overflow: hidden;
    padding: 20px;
}

.character-display:hover {
    transform: scale(1.02);
}

.character-display:active {
    transform: scale(0.98);
}

.character-display.pixelated {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.character-display.pixelated svg {
    filter: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><filter id="pixelate"><feFlood x="0" y="0" height="1" width="1"/><feComposite width="10" height="10"/><feTile result="tile"/><feComposite in="SourceGraphic" in2="tile" operator="in"/><feMorphology operator="dilate" radius="5"/></filter></svg>#pixelate');
}

.character-svg {
    width: 100%;
    height: 100%;
}

.character-svg.animated {
    animation: bobble 1.5s ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes bobble {
    0%, 100% { transform: rotate(-1deg) translateY(0); }
    25% { transform: rotate(1deg) translateY(-3px); }
    50% { transform: rotate(-1deg) translateY(0); }
    75% { transform: rotate(1deg) translateY(-2px); }
}

.fuse-glow {
    animation: fuseGlow 0.5s ease-in-out infinite alternate;
}

@keyframes fuseGlow {
    from { opacity: 0.6; }
    to { opacity: 1; fill: #ff9500; }
}

.sparkle-effect {
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.explosion {
    animation: shake 0.3s ease-in-out 3;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

.explosion-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: explode 1.5s ease-out forwards;
    pointer-events: none;
}

.explosion-emoji {
    font-size: 120px;
    display: block;
}

@keyframes explode {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* Traits Panel */
.traits-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 320px;
    max-width: 100vw;
    height: 100vh;
    background: var(--dark-bg);
    backdrop-filter: blur(10px);
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
    z-index: 100;
    overflow-y: auto;
    padding: 24px;
    border-radius: 0 20px 20px 0;
}

.traits-panel.open {
    transform: translateX(0);
}

.traits-title {
    color: var(--accent-gold);
    font-size: 1.5rem;
    margin-bottom: 24px;
    font-weight: 600;
}

.traits-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trait-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trait-category {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'JetBrains Mono', monospace;
}

.trait-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.trait-option {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.trait-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.trait-option.active {
    background: var(--accent-gold);
    color: #1a1a2e;
    border-color: var(--accent-gold);
    font-weight: 600;
}

.close-traits-btn {
    width: 100%;
    padding: 16px;
    margin-top: 30px;
    background: linear-gradient(135deg, var(--accent-orange), #ff8c42);
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.close-traits-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 87, 51, 0.4);
}

/* FAB Menu */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #2d2d4a);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-main:hover {
    transform: scale(1.1);
}

.fab-main.open {
    transform: rotate(180deg);
    background: linear-gradient(135deg, var(--accent-orange), #ff8c42);
}

.fab-menu {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fab-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateX(60px);
    opacity: 0;
    transition: all 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.fab-menu.open .fab-item {
    transform: translateX(0);
    opacity: 1;
}

.fab-item:hover {
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fab-item.active {
    background: var(--accent-gold);
}

.fab-icon {
    font-size: 18px;
}

.fab-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
}

.footer a {
    color: rgba(0, 0, 0, 0.5);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    transition: all 0.2s ease;
}

.footer a:hover {
    color: #1a1a2e;
    background: rgba(255, 255, 255, 0.8);
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .traits-panel {
        width: 100%;
        border-radius: 0;
    }
    
    .character-display {
        width: 85vw;
        height: 85vw;
    }
    
    .fab-container {
        bottom: 16px;
        right: 16px;
    }
    
    .fab-main {
        width: 54px;
        height: 54px;
    }
}

/* Dark background text adjustment */
.app-container[style*="#1a1a2e"] .title,
.app-container[style*="#2c3e50"] .title,
.app-container[style*="#3357FF"] .title {
    color: white;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.app-container[style*="#1a1a2e"] .subtitle,
.app-container[style*="#2c3e50"] .subtitle,
.app-container[style*="#3357FF"] .subtitle {
    background: rgba(0, 0, 0, 0.4);
    color: white;
}

.app-container[style*="#1a1a2e"] .footer a,
.app-container[style*="#2c3e50"] .footer a,
.app-container[style*="#3357FF"] .footer a {
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}