:root {
    --bg-color: #0d0e15;
    --text-primary: #ffffff;
    --text-secondary: #8e95a3;
    --accent-blue: #007aff;
    --accent-blue-dim: rgba(0, 122, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
    overflow: hidden;
}

/* Dynamic Background Elements */
.bg-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: drift 12s infinite alternate ease-in-out;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 40, 150, 0.4), transparent 70%);
    top: -50px;
    left: -100px;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(10, 30, 100, 0.5), transparent 70%);
    top: 30%;
    right: -80px;
    animation-delay: -5s;
    animation-duration: 15s;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: radial-gradient(circle at top, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at top, black 30%, transparent 80%);
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 40px) scale(1.1);
    }
}

/* Core Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    text-align: center;
    padding: 46px 20px 8px;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.top-logo {
    height: 24px;
    object-fit: contain;
}

.l-ninetalk-text {
    font-size: 18px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
}

.title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    background: #fff;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 6px rgba(0, 122, 255, 0.4));
}

.date {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Hero Section & Podium */
.hero-section {
    position: relative;
    z-index: 5;
}

.podium-area {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 480px;
    padding: 0 10px;
    margin-top: 8px;
    perspective: 1000px;
}

.podium-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    flex: 1;
    max-width: 100px;
}

.podium-rank-2 {
    z-index: 2;
    margin-right: -5px;
}

.podium-rank-1 {
    z-index: 3;
}

.podium-rank-3 {
    z-index: 1;
    margin-left: -5px;
}

.podium-data {
    text-align: center;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
}

.p-name {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 6px;
}

.p-name.large {
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.winner-character {
    width: 120px;
    height: auto;
    margin-top: 16px;
    margin-bottom: -14px;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0px);
    }
}

.p-branch {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 400;
}

.p-count {
    font-size: 16px;
    font-weight: 400;
    color: #fff;
}

.highlight-count {
    color: #57a0ee;
}

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.03);
    color: #468ae7;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
    border: 1.5px solid rgb(2 123 210);
    white-space: nowrap;
}

.pulse-anim {
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(77, 184, 255, 0.2);
    }

    100% {
        box-shadow: 0 0 25px rgba(77, 184, 255, 0.5);
        border-color: rgba(77, 184, 255, 0.8);
    }
}

/* Cylindrical Glass Podium for 3D Feel */
.podium {
    width: 24vw;
    max-width: 80px;
    height: 0;
    /* Target animated via JS */
    position: relative;
    background: linear-gradient(180deg, rgba(200, 210, 240, 0.15) 0%, rgba(200, 210, 240, 0.02) 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: height 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom center;
}

/* Cylinder Top Face */
.podium::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -1px;
    /* accounting for border offset */
    right: -1px;
    height: 24px;
    background: rgba(220, 230, 250, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2;
}

/* Cylinder Bottom Face Shadow */
.podium::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    z-index: -1;
    filter: blur(4px);
}

/* Base adjustment for smaller screens */
@media (max-width: 360px) {
    .podium::before {
        top: -4vw;
        height: 8vw;
    }

    .podium::after {
        bottom: -4vw;
        height: 8vw;
    }
}

/* 1st Place Podium */
.p-1 {
    background: linear-gradient(180deg, rgba(0, 122, 255, 0.25) 0%, rgba(0, 122, 255, 0.05) 100%);
    border-left-color: rgba(0, 122, 255, 0.5);
}

.p-1::before {
    background: rgba(0, 122, 255, 0.35);
    border-color: rgba(0, 122, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.4), inset 0 0 10px rgba(0, 122, 255, 0.8);
}

.p-1::after {
    background: rgba(0, 122, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 122, 255, 0.4);
}

/* Spotlight Active */
.spotlight {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 480px;
    background: linear-gradient(to top, rgba(0, 122, 255, 0.2) 0%, transparent 100%);
    clip-path: polygon(30% 100%, 70% 100%, 100% 0, 0 0);
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    animation: fadeInPulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
    animation-delay: 1.2s;
}

@keyframes fadeInPulse {
    0% {
        opacity: 0.2;
        transform: translateX(-50%) scaleX(0.9);
    }

    100% {
        opacity: 0.6;
        transform: translateX(-50%) scaleX(1.1);
    }
}

