* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #a0d8ef; /* Wintry sky blue fallback */
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#game-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999; /* Force in front of WebGL canvas */
    transform: translateZ(0); /* Hardware accelerated compositing layer */
    pointer-events: none; 
}

/* Top Right UI (Speed & Timer) */
#stats-container {
    position: absolute;
    top: 25px;
    right: 25px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    transform: skewX(-12deg) translateZ(0); /* Skew and hardware acceleration */
    z-index: 10001;
}

.stat-box {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 10px;
    transform: skewX(12deg);
}

.stat-line {
    width: 100%;
    height: 2px;
    background: #eee;
    margin: 5px 0;
}

.stat-label {
    font-weight: 700;
    font-size: 16px;
    color: #333;
}

.stat-value {
    font-weight: 900;
    font-size: 32px;
    color: #000;
    min-width: 60px;
    text-align: right;
    letter-spacing: -1px;
}

.timer {
    font-size: 22px;
    color: #e53935;
}

/* Touch Controls */
#controls-container {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 40px;
    pointer-events: auto;
}

.touch-zone {
    width: 150px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-track {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 40px;
    position: relative;
    backdrop-filter: blur(4px);
    width: 120px;
    height: 50px;
}

.thumb-knob {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 5px; 
    transition: transform 0.1s ease-out;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Message Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
    z-index: 9999;
    transform: translateZ(0);
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

#main-message {
    color: white;
    font-size: 5rem;
    font-weight: 900;
    text-transform: uppercase;
    text-shadow: 0 4px 15px rgba(0,0,0,0.8);
    text-align: center;
    line-height: 1.2;
    transform: skewX(-10deg);
}

.sub-message {
    font-size: 2rem;
    color: #ffca28;
    display: block;
    margin-top: 15px;
    text-transform: none;
    font-weight: bold;
}

/* Whiteout Landing Page & Modal */
.landing-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a14;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    overflow: hidden;
}

.landing-background {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a14 100%);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

.landing-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    width: 100%;
}

.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 64px;
}

.countdown-subline {
    font-size: 12px;
    letter-spacing: 0.3em;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    text-align: center;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-value {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

@media (min-width: 768px) {
    .time-value {
        font-size: 4rem;
    }
}

.time-label {
    font-size: 10px;
    color: #4b5563;
}

@media (min-width: 768px) {
    .time-label {
        font-size: 12px;
    }
}

.countdown-status {
    color: #22d3ee;
    font-size: 14px;
    letter-spacing: 0.1em;
    margin-top: 32px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.locked-clue {
    width: 100%;
    max-width: 28rem;
    border: 1px solid #1f2937;
    background-color: rgba(17, 24, 39, 0.5);
    padding: 24px;
    border-radius: 2px;
    text-align: center;
}

.locked-clue-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #6b7280;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.locked-clue-text {
    color: #4b5563;
    font-size: 14px;
    letter-spacing: 0.05em;
}

.locked-badge {
    color: #374151;
    background-color: #1f2937;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
}

.trigger-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 96px;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
}

.trigger-line {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: #1f2937;
    opacity: 0.5;
}

.patrol-skier {
    position: absolute;
    bottom: 8px;
    width: 100%;
    pointer-events: auto;
    animation: patrol 15s linear infinite;
}

@keyframes patrol {
    0% { transform: translateX(-10%); }
    100% { transform: translateX(110%); }
}

#secret-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 16px;
    transition: transform 0.1s;
}

#secret-trigger:active {
    transform: scale(0.9);
}

.emoji-skier {
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.5)) grayscale(100%) brightness(200%);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background-color: #0a0a14;
    border: 1px solid rgba(34, 211, 238, 0.3);
    padding: 32px;
    max-width: 24rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 30px rgba(34, 211, 238, 0.15);
}

#modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.1em;
}

#modal-body {
    margin-bottom: 24px;
}

#modal-confirm {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-btn-red {
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    background: none;
}

.modal-btn-red:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.modal-btn-cyan {
    background-color: #22d3ee;
    color: #0a0a14;
    border: none;
}

