:root {
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #ffffff 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-hover: #f8fafc;
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --secondary: #0ea5e9;
    --secondary-glow: rgba(14, 165, 233, 0.3);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --connector-color: #cbd5e1;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%), url('bg.webp') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: auto;
}

.app-container {
    padding: 3rem 2rem;
    width: 100%;
    max-width: 1400px;
}

header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.8s ease-out;
}

.header-trophy {
    width: 120px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px var(--primary-glow));
    animation: float 3s ease-in-out infinite;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    text-shadow: 0 4px 10px rgba(16, 185, 129, 0.1);
    text-transform: uppercase;
    letter-spacing: 2px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.share-btn {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.share-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

/* Bracket Layout */
.bracket-container {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 2rem 0;
    animation: fadeIn 1s ease-out;
}

.round {
    display: flex;
    flex-direction: column;
    width: 240px;
}

.round-title {
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

.matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-grow: 1;
}

.match {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    min-height: 120px;
    position: relative;
}

/* Connectors */
.connector {
    position: absolute;
    right: -1.5rem;
    top: 25%;
    width: 1.5rem;
    height: 50%;
    border-top: 2px solid var(--connector-color);
    border-right: 2px solid var(--connector-color);
    border-bottom: 2px solid var(--connector-color);
    border-radius: 0 8px 8px 0;
    z-index: -1;
}

.connector::after {
    content: '';
    position: absolute;
    right: -1.5rem;
    top: 50%;
    width: 1.5rem;
    height: 2px;
    background-color: var(--connector-color);
}

.round:last-child .connector {
    display: none;
}

.round:nth-child(1) .match {}

.round:nth-child(2) .match {}

.round:last-child .match {
    justify-content: center;
    align-items: center;
}

/* Team Nodes */
.team-node {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 48px;
    width: 100%;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.team-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.team-node:hover::before {
    transform: translateX(100%);
}

.team-node:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px) scale(1.02);
}

.team-node.selected {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.team-flag {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.team-flag.hidden {
    opacity: 0;
    width: 0;
    margin: 0;
}

.team-select {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    width: 100%;
}

.team-select option {
    background: #ffffff;
    color: #0f172a;
    padding: 10px;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .app-container {
        padding: 1rem 0.5rem;
    }
    h1 {
        font-size: 2rem;
    }
    header {
        margin-bottom: 2rem;
    }
    .header-trophy {
        width: 80px;
    }
    .bracket-container {
        justify-content: flex-start;
        gap: 1.5rem;
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .round {
        width: 180px;
        min-width: 180px;
    }
    .team-node {
        height: 40px;
        gap: 0.5rem;
    }
    .team-select {
        font-size: 0.85rem;
    }
    .team-flag {
        width: 24px;
        height: 18px;
    }
}