/* Rise animation for data */
.data-rise {
    animation: dataRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dataRise {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Metrics Section */
.metrics-section {
    padding: 24px 0 20px;
    position: relative;
    z-index: 10;
}

.horizontal-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 24px;
    width: 320px;
    max-width: 85vw;
    flex-shrink: 0;
    scroll-snap-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #fff;
    letter-spacing: -0.3px;
}

.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ranking-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.r-rank {
    width: 26px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
    margin-right: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.r-rank.top-1 {
    background: linear-gradient(135deg, var(--accent-blue), #0056b3);
    color: #ffffff;
    border: none;
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.3);
}

.r-info {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.r-branch {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.r-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.r-val {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

.spacer {
    height: 190px;
}

/* Sticky Private Board */
.private-board {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    padding: 24px 20px 34px;
    /* extra bottom padding for mobile safe area */
    border-top: 1px solid var(--glass-border);
    background: rgba(13, 14, 21, 0.7);
    /* Deep Glass */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 100;
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.6);
}

.private-board.fade-in-up {
    animation: stickyUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translate(-50%, 100%);
}

@keyframes stickyUp {
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.board-header {
    margin-bottom: 20px;
}

.board-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.rank-highlight {
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    margin-left: 10px;
    display: inline-block;
    background: linear-gradient(90deg, #fff, var(--accent-blue));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.board-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-val {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
}

.stat-val small {
    font-size: 12px;
    font-weight: 500;
    margin-left: 2px;
    color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #e0e4eb 100%);
    color: #000;
    border: none;
    border-radius: 14px;
    padding: 18px;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 5px 10px rgba(255, 255, 255, 0.05);
}

/* Firework Animation */
.firework-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 10;
}

.firework-container::before,
.firework-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.firework-container::before {
    width: 4px;
    height: 4px;
}

.firework-container::after {
    width: 2px;
    height: 2px;
}

.firework-container.active::before {
    animation: fireworkBurst1 1.2s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

.firework-container.active::after {
    animation: fireworkBurst2 1.4s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes fireworkBurst1 {
    0% {
        box-shadow:
            0 0 0 0 #fff200, 0 0 0 0 #00ffff,
            0 0 0 0 #ff007f, 0 0 0 0 #00ff80,
            0 0 0 0 #fff200, 0 0 0 0 #00ffff,
            0 0 0 0 #ff007f, 0 0 0 0 #00ff80;
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    40% {
        opacity: 1;
    }

    100% {
        box-shadow:
            0 -120px 0 0 #fff200,
            85px -85px 0 0 #00ffff,
            120px 0 0 0 #ff007f,
            85px 85px 0 0 #00ff80,
            0 120px 0 0 #fff200,
            -85px 85px 0 0 #00ffff,
            -120px 0 0 0 #ff007f,
            -85px -85px 0 0 #00ff80;
        transform: translate(-50%, -20px) scale(1);
        opacity: 0;
    }
}

@keyframes fireworkBurst2 {
    0% {
        box-shadow:
            0 0 0 0 #ffaa00, 0 0 0 0 #00e5ff,
            0 0 0 0 #ff55ff, 0 0 0 0 #55ff55,
            0 0 0 0 #ffaa00, 0 0 0 0 #00e5ff,
            0 0 0 0 #ff55ff, 0 0 0 0 #55ff55,
            0 0 0 0 #ffffff, 0 0 0 0 #ffffff,
            0 0 0 0 #ffffff, 0 0 0 0 #ffffff,
            0 0 0 0 #ffffff, 0 0 0 0 #ffffff,
            0 0 0 0 #ffffff, 0 0 0 0 #ffffff;
        transform: translate(-50%, -50%) scale(0) rotate(22.5deg);
        opacity: 1;
    }

    40% {
        opacity: 1;
    }

    100% {
        box-shadow:
            /* Outer Ring */
            0 -160px 0 1px #ffaa00,
            113px -113px 0 1px #00e5ff,
            160px 0 0 1px #ff55ff,
            113px 113px 0 1px #55ff55,
            0 160px 0 1px #ffaa00,
            -113px 113px 0 1px #00e5ff,
            -160px 0 0 1px #ff55ff,
            -113px -113px 0 1px #55ff55,
            /* Inner White Sparks */
            0 -60px 0 0 #ffffff,
            42px -42px 0 0 #ffffff,
            60px 0 0 0 #ffffff,
            42px 42px 0 0 #ffffff,
            0 60px 0 0 #ffffff,
            -42px 42px 0 0 #ffffff,
            -60px 0 0 0 #ffffff,
            -42px -42px 0 0 #ffffff;
        transform: translate(-50%, -10px) scale(1.1) rotate(22.5deg);
        opacity: 0;
    }
}