/* Widescreen Success Dashboard */
.widescreen-dashboard {
    max-width: 420px !important;
    width: 90% !important;
    border: 1px solid rgba(34, 211, 238, 0.4) !important;
    box-shadow: 0 0 50px rgba(34, 211, 238, 0.25) !important;
    border-radius: 16px;
    padding: 30px !important;
    text-align: center !important;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 5px;
}

.decryption-banner {
    font-size: 10px;
    font-weight: 900;
    color: #22d3ee;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 4px;
    animation: flashGreen 2s infinite ease-in-out;
}

@keyframes flashGreen {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.dashboard-title {
    font-size: 26px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    transform: skewX(-6deg);
    margin: 0;
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: start;
}

/* Left Panel: Hint / Packliste */
.dashboard-left {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.dashboard-section-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.sect-icon {
    font-size: 18px;
}

.packlist-hint {
    font-size: 13px;
    font-style: italic;
    font-weight: 500;
    color: #ffd700;
    line-height: 1.5;
    background: rgba(255, 215, 0, 0.08);
    border-left: 3px solid #ffd700;
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: 4px;
}

.packlist-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.packlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    transition: all 0.2s;
}

.packlist-item.checked .checkbox {
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.1);
    font-weight: bold;
}

.checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.pack-text {
    font-weight: 500;
}

/* Right Panel: Leaderboard */
.dashboard-right {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.leaderboard-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 6px;
}

/* Custom Scrollbar for Leaderboard */
.leaderboard-container::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
}

.leaderboard-container::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, 0.2);
    border-radius: 4px;
}

.leaderboard-container::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 211, 238, 0.4);
}

.leaderboard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    transition: all 0.2s ease;
}

.leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.01);
}

.rank {
    font-weight: 900;
    width: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-family: monospace;
}

.name {
    font-weight: 700;
    color: #ffffff;
    flex-grow: 1;
    margin-left: 8px;
}

