/* Import retro pixel font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #0a0a0a;
    color: #00ff00;
    min-height: 100vh;
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(0, 255, 0, 0.03) 0px,
            transparent 2px,
            transparent 4px,
            rgba(0, 255, 0, 0.03) 4px
        );
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header styles */
.game-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.title {
    font-size: 2rem;
    color: #ffff00;
    text-shadow:
        4px 4px 0px #ff0000,
        8px 8px 0px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.2rem;
    animation: titlePulse 2s ease-in-out infinite;
}

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

.title-decoration {
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        #ffff00 20%,
        #ff0000 50%,
        #ffff00 80%,
        transparent 100%
    );
    margin: 1rem auto 0;
    max-width: 600px;
    animation: decorationGlow 3s ease-in-out infinite;
}

@keyframes decorationGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Character grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Character cards */
.character-card {
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 4px solid #00ff00;
    border-radius: 0;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow:
        0 0 20px rgba(0, 255, 0, 0.3),
        inset 0 0 20px rgba(0, 255, 0, 0.05);
}

.character-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, #00ff00, #ffff00, #00ff00);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.character-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #ffff00;
    box-shadow:
        0 8px 30px rgba(255, 255, 0, 0.5),
        inset 0 0 30px rgba(255, 255, 0, 0.1);
}

.character-card:hover::before {
    opacity: 0.3;
    animation: borderRotate 2s linear infinite;
}

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

.character-card:active {
    transform: translateY(-4px) scale(0.98);
}

.card-inner {
    text-align: center;
}

.character-sprite {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    image-rendering: pixelated;
    transition: transform 0.3s ease;
}

.character-card:hover .character-sprite {
    transform: scale(1.1);
    animation: spriteFloat 1s ease-in-out infinite;
}

@keyframes spriteFloat {
    0%, 100% { transform: translateY(0) scale(1.1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

.class-name {
    font-size: 1.2rem;
    color: #ffff00;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0px rgba(255, 0, 0, 0.5);
    letter-spacing: 0.1rem;
}

.class-description {
    font-size: 0.6rem;
    line-height: 1.4;
    color: #00ff00;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 6px solid #ffff00;
    padding: 2rem;
    width: 90%;
    max-width: 900px;
    position: relative;
    box-shadow:
        0 0 40px rgba(255, 255, 0, 0.6),
        inset 0 0 40px rgba(255, 255, 0, 0.1);
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    font-family: 'Press Start 2P', cursive;
    background: none;
    border: 2px solid #ff0000;
    color: #ff0000;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    background-color: #ff0000;
    color: #000;
    transform: scale(1.1);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 1rem;
}

.modal-left {
    text-align: center;
    border-right: 4px solid #00ff00;
    padding-right: 2rem;
}

.modal-sprite {
    width: 150px;
    height: 150px;
    margin: 0 auto 1.5rem;
    filter: drop-shadow(0 4px 12px rgba(0, 255, 0, 0.5));
}

.modal-sprite svg {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.modal-class-name {
    font-size: 1.5rem;
    color: #ffff00;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 0px rgba(255, 0, 0, 0.5);
}

.modal-description {
    font-size: 0.65rem;
    line-height: 1.6;
    color: #00ff00;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.modal-right {
    padding-left: 1rem;
}

.stats-title {
    font-size: 1rem;
    color: #ffff00;
    margin-bottom: 1.5rem;
    text-align: center;
    text-shadow: 2px 2px 0px rgba(255, 0, 0, 0.5);
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-row {
    display: grid;
    grid-template-columns: 60px 1fr 60px;
    align-items: center;
    gap: 1rem;
}

.stat-label {
    font-size: 0.7rem;
    color: #00ff00;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.stat-bar-container {
    height: 20px;
    background-color: #0a0a0a;
    border: 2px solid #00ff00;
    position: relative;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff00 0%, #ffff00 100%);
    width: 0;
    transition: width 0.8s ease-out;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

.stat-bar.animate {
    animation: statFill 0.8s ease-out forwards;
}

.stat-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.stat-value {
    font-size: 0.7rem;
    color: #ffff00;
    text-align: right;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.special-abilities {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 4px solid #00ff00;
}

.abilities-title {
    font-size: 0.8rem;
    color: #ffff00;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0px rgba(255, 0, 0, 0.5);
}

.abilities-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.abilities-list li {
    font-size: 0.6rem;
    color: #00ff00;
    padding: 0.5rem;
    background: rgba(0, 255, 0, 0.05);
    border-left: 3px solid #00ff00;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.8);
}

.abilities-list li::before {
    content: '▸ ';
    color: #ffff00;
}

/* Responsive design */
@media (max-width: 768px) {
    .title {
        font-size: 1.2rem;
        letter-spacing: 0.1rem;
    }

    .character-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .character-card {
        padding: 1rem;
    }

    .character-sprite {
        width: 80px;
        height: 80px;
    }

    .class-name {
        font-size: 0.9rem;
    }

    .class-description {
        font-size: 0.5rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal-left {
        border-right: none;
        border-bottom: 4px solid #00ff00;
        padding-right: 0;
        padding-bottom: 1.5rem;
    }

    .modal-right {
        padding-left: 0;
    }

    .modal-class-name {
        font-size: 1.2rem;
    }

    .stats-title {
        font-size: 0.9rem;
    }

    .stat-row {
        grid-template-columns: 50px 1fr 50px;
        gap: 0.5rem;
    }

    .stat-label,
    .stat-value {
        font-size: 0.6rem;
    }

    .abilities-title {
        font-size: 0.7rem;
    }

    .abilities-list li {
        font-size: 0.55rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .title {
        font-size: 1rem;
    }

    .character-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }

    .close-btn {
        padding: 0.3rem 0.6rem;
        font-size: 1.5rem;
    }

    .modal-sprite {
        width: 120px;
        height: 120px;
    }
}

/* Accessibility */
.character-card:focus {
    outline: 3px solid #ffff00;
    outline-offset: 2px;
}

.close-btn:focus {
    outline: 3px solid #ff0000;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .modal {
        display: none;
    }
}
