/* ===== Container & Header ===== */
.picker-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.8rem;
    z-index: 1;
}

.picker-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.88);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.13);
}

.header-content {
    flex: 1;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, #22c55e 0%, #06b6d4 55%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.88rem;
}

/* ===== Matchup Stage ===== */
.picker-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.matchup-stage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.stage-info {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    flex-shrink: 0;
}

.info-pill {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    min-width: 120px;
}

.pill-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.12rem;
}

.pill-value {
    font-size: 1.08rem;
    font-weight: 800;
    color: #fbbf24;
}

/* ===== Progress Bar ===== */
.progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-bottom: 0.8rem;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #22c55e, #06b6d4, #8b5cf6);
    transition: width 0.35s ease;
}

/* ===== Matchup Arena (vertical centering) ===== */
.matchup-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.matchup-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.4rem;
    align-items: center;
    width: 100%;
    max-width: 960px;
}

/* ===== Pick Cards with Flag Backgrounds ===== */
.pick-card {
    position: relative;
    width: 100%;
    min-height: 280px;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    padding: 0;
    text-align: left;
    color: white;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card-flag-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    transition: transform 0.4s ease;
}

.card-flag-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        160deg,
        rgba(4, 4, 28, 0.55) 0%,
        rgba(4, 4, 28, 0.78) 100%
    );
    transition: background 0.3s ease;
}

.card-content {
    position: relative;
    z-index: 1;
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 280px;
}

.pick-card:hover {
    transform: translateY(-4px) scale(1.015);
    border-color: rgba(34, 197, 94, 0.65);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        0 0 24px rgba(34, 197, 94, 0.15);
}

.pick-card:hover .card-flag-bg {
    transform: scale(1.06);
}

.pick-card:hover .card-flag-bg::after {
    background: linear-gradient(
        160deg,
        rgba(4, 4, 28, 0.45) 0%,
        rgba(4, 4, 28, 0.68) 100%
    );
}

.pick-card:active {
    transform: translateY(-1px) scale(0.99);
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pick-card.animate-in {
    animation: cardEnter 0.35s ease forwards;
}

.pick-country {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.65rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.pick-song {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.65rem;
    line-height: 1.4;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.pick-stage {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
}

.pick-stage.semi1 {
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.pick-stage.semi2 {
    background: rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.5);
    color: #d8b4fe;
}

.pick-stage.auto {
    background: rgba(245, 158, 11, 0.3);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fcd34d;
}

/* ===== VS Divider ===== */
.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vs-ring {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
    border: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
    animation: vsPulse 2.5s ease-in-out infinite;
}

.vs-ring span {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, #d8b4fe, #f9a8d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes vsPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
        border-color: rgba(139, 92, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 32px rgba(139, 92, 246, 0.35);
        border-color: rgba(139, 92, 246, 0.6);
    }
}

.hint-text {
    text-align: center;
    margin-top: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

/* ===== Results Stage ===== */
.results-stage {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    height: 100%;
    min-height: 0;
}

.results-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.results-head h2 {
    font-size: 1.3rem;
    background: linear-gradient(135deg, #22c55e, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Ranking Table ===== */
.ranking-wrap {
    height: 100%;
    min-height: 0;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(6, 6, 28, 0.62);
}

.result-tabs {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.result-tab {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.result-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.result-tab.active {
    background: rgba(139, 92, 246, 0.24);
    border-color: rgba(139, 92, 246, 0.72);
    color: #e9d5ff;
}

.result-views {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.result-view {
    display: none;
    flex: 1;
    min-height: 0;
}

.result-view.active {
    display: flex;
    flex-direction: column;
}

.full-height {
    height: 100%;
    min-height: 0;
    flex: 1;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.ranking-table th,
.ranking-table td {
    padding: 0.6rem 0.7rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ranking-table th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.62);
    position: sticky;
    top: 0;
    background: rgba(6, 6, 28, 0.95);
    z-index: 2;
}

.ranking-table td {
    font-size: 0.85rem;
}

.ranking-table tbody tr {
    transition: background 0.15s;
}

.ranking-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.ranking-table tbody tr:nth-child(-n+3) td:first-child {
    font-weight: 800;
    color: #fbbf24;
}

.ranking-country {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.stage-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.18rem 0.52rem;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stage-badge.semi1 {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

.stage-badge.semi2 {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
}

.stage-badge.auto {
    background: rgba(245, 158, 11, 0.22);
    color: #fcd34d;
}

.semi-panel {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 34, 0.55);
    padding: 0.8rem;
    overflow: auto;
}

.semi-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.col-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.col-heading.qualified-heading {
    color: #4ade80;
}

.col-heading.nq-heading {
    color: #f87171;
}

.chip-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.result-chip {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.6rem;
    font-size: 0.76rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.result-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.result-chip .chip-rank {
    font-weight: 800;
    font-size: 0.72rem;
    min-width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.result-chip .chip-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.result-chip .chip-info {
    flex: 1;
    min-width: 0;
}

.result-chip .chip-country {
    font-weight: 700;
    display: block;
}

.result-chip .chip-artist {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.55);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-chip.qualifier {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.1);
}

.result-chip.qualifier .chip-rank {
    color: #4ade80;
}

.result-chip.non-qualifier {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
}

.result-chip.non-qualifier .chip-rank {
    color: #f87171;
}

/* ===== Grand Final Lineup ===== */
.grand-final-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem;
}

.gf-chip {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.gf-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.gf-chip .gf-rank {
    font-weight: 800;
    font-size: 0.72rem;
    min-width: 24px;
    text-align: center;
    color: #fbbf24;
    flex-shrink: 0;
}

.gf-chip .gf-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.gf-chip .gf-info {
    flex: 1;
    min-width: 0;
}

.gf-chip .gf-country {
    font-weight: 700;
    display: block;
}

.gf-chip .gf-path {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
}

.gf-chip .gf-path.semi1 { color: #93c5fd; }
.gf-chip .gf-path.semi2 { color: #d8b4fe; }
.gf-chip .gf-path.auto { color: #fcd34d; }

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 1050px) {
    .matchup-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        max-width: 420px;
    }

    .card-content {
        min-height: 160px;
    }

    .pick-card {
        min-height: 160px;
    }

    .vs-ring {
        width: 44px;
        height: 44px;
    }

    .vs-ring span {
        font-size: 0.85rem;
    }

    .grand-final-list {
        grid-template-columns: 1fr;
    }
}
