/* ========================================
   Runway PC - Styles
   ======================================== */

/* CSS Variables */
:root {
    /* Brand Colors */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;

    /* Background Colors */
    --bg-dark: #0f172a;
    --bg-header: #1e3a5f;
    --bg-runway: #67e8f9;

    /* Text Colors */
    --text-light: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #94a3b8;

    /* Contestant Colors */
    --c1: #ef4444;
    --c2: #f97316;
    --c3: #eab308;
    --c4: #22c55e;
    --c5: #06b6d4;
    --c6: #3b82f6;
    --c7: #8b5cf6;
    --c8: #ec4899;

    /* Responsive Scale Factor (set by JavaScript) */
    --scale-factor: 1;

    /* Scaled Spacing */
    --header-height: calc(70px * var(--scale-factor));
    --runway-padding: calc(20px * var(--scale-factor));
    --contestant-start: calc(60px * var(--scale-factor));

    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.5;
}

/* ========================================
   Header
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, var(--bg-header) 0%, #1e4976 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 calc(24px * var(--scale-factor));
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: calc(12px * var(--scale-factor));
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 24px;
}

/* Race Branding */
.race-branding {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
}

.race-name {
    font-weight: 700;
    font-size: calc(1.6rem * var(--scale-factor));
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    outline: none;
    padding: calc(2px * var(--scale-factor)) calc(6px * var(--scale-factor));
    border-radius: calc(6px * var(--scale-factor));
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    max-width: calc(350px * var(--scale-factor));
    min-width: calc(60px * var(--scale-factor));
    cursor: text;
}

.race-name:hover {
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    border-color: rgba(255, 255, 255, 0.2);
}

.race-name:focus {
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    border-color: var(--primary);
}

.race-name:empty::before {
    content: 'New Race';
    color: var(--text-muted);
}

.race-by {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.brand-icon svg {
    width: 16px;
    height: 16px;
}

@keyframes bounce {

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

    50% {
        transform: translateY(-4px);
    }
}

/* View Selector */
.view-selector {
    display: flex;
    gap: calc(8px * var(--scale-factor));
    background: var(--glass-bg);
    padding: calc(8px * var(--scale-factor)) calc(12px * var(--scale-factor));
    border-radius: calc(30px * var(--scale-factor));
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.view-pill {
    width: calc(36px * var(--scale-factor));
    height: calc(36px * var(--scale-factor));
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(0.75rem * var(--scale-factor));
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.view-pill:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px currentColor;
}

.view-pill.active {
    border-color: white;
    box-shadow: 0 0 16px currentColor;
}

/* Default View Pill - special styling */
.view-pill-default {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    font-weight: 700;
    font-size: calc(0.85rem * var(--scale-factor));
}

.view-pill-default:hover {
    box-shadow: 0 0 12px rgba(100, 116, 139, 0.6);
}

.view-pill-default.active {
    border-color: white;
    box-shadow: 0 0 16px rgba(100, 116, 139, 0.8);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--scale-factor));
    padding: calc(10px * var(--scale-factor)) calc(18px * var(--scale-factor));
    border: none;
    border-radius: calc(12px * var(--scale-factor));
    font-family: inherit;
    font-size: calc(0.95rem * var(--scale-factor));
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-add {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-settings {
    background: var(--glass-bg);
    color: white;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Gap Toggle Button */
.btn-gap {
    background: var(--glass-bg);
    color: white;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: calc(10px * var(--scale-factor)) calc(14px * var(--scale-factor));
    min-width: calc(44px * var(--scale-factor));
    justify-content: center;
}

.btn-gap:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-gap.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: transparent;
}

.btn-gap.active:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-gap .btn-icon {
    font-weight: 700;
    font-size: calc(1rem * var(--scale-factor));
}

.btn-icon {
    font-size: calc(1.1rem * var(--scale-factor));
}

/* ========================================
   Runway
   ======================================== */
.runway-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-runway);
}

