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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Add floating particles effect */
.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 255, 0.3) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(30px) rotate(240deg); }
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff; }
    to { text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff; }
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-btn {
    padding: 12px 24px;
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: white;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.team-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px auto;
    max-width: 600px;
}

.slot {
    aspect-ratio: 1;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.slot:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.slot.has-pokemon {
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.empty-slot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    color: rgba(255, 255, 255, 0.5);
}

.pokemon-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pokemon-sprite {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.pokemon-name {
    font-size: 0.8em;
    text-align: center;
}

.types {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.type {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    text-transform: uppercase;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.search-container {
    margin: 20px 0;
}

#searchInput {
    width: 100%;
    padding: 10px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
}

.pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.pokemon-cell {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pokemon-cell:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.moves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #667eea #f0f0f0;
}

.move-card {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.move-card:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
}

.move-card.selected {
    background: #667eea;
    color: white;
    border-color: #5a6fd8;
}

.move-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.move-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 8px;
    color: white;
}

.move-category {
    font-size: 0.85em;
    color: #666;
}

.move-stats {
    margin: 8px 0;
    font-size: 0.85em;
    display: flex;
    gap: 15px;
    color: #555;
}

.move-card.selected .move-category,
.move-card.selected .move-stats,
.move-card.selected .move-details {
    color: rgba(255, 255, 255, 0.9);
}

.move-details {
    font-size: 0.8em;
    color: #777;
    line-height: 1.4;
}

/* Enhanced battle arena */
.battle-arena {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.battle-container {
    max-width: 800px;
    margin: 0 auto;
}

.battle-field {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 20px 0;
}

.opponent-section, .player-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.player-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.player-section h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.player-section .team-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.pokemon-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.pokemon-info h3 {
    margin-bottom: 10px;
    font-size: 1.5em;
}

.health-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.health-bar {
    width: 200px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.health-text {
    font-size: 0.9em;
    font-weight: bold;
}

.battle-sprite {
    width: 120px;
    height: 120px;
    image-rendering: pixelated;
    transition: transform 0.3s ease;
}

.battle-sprite:hover {
    transform: scale(1.1);
}

.battle-actions {
    margin: 20px 0;
}

.battle-move {
    cursor: pointer;
    transition: transform 0.2s;
}

.battle-move:hover {
    transform: scale(1.05);
}

.battle-move.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.battle-log {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.battle-message {
    margin: 5px 0;
    font-size: 1.1em;
}

.battle-result {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.battle-result h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.battle-btn {
    display: block;
    margin: 20px auto;
    padding: 15px 30px;
    font-size: 1.2em;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.battle-btn:hover {
    background: #ff5252;
    transform: scale(1.05);
}

.save-btn {
    background: #4caf50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-size: 1.1em;
    cursor: pointer;
    float: right;
}

.save-btn:hover {
    background: #45a049;
}

/* Creator styles */
.creator-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.creator-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.status-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 50%;
    font-size: 1.2em;
    margin-left: 5px;
    animation: pulse 2s infinite;
}

.status-indicator.burn {
    background-color: #ff6b6b;
    color: white;
}

.status-indicator.poison {
    background-color: #a040a0;
    color: white;
}

.status-indicator.paralyze {
    background-color: #f8d030;
    color: #333;
}

.status-indicator.frozen {
    background-color: #98d8d8;
    color: #333;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.stat-buffs {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.stat-buff {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: statBuffPulse 2s infinite;
}

@keyframes statBuffPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pokemon-switch {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.pokemon-switch h3 {
    margin-bottom: 15px;
    color: white;
}

.switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.switch-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #333;
}

.switch-card:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.switch-sprite {
    width: 60px;
    height: 60px;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.switch-name {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 3px;
}

.switch-hp {
    font-size: 0.8em;
    color: #666;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.team-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#teamSelector {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
}

.small-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.small-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.small-btn.danger {
    background: rgba(255, 99, 71, 0.7);
}

.small-btn.danger:hover {
    background: rgba(255, 99, 71, 0.9);
}

.team-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.move-finder-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

#moveFinderResults {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.team-display {
    margin-top: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.team-display h4 {
    margin-bottom: 15px;
    text-align: center;
}

.battle-team {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.team-member {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.team-member:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.team-member.active {
    background: rgba(76, 175, 80, 0.3);
    border: 2px solid #4caf50;
}

.team-member.fainted {
    opacity: 0.5;
    cursor: not-allowed;
}

.team-sprite {
    width: 50px;
    height: 50px;
    image-rendering: pixelated;
    margin-bottom: 5px;
}

.team-name {
    font-size: 0.8em;
    font-weight: bold;
}

.team-hp {
    font-size: 0.7em;
    color: #ccc;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lobby-players {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
}

.player-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    min-width: 150px;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.ready-btn, .ready-indicator {
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    display: inline-block;
}

.ready-btn {
    background: #4caf50;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ready-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.ready-btn.ready {
    background: #ff6b6b;
}

.ready-indicator {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
}

.ready-indicator.ready {
    background: #4caf50;
    color: white;
}

#startBattleBtn {
    margin-top: 20px;
}

/* Local battle styling */
.local-battle-setup {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.player-setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

#startLocalBattleBtn {
    display: block;
    margin: 30px auto;
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(45deg, #ff6b6b, #ff5252);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

#startLocalBattleBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Responsive design */
@media (max-width: 768px) {
    .player-setup {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 1em;
    }
}