.score {
    font-family: monospace;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

/* Leaderboard Highlight Classes */
.leaderboard-row.gold {
    background: rgba(255, 215, 0, 0.06);
    border-color: rgba(255, 215, 0, 0.25);
}
.leaderboard-row.gold .rank { color: #ffd700; }
.leaderboard-row.gold .score { color: #ffd700; }

.leaderboard-row.silver {
    background: rgba(192, 192, 192, 0.06);
    border-color: rgba(192, 192, 192, 0.25);
}
.leaderboard-row.silver .rank { color: #c0c0c0; }
.leaderboard-row.silver .score { color: #c0c0c0; }

.leaderboard-row.player-highlight {
    background: rgba(34, 211, 238, 0.12);
    border-color: #22d3ee;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
    position: relative;
    animation: glowBorder 1.5s infinite alternate ease-in-out;
}

@keyframes glowBorder {
    0% { border-color: rgba(34, 211, 238, 0.5); box-shadow: 0 0 6px rgba(34, 211, 238, 0.1); }
    100% { border-color: rgba(34, 211, 238, 1); box-shadow: 0 0 16px rgba(34, 211, 238, 0.3); }
}

.leaderboard-row.player-highlight .rank { color: #22d3ee; }
.leaderboard-row.player-highlight .name { color: #22d3ee; }
.leaderboard-row.player-highlight .score { color: #22d3ee; }

.you-tag {
    font-size: 8px;
    font-weight: 900;
    background: #22d3ee;
    color: #0a0a14;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.leaderboard-row.inactive {
    opacity: 0.65;
}

.leaderboard-row.locked {
    opacity: 0.45;
    background: rgba(0, 0, 0, 0.2);
}
.leaderboard-row.locked .name {
    color: rgba(255, 255, 255, 0.5);
}

.text-highlight {
    color: #ff9d00 !important;
}

.text-gold {
    color: #ffd700 !important;
    font-weight: bold;
}

.tag-tbc {
    font-size: 10px;
    font-weight: 900;
    color: #ffffff;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.leaderboard-row.locked .score {
    font-style: italic;
    font-family: inherit;
    font-size: 11px;
}

.dashboard-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.dashboard-footer button {
    width: auto !important;
    padding: 12px 30px !important;
    font-size: 13px !important;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
}

/* Widescreen Responsive styling */
@media (max-width: 900px) {
    .dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .widescreen-dashboard {
        padding: 20px !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #stats-container { top: 15px; right: 15px; transform: none; padding: 10px; }
    .stat-box { transform: none; }
    .stat-value { font-size: 24px; }
    .timer { font-size: 18px; }
    #main-message { font-size: 3rem; transform: none;}
    .sub-message { font-size: 1.5rem; }
    #controls-container { padding: 0 20px; bottom: 20px; }
}

/* SERVICE ROOM UI */
#service-room {
    background: transparent !important; /* No dark full-screen backdrop, floating vibe */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: none;
    flex-direction: column;
    z-index: 10000;
    transform: translateZ(0);
    transition: none !important; /* Instant hide when selecting Race Now */
    opacity: 1 !important; /* Overrides screen fade out behavior */
    pointer-events: none; /* Mouse clicks pass through to 3D scene in center */
}

#service-room.active {
    display: flex;
    align-items: stretch !important; /* Push floating panels to the screen margins */
}

.sr-topbar {
    width: calc(100% - 80px);
    margin: 30px auto 0 auto;
    border-radius: 12px;
    height: 60px;
    background: linear-gradient(90deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 10;
    pointer-events: auto;
}

.sr-title {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    color: white;
}

.sr-currency {
    font-size: 18px;
    font-weight: 700;
    color: #ffd700;
}

.sr-content {
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: space-between;
    padding: 40px;
    pointer-events: none;
}

/* Left Panel */
.sr-left-panel {
    width: 350px;
    background: rgba(15, 30, 60, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    pointer-events: auto;
}

/* Fixed Team Uniform Showcase */
.sr-team-uniform {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.sr-uniform-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.sr-uniform-tag {
    font-size: 9px;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 2px;
}

.sr-uniform-title {
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 1px;
    transform: skewX(-6deg);
}

.sr-uniform-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sr-uniform-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.sr-uniform-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.sr-uniform-dot.blue {
    background-color: #3b82d6;
    color: #3b82d6;
}

.sr-uniform-dot.white {
    background-color: #ffffff;
    color: #ffffff;
}

.sr-section-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    border-left: 3px solid #00f0ff;
    padding-left: 8px;
}

/* Ski Cards Selector List */
.sr-ski-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.sr-ski-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.sr-ski-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.sr-ski-card.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00f0ff;
    transform: translateX(8px);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.ski-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.25s;
}

.sr-ski-card.active .ski-color-indicator {
    transform: scale(1.15);
}

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

.ski-name {
    font-size: 14px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.ski-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.3;
}

/* Right Panel */
.sr-right-panel {
    width: 350px;
    background: rgba(15, 30, 60, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    pointer-events: auto;
}

.sr-tokens-display {
    color: #00ffcc;
    font-size: 18px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.sr-stat {
    margin-bottom: 25px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.stat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upgrade-btn {
    width: 30px;
    height: 30px;
    background: #f72585;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.upgrade-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.upgrade-btn:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
}

.stat-bar-container {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, #4cc9f0, #f72585);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.start-race-btn {
    margin-top: auto;
    background: linear-gradient(45deg, #f72585, #b5179e);
    color: white;
    font-size: 24px;
    font-weight: 900;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(247, 37, 133, 0.4);
    transition: transform 0.2s;
    text-align: center;
    display: block;
}

.start-race-btn:hover {
    transform: scale(1.05);
}

/* CINEMATIC VIDEO LOADING SCREEN */
.video-loader-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s;
}

.video-loader-screen.active {
    opacity: 1;
    visibility: visible;
}

.video-loader-screen video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 1;
}

.video-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0) 75%, rgba(0,0,0,0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    pointer-events: none;
    box-sizing: border-box;
}

.video-loader-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideDown 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mission-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulsing-red-dot {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 12px #ef4444;
    animation: redPulse 1.5s infinite alternate;
}

@keyframes redPulse {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

.mission-status {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ef4444;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.mission-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transform: skewX(-6deg);
}

.video-loader-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loading-bar-wrapper {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #00ffcc);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
    transition: width 0.1s linear;
}

.video-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.loading-subtext {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    animation: textFlicker 3s infinite;
}

@keyframes textFlicker {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.skip-video-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 24px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.skip-video-btn:hover {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

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

.skip-arrow {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-video-btn:hover .skip-arrow {
    transform: translateX(4px);
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

/* Mobile adjustments */
@media (max-width: 768px) {
    .video-overlay {
        padding: 20px;
    }
    .mission-title {
        font-size: 20px;
        letter-spacing: 2px;
    }
    .skip-video-btn {
        padding: 8px 16px;
        font-size: 11px;
    }
    .loading-subtext {
        font-size: 10px;
        letter-spacing: 1px;
    }
}

/* Fullscreen Orientation Lock Overlay */
.orientation-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999; /* Higher than video, game UI, and modal elements */
    background: radial-gradient(circle at center, #0f172a, #020617);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    pointer-events: auto;
    font-family: 'Inter', sans-serif;
}

/* Activate only when the phone is held vertically (portrait) */
@media screen and (orientation: portrait) {
    .orientation-overlay {
        display: flex;
    }
}

.orientation-box {
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: zoomIn 0.3s ease-out;
}

.phone-rotate-icon {
    width: 90px;
    height: 90px;
    color: #22d3ee;
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.3));
}

@keyframes rotatePhoneRect {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-90deg); }
    70% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

.orientation-title {
    font-size: 22px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    margin: 0;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.4);
    transform: skewX(-6deg);
}

.orientation-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin: 0;
}

/* ============================================================================
   FLOATING SPOTIFY MUSIC WIDGET (GLASSMORPHISM)
   ============================================================================ */
.spotify-widget-container {
    position: fixed;
    bottom: 25px;
    left: 40px;
    width: 340px;
    height: 412px; /* 48px header + 352px iframe + 12px padding */
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(34, 211, 238, 0.15);
    z-index: 200005; /* Always on top of landing screen, menu and gameplay */
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: none;
    flex-direction: column;
    padding: 0;
    pointer-events: auto;
}

.spotify-widget-container.visible {
    display: flex;
}

.spotify-widget-content iframe {
    border: none;
    border-radius: 12px;
}

.spotify-widget-container:hover {
    border-color: rgba(34, 211, 238, 0.6);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 25px rgba(34, 211, 238, 0.25);
}

/* Collapsed State (Transforms into a sleek, small pill at the bottom-left) */
.spotify-widget-container.collapsed {
    height: 48px;
    width: 220px;
    border-radius: 24px;
    border-color: rgba(34, 211, 238, 0.25);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(34, 211, 238, 0.1);
}

.spotify-widget-container.collapsed:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 18px rgba(34, 211, 238, 0.2);
}

.spotify-widget-header {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.4s;
    user-select: none;
    -webkit-user-select: none;
}

.spotify-widget-container.collapsed .spotify-widget-header {
    border-bottom-color: transparent;
}

.spotify-widget-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-icon {
    font-size: 16px;
    animation: musicWobble 2s infinite ease-in-out;
}

@keyframes musicWobble {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

.music-text-collapsed {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    display: block;
}

.music-text-expanded {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #22d3ee;
    display: none;
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: skewX(-6deg);
}

.spotify-widget-container:not(.collapsed) .music-text-collapsed {
    display: none;
}

.spotify-widget-container:not(.collapsed) .music-text-expanded {
    display: block;
}

.music-status-dot {
    width: 6px;
    height: 6px;
    background-color: #22d3ee;
    border-radius: 50%;
    margin-left: 2px;
}

.music-status-dot.pulsing {
    box-shadow: 0 0 8px #22d3ee;
    animation: dotPulse 1.5s infinite alternate ease-in-out;
}

@keyframes dotPulse {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.25); }
}

.spotify-widget-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.spotify-widget-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.toggle-icon {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.spotify-widget-content {
    flex: 1;
    padding: 6px 12px 12px 12px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 0.3s;
    opacity: 1;
}

.spotify-login-prompt {
    margin-bottom: 8px;
    text-align: center;
}

.spotify-preview-warning {
    font-size: 10px;
    color: #ffd700; /* gold/warning yellow */
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    line-height: 1.4;
    text-align: left;
    transform: skewX(-5deg);
}

.spotify-login-link {
    display: inline-block;
    width: 100%;
    background: #1DB954; /* Spotify Green */
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(29, 185, 84, 0.3);
    transition: all 0.3s ease;
    transform: skewX(-5deg);
    text-align: center;
}

.spotify-login-link:hover {
    background: #1ed760;
    box-shadow: 0 4px 15px rgba(29, 185, 84, 0.5);
    transform: skewX(-5deg) translateY(-1px);
}

.spotify-security-note {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    letter-spacing: 0.2px;
    text-align: center;
}

.spotify-widget-container.collapsed .spotify-widget-content {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================================
   RESPONSIVE WIDGET STYLING
   ============================================================================ */
@media (max-width: 768px) {
    /* On mobile screens, position at top-left below the top bar so it doesn't 
       interfere with mobile steering controls at the bottom */
    .spotify-widget-container {
        bottom: auto;
        top: 110px;
        left: 20px;
        width: 300px;
        height: 412px;
    }
    
    .spotify-widget-container.collapsed {
        width: 180px;
        height: 42px;
    }
    
    .spotify-widget-header {
        height: 42px;
    }
    
    .music-text-expanded {
        max-width: 190px;
    }
}

/* ============================================================================
   FIS PORTAL LANDING PAGE & BADGES (RACE 2)
   ============================================================================ */

/* FIS Portal Card Styling */
.fis-portal-card {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 600px;
    background: rgba(10, 10, 20, 0.85);
    border: 1px solid rgba(255, 102, 0, 0.35); /* FIS Orange border */
    box-shadow: 0 0 40px rgba(255, 102, 0, 0.15), inset 0 0 20px rgba(255, 102, 0, 0.05);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: skewX(-2deg);
}

.fis-portal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid rgba(255, 102, 0, 0.2);
    padding-bottom: 15px;
}

.fis-logo-glow {
    font-size: 32px;
    font-weight: 900;
    color: #ff6600;
    letter-spacing: 2px;
    background: rgba(255, 102, 0, 0.1);
    padding: 4px 15px;
    border: 2px solid #ff6600;
    border-radius: 4px;
    text-shadow: 0 0 10px rgba(255, 102, 0, 0.6);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.3);
    transform: skewX(-10deg);
}

.fis-portal-title h2 {
    font-size: 20px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 1px;
    margin: 0;
}

.fis-portal-title p {
    font-size: 11px;
    font-weight: bold;
    color: #888899;
    letter-spacing: 3px;
    margin: 3px 0 0 0;
}

.fis-portal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Athlete Metadata */
.fis-athlete-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
}

.meta-row {
    font-size: 12px;
    color: #aaaabb;
}

.meta-row span {
    font-weight: bold;
    color: #666677;
    margin-right: 5px;
}

.meta-row strong {
    color: #ffffff;
}

.badge {
    font-size: 9px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-pending {
    background: rgba(255, 102, 0, 0.15);
    color: #ffaa00;
    border: 1px solid rgba(255, 102, 0, 0.3);
    animation: flashPending 1.5s infinite alternate;
}

@keyframes flashPending {
    0% { opacity: 0.7; }
    100% { opacity: 1; box-shadow: 0 0 8px rgba(255, 170, 0, 0.2); }
}

.badge-active {
    background: rgba(0, 240, 255, 0.15);
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

/* Letter Box */
.fis-letter-box {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #ff6600;
    padding: 15px;
    border-radius: 4px;
}

.fis-letter-box h3 {
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.fis-letter-box p {
    font-size: 12px;
    color: #cccccc;
    line-height: 1.5;
    margin-bottom: 10px;
}

.fis-letter-box p:last-child {
    margin-bottom: 0;
}

.fis-target-metric {
    font-size: 14px !important;
    color: #ffaa00 !important;
    letter-spacing: 1px;
    margin-top: 10px;
}

/* Countdown in Athlete Page */
.fis-countdown-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
}

.countdown-label {
    font-size: 10px;
    font-weight: bold;
    color: #666677;
    letter-spacing: 1.5px;
}

.fis-countdown {
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    color: #00f0ff;
    letter-spacing: 1px;
}

.time-block {
    color: #ffffff;
    font-weight: 900;
}

/* Authenticate Button */
.fis-btn-authenticate {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 16px;
    background: #ff6600;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    transform: skewX(-5deg);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.4);
}

.fis-btn-authenticate:hover {
    background: #ff8533;
    box-shadow: 0 4px 25px rgba(255, 102, 0, 0.6);
    transform: skewX(-5deg) translateY(-2px);
}

.btn-scan-line {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    animation: scanButton 2s infinite linear;
}

@keyframes scanButton {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Biometric Scanner overlay screen */
.biometric-scanner-screen {
    position: fixed;
    inset: 0;
    z-index: 100005;
    background-color: #05050a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.scanner-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    width: 90%;
    max-width: 800px;
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.1);
}

@media (max-width: 768px) {
    .scanner-container {
        grid-template-columns: 1fr;
        max-width: 450px;
    }
}

.scanner-camera-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

#webcam-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera */
}

/* Camera scan grid overlay */
.scanner-overlay-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

/* Laser sweep bar */
.scanner-sweep-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(180deg, rgba(0, 240, 255, 0) 0%, #00f0ff 50%, rgba(0, 240, 255, 0) 100%);
    box-shadow: 0 0 15px #00f0ff;
    animation: scanSweep 3s infinite ease-in-out;
    pointer-events: none;
}

@keyframes scanSweep {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* Scanner Corners */
.scanner-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00f0ff;
    pointer-events: none;
}
.scanner-corner.tl { top: 15px; left: 15px; border-right: none; border-bottom: none; }
.scanner-corner.tr { top: 15px; right: 15px; border-left: none; border-bottom: none; }
.scanner-corner.bl { bottom: 15px; left: 15px; border-right: none; border-top: none; }
.scanner-corner.br { bottom: 15px; right: 15px; border-left: none; border-top: none; }

/* Scanner HUD Panel */
.scanner-hud-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 220px;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
    padding-bottom: 10px;
}

.hud-title {
    font-size: 13px;
    font-weight: 900;
    color: #00f0ff;
    letter-spacing: 2px;
}

.hud-sys-status {
    font-size: 10px;
    font-weight: bold;
    color: #ff3300;
    letter-spacing: 1px;
}

.hud-sys-status.pulsing {
    animation: pulseStatus 1s infinite alternate;
}

@keyframes pulseStatus {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.hud-log-box {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 12px;
    margin: 15px 0;
    font-family: monospace;
    font-size: 11px;
    color: #00ff66;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    line-height: 1.4;
}

.log-entry {
    white-space: pre-wrap;
    word-break: break-all;
}

.hud-footer {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.auth-bar-progress {
    height: 100%;
    width: 0%;
    background: #00f0ff;
    box-shadow: 0 0 10px #00f0ff;
    transition: width 0.1s linear;
}

/* Password Authentication Styles */
.scanner-pass-container {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pass-label {
    font-size: 10px;
    color: #00f0ff;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.pass-input-row {
    display: flex;
    gap: 10px;
}

.scanner-pass-input {
    flex-grow: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    font-family: monospace;
    font-size: 13px;
    border-radius: 4px;
    outline: none;
    text-align: center;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
    transition: all 0.3s ease;
}

.scanner-pass-input:focus {
    border-color: #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.scanner-pass-input.error {
    border-color: #ff3300;
    color: #ff3300;
    box-shadow: 0 0 15px rgba(255, 51, 0, 0.5);
    animation: shakeInput 0.4s ease-in-out;
}

.scanner-pass-btn {
    padding: 10px 20px;
    background: #00f0ff;
    color: #05050a;
    border: none;
    font-family: monospace;
    font-weight: 900;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    letter-spacing: 1px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
    transition: all 0.2s ease;
}

.scanner-pass-btn:hover {
    background: #ffffff;
    box-shadow: 0 0 15px #ffffff;
}

@keyframes shakeInput {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* Flash overlay */
.scanner-flash-overlay {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 100006;
}

.scanner-flash-overlay.trigger-flash {
    animation: flashCamera 0.8s ease-out;
}

@keyframes flashCamera {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Redesigned Success Modal: Physical Accreditation Badge */
.badge-column {
    display: flex;
    justify-content: center;
    align-items: center;
}

.fis-badge {
    width: 100%;
    max-width: 280px;
    background: #fdfdfd; /* Physical white badge look */
    border: 1px solid #dddddd;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 3px rgba(255, 255, 255, 0.1);
    color: #1a1a2e;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fis-badge-top {
    background: #ff6600; /* FIS Orange header */
    color: #ffffff;
    padding: 12px 15px;
    text-align: center;
    border-bottom: 4px solid #1a1a2e;
}

.badge-org {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
}

.badge-event {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 3px;
    margin-top: 2px;
}

.badge-location {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffd700; /* Gold */
}

.fis-badge-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: radial-gradient(circle at center, #ffffff 60%, #f0f0f5 100%);
}

.badge-photo-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border: 3px solid #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.badge-selfie-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 240, 255, 0.85);
    color: #000000;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    padding: 2px 0;
    letter-spacing: 1px;
}

.badge-details {
    width: 100%;
    text-align: center;
}

.badge-name {
    font-size: 18px;
    font-weight: 900;
    color: #1a1a2e;
}

.badge-role {
    font-size: 10px;
    font-weight: bold;
    color: #ff6600;
    letter-spacing: 1px;
    margin-top: 3px;
}

.badge-stat {
    font-size: 12px;
    font-weight: bold;
    color: #444455;
    margin-top: 10px;
    border-top: 1px solid #e2e2e8;
    padding-top: 8px;
}

.badge-time {
    color: #e53935;
    font-family: monospace;
    font-size: 15px;
    font-weight: 900;
}

.fis-badge-footer {
    background: #e2e2e8;
    border-top: 1px solid #d2d2d8;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-qrcode-img {
    width: 55px;
    height: 55px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    padding: 2px;
}

.badge-stamp {
    font-size: 8px;
    font-weight: 900;
    color: #2e7d32;
    border: 2px solid #2e7d32;
    border-radius: 4px;
    padding: 2px 4px;
    letter-spacing: 0.5px;
    transform: rotate(-10deg);
    text-shadow: 0 0 1px rgba(0,0,0,0.1);
}

/* Malta Celebratory Transition Overlay */
.malta-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 100010; /* Above all other layers */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(5, 5, 10, 0.4);
    backdrop-filter: blur(2px);
    pointer-events: none;
    transition: background-color 1s ease-in-out;
}

.malta-transition-overlay.active {
    animation: flashOverlay 0.4s ease-out forwards;
}

.malta-transition-overlay.dissolve {
    background-color: rgba(5, 5, 10, 0);
}

.malta-transition-text {
    font-size: 8rem;
    font-weight: 900;
    color: #ff6600; /* Sunny Orange */
    text-shadow: 0 0 30px rgba(255, 102, 0, 0.9), 0 0 80px rgba(255, 215, 0, 0.7);
    letter-spacing: 6px;
    font-style: italic;
    transform: scale(5);
    opacity: 0;
}

.malta-transition-overlay.active .malta-transition-text {
    animation: stampIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.malta-transition-overlay.dissolve .malta-transition-text {
    animation: dissolveOut 0.8s ease-in forwards;
}

/* Success modal overlay Mediterranean Theme */
.modal-overlay.success-state {
    background: radial-gradient(circle, #ffb703 0%, #fb8500 60%, #d62828 100%);
    backdrop-filter: blur(3px);
    animation: fadeToMalta 1s ease-in-out forwards;
}

/* Transitioning border glow on the widescreen success card to match Malta sun */
.modal-overlay.success-state .widescreen-dashboard {
    border: 1px solid rgba(255, 183, 3, 0.6) !important;
    box-shadow: 0 0 60px rgba(251, 133, 0, 0.4) !important;
}

@keyframes stampIn {
    0% {
        transform: scale(5);
        opacity: 0;
        filter: blur(8px);
    }
    70% {
        transform: scale(0.9);
        opacity: 1;
        filter: blur(0);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes dissolveOut {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
        filter: blur(6px);
    }
}

@keyframes flashOverlay {
    0% {
        background-color: rgba(255, 255, 255, 1);
    }
    100% {
        background-color: rgba(5, 5, 10, 0.6);
    }
}

@keyframes fadeToMalta {
    from {
        background: rgba(5, 5, 10, 0.6);
        opacity: 0;
    }
    to {
        background: radial-gradient(circle, #ffb703 0%, #fb8500 60%, #d62828 100%);
        opacity: 1;
    }
}

/* Mobile optimizations for Malta transition */
@media (max-width: 768px) {
    .malta-transition-text {
        font-size: 4rem;
        letter-spacing: 3px;
    }
}