/* ========================================
   ANIMATED WATER WAVE SYSTEM
   Calm, believable water surface
   ======================================== */

/* Water Waves Container - extends with scrollable runway */
.water-waves {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

/* Runway needs to be above waves */
.runway {
    position: relative;
    min-width: 100%;
    height: 100%;
    padding: var(--runway-padding);
    z-index: 2;
    display: flex;
    flex-direction: column;
}

/* ----------------------------------------
   DARK DEPTH WAVE LAYER
   Slowest, large soft bands moving Left→Right
   ---------------------------------------- */
.depth-wave-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.depth-wave {
    position: absolute;
    width: 200%;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(0, 160, 190, 0.05) 400px,
            rgba(0, 150, 180, 0.06) 800px,
            rgba(0, 160, 190, 0.05) 1200px,
            transparent 1600px);
    filter: blur(15px);
    animation: depthWaveMove 40s linear infinite;
}

/* Dark wave 1 - widest, slowest */
.depth-wave-1 {
    top: 10%;
    height: 200px;
    animation-duration: 45s;
    animation-delay: 0s;
}

/* Dark wave 2 - mid position */
.depth-wave-2 {
    top: 45%;
    height: 180px;
    animation-duration: 38s;
    animation-delay: -15s;
}

/* Dark wave 3 - lower */
.depth-wave-3 {
    top: 75%;
    height: 160px;
    animation-duration: 42s;
    animation-delay: -8s;
}

@keyframes depthWaveMove {
    0% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(0%) translateY(2px);
    }

    100% {
        transform: translateX(-50%) translateY(0);
    }
}

/* ----------------------------------------
   LIGHT REFLECTION WAVE LAYER
   Thin broken streaks moving Right→Left
   with breathing opacity
   ---------------------------------------- */
.reflection-wave-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.reflection-wave {
    position: absolute;
    height: 3px;
    width: 200%;
    background:
        repeating-linear-gradient(90deg,
            transparent 0px,
            rgba(180, 240, 255, 0.04) 100px,
            rgba(200, 250, 255, 0.05) 250px,
            rgba(180, 240, 255, 0.04) 400px,
            transparent 500px,
            transparent 700px);
    filter: blur(7px);
    animation: reflectionWaveMove 50s linear infinite, reflectionBreathing 6s ease-in-out infinite;
}

/* Reflection streaks at various vertical positions */
.reflection-wave-1 {
    top: 15%;
    animation-duration: 55s, 5s;
    animation-delay: 0s, 0s;
}

.reflection-wave-2 {
    top: 32%;
    animation-duration: 48s, 7s;
    animation-delay: -15s, -2s;
}

.reflection-wave-3 {
    top: 50%;
    animation-duration: 60s, 6s;
    animation-delay: -25s, -1s;
}

.reflection-wave-4 {
    top: 68%;
    animation-duration: 52s, 5.5s;
    animation-delay: -35s, -3s;
}

.reflection-wave-5 {
    top: 85%;
    animation-duration: 58s, 6.5s;
    animation-delay: -45s, -4s;
}

