:root {
    --color-ice: #b3e5fc;
    --color-ice-light: #e1f5fe;
    --color-ice-glow: rgba(179, 229, 252, 0.4);
    --color-primary: #4fc3f7;
    --color-primary-bright: #81d4fa;
    --color-accent-warm: #ffb74d;
    --color-text-secondary: #90a4ae;
    --color-text-muted: #607d8b;
    --shadow-glass: 0 8px 32px rgba(13, 33, 55, 0.5);
    --shadow-glow: 0 0 30px var(--color-ice-glow);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

body#indexBody {
    background: linear-gradient(180deg, var(--arctic-dark) 0%, var(--arctic-deep) 50%, var(--arctic-medium) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

#snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: var(--ice-white);
    animation: snowfall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes snowfall {
    0% {
        transform: translateY(-10px) rotate(0deg);
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

#arctic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

#arctic-aurora {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(135deg,
            transparent 30%,
            rgba(79, 195, 247, 0.1) 40%,
            rgba(129, 212, 250, 0.08) 50%,
            rgba(100, 255, 218, 0.06) 60%,
            transparent 70%);
    animation: aurora 15s ease-in-out infinite alternate;
}

@keyframes aurora {
    0% {
        opacity: 0.3;
        transform: translateX(-5%) skewX(-5deg);
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 0.4;
        transform: translateX(5%) skewX(5deg);
    }
}

#arctic-wave,
#arctic-wave-2 {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 200px;
    background: linear-gradient(to top,
            rgba(13, 71, 161, 0.6) 0%,
            rgba(21, 101, 192, 0.4) 50%,
            transparent 100%);
}

#arctic-wave {
    clip-path: polygon(0 70%, 5% 65%, 10% 68%, 15% 62%, 20% 66%, 25% 60%,
            30% 64%, 35% 58%, 40% 62%, 45% 56%, 50% 60%,
            55% 54%, 60% 58%, 65% 52%, 70% 56%, 75% 50%,
            80% 54%, 85% 48%, 90% 52%, 95% 46%, 100% 50%,
            100% 100%, 0 100%);
    animation: wave 8s ease-in-out infinite;
}

#arctic-wave-2 {
    height: 180px;
    background: linear-gradient(to top,
            rgba(25, 118, 210, 0.5) 0%,
            rgba(66, 165, 245, 0.3) 50%,
            transparent 100%);
    clip-path: polygon(0 75%, 5% 70%, 10% 73%, 15% 67%, 20% 71%, 25% 65%,
            30% 69%, 35% 63%, 40% 67%, 45% 61%, 50% 65%,
            55% 59%, 60% 63%, 65% 57%, 70% 61%, 75% 55%,
            80% 59%, 85% 53%, 90% 57%, 95% 51%, 100% 55%,
            100% 100%, 0 100%);
    animation: wave 10s ease-in-out infinite reverse;
    animation-delay: -2s;
}

@keyframes wave {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-25%);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

.main-content {
    position: relative;
    z-index: 10;
    width: 95%;
    max-width: 800px;
    padding: 40px 20px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.hub-container {
    background: rgba(13, 33, 55, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(179, 229, 252, 0.01);
    box-shadow: var(--shadow-glass), var(--shadow-glow);
    padding: 40px;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

header {
    text-align: center;
    margin-bottom: 35px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px var(--color-ice-glow));
    animation: bobLogo 3s ease-in-out infinite;
}

@keyframes bobLogo {

    0%,
    100% {
        transform: translateY(0) rotate(-3deg);
    }

    50% {
        transform: translateY(-5px) rotate(3deg);
    }
}

#main-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-ice-light) 0%, var(--color-primary) 50%, var(--color-ice) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 3px;
    margin: 0;
}

.welcome-text {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    margin: 0;
    line-height: 1.6;
}

#captain-section {
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(79, 195, 247, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(79, 195, 247, 0.2);
}

#captain-section.hidden {
    display: none;
}

.captain-welcome h2 {
    color: var(--color-primary);
    font-size: 1.4rem;
    margin: 0 0 10px 0;
}

