@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600;700&display=swap');

:root {
    --bg-color: #ffde59; /* Vibrant yellow */
    --text-color: #2d3436;
    --primary: #ff5757; /* Red */
    --secondary: #5ce1e6; /* Cyan */
    --accent: #c1ff72; /* Lime */
    --border-color: #2d3436;
    --border-width: 4px;
    --shadow-offset: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Icons */
.icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    margin-bottom: 2px;
}

/* Neo-Brutalism Utilities */
.brutal-box {
    background-color: #ffffff;
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0px var(--border-color);
    border-radius: 12px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.brutal-box:hover {
    transform: translateY(-4px);
    box-shadow: 10px 10px 0px var(--border-color);
}

.brutal-btn {
    background-color: var(--accent);
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0px var(--border-color);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease-in-out;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brutal-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--border-color);
}

.brutal-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px var(--border-color);
}

.brutal-btn.primary { background-color: var(--primary); color: white; }
.brutal-btn.secondary { background-color: var(--secondary); }

.brutal-input {
    width: 100%;
    padding: 15px;
    border: var(--border-width) solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.05);
}

.brutal-input:focus {
    outline: none;
    background-color: #f1f2f6;
    box-shadow: inset 4px 4px 0px rgba(0,0,0,0.1);
}

/* Layout */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: #ffffff;
    border-bottom: var(--border-width) solid var(--border-color);
    box-shadow: 0 4px 0px var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -2px;
    color: var(--primary);
    text-shadow: 2px 2px 0px var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo .icon {
    width: 32px;
    height: 32px;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
    border: var(--border-width) solid var(--border-color);
    border-radius: 8px;
    background: var(--accent);
    box-shadow: 4px 4px 0px var(--border-color);
    transition: all 0.1s ease-in-out;
}

.hamburger:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px var(--border-color);
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.mobile-menu-overlay.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: #ffffff;
    border-bottom: var(--border-width) solid var(--border-color);
    box-shadow: 0 4px 0px var(--border-color);
}

.close-btn {
    cursor: pointer;
    padding: 10px;
    border: var(--border-width) solid var(--border-color);
    border-radius: 8px;
    background: var(--primary);
    color: white;
    box-shadow: 4px 4px 0px var(--border-color);
}

.mobile-menu-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-menu-content .brutal-btn {
    width: 100%;
    font-size: 1.2rem;
    padding: 15px;
    justify-content: flex-start;
}

@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }
    .desktop-menu {
        display: none;
    }
    .hamburger {
        display: block;
    }
    .mobile-menu-header {
        padding: 15px 20px;
    }
}

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

/* Battles Grid */
#battles-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

@media (max-width: 992px) {
    #battles-list {
        grid-template-columns: 1fr;
    }
}

/* Battles */
.battle-card {
    padding: 30px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.battle-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: -1px;
    line-height: 1.2;
}

.battle-images {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex: 1;
    align-items: stretch;
}

.photo-container {
    flex: 1;
    position: relative;
    cursor: pointer;
    border: var(--border-width) solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #eee;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.photo-container:hover {
    transform: scale(1.02) translateY(-5px);
    z-index: 5;
    box-shadow: 8px 8px 0px var(--border-color);
}

.photo-container:active {
    transform: scale(0.98);
}

.photo-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.photo-container img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    flex: 1;
}

.vote-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 7px;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.pc-vote {
    position: absolute;
    bottom: 25px;
    right: 10px;
    z-index: 10;
}

.mobile-vote-container {
    display: none;
}

.vote-count {
    display: inline-block;
    background: var(--border-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.vs-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    border: var(--border-width) solid var(--border-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    z-index: 10;
    box-shadow: 4px 4px 0px var(--border-color);
    animation: pulse 2s infinite;
    pointer-events: none;
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .battle-card {
        padding: 15px;
    }

    .battle-images {
        flex-direction: row;
        gap: 10px;
    }
    
    .photo-container img {
        height: auto;
    }

    .pc-vote {
        display: none;
    }

    .mobile-vote-container {
        display: flex;
        justify-content: center;
        margin-top: 5px;
    }

    .vote-count {
        font-size: 1rem;
        padding: 5px 10px;
    }

    .mobile-single-line {
        font-size: min(2.2rem, 8vw) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-single-line svg {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px;
    }

    .upload-grid {
        gap: 10px !important;
    }

    .upload-text {
        font-size: 0.9rem !important;
        white-space: nowrap;
        display: block;
        text-align: center;
        width: 100%;
    }

    .file-upload-wrapper {
        height: auto !important;
        aspect-ratio: 1 / 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 5px;
    }

    .vs-badge {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: calc(50% - 15px);
        left: 50%;
        transform: translate(-50%, -50%);
        border-width: 3px;
        box-shadow: 3px 3px 0px var(--border-color);
    }
}

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

.hidden {
    display: none !important;
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
    gap: 25px;
    animation: slideRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: translateX(-20px);
}

@keyframes slideRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rank-badge {
    font-size: 2rem;
    font-weight: bold;
    width: 60px;
    text-align: center;
}

.leaderboard-img-container {
    width: 100px;
    height: 100px;
}

.leaderboard-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: var(--border-width) solid var(--border-color);
    border-radius: 12px;
    box-shadow: 4px 4px 0px var(--border-color);
}

.win-icon {
    font-size: 3rem;
    margin-left: auto;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-info {
    flex: 1;
}

/* Crowns */
.crown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.diamond-crown { color: #00ffff; filter: drop-shadow(0 0 5px #00ffff); }
.platinum-crown { color: #e5e4e2; }
.gold-crown { color: #ffd700; filter: drop-shadow(0 0 5px #ffd700); }
.silver-crown { color: #c0c0c0; }
.bronze-crown { color: #cd7f32; }

/* File Upload */
.file-upload-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    border: var(--border-width) dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: #f8f9fa;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.2s;
}

.file-upload-wrapper:hover {
    background: #e9ecef;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-preview {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    z-index: 1;
}

/* Profile */
.profile-stat {
    font-size: 1.4rem;
    margin-bottom: 15px;
    background: var(--accent);
    padding: 10px 20px;
    border: var(--border-width) solid var(--border-color);
    border-radius: 8px;
    display: inline-block;
    margin-right: 15px;
    box-shadow: 4px 4px 0px var(--border-color);
}

.history-item {
    padding: 20px;
    border-bottom: var(--border-width) solid var(--border-color);
}
.history-item:last-child {
    border-bottom: none;
}
