/* --- General Styles --- */
body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #ffffff 0%, #e6f3ff 100%);
    touch-action: none;
}

canvas {
    display: block;
    cursor: pointer; 
    -webkit-tap-highlight-color: transparent; 
    outline: none;
}

/* --- Floating Menu --- */
#floating-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 16px;
    padding-bottom: 0px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 300px;
    height: auto; 
    max-height: 75vh;
    transition: width 0.3s ease;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    /* Custom Scrollbar for aesthetics */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 65vh; 
    opacity: 1;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    margin-bottom: 5px;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    padding: 5px 0;
    flex-shrink: 0; 
}

.number-circle {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background-color: transparent;
    border: 1px solid #5a5a5a;
    color: #4b4a4a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    transition: all 0.2s ease;
    user-select: none;
}

.menu-text {
    margin-left: 12px;
    font-size: 14px;
    text-align: left;
    font-weight: 500;
    color: #464646;
}

.menu-text div {
    line-height: 1.2;
}

/* --- Hover Effects --- */
.menu-item:hover .number-circle {
    background-color: #217fe4;
    border: 1px solid #217fe4;
    color: white;
}

.menu-item:hover .menu-text {
    color: #0056b3;
}

/* --- Menu Title Section --- */
.menu-title {
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    transition: margin 0.3s ease, border-color 0.3s ease;
}

.collapse-button {
    cursor: pointer;
    padding: 10px 0;
    text-align: center;
    font-size: 14px;
    color: #b0b0b0; 
    transition: color 0.2s ease;
}

.collapse-button:hover {
    color: #808080; 
}

/* --- Collapsed State --- */
#floating-menu.collapsed .menu-title {
    border-bottom: 1px solid transparent;
    margin-bottom: 0;
}

#floating-menu.collapsed .menu-content {
    max-height: 0; 
    opacity: 0;    
    margin-bottom: 0;
    overflow: hidden; 
    pointer-events: none; 
}

/* --- Loader Overlay --- */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#loading-container {
    width: 300px;
    text-align: center;
}

#progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: #217fe4;
    transition: width 0.2s ease;
}

#loading-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

/* --- Bottom Info Panel --- */
#bottom-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(250%); 
    width: 80%;
    max-width: 400px; 
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
    padding: 15px 20px; 
    border-radius: 16px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    border: 1px solid rgba(255,255,255,0.8);
}

#bottom-panel.active {
    transform: translateX(-50%) translateY(0);
}

.panel-close {
    position: absolute;
    top: -12px; 
    right: -12px;
    cursor: pointer;
    font-size: 18px;
    color: #555;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 2px rgba(0,0,0,0.2);
    z-index: 1501;
    transition: all 0.2s ease;
}

.panel-close:hover {
    background: #f0f0f0;
    color: #000;
    transform: scale(1.1);
}

#bottom-panel .menu-item {
    padding: 5px 0;
    margin: 0;
    width: 100%;
}