.captain-welcome h2 .icon {
    margin-right: 8px;
}

.captain-welcome p {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#captain-name-input {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    border: 2px solid rgba(79, 195, 247, 0.3);
    border-radius: 12px;
    background: rgba(10, 25, 41, 0.6);
    color: var(--color-text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#captain-name-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

#captain-name-input.error {
    animation: shake 0.5s ease;
    border-color: var(--color-danger);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

#captain-name-input::placeholder {
    color: var(--color-text-muted);
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #29b6f6 100%);
    color: var(--color-bg-deep);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 195, 247, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform var(--transition-fast);
}

.btn-primary:hover .btn-icon {
    transform: translateX(3px);
}

#difficulty-selection {
    margin-bottom: 30px;
}

#difficulty-selection h2 {
    color: var(--color-text-primary);
    font-size: 1.3rem;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.greeting-text {
    color: var(--color-accent-warm);
    font-size: 0.95rem;
    font-style: italic;
    margin: 0 0 25px 0;
    min-height: 1.5em;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(179, 229, 252, 0.15);
    border-radius: 16px;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.diff-btn:hover {
    background: rgba(79, 195, 247, 0.1);
    border-color: var(--color-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(79, 195, 247, 0.2);
}

.diff-btn:active {
    transform: translateY(-2px);
}

.diff-icon {
    font-size: 2rem;
}

.diff-name {
    font-weight: 600;
    font-size: 1rem;
}

.diff-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

#leaderboard {
    margin-bottom: 20px;
}

#leaderboard h2 {
    color: var(--color-accent-warm);
    font-size: 1.3rem;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(179, 229, 252, 0.1);
}

.leaderboard-content {
    overflow-x: auto;
}

#results-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
}

#results-table th,
#results-table td {
    padding: 14px 12px;
    text-align: center;
}

#results-table th {
    background: rgba(79, 195, 247, 0.15);
    color: var(--color-ice);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#results-table tbody tr {
    border-bottom: 1px solid rgba(179, 229, 252, 0.08);
    transition: background var(--transition-fast);
}

#results-table tbody tr:hover {
    background: rgba(79, 195, 247, 0.05);
}

#results-table tbody tr.top-score {
    background: rgba(105, 240, 174, 0.08);
}

#results-table tbody tr.top-score td {
    color: var(--color-success);
    font-weight: 600;
}

#results-table .rank {
    font-size: 1.2rem;
}

#results-table .score {
    font-weight: 700;
    color: var(--color-primary-bright);
}

#results-table .captain {
    color: var(--color-text-primary);
}

#results-table .no-data {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 30px;
}

.audio-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 100;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(13, 33, 55, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(179, 229, 252, 0.2);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    background: rgba(79, 195, 247, 0.2);
    transform: scale(1.1);
}

.audio-icon {
    font-size: 1.4rem;
}

.audio-slider-wrap {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: rgba(13, 33, 55, 0.95);
    backdrop-filter: blur(15px);
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid rgba(179, 229, 252, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
}

.audio-slider-wrap.hidden {
    display: none;
}

.audio-slider-wrap label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

#master-volume {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

#master-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

#master-volume::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#volume-value {
    font-size: 0.9rem;
    color: var(--color-primary);
    text-align: center;
}

#main-footer {
    position: relative;
    z-index: 10;
    width: 100%;
    margin-top: auto;
    padding: 20px;
    background: rgba(10, 25, 41, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(179, 229, 252, 0.1);
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px;
}

.footer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.footer-link:hover,
.footer-link.active {
    color: var(--color-primary);
}

.nav-icon {
    font-size: 1.3rem;
}

.copyright {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeInUp 0.5s ease-out;
}

@media (max-width: 600px) {
    .hub-container {
        padding: 25px 20px;
    }

    #main-title {
        font-size: 2rem;
    }

    .logo-icon {
        font-size: 2.5rem;
    }

    .difficulty-options {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    #captain-name-input {
        min-width: 100%;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    #results-table th,
    #results-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .audio-panel {
        bottom: 90px;
        right: 15px;
    }
}