@keyframes reflectionWaveMove {
    0% {
        transform: translateX(50%);
    }

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

@keyframes reflectionBreathing {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* ----------------------------------------
   TEXT BACKDROP FOR READABILITY
   Subtle shadow under contestant info
   ---------------------------------------- */
.contestant-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 50px;
    /* Subtle backdrop for readability over waves */
    text-shadow:
        0 1px 3px rgba(0, 120, 140, 0.12),
        0 0 8px rgba(80, 200, 220, 0.08);
}

/* Contestant Lanes */
.lane {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-height: 50px;
    transition: transform 0.4s ease-out;
    will-change: transform;
}

/* Gap Label - Sticky to left side */
.lane-label {
    position: sticky;
    left: 10px;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow-md);
    z-index: 100;
    /* Higher z-index to stay on top */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Gap Label Hidden State */
.lane-label.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.lane-diff {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Contestant Avatar */
.contestant {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    /* No transition - JS controls step-by-step movement */
    cursor: pointer;
    z-index: 20;
}

.contestant:hover {
    transform: scale(1.05);
    z-index: 30;
}

.contestant.focused .contestant-duckling svg {
    filter: drop-shadow(0 0 8px var(--primary)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Duckling Mascot */
.contestant-duckling {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    position: relative;
    animation: ducklingFloat 2s ease-in-out infinite;
}

.contestant-duckling svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Idle Floating Animation */
@keyframes ducklingFloat {

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

    25% {
        transform: translateY(-4px) rotate(2deg);
    }

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

    75% {
        transform: translateY(-5px) rotate(-2deg);
    }
}

/* Swimming Animation - triggered when moving */
.contestant-duckling.swimming {
    animation: ducklingSwim 0.4s ease-out forwards;
}

@keyframes ducklingSwim {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    20% {
        transform: translateY(-6px) rotate(-8deg) scale(1.05);
    }

    40% {
        transform: translateY(-3px) rotate(5deg) scale(1.02);
    }

    60% {
        transform: translateY(-4px) rotate(-3deg) scale(1);
    }

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

    100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
}

/* ========================================
   REALISTIC WATER EFFECTS
   - No perfect circles
   - No splashes
   - Soft, blurred, water-colored
   - Water lags behind duck
   - Scales with duckling size via --water-effect-scale
   ======================================== */

/* V-Shape Body Displacement - Duck pushes water aside */
.body-displacement {
    position: absolute;
    top: 60%;
    left: 10px;
    width: 30px;
    height: 30px;
    pointer-events: none;
    opacity: 0;
    transform: scale(var(--water-effect-scale, 1));
    transform-origin: left center;
}

q .contestant-duckling.swimming .body-displacement {
    animation: displacementAppear 0.5s ease-out forwards;
}

.displacement-left,
.displacement-right {
    position: absolute;
    width: 25px;
    height: 4px;
    background: linear-gradient(to left,
            rgba(255, 255, 255, 0.85),
            rgba(220, 250, 255, 0.7),
            transparent);
    border-radius: 50%;
    filter: blur(0.5px);
    opacity: 0;
}

.displacement-left {
    top: 0;
    left: 100%;
    transform: rotate(-20deg);
    transform-origin: right center;
}

.displacement-right {
    bottom: 0;
    left: 100%;
    transform: rotate(20deg);
    transform-origin: right center;
}

.contestant-duckling.swimming .displacement-left,
.contestant-duckling.swimming .displacement-right {
    animation: vShapeSpread 0.6s ease-out forwards;
}

.contestant-duckling.swimming .displacement-right {
    animation-delay: 0.03s;
}

@keyframes displacementAppear {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes vShapeSpread {
    0% {
        opacity: 0.95;
        width: 8px;
        transform: rotate(var(--rotate, -20deg)) translateX(0);
    }

    40% {
        opacity: 0.75;
        width: 20px;
    }

    100% {
        opacity: 0;
        width: 35px;
        transform: rotate(var(--rotate, -20deg)) translateX(-15px);
    }
}

.displacement-left {
    --rotate: -22deg;
}

.displacement-right {
    --rotate: 22deg;
}

/* Forward Wake Arc - Water being gently pushed */
.forward-wake {
    position: absolute;
    right: calc(-8px * var(--water-effect-scale, 1));
    top: 50%;
    transform: translateY(-50%);
    width: calc(12px * var(--water-effect-scale, 1));
    height: calc(20px * var(--water-effect-scale, 1));
    pointer-events: none;
    opacity: 0;
}

.forward-wake::before {
    content: '';
    position: absolute;
    width: calc(10px * var(--water-effect-scale, 1));
    height: calc(16px * var(--water-effect-scale, 1));
    border: calc(2px * var(--water-effect-scale, 1)) solid rgba(255, 255, 255, 0.8);
    border-left: none;
    border-radius: 0 50% 50% 0;
    filter: blur(0.3px);
}

.contestant-duckling.swimming .forward-wake {
    animation: forwardWakeAppear 0.4s ease-out forwards;
}

@keyframes forwardWakeAppear {
    0% {
        opacity: 0.95;
        transform: translateY(-50%) scaleX(0.5);
    }

    30% {
        opacity: 0.8;
        transform: translateY(-50%) scaleX(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scaleX(1.3);
    }
}

/* Trailing Elongated Ripples - Wider than tall, fading back */
.trailing-ripples {
    position: absolute;
    left: -60px;
    top: 80%;
    transform: translateY(-50%) scale(var(--water-effect-scale, 1));
    transform-origin: right center;
    width: 70px;
    height: 50px;
    pointer-events: none;
    opacity: 0;
}

.contestant-duckling.swimming .trailing-ripples {
    animation: trailAppear 0.8s ease-out forwards;
}

@keyframes trailAppear {
    0% {
        opacity: 1;
    }

    60% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
    }
}

.trail-ripple {
    position: absolute;
    height: 4px;
    border-radius: 50%;
    background: linear-gradient(to left,
            rgba(255, 255, 255, 0.85),
            rgba(220, 250, 255, 0.6),
            transparent);
    filter: blur(0.5px);
    opacity: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Each ripple progressively wider, more spaced, more faded */
.trail-ripple.trail-1 {
    right: 0;
    width: 18px;
    height: 5px;
}

.trail-ripple.trail-2 {
    right: 22px;
    width: 22px;
    height: 4px;
}

.trail-ripple.trail-3 {
    right: 48px;
    width: 16px;
    height: 3px;
}

.trail-ripple.trail-4 {
    right: 68px;
    width: 12px;
    height: 2px;
}

.contestant-duckling.swimming .trail-ripple.trail-1 {
    animation: trailRipple1 0.7s ease-out forwards;
}

.contestant-duckling.swimming .trail-ripple.trail-2 {
    animation: trailRipple2 0.7s ease-out 0.08s forwards;
}

.contestant-duckling.swimming .trail-ripple.trail-3 {
    animation: trailRipple3 0.7s ease-out 0.16s forwards;
}

.contestant-duckling.swimming .trail-ripple.trail-4 {
    animation: trailRipple4 0.7s ease-out 0.24s forwards;
}

@keyframes trailRipple1 {
    0% {
        opacity: 0.9;
        width: 10px;
        transform: translateY(-50%) translateX(5px);
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
        width: 25px;
        transform: translateY(-50%) translateX(-10px);
    }
}

@keyframes trailRipple2 {
    0% {
        opacity: 0.75;
        width: 12px;
        transform: translateY(-50%) translateX(5px);
    }

    50% {
        opacity: 0.55;
    }

    100% {
        opacity: 0;
        width: 28px;
        transform: translateY(-50%) translateX(-12px);
    }
}

@keyframes trailRipple3 {
    0% {
        opacity: 0.55;
        width: 10px;
        transform: translateY(-50%) translateX(5px);
    }

    50% {
        opacity: 0.35;
    }

    100% {
        opacity: 0;
        width: 22px;
        transform: translateY(-50%) translateX(-12px);
    }
}

@keyframes trailRipple4 {
    0% {
        opacity: 0.4;
        width: 6px;
        transform: translateY(-50%) translateX(5px);
    }

    50% {
        opacity: 0.25;
    }

    100% {
        opacity: 0;
        width: 16px;
        transform: translateY(-50%) translateX(-10px);
    }
}

/* Subtle Paddle Disturbances - Implied foot motion */
.paddle-disturbance {
    position: absolute;
    left: -15px;
    bottom: -5px;
    width: 25px;
    height: 15px;
    pointer-events: none;
    opacity: 0;
    transform: scale(var(--water-effect-scale, 1));
    transform-origin: right bottom;
}

.contestant-duckling.swimming .paddle-disturbance {
    animation: paddleAppear 0.5s ease-out forwards;
}

@keyframes paddleAppear {
    0% {
        opacity: 0.85;
    }

    30% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
    }
}

.paddle-wobble {
    position: absolute;
    width: 8px;
    height: 3px;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0;
}

.paddle-wobble:nth-child(1) {
    left: 0;
    top: 30%;
}

.paddle-wobble:nth-child(2) {
    left: 10px;
    top: 60%;
}

.contestant-duckling.swimming .paddle-wobble:nth-child(1) {
    animation: paddleWobble 0.4s ease-out forwards;
}

.contestant-duckling.swimming .paddle-wobble:nth-child(2) {
    animation: paddleWobble 0.4s ease-out 0.1s forwards;
}

@keyframes paddleWobble {
    0% {
        opacity: 0.4;
        transform: translateX(3px) scaleX(0.5);
    }

    40% {
        opacity: 0.3;
        transform: translateX(0) scaleX(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-5px) scaleX(1.3);
    }
}

/* Wing Flapping Animation - Keep existing */
.duckling-wing {
    transform-origin: 26px 30px;
    transform: rotate(-15deg);
    transition: transform 0.1s ease;
}

.contestant-duckling.swimming .duckling-wing {
    animation: wingFlap 0.35s ease-in-out;
}

@keyframes wingFlap {
    0% {
        transform: rotate(-15deg);
    }

    20% {
        transform: rotate(-35deg) translateY(-3px);
    }

    40% {
        transform: rotate(-5deg) translateY(2px);
    }

    60% {
        transform: rotate(-30deg) translateY(-2px);
    }

    80% {
        transform: rotate(-10deg) translateY(1px);
    }

    100% {
        transform: rotate(-15deg);
    }
}

.contestant-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 50px;
}

.contestant-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.contestant-points {
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
    opacity: 0.9;
}

.contestant-rank {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Points Badge - kept for backwards compatibility */
.points-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--bg-dark);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Modals
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--glass-bg);
    color: var(--text-light);
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Add Panel */
.add-panel {
    width: 450px;
}

.point-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.point-row:last-child {
    border-bottom: none;
}

.point-row-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.point-row-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.point-row-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.point-row-current {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.point-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

/* Sign Toggle Buttons */
.sign-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-muted);
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sign-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.sign-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.sign-btn[data-sign="-"].active {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.point-input {
    width: 80px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all var(--transition-fast);
}

/* Hide number input spin buttons */
.point-input::-webkit-outer-spin-button,
.point-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.point-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.point-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 48px;
    font-size: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

/* Visibility Toggle Button */
.btn-toggle-visibility {
    position: absolute;
    left: 24px;
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-visibility:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    transform: scale(1.05);
}

.btn-toggle-visibility.hidden {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.visibility-icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* Hidden Points Input Style */
.point-input.hidden-value {
    -webkit-text-security: disc;
    text-security: disc;
    letter-spacing: 2px;
}

/* Fallback for browsers without text-security */
@supports not ((-webkit-text-security: disc) or (text-security: disc)) {
    .point-input.hidden-value {
        font-family: 'password-mask', monospace;
    }
}

/* ========================================
   Settings Panel
   ======================================== */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.settings-overlay.active {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-left: 1px solid var(--glass-border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
    transition: right var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.settings-overlay.active .settings-panel {
    right: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.settings-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.settings-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-muted);
}

/* File Menu */
.file-menu-container {
    position: relative;
}

.btn-file {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    color: white;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    justify-content: flex-start;
    gap: 10px;
    transition: all var(--transition-fast);
}

.btn-file:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform var(--transition-fast);
}

.btn-file.active .dropdown-arrow {
    transform: rotate(180deg);
}

.file-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 10;
}

.file-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.file-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.file-option-icon {
    font-size: 1.1rem;
}

/* Open Race Modal */
.open-race-modal {
    width: 500px;
    max-width: 90%;
}

.saved-races-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-race-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.saved-race-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    transform: translateX(4px);
}

.saved-race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.saved-race-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-light);
}

.saved-race-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-race-info {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.saved-race-contestants {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.saved-race-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.saved-race-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.race-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.race-action-btn.load {
    background: var(--primary);
    color: white;
}

.race-action-btn.load:hover {
    background: var(--primary-light);
}

.race-action-btn.delete {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.race-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

.no-races-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-style: italic;
}

/* Contestant List */
.contestant-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.contestant-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
}

.contestant-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.contestant-item-color {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.contestant-item-color:hover {
    transform: scale(1.1);
}

.contestant-item-name {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.contestant-item-name:focus {
    border-bottom-color: var(--primary);
}

.contestant-item-actions {
    display: flex;
    gap: 8px;
}

.contestant-item-btn {
    padding: 6px 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.contestant-item-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.contestant-item-btn.delete {
    color: #f87171;
    padding: 6px 8px;
    font-size: 1rem;
}

.contestant-item-btn.delete:hover {
    background: rgba(248, 113, 113, 0.2);
}

/* Color Picker Row */
.color-picker-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-option:hover {
    transform: scale(1.2);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 8px currentColor;
}

/* Custom Color Picker Button - Gradient Circle */
.color-picker-custom {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg,
            #f472b6 0%,
            #a78bfa 25%,
            #60a5fa 50%,
            #34d399 75%,
            #fbbf24 100%);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.color-picker-custom:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.color-picker-custom .contestant-item-color {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Add Contestant Button */
.btn-add-contestant {
    width: 100%;
    padding: 14px;
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    color: var(--text-muted);
    border-radius: 12px;
    font-size: 0.95rem;
    justify-content: center;
}

.btn-add-contestant:hover {
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Login Button */
.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 10px;
    justify-content: center;
    opacity: 0.6;
    cursor: not-allowed;
}

.coming-soon {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* Action Buttons Row */
.action-buttons-row {
    display: flex;
    gap: 12px;
}

.btn-action {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-reset-small {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
}

.btn-reset-small:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4);
}

.btn-end {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.btn-end:hover {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.btn-action .btn-icon {
    font-size: 1rem;
}

/* ========================================
   Podium Lightbox (End Race Reveal)
   ======================================== */
.podium-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #1e3a5f 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.podium-overlay.active {
    opacity: 1;
    visibility: visible;
}

.podium-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.podium-overlay.active .podium-content {
    transform: scale(1);
    opacity: 1;
}

.podium-rank {
    font-size: calc(3rem * var(--scale-factor));
    font-weight: 800;
    color: #7dd3fc;
    /* Light blue for non-top-3 */
    text-shadow: 0 4px 20px rgba(125, 211, 252, 0.3);
    animation: podiumRankPulse 2s ease-in-out infinite;
}

@keyframes podiumRankPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.podium-duckling {
    width: calc(250px * var(--scale-factor));
    height: calc(250px * var(--scale-factor));
    animation: podiumFloat 3s ease-in-out infinite;
}

.podium-duckling svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
}

@keyframes podiumFloat {

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

    25% {
        transform: translateY(-15px) rotate(3deg);
    }

    50% {
        transform: translateY(-8px) rotate(0deg);
    }

    75% {
        transform: translateY(-12px) rotate(-3deg);
    }
}

.podium-name {
    font-size: calc(2.5rem * var(--scale-factor));
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.podium-points {
    font-size: calc(1.5rem * var(--scale-factor));
    font-weight: 600;
    color: var(--primary-light);
}

.podium-hint {
    display: none;
    /* Hidden - no longer needed */
}

.podium-hint.visible {
    opacity: 1;
    visibility: visible;
    animation: podiumHintPulse 2s ease-in-out infinite;
}

@keyframes podiumHintPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Special styling for top 3 */
.podium-overlay.first-place .podium-rank {
    font-size: calc(4rem * var(--scale-factor));
    background: linear-gradient(135deg, #ffd700 0%, #ffb800 50%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.podium-overlay.second-place .podium-rank {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 50%, #c0c0c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.podium-overlay.third-place .podium-rank {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 50%, #cd7f32 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Ready Screen (Are You Ready?)
   ======================================== */
.ready-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    text-align: center;
}

.ready-icon {
    font-size: calc(6rem * var(--scale-factor));
    animation: readyIconWave 1.5s ease-in-out infinite;
}

@keyframes readyIconWave {

    0%,
    100% {
        transform: rotate(-10deg) scale(1);
    }

    50% {
        transform: rotate(10deg) scale(1.1);
    }
}

.ready-title {
    font-size: calc(4rem * var(--scale-factor));
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #38bdf8 50%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: readyTitleShine 2s linear infinite;
    text-shadow: 0 4px 30px rgba(56, 189, 248, 0.3);
}

@keyframes readyTitleShine {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.ready-hint {
    font-size: calc(1.2rem * var(--scale-factor));
    color: var(--text-muted);
    animation: readyHintPulse 2s ease-in-out infinite;
}

@keyframes readyHintPulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* ========================================
   Countdown Display (3, 2, 1)
   ======================================== */
.countdown-display {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(12rem * var(--scale-factor));
    font-weight: 900;
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(251, 191, 36, 0.5);
    filter: drop-shadow(0 10px 30px rgba(249, 115, 22, 0.4));
}

/* ========================================
   Final Summary Screen
   ======================================== */
.final-summary-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px;
    width: 100%;
    max-width: 900px;
}

.final-title {
    font-size: calc(2.5rem * var(--scale-factor));
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700 0%, #ffb800 50%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: finalTitleShine 3s linear infinite;
    text-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

@keyframes finalTitleShine {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.final-grid {
    display: flex;
    flex-direction: column;
    gap: calc(20px * var(--scale-factor));
    width: 100%;
}

.final-row {
    display: flex;
    justify-content: center;
    gap: calc(16px * var(--scale-factor));
    flex-wrap: wrap;
}

.final-contestant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(8px * var(--scale-factor));
    padding: calc(16px * var(--scale-factor)) calc(20px * var(--scale-factor));
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: calc(16px * var(--scale-factor));
    backdrop-filter: blur(10px);
    min-width: calc(140px * var(--scale-factor));
    transition: all 0.3s ease;
}

.final-contestant:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Special styling for top 3 in final summary */
.final-row:first-child .final-contestant:first-child {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.final-row:first-child .final-contestant:nth-child(2) {
    border-color: #c0c0c0;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.final-row:first-child .final-contestant:nth-child(3) {
    border-color: #cd7f32;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}

.final-rank {
    font-size: calc(1.2rem * var(--scale-factor));
    font-weight: 700;
    color: #7dd3fc;
    /* Light blue for non-top-3 */
}

.final-row:first-child .final-contestant:first-child .final-rank {
    background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: calc(1.4rem * var(--scale-factor));
}

.final-row:first-child .final-contestant:nth-child(2) .final-rank {
    background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-row:first-child .final-contestant:nth-child(3) .final-rank {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-duckling {
    width: calc(120px * var(--scale-factor));
    height: calc(120px * var(--scale-factor));
}

.final-duckling svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.final-name {
    font-size: calc(1rem * var(--scale-factor));
    font-weight: 600;
    color: white;
    text-align: center;
    max-width: calc(120px * var(--scale-factor));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.final-points {
    font-size: calc(0.9rem * var(--scale-factor));
    font-weight: 500;
    color: var(--primary-light);
}

.final-hint {
    display: none;
    /* Hidden - no longer needed */
}

@keyframes finalHintPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* ========================================
   Confirmation Modal
   ======================================== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    max-width: 360px;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

.confirm-overlay.active .confirm-modal {
    transform: scale(1) translateY(0);
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 12px;
}

.confirm-message {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.confirm-cancel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
}

.confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.confirm-yes {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border: none;
    color: white;
}

.confirm-yes:hover {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.lane {
    animation: fadeIn 0.5s ease forwards;
}

.lane:nth-child(1) {
    animation-delay: 0.05s;
}

.lane:nth-child(2) {
    animation-delay: 0.1s;
}

.lane:nth-child(3) {
    animation-delay: 0.15s;
}

.lane:nth-child(4) {
    animation-delay: 0.2s;
}

.lane:nth-child(5) {
    animation-delay: 0.25s;
}

.lane:nth-child(6) {
    animation-delay: 0.3s;
}

.lane:nth-child(7) {
    animation-delay: 0.35s;
}

.lane:nth-child(8) {
    animation-delay: 0.4s;
}

/* ========================================
   Authentication Modal
   ======================================== */
.auth-modal-overlay {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.auth-modal {
    max-width: 420px;
    width: 90%;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.auth-modal .modal-header {
    padding: 24px 24px 0;
    border-bottom: none;
}

.auth-modal .modal-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-modal .modal-body {
    padding: 24px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.auth-field input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.auth-field input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.auth-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    padding: 0 16px;
}

.btn-google {
    width: 100%;
    padding: 14px;
    background: white;
    border: none;
    border-radius: 12px;
    color: #374151;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-google:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-google svg {
    flex-shrink: 0;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Login Button States */
.btn-login {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-login.logged-in {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
}

.btn-login.logged-in:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.user-avatar {
    font-size: 1.2rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-action {
    font-size: 0.75rem;
    opacity: 0.8;
}

.coming-soon {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 8px;
    font-style: italic;
}

/* ========================================
   Audio Controls
   ======================================== */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.audio-toggle-row,
.audio-volume-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.audio-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.btn-audio-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-audio-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-audio-toggle.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-audio-toggle.active .audio-status {
    font-weight: 600;
}

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

.audio-status {
    font-weight: 500;
    min-width: 24px;
}

/* Volume Slider */
.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 200px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.volume-slider:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Slider track for WebKit browsers */
.volume-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.6);
}

/* Slider track for Firefox */
.volume-slider::-moz-range-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.6);
}

.volume-value {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* Audio Section Divider */
.audio-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 12px 0;
}

/* Audio Control Group */
.audio-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Movement Quack Selector */
.audio-select-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.quack-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quack-selector {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 100px;
}

.quack-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.quack-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.quack-selector option {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 8px;
}

.btn-test-quack {
    padding: 6px 12px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-test-quack:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

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

/* ========================================
   Pool Color Picker
   ======================================== */
.pool-color-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pool-color-picker label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.color-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-input-row input[type="color"] {
    width: 50px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-row input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

.color-value {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
}

/* Editable Hex Color Input */
.color-value-input {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    width: 90px;
    text-align: center;
    border: 1px solid transparent;
    outline: none;
    transition: all var(--transition-fast);
    text-transform: uppercase;
}

.color-value-input:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.color-value-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.btn-reset-color {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-reset-color:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Duckling Size Settings
   ======================================== */
.duckling-size-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.duckling-mode-toggle {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duckling-mode-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.duckling-mode-buttons {
    display: flex;
    gap: 8px;
}

.duckling-mode-btn {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.duckling-mode-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.duckling-mode-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.duckling-size-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.size-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.size-slider-row label {
    flex-shrink: 0;
    width: 70px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.size-slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.size-value {
    min-width: 50px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: monospace;
}

.duckling-size-hint {
    margin: 0;
    padding: 10px 12px;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.duckling-size-hint span {
    font-weight: 600;
    color: var(--primary-light);
}